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 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 |
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().
Bool b_pushb1_get_value | ( | char * | buf | ) |
Get a pushbutton current state.
buf | char buffer in which the push button state is stored. |
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.
buf | char buffer in which the push button state is stored. |
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.
buf | char buffer in which the push button state is stored. |
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 }
const signed portCHAR* acpc_pushb_events[2] |
Initial value:
{ (signed portCHAR *)"RELEASE", (signed portCHAR *)"PRESS" }
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] |
Bool b_pushb3 = PUSHB_EVENT_RELEASE [static] |