Microchip® Advanced Software Framework

commands.c File Reference

WSNDemo command handler implementation.

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

#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "nwk.h"
#include "sysTimer.h"
#include "commands.h"
#include "wsndemo.h"
#include "asf.h"

Data Structures

struct  AppCmdHeader_t
 
struct  AppCmdIdentify_t
 
struct  AppCmdPendingTableEntry_t
 
struct  AppCmdUartHeader_t
 
struct  AppCmdUartIdentify_t
 

Macros

#define APP_CMD_ENDPOINT   2
 
#define APP_CMD_INVALID_ADDR   0xffff
 
#define APP_CMD_PENDING_TABLE_SIZE   5
 
#define APP_CMD_UART_BUFFER_SIZE   16
 

Enumerations

enum  AppCmdUartState_t {
  APP_CMD_UART_STATE_IDLE,
  APP_CMD_UART_STATE_SYNC,
  APP_CMD_UART_STATE_DATA,
  APP_CMD_UART_STATE_MARK,
  APP_CMD_UART_STATE_CSUM
}
 

Functions

void APP_CommandsByteReceived (uint8_t byte)
 
void APP_CommandsInit (void)
 
bool APP_CommandsPending (uint16_t addr)
 
static void appCmdBuffer (uint16_t addr, uint8_t *data, uint8_t size)
 
static void appCmdCheckPendingTable (void)
 
static void appCmdDataConf (NWK_DataReq_t *req)
 
static bool appCmdDataInd (NWK_DataInd_t *ind)
 
static void appCmdDataRequest (AppCmdPendingTableEntry_t *entry)
 
static bool appCmdHandle (uint8_t *data, uint8_t size)
 
static void appCmdIdentifyDurationTimerHandler (SYS_Timer_t *timer)
 
static void appCmdIdentifyPeriodTimerHandler (SYS_Timer_t *timer)
 
static void appCmdUartProcess (uint8_t *data, uint8_t size)
 

Variables

static NWK_DataReq_t appCmdDataReq
 
static SYS_Timer_t appCmdIdentifyDurationTimer
 
static SYS_Timer_t appCmdIdentifyPeriodTimer
 
static AppCmdPendingTableEntry_tappCmdInProgress
 
static AppCmdPendingTableEntry_t appCmdPendingTable [APP_CMD_PENDING_TABLE_SIZE]
 
static uint8_t appCmdUartBuf [APP_CMD_UART_BUFFER_SIZE]
 
static uint8_t appCmdUartCsum
 
static uint8_t appCmdUartPtr
 
static AppCmdUartState_t appCmdUartState = APP_CMD_UART_STATE_IDLE
 

#define APP_CMD_ENDPOINT   2

Referenced by APP_CommandsInit().

#define APP_CMD_INVALID_ADDR   0xffff
#define APP_CMD_PENDING_TABLE_SIZE   5
#define APP_CMD_UART_BUFFER_SIZE   16

Enumerator
APP_CMD_UART_STATE_IDLE 
APP_CMD_UART_STATE_SYNC 
APP_CMD_UART_STATE_DATA 
APP_CMD_UART_STATE_MARK 
APP_CMD_UART_STATE_CSUM 

bool APP_CommandsPending ( uint16_t  addr)
static void appCmdCheckPendingTable ( void  )
static
static bool appCmdDataInd ( NWK_DataInd_t ind)
static
static void appCmdIdentifyDurationTimerHandler ( SYS_Timer_t timer)
static
static void appCmdIdentifyPeriodTimerHandler ( SYS_Timer_t timer)
static

Referenced by APP_CommandsInit(), and appCmdHandle().

NWK_DataReq_t appCmdDataReq
static

Referenced by appCmdDataRequest().

SYS_Timer_t appCmdIdentifyDurationTimer
static

Referenced by appCmdHandle().

SYS_Timer_t appCmdIdentifyPeriodTimer
static
uint8_t appCmdUartBuf[APP_CMD_UART_BUFFER_SIZE]
static
uint8_t appCmdUartCsum
static
uint8_t appCmdUartPtr
static
AppCmdUartState_t appCmdUartState = APP_CMD_UART_STATE_IDLE
static