#include <string.h>
#include "compiler.h"
#include "gpio.h"
#include "FreeRTOS.h"
#include "potentiometer.h"
#include "datalog.h"
#include "shell.h"
#include "board.h"
#include "adc.h"
#include "sensor.h"
#include "config_file.h"
#include "fsaccess.h"
#include "BasicSMTP.h"
Macros | |
#define | POT_GETCONF_MAXLEN 64 |
#define | SENSOR_POT_CONFIG_FILE "A:/CFG/POT.TXT" |
Functions | |
bool | b_potentiometer_get_value (xLogDef *pxLog) |
Get the current potentiometer value. More... | |
bool | b_potentiometer_init (void) |
Init the potentiometer channel. More... | |
eExecStatus | e_potentiometer_get_config (signed portCHAR **ppcStringReply) |
Get the potentiometer sensor config. More... | |
eExecStatus | e_potentiometer_set_config (signed portCHAR **ppcStringReply, int ac, signed portCHAR *av[]) |
Set the sensor config. More... | |
int | sprintf (char *out, const char *format,...) |
Variables | |
static volatile avr32_adc_t * | adc = (volatile avr32_adc_t *) &AVR32_ADC |
static bool | b_pot_alarm = false |
static bool | b_pot_alarm_max = pdFALSE |
static bool | b_pot_alarm_min = pdFALSE |
unsigned int | ul_pot_lograte = 5 |
static unsigned int | ul_pot_max = 100 |
static unsigned int | ul_pot_min = 0 |
xSemaphoreHandle | xCFGMutex |
#define POT_GETCONF_MAXLEN 64 |
Max string length of a get config.
Referenced by e_potentiometer_get_config().
#define SENSOR_POT_CONFIG_FILE "A:/CFG/POT.TXT" |
Path for the config file
Referenced by b_potentiometer_init(), and e_potentiometer_set_config().
Get the current potentiometer value.
pxLog | a Log structure. |
References adc, adc_disable(), adc_enable(), adc_get_value(), ADC_MAX_VALUE, adc_start(), b_pot_alarm, b_pot_alarm_max, b_pot_alarm_min, NULL, LogDef::pcStringLog, pdFALSE, pdTRUE, LogDef::pfFreeStringLog, pvPortMalloc(), sprintf(), ul_pot_max, ul_pot_min, v_SMTP_Post, and vPortFree().
Referenced by b_sensor_get_value().
bool b_potentiometer_init | ( | void | ) |
Init the potentiometer channel.
Init the potentiometer sensor channel.
References b_pot_alarm, config_file_get_value(), gpio_enable_module_pin(), NULL, pdTRUE, SENSOR_POT_CONFIG_FILE, ul_pot_lograte, ul_pot_max, ul_pot_min, x_supervisor_SemaphoreGive(), and x_supervisor_SemaphoreTake().
eExecStatus e_potentiometer_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the potentiometer 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 b_pot_alarm, NULL, pdTRUE, POT_GETCONF_MAXLEN, pvPortMalloc(), SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, sprintf(), ul_pot_lograte, ul_pot_max, and ul_pot_min.
eExecStatus e_potentiometer_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 b_pot_alarm, config_file_set_value(), NULL, pdFALSE, pdTRUE, SENSOR_MSG_ALARM_OFF, SENSOR_MSG_ALARM_ON, SENSOR_MSG_CONFIG_SET, SENSOR_POT_CONFIG_FILE, SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK_NO_FREE, ul_pot_lograte, ul_pot_max, and ul_pot_min.
int sprintf | ( | char * | out, |
const char * | format, | ||
... | |||
) |
References printk_va().
Referenced by b_ledb1_get_value(), b_ledb2_get_value(), b_light_get_value(), b_potentiometer_get_value(), b_temperature_get_value(), e_cptime_cmd_get_config(), e_fscmds_shell_disk(), e_light_get_config(), e_potentiometer_get_config(), e_smtpclient_cmd_get_config(), e_temperature_get_config(), e_usbsys_lsusb(), format_message(), main(), mmi_activity_display(), mmi_display(), portTASK_FUNCTION(), prv_df(), prv_ls(), prv_xopen_current_logfile(), reader_id3_v1_track(), v_cptime_GetDateInFatStringFormat(), vdatalog_make_logstring(), vEthernetGetGWAddr(), vEthernetGetIPAddr(), vEthernetGetMACAddr(), and vEthernetGetSubnetMask().
|
static |
ADC cell.
Referenced by b_potentiometer_get_value().
Alarm upon event.
Referenced by b_potentiometer_get_value(), b_potentiometer_init(), e_potentiometer_get_config(), and e_potentiometer_set_config().
Alarm for max is pending ?
Referenced by b_potentiometer_get_value().
Alarm for min is pending ?
Referenced by b_potentiometer_get_value().
unsigned int ul_pot_lograte = 5 |
Value for the log rate.
Referenced by b_potentiometer_init(), e_potentiometer_get_config(), e_potentiometer_set_config(), and portTASK_FUNCTION().
|
static |
Max Value for alarm.
Referenced by b_potentiometer_get_value(), b_potentiometer_init(), e_potentiometer_get_config(), and e_potentiometer_set_config().
|
static |
Min value for alarm.
Referenced by b_potentiometer_get_value(), b_potentiometer_init(), e_potentiometer_get_config(), and e_potentiometer_set_config().
xSemaphoreHandle xCFGMutex |
The CFG system mutex.