42 #include "contiki-net.h" 43 #include "sys/clock.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 96 extern 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 LOG_INFO(
"Node ID: %d\n", node_id);
262 #if BOARD_SENSORS_ENABLE 266 fade(Board_PIN_LED1);
280 ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
288 ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
Header file for the CC13xx/CC26xx BLE Beacon Daemon.
Header file for the energy estimation mechanism
void platform_init_stage_two()
Stage 2 of platform driver initialisation.
void platform_idle()
The platform's idle/sleep function.
Header file of UART driver for CC13xx/CC26xx.
void leds_init(void)
Initialise the LED HAL.
The short address (16 bits) for the radio, which is used by the h/w filter.
int_fast32_t uart0_set_callback(uart0_input_fxn_t input_cb)
Set the callback function for when bytes are received on UART0.
Node-id (simple 16-bit identifiers) handling.
Channel used for radio communication.
The parameter was set/read successfully.
int radio_value_t
Each radio has a set of parameters that designate the current configuration and state of the radio...
bool clock_arch_enter_idle(void)
Prepare to enter some low-power mode.
void gpio_hal_init()
Initialise the GPIO HAL.
linkaddr_t linkaddr_node_addr
The link-layer address of the node.
void ieee_addr_cpy_to(uint8_t *dst, uint8_t len)
Copy the node's IEEE address to a destination memory area.
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.
void uart0_init(unsigned long ubr)
Initalize the RS232 port.
void clock_arch_exit_idle(void)
Cleanup after returning from low-power mode.
The personal area network identifier (PAN ID), which is used by the h/w frame filtering functionality...
Header file for the real-time timer module.
802.15.4 frame creation and parsing functions
rf_ble_beacond_result_t rf_ble_beacond_init(void)
Initialize the BLE advertisement/beacon daemon.
void platform_init_stage_three()
Final stage of platform driver initialisation.
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.
void random_init(unsigned short seed)
Seed the cc2538 random number generator.
Long (64 bits) address for the radio, which is used by the address filter.
Header file of common CC13xx/CC26xx RF functionality.
Generic serial I/O process header filer.
void watchdog_periodic(void)
Writes the WDT clear sequence.
Header file for the GPIO HAL.
Header file for the logging system
Header file for the LED HAL.
void platform_init_stage_one(void)
Basic (Stage 1) platform driver initialisation.
Header file for the CC13xx/CC26xx clock implementation.
Header file of True Random Number Generator for CC13xx/CC26xx.
void process_start(struct process *p, process_data_t data)
Start a process.