Atmel Software Framework

tester.c File Reference

Tester application.

Copyright (C) 2012-2015 Atmel Corporation. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software may only be redistributed and used in connection with an Atmel microcontroller product.

THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "config.h"
#include "phy.h"
#include "sys.h"
#include "nwk.h"
#include "led.h"
#include "sysclk.h"
#include "tester.h"
#include "commands.h"
#include "filter.h"
#include "events.h"
#include "time.h"
#include "sio2host.h"
#include "asf.h"

Typedefs

typedef enum AppState_t AppState_t
 
typedef enum AppUartState_t AppUartState_t
 

Enumerations

enum  AppState_t {
  APP_STATE_INITIAL,
  APP_STATE_IDLE,
  APP_STATE_INITIAL,
  APP_STATE_IDLE,
  APP_STATE_INITIAL,
  APP_STATE_MEASURE_ED,
  APP_STATE_WAIT_SCAN_TIMER,
  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
}
 
enum  AppUartState_t {
  APP_UART_STATE_IDLE,
  APP_UART_STATE_READ_SIZE_1,
  APP_UART_STATE_READ_SIZE_2,
  APP_UART_STATE_READ_DATA,
  APP_UART_STATE_READ_CRC_1,
  APP_UART_STATE_READ_CRC_2
}
 

Functions

static void APP_TaskHandler (void)
 
static uint16_t appCrcCcittUpdate (uint16_t crc, uint8_t byte)
 
static void appUartSendAck (AppStatus_t status)
 
void appUartSendCommand (uint8_t *buf, uint16_t size)
 
static void appUartStateMachine (uint8_t byte)
 
int main (void)
 
static void Serial_Handler (void)
 

Variables

static AppState_t appState = APP_STATE_INITIAL
 
static uint8_t appUartBuffer [APP_UART_BUFFER_SIZE]
 
static uint16_t appUartBufferCrc
 
static uint16_t appUartBufferPtr
 
static uint16_t appUartCrc
 
static uint16_t appUartSize
 
static AppUartState_t appUartState = APP_UART_STATE_IDLE
 
static uint8_t rx_data [APP_RX_BUF_SIZE]
 
static uint8_t sio_rx_length
 

typedef enum AppState_t AppState_t

enum AppState_t
Enumerator
APP_STATE_INITIAL 
APP_STATE_IDLE 
APP_STATE_INITIAL 
APP_STATE_IDLE 
APP_STATE_INITIAL 
APP_STATE_MEASURE_ED 
APP_STATE_WAIT_SCAN_TIMER 
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 
Enumerator
APP_UART_STATE_IDLE 
APP_UART_STATE_READ_SIZE_1 
APP_UART_STATE_READ_SIZE_2 
APP_UART_STATE_READ_DATA 
APP_UART_STATE_READ_CRC_1 
APP_UART_STATE_READ_CRC_2 

static void APP_TaskHandler ( void  )
static
static uint16_t appCrcCcittUpdate ( uint16_t  crc,
uint8_t  byte 
)
static
void appUartSendCommand ( uint8_t *  buf,
uint16_t  size 
)
void Serial_Handler ( void  )
static

AppState_t appState = APP_STATE_INITIAL
static

Referenced by APP_TaskHandler().

uint8_t appUartBuffer[APP_UART_BUFFER_SIZE]
static

Referenced by appUartStateMachine().

uint16_t appUartBufferCrc
static

Referenced by appUartStateMachine().

uint16_t appUartBufferPtr
static

Referenced by appUartStateMachine().

uint16_t appUartCrc
static

Referenced by appUartStateMachine().

uint16_t appUartSize
static

Referenced by appUartStateMachine().

AppUartState_t appUartState = APP_UART_STATE_IDLE
static

Referenced by appUartStateMachine().

uint8_t rx_data[APP_RX_BUF_SIZE]
static
uint8_t sio_rx_length
static

Referenced by Serial_Handler().