Microchip® Advanced Software Framework

EdDemo.c File Reference

Energy Detection Demo application implementation.

Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "config.h"
#include "phy.h"
#include "sys.h"
#include "nwk.h"
#include "sysTimer.h"
#include "sio2host.h"
#include "led.h"
#include "sysclk.h"
#include "asf.h"

Typedefs

typedef enum AppState_t AppState_t
 

Enumerations

enum  AppState_t {
  APP_STATE_INITIAL,
  APP_STATE_SEND,
  APP_STATE_WAIT_CONF,
  APP_STATE_SENDING_DONE,
  APP_STATE_WAIT_SEND_TIMER,
  APP_STATE_WAIT_COMMAND_TIMER,
  APP_STATE_PREPARE_TO_SLEEP,
  APP_STATE_SLEEP,
  APP_STATE_WAKEUP,
  APP_STATE_INITIAL,
  APP_STATE_IDLE,
  APP_STATE_INITIAL,
  APP_STATE_MEASURE_ED,
  APP_STATE_WAIT_SCAN_TIMER,
  APP_STATE_INITIAL,
  APP_STATE_IDLE
}
 

Functions

static void APP_TaskHandler (void)
 
static void appInit (void)
 
static void appPrintEdValues (void)
 
static void appScanTimerHandler (SYS_Timer_t *timer)
 
int main (void)
 Main function. More...
 

Variables

static uint8_t appEdValue [APP_LAST_CHANNEL-APP_FIRST_CHANNEL+1]
 
static SYS_Timer_t appScanTimer
 
static AppState_t appState = APP_STATE_INITIAL
 

typedef enum AppState_t AppState_t

enum AppState_t
Enumerator
APP_STATE_INITIAL 
APP_STATE_SEND 
APP_STATE_WAIT_CONF 
APP_STATE_SENDING_DONE 
APP_STATE_WAIT_SEND_TIMER 
APP_STATE_WAIT_COMMAND_TIMER 
APP_STATE_PREPARE_TO_SLEEP 
APP_STATE_SLEEP 
APP_STATE_WAKEUP 
APP_STATE_INITIAL 
APP_STATE_IDLE 
APP_STATE_INITIAL 
APP_STATE_MEASURE_ED 
APP_STATE_WAIT_SCAN_TIMER 
APP_STATE_INITIAL 
APP_STATE_IDLE 

static void appPrintEdValues ( void  )
static
static void appScanTimerHandler ( SYS_Timer_t timer)
static

References APP_STATE_MEASURE_ED, and appState.

Referenced by appInit().

int main ( void  )

Main function.

Main function.

This function initializes the MAC, initiates a MLME reset request (wpan_mlme_reset_req()), and implements a the main loop.

Main function.

The master example begins by initializing required board resources. The system clock, basic GPIO pin mapping, and interrupt vectors are established.

A memory location on a TWI slave is written with a fixed test pattern which is then read back into a separate buffer. As a basic sanity check, the original write-buffer values are compared with values read from the slave to a separate buffer. An LED on the development board is illuminated when there is a match between the written and read data.

Returns
Nothing.

Main function.

Main function.

Initializes the clock system, board and serial output, then sets up the Sleep Manager unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the IOPORT Service unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the USART unit test suite and runs it.

Main function.

Initializes the clock system, board and serial output, then sets up the TWI unit test suite and runs it.

Main function.

Returns
error code

The SAM3X_EK, SAM3X Arduino board and SAM4C_EK use two bytes length internal address EEPROM.

References APP_TaskHandler(), board_init(), cpu_irq_enable, delay_init, LED0, LED_On, sio2host_init(), SYS_Init(), SYS_TaskHandler(), and sysclk_init().

uint8_t appEdValue[APP_LAST_CHANNEL-APP_FIRST_CHANNEL+1]
static
SYS_Timer_t appScanTimer
static