Microchip® Advanced Software Framework

Peer2Peer.c File Reference

Peer2Peer 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 "sys.h"
#include "led.h"
#include "sysclk.h"
#include "phy.h"
#include "nwk.h"
#include "sysTimer.h"
#include "sio2host.h"
#include "asf.h"

Macros

#define APP_BUFFER_SIZE   (NWK_MAX_PAYLOAD_SIZE - NWK_SECURITY_MIC_SIZE)
 

Typedefs

typedef enum AppState_t AppState_t
 

Enumerations

enum  AppState_t {
  APP_STATE_INITIAL,
  APP_STATE_MEASURE_ED,
  APP_STATE_WAIT_SCAN_TIMER,
  APP_STATE_INITIAL,
  APP_STATE_IDLE,
  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
}
 

Functions

static void APP_TaskHandler (void)
 
static void appDataConf (NWK_DataReq_t *req)
 
static bool appDataInd (NWK_DataInd_t *ind)
 
static void appInit (void)
 
static void appSendData (void)
 
static void appTimerHandler (SYS_Timer_t *timer)
 
int main (void)
 

Variables

static NWK_DataReq_t appDataReq
 
static uint8_t appDataReqBuffer [APP_BUFFER_SIZE]
 
static bool appDataReqBusy = false
 
static AppState_t appState = APP_STATE_INITIAL
 
static SYS_Timer_t appTimer
 
static uint8_t appUartBuffer [APP_BUFFER_SIZE]
 
static uint8_t appUartBufferPtr = 0
 
static uint8_t rx_data [APP_RX_BUF_SIZE]
 
static uint8_t sio_rx_length
 

#define APP_BUFFER_SIZE   (NWK_MAX_PAYLOAD_SIZE - NWK_SECURITY_MIC_SIZE)

typedef enum AppState_t AppState_t

enum AppState_t
Enumerator
APP_STATE_INITIAL 
APP_STATE_MEASURE_ED 
APP_STATE_WAIT_SCAN_TIMER 
APP_STATE_INITIAL 
APP_STATE_IDLE 
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 

static void appDataConf ( NWK_DataReq_t req)
static

References appDataReqBusy.

Referenced by appSendData().

static bool appDataInd ( NWK_DataInd_t ind)
static
static void appTimerHandler ( SYS_Timer_t timer)
static

References appSendData().

Referenced by appInit().

NWK_DataReq_t appDataReq
static
uint8_t appDataReqBuffer[APP_BUFFER_SIZE]
static

Referenced by appSendData().

bool appDataReqBusy = false
static

Referenced by appDataConf(), and appSendData().

AppState_t appState = APP_STATE_INITIAL
static

Referenced by APP_TaskHandler().

SYS_Timer_t appTimer
static
uint8_t appUartBuffer[APP_BUFFER_SIZE]
static

Referenced by APP_TaskHandler(), and appSendData().

uint8_t appUartBufferPtr = 0
static

Referenced by APP_TaskHandler(), and appSendData().

uint8_t rx_data[APP_RX_BUF_SIZE]
static

Referenced by APP_TaskHandler().

uint8_t sio_rx_length
static

Referenced by APP_TaskHandler().