Microchip® Advanced Software Framework

potentiometer.h File Reference
#include "compiler.h"
#include "FreeRTOS.h"
#include "shell.h"
#include "datalog.h"

Functions

bool b_potentiometer_get_value (xLogDef *pxLog)
 Get the current potentiometer value. More...
 
bool b_potentiometer_init (void)
 Init the potentiometer sensor 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...
 

Variables

unsigned int ul_pot_lograte
 

bool b_potentiometer_get_value ( xLogDef pxLog)

Get the current potentiometer value.

Parameters
pxLoga Log structure.
Returns
true upon success, false if error.

References adc, adc_disable(), adc_enable(), adc_get_value(), ADC_MAX_VALUE, ADC_POTENTIOMETER_CHANNEL, 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 sensor channel.

Returns
true upon success, false if error.

Init the potentiometer sensor channel.

Returns
true upon success, false if error.

References ADC_POTENTIOMETER_FUNCTION, ADC_POTENTIOMETER_PIN, 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.

Parameters
ppcStringReplyInput/Output. The response string. NEVER NULL AS INPUT. A malloc for the response string is performed here; the caller must free this string.
Returns
the status of the command execution.

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.

Parameters
ppcStringReplyInput/Output. The response string. NEVER NULL AS INPUT.
acInput. Number of args
avInput. pointer to args
Returns
the status of the command execution.

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.

unsigned int ul_pot_lograte

Declaration for datalog use

Value for the log rate.

Referenced by b_potentiometer_init(), e_potentiometer_get_config(), e_potentiometer_set_config(), and portTASK_FUNCTION().