#include <string.h>
#include "compiler.h"
#include "gpio.h"
#include "FreeRTOS.h"
#include "task.h"
#include "joystick.h"
#include "datalog.h"
#include "shell.h"
#include "board.h"
#include "sensor.h"
#include "config_file.h"
#include "fsaccess.h"
#include "mmi.h"
#include "BasicSMTP.h"
Macros | |
#define | JS_EVENT_DOWN 0x10 |
#define | JS_EVENT_LEFT 0x02 |
#define | JS_EVENT_PUSH 0x01 |
#define | JS_EVENT_RIGHT 0x04 |
#define | JS_EVENT_UP 0x08 |
#define | JS_GETCONF_MAXLEN 16 |
#define | JS_NB_EVENT 32 |
#define | SENSOR_JS_CONFIG_FILE "A:/CFG/JS.TXT" |
Functions | |
bool | b_joystick_get_value (xLogDef *pxLog) |
Get the current joystick state. More... | |
bool | b_joystick_init (void) |
Init the joystick sensor. More... | |
eExecStatus | e_joystick_get_config (signed portCHAR **ppcStringReply) |
Get the joystick sensor config. More... | |
eExecStatus | e_joystick_set_config (signed portCHAR **ppcStringReply, int ac, signed portCHAR *av[]) |
Set the sensor config. More... | |
static portBASE_TYPE | prvjoystick_ISR_NonNakedBehaviour (void) |
joystick interrupt handler. Here, declarations should be done More... | |
void | v_joystick_stop (void) |
Stop the joystick sensor. More... | |
void | vjoystick_ISR (void) |
joystick naked interrupt handler. More... | |
Variables | |
const signed portCHAR * | acpc_js_events [JS_NB_EVENT] |
static bool | bAlarm = false |
static U32 | u32LastCountValue = 0 |
static unsigned short | x_joystick = 0 |
xSemaphoreHandle | xCFGMutex |
#define JS_EVENT_DOWN 0x10 |
Referenced by prvjoystick_ISR_NonNakedBehaviour().
#define JS_EVENT_LEFT 0x02 |
Referenced by prvjoystick_ISR_NonNakedBehaviour().
#define JS_EVENT_PUSH 0x01 |
Mask for events on joystick.
Referenced by prvjoystick_ISR_NonNakedBehaviour().
#define JS_EVENT_RIGHT 0x04 |
Referenced by prvjoystick_ISR_NonNakedBehaviour().
#define JS_EVENT_UP 0x08 |
Referenced by prvjoystick_ISR_NonNakedBehaviour().
#define JS_GETCONF_MAXLEN 16 |
Max string length of a get config.
#define JS_NB_EVENT 32 |
Max number of events on joystick.
#define SENSOR_JS_CONFIG_FILE "A:/CFG/JS.TXT" |
Path to the config file.
Referenced by b_joystick_init(), and e_joystick_set_config().
Get the current joystick state.
pxLog | a Log structure. |
References acpc_js_events, NULL, LogDef::pcStringLog, LogDef::pfFreeStringLog, and x_joystick.
Referenced by b_sensor_get_value().
bool b_joystick_init | ( | void | ) |
Init the joystick sensor.
References bAlarm, config_file_get_value(), Disable_global_interrupt, Enable_global_interrupt, gpio_enable_pin_interrupt(), GPIO_PIN_CHANGE, INTC_register_interrupt(), pdTRUE, SENSOR_JS_CONFIG_FILE, vjoystick_ISR(), x_supervisor_SemaphoreGive(), and x_supervisor_SemaphoreTake().
eExecStatus e_joystick_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the joystick sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. A malloc for the response string is performed here; the caller must free this string. |
References bAlarm, SENSOR_MSG_ALARM_OFF, SENSOR_MSG_ALARM_ON, and SHELL_EXECSTATUS_OK_NO_FREE.
eExecStatus e_joystick_set_config | ( | signed portCHAR ** | ppcStringReply, |
int | ac, | ||
signed portCHAR * | av[] | ||
) |
Set the sensor config.
ppcStringReply | Input/Output. The response string. NEVER NULL AS INPUT. |
ac | Input. Number of args |
av | Input. pointer to args |
References bAlarm, config_file_set_value(), pdFALSE, pdTRUE, SENSOR_JS_CONFIG_FILE, SENSOR_MSG_ALARM_OFF, SENSOR_MSG_ALARM_ON, SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, and SHELL_EXECSTATUS_OK_NO_FREE.
|
static |
joystick interrupt handler. Here, declarations should be done
References acpc_js_events, bAlarm, Clr_bits, DATALOG_ID_JS, gpio_clear_pin_interrupt_flag(), gpio_get_pin_interrupt_flag(), gpio_get_pin_value(), LogDef::id, JS_EVENT_DOWN, JS_EVENT_LEFT, JS_EVENT_PUSH, JS_EVENT_RIGHT, JS_EVENT_UP, NULL, LogDef::pcStringLog, pdFALSE, pdTRUE, LogDef::pfFreeStringLog, pxdatalog_log_alloc_init_FromISR, Set_bits, u32LastCountValue, v_SMTP_PostFromISR, vMMI_UserMenuDisplayNextItem(), vMMI_UserMenuDisplayPreviousItem(), vMMI_UserMenuValidateItem(), x_datalog_AddLogFromISR(), x_joystick, and xTaskGetTickCount().
Referenced by vjoystick_ISR().
void v_joystick_stop | ( | void | ) |
Stop the joystick sensor.
References gpio_disable_pin_interrupt().
void vjoystick_ISR | ( | void | ) |
joystick naked interrupt handler.
References portENTER_SWITCHING_ISR, portEXIT_SWITCHING_ISR, and prvjoystick_ISR_NonNakedBehaviour().
Referenced by b_joystick_init().
const signed portCHAR* acpc_js_events[JS_NB_EVENT] |
Joystick events string, regarding bit field value.
Referenced by b_joystick_get_value(), and prvjoystick_ISR_NonNakedBehaviour().
Alarm upon event.
Referenced by b_joystick_init(), e_joystick_get_config(), e_joystick_set_config(), and prvjoystick_ISR_NonNakedBehaviour().
|
static |
Debouncing variable.
Referenced by prvjoystick_ISR_NonNakedBehaviour().
|
static |
Joystick events.
Referenced by b_joystick_get_value(), and prvjoystick_ISR_NonNakedBehaviour().
xSemaphoreHandle xCFGMutex |
The CFG system mutex.