Microchip® Advanced Software Framework

helper.c File Reference

ATmegaRFX RCB board header file.

This file contains definitions and services related to the features of the ATmega256RFR2 Xplained Pro board.

To use this board, define BOARD= ATMEGA256RFR2_XPLAINED_PRO.

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

#include "compiler.h"
#include "conf_board.h"
#include "helper.h"
#include <asf.h>

Functions

void acc_disable (void)
 disable the Accelerometer More...
 
static void acc_enable (acc_status_t status)
 Enable or disable the Accelerometer. More...
 
void acc_init (void)
 Initialize the Accelerometer. More...
 
void adc_init (void)
 Initialize ADC for Accelerometer. More...
 
uint16_t adc_read (adc_channel_t channel)
 Read the ADC for Accelerometer. More...
 
button_id_t button_scan (void)
 Button handling handles the button pressed events. More...
 
void led_ctrl (led_id_t led_no, led_action_t led_setting)
 Control LED status. More...
 
void pulse_latch (void)
 Pulse latch for connected external hardware. More...
 
void read_acc (uint16_t *x, uint16_t *y, uint16_t *z, uint16_t *ref)
 Read the ACC-Sensor Values with low-pass filtering. More...
 
void set_button_pins_for_normal_mode (void)
 Button pins setting for active/normal mode. More...
 
void update_latch_status (void)
 Update the latch status. More...
 

Variables

static uint16_t ADC_ref_val
 
static uint8_t latch_status = 0xDF
 
static uint16_t x_axis_val
 
static uint16_t y_axis_val
 
static uint16_t z_axis_val
 

void acc_disable ( void  )

disable the Accelerometer

References acc_enable(), and ACC_OFF.

static void acc_enable ( acc_status_t  status)
static

Enable or disable the Accelerometer.

Parameters
statusEnable or disable the accelerometer

References ACC_PWR, latch_status, and pulse_latch().

Referenced by acc_disable(), and acc_init().

void acc_init ( void  )

Initialize the Accelerometer.

References acc_enable(), ACC_ON, ADC_ref_val, x_axis_val, y_axis_val, and z_axis_val.

Referenced by board_init().

void adc_init ( void  )

Initialize ADC for Accelerometer.

Referenced by board_init().

uint16_t adc_read ( adc_channel_t  channel)

Read the ADC for Accelerometer.

Parameters
channelADC channel to be read
Returns
uint16_t Value read from ADC

Referenced by read_acc().

button_id_t button_scan ( void  )
void led_ctrl ( led_id_t  led_no,
led_action_t  led_setting 
)

Control LED status.

Parameters
[in]led_noLED ID
[in]led_settingLED_ON, LED_OFF, LED_TOGGLE

References latch_status, LED_OFF, LED_ON, LED_TOGGLE, and pulse_latch().

void pulse_latch ( void  )

Pulse latch for connected external hardware.

References LATCH_DATA, LATCH_DATA_DIR, LATCH_PULSE, and latch_status.

Referenced by acc_enable(), board_init(), and led_ctrl().

void read_acc ( uint16_t *  x,
uint16_t *  y,
uint16_t *  z,
uint16_t *  ref 
)

Read the ACC-Sensor Values with low-pass filtering.

Parameters
xX-axis value is read and stored in this parameter
yy-axis value is read and stored in this parameter
zz-axis value is read and stored in this parameter
refref value is read and stored in this parameter

References adc_read(), ADC_REF, ADC_ref_val, X_AXIS, x_axis_val, Y_AXIS, y_axis_val, Z_AXIS, and z_axis_val.

Referenced by acc_read_cb(), and app_task().

void set_button_pins_for_normal_mode ( void  )

Button pins setting for active/normal mode.

References BUTTON_PORT1, BUTTON_PORT1_DIR, BUTTON_PORT2, and BUTTON_PORT2_DIR.

Referenced by board_init().

void update_latch_status ( void  )

Update the latch status.

References latch_status.

Referenced by board_init().

uint16_t ADC_ref_val
static

Referenced by acc_init(), and read_acc().

uint8_t latch_status = 0xDF
static
uint16_t x_axis_val
static

Referenced by acc_init(), and read_acc().

uint16_t y_axis_val
static

Referenced by acc_init(), and read_acc().

uint16_t z_axis_val
static

Referenced by acc_init(), and read_acc().