s_pushb.c File Reference


Detailed Description

AVR32 UC3 Control Panel push buttons sensor module.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file s_pushb.c.

#include <string.h>
#include <stdio.h>
#include "compiler.h"
#include "s_pushb.h"
#include "gpio.h"
#include "FreeRTOS.h"

Go to the source code of this file.

Defines

#define PB1_POSITION   GPIO_PUSH_BUTTON_0
#define PB2_POSITION   GPIO_PUSH_BUTTON_1
#define PB3_POSITION   GPIO_PUSH_BUTTON_2
#define PUSHB_EVENT_PRESS   TRUE
#define PUSHB_EVENT_RELEASE   FALSE
#define SENSOR_PB1_CONFIG_FILE   "CFG/PB1.TXT"
#define SENSOR_PB2_CONFIG_FILE   "CFG/PB2.TXT"
#define SENSOR_PB3_CONFIG_FILE   "CFG/PB3.TXT"

Functions

Bool b_pushb1_get_value (char *buf)
 Get a pushbutton current state.
Bool b_pushb2_get_value (char *buf)
 Get a pushbutton current state.
Bool b_pushb3_get_value (char *buf)
 Get a pushbutton current state.

Variables

const signed portCHAR * acpc_pushb_events [2]
static Bool b_pushb1 = PUSHB_EVENT_RELEASE
static Bool b_pushb2 = PUSHB_EVENT_RELEASE
static Bool b_pushb3 = PUSHB_EVENT_RELEASE


Define Documentation

#define PB1_POSITION   GPIO_PUSH_BUTTON_0

Definition at line 65 of file s_pushb.c.

Referenced by b_pushb1_get_value().

#define PB2_POSITION   GPIO_PUSH_BUTTON_1

Definition at line 66 of file s_pushb.c.

Referenced by b_pushb2_get_value().

#define PB3_POSITION   GPIO_PUSH_BUTTON_2

Definition at line 67 of file s_pushb.c.

Referenced by b_pushb3_get_value().

#define PUSHB_EVENT_PRESS   TRUE

Pushbutton events.

Definition at line 58 of file s_pushb.c.

Referenced by b_pushb1_get_value(), b_pushb2_get_value(), and b_pushb3_get_value().

#define PUSHB_EVENT_RELEASE   FALSE

Definition at line 59 of file s_pushb.c.

Referenced by b_pushb1_get_value(), b_pushb2_get_value(), and b_pushb3_get_value().

#define SENSOR_PB1_CONFIG_FILE   "CFG/PB1.TXT"

Definition at line 61 of file s_pushb.c.

#define SENSOR_PB2_CONFIG_FILE   "CFG/PB2.TXT"

Definition at line 62 of file s_pushb.c.

#define SENSOR_PB3_CONFIG_FILE   "CFG/PB3.TXT"

Definition at line 63 of file s_pushb.c.


Function Documentation

Bool b_pushb1_get_value ( char *  buf  ) 

Get a pushbutton current state.

Parameters:
buf char buffer in which the push button state is stored.
Returns:
TRUE upon success, FALSE if error.

Definition at line 94 of file s_pushb.c.

References acpc_pushb_events, b_pushb1, PB1_POSITION, PUSHB_EVENT_PRESS, and PUSHB_EVENT_RELEASE.

Referenced by device_full_custom_task().

00095 {
00096    // input is pulled up, if 1 : input is not active
00097    if (gpio_get_pin_value(PB1_POSITION)) {
00098       b_pushb1 = PUSHB_EVENT_RELEASE;
00099    } else {
00100       b_pushb1 = PUSHB_EVENT_PRESS;
00101    }
00102    // Build the log string.
00103    sprintf( buf, "%s\r\n", (portCHAR *)acpc_pushb_events[b_pushb1]);
00104    return TRUE;
00105 }

Bool b_pushb2_get_value ( char *  buf  ) 

Get a pushbutton current state.

Parameters:
buf char buffer in which the push button state is stored.
Returns:
TRUE upon success, FALSE if error.

Definition at line 116 of file s_pushb.c.

References acpc_pushb_events, b_pushb2, PB2_POSITION, PUSHB_EVENT_PRESS, and PUSHB_EVENT_RELEASE.

Referenced by device_full_custom_task().

00117 {
00118    // input is pulled up, if 1 : input is not active
00119    if (gpio_get_pin_value(PB2_POSITION)) {
00120       b_pushb2 = PUSHB_EVENT_RELEASE;
00121    } else {
00122       b_pushb2 = PUSHB_EVENT_PRESS;
00123    }
00124    // Build the log string.
00125    sprintf( buf, "%s\r\n", (portCHAR *)acpc_pushb_events[b_pushb2]);
00126    return TRUE;
00127 }

Bool b_pushb3_get_value ( char *  buf  ) 

Get a pushbutton current state.

Parameters:
buf char buffer in which the push button state is stored.
Returns:
TRUE upon success, FALSE if error.

Definition at line 139 of file s_pushb.c.

References acpc_pushb_events, b_pushb3, PB3_POSITION, PUSHB_EVENT_PRESS, and PUSHB_EVENT_RELEASE.

00140 {
00141    // input is pulled up, if 1 : input is not active
00142    if (gpio_get_pin_value(PB3_POSITION)) {
00143       b_pushb3 = PUSHB_EVENT_RELEASE;
00144    } else {
00145       b_pushb3 = PUSHB_EVENT_PRESS;
00146    }
00147    // Build the log string.
00148    sprintf( buf, "%s\r\n", (portCHAR *)acpc_pushb_events[b_pushb3]);
00149    return TRUE;
00150 }


Variable Documentation

const signed portCHAR* acpc_pushb_events[2]

Initial value:

 {
   (signed portCHAR *)"RELEASE",
   (signed portCHAR *)"PRESS"
}
Pushbutton events string.

Definition at line 72 of file s_pushb.c.

Referenced by b_pushb1_get_value(), b_pushb2_get_value(), and b_pushb3_get_value().

Bool b_pushb1 = PUSHB_EVENT_RELEASE [static]

Pushbutton events emulation.

Definition at line 78 of file s_pushb.c.

Referenced by b_pushb1_get_value().

Bool b_pushb2 = PUSHB_EVENT_RELEASE [static]

Definition at line 79 of file s_pushb.c.

Referenced by b_pushb2_get_value().

Bool b_pushb3 = PUSHB_EVENT_RELEASE [static]

Definition at line 81 of file s_pushb.c.

Referenced by b_pushb3_get_value().


Generated on Fri Feb 19 02:22:52 2010 for AVR32 - Control Panel demonstration. by  doxygen 1.5.5