42 #include "contiki-net.h" 43 #include "sys/clock.h" 51 #include "dev/watchdog.h" 53 #include "lib/random.h" 54 #include "lib/sensors.h" 59 #include <ti/devices/DeviceFamily.h> 60 #include DeviceFamily_constructPath(driverlib/driverlib_release.h) 61 #include DeviceFamily_constructPath(driverlib/chipinfo.h) 62 #include DeviceFamily_constructPath(driverlib/vims.h) 64 #include <ti/drivers/dpl/HwiP.h> 65 #include <ti/drivers/I2C.h> 66 #include <ti/drivers/NVS.h> 67 #include <ti/drivers/PIN.h> 68 #include <ti/drivers/pin/PINCC26XX.h> 69 #include <ti/drivers/Power.h> 70 #include <ti/drivers/SPI.h> 71 #include <ti/drivers/TRNG.h> 72 #include <ti/drivers/UART.h> 74 #include "board-peripherals.h" 88 #define LOG_MODULE "CC13xx/CC26xx" 89 #define LOG_LEVEL LOG_LEVEL_MAIN 95 extern void Board_initHook(
void);
106 uint32_t pivot = 800;
107 uint32_t pivot_half = pivot / 2;
109 for(k = 0; k < pivot; ++k) {
110 j = (k > pivot_half) ? pivot - k : k;
112 PINCC26XX_setOutputValue(pin, 1);
113 for(i = 0; i < j; ++i) {
114 __asm__ __volatile__ (
"nop");
116 PINCC26XX_setOutputValue(pin, 0);
117 for(i = 0; i < pivot_half - j; ++i) {
118 __asm__ __volatile__ (
"nop");
132 memset(ext_addr, 0x0,
sizeof(ext_addr));
137 short_addr = (((uint16_t)ext_addr[7] << 0) |
138 ((uint16_t)ext_addr[6] << 8));
140 NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID);
141 NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr);
142 NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr,
sizeof(ext_addr));
148 DRIVERLIB_ASSERT_CURR_RELEASE();
151 VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
153 VIMSConfigure(VIMS_BASE,
true,
true);
158 if(PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
173 fade(Board_PIN_LED0);
176 #if TI_UART_CONF_ENABLE 179 #if TI_I2C_CONF_ENABLE 182 #if TI_SPI_CONF_ENABLE 185 #if TI_NVS_CONF_ENABLE 191 fade(Board_PIN_LED1);
202 #if TI_UART_CONF_UART0_ENABLE 211 unsigned short seed = 0;
212 if(!
trng_rand((uint8_t *)&seed,
sizeof(seed), TRNG_WAIT_FOREVER)) {
223 fade(Board_PIN_LED0);
229 #if RF_CONF_BLE_BEACON_ENABLE 238 LOG_DBG(
"With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP,
239 DRIVERLIB_RELEASE_BUILD);
240 LOG_DBG(
"IEEE 802.15.4: %s, Sub-1 GHz: %s, BLE: %s\n",
241 ChipInfo_SupportsIEEE_802_15_4() ?
"Yes" :
"No",
242 ChipInfo_SupportsPROPRIETARY() ?
"Yes" :
"No",
243 ChipInfo_SupportsBLE() ?
"Yes" :
"No");
245 #if (RF_MODE == RF_MODE_SUB_1_GHZ) 246 LOG_INFO(
"Operating frequency on Sub-1 GHz\n");
247 #elif (RF_MODE == RF_MODE_2_4_GHZ) 248 LOG_INFO(
"Operating frequency on 2.4 GHz\n");
251 NETSTACK_RADIO.get_value(RADIO_PARAM_CHANNEL, &chan);
252 LOG_INFO(
"RF: Channel %d", chan);
254 if(NETSTACK_RADIO.get_value(RADIO_PARAM_PAN_ID, &pan) == RADIO_RESULT_OK) {
255 LOG_INFO_(
", PANID 0x%04X", pan);
259 LOG_INFO(
"Node ID: %d\n", node_id);
261 #if BOARD_CONF_SENSORS_ENABLE 265 fade(Board_PIN_LED1);
Header file for the CC13xx/CC26xx BLE Beacon Daemon.
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.
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.
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.
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.
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.