Microchip® Advanced Software Framework

thirdparty/wireless/avr2025_mac/apps/mac/beacon/dev/main.c File Reference
#include <string.h>
#include <inttypes.h>
#include <stdio.h>
#include "conf_board.h"
#include "avr2025_mac.h"
#include "delay.h"
#include "common_sw_timer.h"
#include "sio2host.h"
#include "common_hw_timer.h"
#include "beacon_app.h"
#include <asf.h>

Macros

#define APP_GUARD_TIME_US   (10000)
 
#define CHANNEL_OFFSET   (0)
 Channel Offset will give us the channel number as (CHANNEL_OFFSET + 11) More...
 
#define GTS_PAYLOAD_LEN   (18)
 
#define LED_DATA   (LED0)
 
#define LED_DATA   (LED0)
 
#define LED_NWK_SETUP   (LED0)
 
#define LED_START   (LED0)
 
#define MCU_WAKEUP_TIME   (150)
 
#define PAYLOAD_LEN   (104)
 
#define SCAN_DURATION_LONG   (6)
 Defines the long scan duration time. More...
 
#define SCAN_DURATION_SHORT   (5)
 Defines the short scan duration time. More...
 
#define TIMER_SYNC_BEFORE_ASSOC_MS   (3000)
 

Functions

static void app_alert (void)
 Alert to indicate something has gone wrong in the application. More...
 
int main (void)
 Main function of the device application. More...
 
static void network_search_indication_cb (void *parameter)
 Callback function indicating network search. More...
 
static void print_stack_app_build_features (void)
 This function shows the stack and application capabilities on terminal if SIO_HUB switch is enabled. More...
 
static void rx_data_led_off_cb (void *parameter)
 Callback function for switching off the LED after data reception. More...
 
void usr_mcps_data_conf (uint8_t msduHandle, uint8_t status, uint32_t Timestamp)
 Callback function that must be implemented by application (NHLE) for MAC service MCPS-DATA.confirm. More...
 
void usr_mcps_data_ind (wpan_addr_spec_t *SrcAddrSpec, wpan_addr_spec_t *DstAddrSpec, uint8_t msduLength, uint8_t *msdu, uint8_t mpduLinkQuality, uint8_t DSN, uint32_t Timestamp)
 
void usr_mlme_gts_conf (gts_char_t GtsChar, uint8_t status)
 
void usr_mlme_gts_ind (uint16_t DeviceAddr, gts_char_t GtsChar)
 
void usr_mlme_reset_conf (uint8_t status)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-RESET.confirm. More...
 
void usr_mlme_set_conf (uint8_t status, uint8_t PIBAttribute)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-SET.confirm. More...
 
void usr_mlme_sync_loss_ind (uint8_t LossReason, uint16_t PANId, uint8_t LogicalChannel, uint8_t ChannelPage)
 Callback function that must be implemented by application (NHLE) for MAC service MLME-SYNC-LOSS.indication. More...
 

Variables

app_state_t app_state = APP_IDLE
 This variable stores the current state of the node. More...
 
static uint8_t APP_TIMER
 
static uint32_t bc_rx_cnt
 
static uint32_t channels_supported
 
wpan_addr_spec_t coord_addr_spec
 
uint8_t current_channel
 
uint8_t current_channel_page
 
uint8_t default_key_source [8]
 
static uint32_t indirect_rx_cnt
 
static uint8_t msdu_payload [PAYLOAD_LEN]
 This array stores the current msdu payload. More...
 

#define APP_GUARD_TIME_US   (10000)

Referenced by main().

#define CHANNEL_OFFSET   (0)

Channel Offset will give us the channel number as (CHANNEL_OFFSET + 11)

#define GTS_PAYLOAD_LEN   (18)
#define LED_DATA   (LED0)
#define LED_DATA   (LED0)
#define LED_NWK_SETUP   (LED0)
#define LED_START   (LED0)

Referenced by main().

#define MCU_WAKEUP_TIME   (150)
#define PAYLOAD_LEN   (104)
#define SCAN_DURATION_LONG   (6)

Defines the long scan duration time.

#define SCAN_DURATION_SHORT   (5)

Defines the short scan duration time.

#define TIMER_SYNC_BEFORE_ASSOC_MS   (3000)

static void app_alert ( void  )
static

Alert to indicate something has gone wrong in the application.

static void network_search_indication_cb ( void *  parameter)
static

Callback function indicating network search.

Parameters
parameterPointer to callback parameter (not used in this application, but could be if desired).

References LED_NWK_SETUP.

static void print_stack_app_build_features ( void  )
static

This function shows the stack and application capabilities on terminal if SIO_HUB switch is enabled.

Referenced by main().

static void rx_data_led_off_cb ( void *  parameter)
static

Callback function for switching off the LED after data reception.

Parameters
parameterPointer to callback parameter (not used in this application, but could be if desired).

References LED_DATA.

Referenced by usr_mcps_data_ind().

void usr_mcps_data_ind ( wpan_addr_spec_t SrcAddrSpec,
wpan_addr_spec_t DstAddrSpec,
uint8_t  msduLength,
uint8_t *  msdu,
uint8_t  mpduLinkQuality,
uint8_t  DSN,
uint32_t  Timestamp 
)

app_state_t app_state = APP_IDLE

This variable stores the current state of the node.

uint8_t APP_TIMER
static

Referenced by main(), and usr_mcps_data_ind().

uint32_t bc_rx_cnt
static

Referenced by usr_mcps_data_ind().

uint32_t channels_supported
static
wpan_addr_spec_t coord_addr_spec
uint8_t current_channel
uint8_t current_channel_page
uint8_t default_key_source[8]
uint32_t indirect_rx_cnt
static

Referenced by usr_mcps_data_ind().

uint8_t msdu_payload[PAYLOAD_LEN]
static

This array stores the current msdu payload.