ESOS32
ESOSOn32-bitProcessors
|
Files | |
file | esos_hwxxx_sensor.c |
Template for creating hardware-specific support for ESOS32 sensors (typically, A/D conversion) service. | |
file | esos_hwxxx_sensor.c |
Template for creating hardware-specific support for ESOS32 sensors (typically, A/D conversion) service. | |
file | esos_sensor.h |
file | esos_hwxxx_sensor.h |
This file contains routines which define, configure and allow use of the "sensors" service (A/D converter) on the target hardware (hwxxxx) | |
Enumerations | |
enum | esos_sensor_ch_t { ESOS_SENSOR_CH00 = 0x00, ESOS_SENSOR_CH01, ESOS_SENSOR_CH02, ESOS_SENSOR_CH03, ESOS_SENSOR_CH04, ESOS_SENSOR_CH05, ESOS_SENSOR_CH06, ESOS_SENSOR_CH07, ESOS_SENSOR_CH08, ESOS_SENSOR_CH09, ESOS_SENSOR_CH0A, ESOS_SENSOR_CH0B, ESOS_SENSOR_CH0C, ESOS_SENSOR_CH0D, ESOS_SENSOR_CH0E, ESOS_SENSOR_CH0F } |
enum | esos_sensor_vref_t { ESOS_SENSOR_VREF_1V0 = 0x00, ESOS_SENSOR_VREF_1V024, ESOS_SENSOR_VREF_2V0, ESOS_SENSOR_VREF_2V048, ESOS_SENSOR_VREF_3V0, ESOS_SENSOR_VREF_3V3, ESOS_SENSOR_VREF_4V0, ESOS_SENSOR_VREF_4V096, ESOS_SENSOR_VREF_5V0 } |
enum | esos_sensor_process_t { ESOS_SENSOR_ONE_SHOT = 0x00, ESOS_SENSOR_AVG2 = 0x01, ESOS_SENSOR_AVG4 = 0x02, ESOS_SENSOR_AVG8 = 0x03, ESOS_SENSOR_AVG16 = 0x04, ESOS_SENSOR_AVG32 = 0x05, ESOS_SENSOR_AVG64 = 0x06, ESOS_SENSOR_MIN2 = 0x21, ESOS_SENSOR_MIN4 = 0x22, ESOS_SENSOR_MIN8 = 0x23, ESOS_SENSOR_MIN16 = 0x24, ESOS_SENSOR_MIN32 = 0x25, ESOS_SENSOR_MIN64 = 0x26, ESOS_SENSOR_MAX2 = 0x41, ESOS_SENSOR_MAX4 = 0x42, ESOS_SENSOR_MAX8 = 0x43, ESOS_SENSOR_MAX16 = 0x44, ESOS_SENSOR_MAX32 = 0x45, ESOS_SENSOR_MAX64 = 0x46, ESOS_SENSOR_MEDIAN2 = 0x81, ESOS_SENSOR_MEDIAN4 = 0x82, ESOS_SENSOR_MEDIAN8 = 0x83, ESOS_SENSOR_MEDIAN16 = 0x84, ESOS_SENSOR_MEDIAN32 = 0x85, ESOS_SENSOR_MEDIAN64 = 0x86 } |
enum | esos_sensor_format_t { ESOS_SENSOR_FORMAT_BITS = 0x00, ESOS_SENSOR_FORMAT_VOLTAGE = 0x80, ESOS_SENSOR_FORMAT_PERCENT = 0x40 } |
Functions | |
ESOS_CHILD_TASK (_WAIT_ON_AVAILABLE_SENSOR, esos_sensor_ch_t e_senCh, esos_sensor_vref_t e_senVRef) | |
ESOS_CHILD_TASK (_WAIT_SENSOR_QUICK_READ, uint16_t *pu16_data) | |
int | compareUint16 (const void *pv_a, const void *pv_b) |
uint16_t | medianOfBuffer (uint16_t *pu16_buf, uint8_t u8_nelem) |
uint16_t | maxOfBuffer (uint16_t *pu16_buf, uint8_t u8_nelem) |
ESOS_CHILD_TASK (_WAIT_SENSOR_READ, uint16_t *pu16_data, uint8_t e_senProcess, esos_sensor_format_t e_senFMT) | |
BOOL | ESOS_SENSOR_CLOSE (void) |
void | esos_sensor_config_hw (esos_sensor_ch_t e_senCh, esos_sensor_vref_t e_senVRef) |
BOOL | esos_sensor_is_converting_hw (void) |
void | esos_sensor_initiate_conversion_hw (void) |
uint16_t | esos_sensor_getvalue_u16_hw (void) |
void | esos_sensor_release_hw (void) |
#define ESOS_TASK_WAIT_ON_AVAILABLE_SENSOR | ( | CHCONST, | |
VREFCONST | |||
) |
Definition at line 143 of file esos_sensor.h.
#define ESOS_TASK_WAIT_SENSOR_QUICK_READ | ( | u16_data | ) |
Definition at line 148 of file esos_sensor.h.
#define ESOS_TASK_WAIT_SENSOR_READ | ( | u16_data, | |
PROCESSCONST, | |||
FMTCONST | |||
) |
Definition at line 153 of file esos_sensor.h.
#define ESOS_TASK_WAIT_WHILE_ADC_BUSY |
Definition at line 136 of file esos_sensor.h.
enum esos_sensor_ch_t |
enumeration to select sensor channel
Definition at line 51 of file esos_sensor.h.
enum esos_sensor_format_t |
enumeration to select sensor return value format
Definition at line 119 of file esos_sensor.h.
enumeration to select sensor processing
Definition at line 88 of file esos_sensor.h.
enum esos_sensor_vref_t |
enumeration to select sensor voltage reference
Definition at line 73 of file esos_sensor.h.
int compareUint16 | ( | const void * | pv_a, |
const void * | pv_b | ||
) |
Compares two data values
pv_a | pointer to the first value in comparison |
pv_b | pointer to the second value in comparison |
Definition at line 84 of file esos_sensor.c.
ESOS_CHILD_TASK | ( | _WAIT_ON_AVAILABLE_SENSOR | , |
esos_sensor_ch_t | e_senCh, | ||
esos_sensor_vref_t | e_senVRef | ||
) |
Waits until a sensor is available.
e_senCh | enumeration to select sensor channel |
e_senVRef | enumeration to select sensor voltage reference |
Definition at line 45 of file esos_sensor.c.
ESOS_CHILD_TASK | ( | _WAIT_SENSOR_QUICK_READ | , |
uint16_t * | pu16_data | ||
) |
Waits until a sensor is read (quick version).
pu16_data | pointer to the location of the resulting data |
Definition at line 65 of file esos_sensor.c.
ESOS_CHILD_TASK | ( | _WAIT_SENSOR_READ | , |
uint16_t * | pu16_data, | ||
uint8_t | e_senProcess, | ||
esos_sensor_format_t | e_senFMT | ||
) |
Waits until a sensor is read (extended version).
pu16_data | pointer to the resultant data |
e_senProcess | enumeration of type of processing to be completed |
e_senFMT | enumeration of the format of the resultant data |
Definition at line 135 of file esos_sensor.c.
BOOL ESOS_SENSOR_CLOSE | ( | void | ) |
Waits until a sensor is closed.
Definition at line 390 of file esos_sensor.c.
void esos_sensor_config_hw | ( | esos_sensor_ch_t | e_senCh, |
esos_sensor_vref_t | e_senVRef | ||
) |
Configure and enable the sensor module for hwxxx hardware.
e_senCh | specifies sensor channel |
e_senVRef | specifies sensor voltage reference |
Definition at line 60 of file esos_hwxxx_sensor.c.
uint16_t esos_sensor_getvalue_u16_hw | ( | void | ) |
Receive the value from a conversion that has already been initiated
Definition at line 84 of file esos_hwxxx_sensor.c.
void esos_sensor_initiate_conversion_hw | ( | void | ) |
Initiate a conversion for a configured sensor
Definition at line 76 of file esos_hwxxx_sensor.c.
BOOL esos_sensor_is_converting_hw | ( | void | ) |
Determine truth of: the sensor is currently converting
Definition at line 68 of file esos_hwxxx_sensor.c.
void esos_sensor_release_hw | ( | void | ) |
Release any pending conversions for the sensor
Definition at line 92 of file esos_hwxxx_sensor.c.
uint16_t maxOfBuffer | ( | uint16_t * | pu16_buf, |
uint8_t | u8_nelem | ||
) |
Finds the maximum value of a buffer of data
pu16_buf | pointer to the buffer |
u8_nelem | number of elements in the buffer |
Definition at line 113 of file esos_sensor.c.
uint16_t medianOfBuffer | ( | uint16_t * | pu16_buf, |
uint8_t | u8_nelem | ||
) |
Finds the median of a buffer of data
pu16_buf | pointer to the buffer |
u8_nelem | number of elements in the buffer |
Definition at line 97 of file esos_sensor.c.