44#include "dev/watchdog.h"
47extern int msp430_dco_required;
53#define LOG_MODULE "FR5969"
54#define LOG_LEVEL LOG_LEVEL_MAIN
64#define DEVICE_DESCRIPTOR_BASE ((const uint8_t *)0x1A00)
65#define DEVICE_DESCRIPTOR_MAX_LEN 256
66#define TLV_TAG_RANDOM_NUMBER 0x08
67#define TLV_TAG_END 0xfe
70lladdr_from_device_descriptor(linkaddr_t *
addr)
72 const uint8_t *desc = DEVICE_DESCRIPTOR_BASE;
73 uint8_t info_len_words = desc[0];
79 if(info_len_words == 0 || info_len_words > DEVICE_DESCRIPTOR_MAX_LEN / 4) {
84 end = desc + info_len_words * 4;
90 if(tag == TLV_TAG_END || p + 2 + len > end) {
93 if(tag == TLV_TAG_RANDOM_NUMBER && len > 0) {
97 for(
size_t i = 0; i < LINKADDR_SIZE; i++) {
98 addr->u8[i] = p[2 + (i % len)];
102 addr->u8[0] = (
addr->u8[0] & ~0x01) | 0x02;
115 memset(&
addr, 0,
sizeof(linkaddr_t));
116 if(!lladdr_from_device_descriptor(&
addr)) {
118 addr.u8[0] = (node_id >> 8) & 0xff;
119 addr.u8[1] = node_id & 0xff;
149 __delay_cycles(F_CPU / 4);
158 LOG_INFO(
"Platform: MSP-EXP430FR5969 LaunchPad\n");
169 LOG_INFO(
"Node ID: %u\n", node_id);
172 uart0_set_input(serial_line_input_byte);
175 leds_off(LEDS_GREEN);
188 ENERGEST_SWITCH(ENERGEST_TYPE_CPU, ENERGEST_TYPE_LPM);
192 if(msp430_dco_required) {
193 _BIS_SR(GIE | CPUOFF);
195 _BIS_SR(GIE | SCG0 | SCG1 | CPUOFF);
199 ENERGEST_SWITCH(ENERGEST_TYPE_LPM, ENERGEST_TYPE_CPU);
Header file for the energy estimation mechanism.
Header file for the GPIO HAL.
void uart0_init(void)
Initializes the UART driver.
void watchdog_start(void)
Starts the WDT in watchdog mode if enabled by user configuration, maximum interval.
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 watchdog_stop(void)
Stops the WDT such that it won't timeout and cause MCU reset.
void leds_init(void)
Initialise the LED HAL.
void gpio_hal_init()
Initialise the GPIO HAL.
static void linkaddr_set_node_addr(linkaddr_t *addr)
Set the address of the current node.
process_num_events_t process_nevents(void)
Number of events waiting to be processed.
Header file for the LED HAL.
Header file for the logging system.
Node-id (simple 16-bit identifiers) handling.
Generic serial I/O process header filer.
static uip_ds6_addr_t * addr
Pointer to a nbr cache entry.