42#include "contiki-net.h"
52#include "dev/watchdog.h"
54#include "lib/random.h"
55#include "lib/sensors.h"
60#include <ti/devices/DeviceFamily.h>
61#include DeviceFamily_constructPath(driverlib/driverlib_release.h)
62#include DeviceFamily_constructPath(driverlib/chipinfo.h)
63#include DeviceFamily_constructPath(driverlib/vims.h)
65#include <ti/drivers/dpl/HwiP.h>
66#include <ti/drivers/I2C.h>
67#include <ti/drivers/NVS.h>
68#include <ti/drivers/PIN.h>
69#include <ti/drivers/pin/PINCC26XX.h>
70#include <ti/drivers/Power.h>
71#include <ti/drivers/SPI.h>
72#include <ti/drivers/TRNG.h>
73#include <ti/drivers/UART.h>
75#include "board-peripherals.h"
89#define LOG_MODULE "CC13xx/CC26xx"
90#define LOG_LEVEL LOG_LEVEL_MAIN
96extern void Board_initHook(
void);
107 uint32_t pivot = 800;
108 uint32_t pivot_half = pivot / 2;
110 for(k = 0; k < pivot; ++k) {
111 j = (k > pivot_half) ? pivot - k : k;
113 PINCC26XX_setOutputValue(pin, 1);
114 for(i = 0; i < j; ++i) {
115 __asm__ __volatile__ (
"nop");
117 PINCC26XX_setOutputValue(pin, 0);
118 for(i = 0; i < pivot_half - j; ++i) {
119 __asm__ __volatile__ (
"nop");
133 memset(ext_addr, 0x0,
sizeof(ext_addr));
138 short_addr = (((uint16_t)ext_addr[7] << 0) |
139 ((uint16_t)ext_addr[6] << 8));
149 DRIVERLIB_ASSERT_CURR_RELEASE();
152 VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
154 VIMSConfigure(VIMS_BASE,
true,
true);
159 if(PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
174 fade(Board_PIN_LED0);
177#if TI_UART_CONF_ENABLE
180#if TI_I2C_CONF_ENABLE
183#if TI_SPI_CONF_ENABLE
186#if TI_NVS_CONF_ENABLE
192 fade(Board_PIN_LED1);
203#if TI_UART_CONF_UART0_ENABLE
212 unsigned short seed = 0;
213 if(!
trng_rand((uint8_t *)&seed,
sizeof(seed), TRNG_WAIT_FOREVER)) {
224 fade(Board_PIN_LED0);
230#if RF_CONF_BLE_BEACON_ENABLE
239 LOG_DBG(
"With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP,
240 DRIVERLIB_RELEASE_BUILD);
241 LOG_DBG(
"IEEE 802.15.4: %s, Sub-1 GHz: %s, BLE: %s\n",
242 ChipInfo_SupportsIEEE_802_15_4() ?
"Yes" :
"No",
243 ChipInfo_SupportsPROPRIETARY() ?
"Yes" :
"No",
244 ChipInfo_SupportsBLE() ?
"Yes" :
"No");
246#if (RF_MODE == RF_MODE_SUB_1_GHZ)
247 LOG_INFO(
"Operating frequency on Sub-1 GHz\n");
248#elif (RF_MODE == RF_MODE_2_4_GHZ)
249 LOG_INFO(
"Operating frequency on 2.4 GHz\n");
253 LOG_INFO(
"RF: Channel %d", chan);
256 LOG_INFO_(
", PANID 0x%04X", pan);
260#if BOARD_SENSORS_ENABLE
264 fade(Board_PIN_LED1);
278 ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
286 ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
Header file for the CC13xx/CC26xx BLE Beacon Daemon.
Header file for the CC13xx/CC26xx clock implementation.
Header file for the energy estimation mechanism.
802.15.4 frame creation and parsing functions
Header file for the GPIO HAL.
bool clock_arch_enter_idle(void)
Prepare to enter some low-power mode.
void clock_arch_exit_idle(void)
Cleanup after returning from low-power mode.
rf_ble_beacond_result_t rf_ble_beacond_init(void)
Initialize the BLE advertisement/beacon daemon.
bool trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us)
Generates a stream of entropy from which you can create a true random number from.
int_fast32_t uart0_set_callback(uart0_input_fxn_t input_cb)
Set the callback function for when bytes are received on UART0.
void ieee_addr_cpy_to(uint8_t *dst, uint8_t len)
Copy the node's IEEE address to a destination memory area.
void random_init(unsigned short seed)
Seed the cc2538 random number generator.
void watchdog_periodic(void)
Writes the WDT clear sequence.
void platform_init_stage_three()
Final stage of platform driver initialisation.
void platform_init_stage_one(void)
Basic (Stage 1) platform driver initialisation.
void platform_idle()
The platform's idle/sleep function.
void platform_init_stage_two()
Stage 2 of platform driver initialisation.
void leds_init(void)
Initialise the LED HAL.
void gpio_hal_init()
Initialise the GPIO HAL.
linkaddr_t linkaddr_node_addr
The link-layer address of the node.
void uart0_init(unsigned long ubr)
Initalize the RS232 port.
void process_start(struct process *p, process_data_t data)
Start a process.
int radio_value_t
Each radio has a set of parameters that designate the current configuration and state of the radio.
@ RADIO_RESULT_OK
The parameter was set/read successfully.
@ RADIO_PARAM_CHANNEL
Channel used for radio communication.
@ RADIO_PARAM_64BIT_ADDR
Long (64 bits) address for the radio, which is used by the address filter.
@ RADIO_PARAM_PAN_ID
The personal area network identifier (PAN ID), which is used by the h/w frame filtering functionality...
@ RADIO_PARAM_16BIT_ADDR
The short address (16 bits) for the radio, which is used by the h/w filter.
Header file for the LED HAL.
Header file for the logging system.
Node-id (simple 16-bit identifiers) handling.
Header file of common CC13xx/CC26xx RF functionality.
Header file for the real-time timer module.
Generic serial I/O process header filer.
int serial_line_input_byte(unsigned char c)
Get one byte of input from the serial driver.
Header file for the CC13xx/CC26xx IEEE address driver.
Header file of True Random Number Generator for CC13xx/CC26xx.
Header file of UART driver for CC13xx/CC26xx.