#include <string.h>
#include "compiler.h"
#include "FreeRTOS.h"
#include "temperature.h"
#include "datalog.h"
#include "shell.h"
#include "board.h"
#include "gpio.h"
#include "adc.h"
#include "sensor.h"
#include "config_file.h"
#include "fsaccess.h"
#include "BasicSMTP.h"
Macros | |
#define | SENSOR_TEMP_CONFIG_FILE "A:/CFG/TEMP.TXT" |
#define | TEMPERATURE_GETCONF_MAXLEN 64 |
Functions | |
bool | b_temperature_get_value (xLogDef *pxLog) |
Get the current temperature value. More... | |
bool | b_temperature_init (void) |
Init the temperature channel. More... | |
eExecStatus | e_temperature_get_config (signed portCHAR **ppcStringReply) |
Get the temperature sensor config. More... | |
eExecStatus | e_temperature_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_temp_alarm = pdFALSE |
static bool | b_temp_alarm_max = pdFALSE |
static bool | b_temp_alarm_min = pdFALSE |
static int | l_temp_max = 100 |
static int | l_temp_min = -50 |
const unsigned short | temperature_code [] |
The following table give the correspondance between the ADC code and the temperature Each elements of the table corresponds to an ADC code value. More... | |
unsigned int | ul_temp_lograte = 5 |
xSemaphoreHandle | xCFGMutex |
#define SENSOR_TEMP_CONFIG_FILE "A:/CFG/TEMP.TXT" |
Path for the config file
Referenced by b_temperature_init(), and e_temperature_set_config().
#define TEMPERATURE_GETCONF_MAXLEN 64 |
Max string length of a get config.
Referenced by e_temperature_get_config().
Get the current temperature value.
pxLog | a Log structure. |
References adc, adc_disable(), adc_enable(), adc_get_value(), adc_start(), b_temp_alarm, b_temp_alarm_max, b_temp_alarm_min, index, l_temp_max, l_temp_min, NULL, LogDef::pcStringLog, pdFALSE, pdTRUE, LogDef::pfFreeStringLog, pvPortMalloc(), sprintf(), temperature_code, v_SMTP_Post, and vPortFree().
Referenced by b_sensor_get_value().
bool b_temperature_init | ( | void | ) |
Init the temperature channel.
References b_temp_alarm, config_file_get_value(), gpio_enable_module_pin(), l_temp_max, l_temp_min, NULL, pdTRUE, SENSOR_TEMP_CONFIG_FILE, ul_temp_lograte, x_supervisor_SemaphoreGive(), and x_supervisor_SemaphoreTake().
eExecStatus e_temperature_get_config | ( | signed portCHAR ** | ppcStringReply | ) |
Get the temperature 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_temp_alarm, l_temp_max, l_temp_min, NULL, pdTRUE, pvPortMalloc(), SHELL_ERRMSG_MEMALLOC, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK, sprintf(), TEMPERATURE_GETCONF_MAXLEN, and ul_temp_lograte.
eExecStatus e_temperature_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_temp_alarm, config_file_set_value(), l_temp_max, l_temp_min, NULL, pdFALSE, pdTRUE, SENSOR_MSG_ALARM_OFF, SENSOR_MSG_ALARM_ON, SENSOR_MSG_CONFIG_SET, SENSOR_TEMP_CONFIG_FILE, SHELL_ERRMSG_CONFIGERROR, SHELL_EXECSTATUS_KO, SHELL_EXECSTATUS_OK_NO_FREE, and ul_temp_lograte.
int sprintf | ( | char * | out, |
const char * | format, | ||
... | |||
) |
|
static |
ADC cell.
Referenced by acc_init(), acc_update(), adc_init(), b_temperature_get_value(), bsensor_start(), get_adc(), rtouch_disable_adc_int(), rtouch_enable_adc_int(), rtouch_get_adc_value(), rtouch_prepare_adc(), and rtouch_start_read().
Alarm upon event.
Referenced by b_temperature_get_value(), b_temperature_init(), e_temperature_get_config(), and e_temperature_set_config().
Alarm for max is pending ?
Referenced by b_temperature_get_value().
Alarm for min is pending ?
Referenced by b_temperature_get_value().
|
static |
Max Value for alarm.
Referenced by b_temperature_get_value(), b_temperature_init(), e_temperature_get_config(), and e_temperature_set_config().
|
static |
Min value for alarm.
Referenced by b_temperature_get_value(), b_temperature_init(), e_temperature_get_config(), and e_temperature_set_config().
const unsigned short temperature_code[] |
The following table give the correspondance between the ADC code and the temperature Each elements of the table corresponds to an ADC code value.
The index in the table give the corresponding temperature (inC) with the following formula : Tempeature=index-20. table[O] corresponds to -20C temperature code The following table gives the ADC code for VCC=3.3V and Aref=AVcc
Referenced by b_temperature_get_value().
unsigned int ul_temp_lograte = 5 |
Value for the log rate.
Referenced by b_temperature_init(), e_temperature_get_config(), e_temperature_set_config(), and portTASK_FUNCTION().
xSemaphoreHandle xCFGMutex |
The CFG system mutex.