simple FS  v0.1.0
Macros | Functions | Variables

module for Analog-Digital converter More...

Collaboration diagram for Sensor_ADC:

Macros

#define ADC_RESOLUTION   12
 Physically resolution of ADC peripheral. More...
 
#define ADC_Q_RESOLUTION   5
 Precision of converted value. More...
 
#define ADC_HW_MULTIPLYER   8
 Physically placed voltage divider in measuring circuit.
 
#define Q_FORMAT_ADC   (((8-ADC_Q_RESOLUTION)<<8) | ADC_Q_RESOLUTION)
 
#define ADC_VALUE_CONSTANT   (10*(2<<(ADC_RESOLUTION-ADC_Q_RESOLUTION-1)))
 

Functions

void adc_init (void *handle, uint16_t adc_dummy)
 Initialization of ADC module. More...
 
SensorID_tget_adc_sensor_id (uint8_t index)
 Return ID of sensor. More...
 
RecordDescriptor_t adc_getType ()
 Return format specification of this senor. More...
 
SensorValue_tget_adc_value ()
 Read measured value from ADC. More...
 
void adc_reset (void)
 Reset ADC peripheral. More...
 
void adc_doMeasure (void)
 Start the measure procedure in blocking mode. More...
 
uint8_t adc_count (void)
 Return number of sensors in this peripheral. More...
 

Variables

SensorInterface_t adcSensor
 Interface to ADC sensor. More...
 
volatile RecordDescriptor_t adcFormatDescriptor
 
SensorID_t adc_sid
 
SensorValue_t adc_data
 
SensorInterface_t adcSensor
 Interface to ADC sensor. More...
 

Detailed Description

module for Analog-Digital converter

Macro Definition Documentation

◆ ADC_Q_RESOLUTION

#define ADC_Q_RESOLUTION   5

Precision of converted value.

It will be used in value conversion.

◆ ADC_RESOLUTION

#define ADC_RESOLUTION   12

Physically resolution of ADC peripheral.

This value have to be same as a resolution of real ADC.

Function Documentation

◆ adc_count()

uint8_t adc_count ( void  )

Return number of sensors in this peripheral.

Returns
1

◆ adc_doMeasure()

void adc_doMeasure ( void  )

Start the measure procedure in blocking mode.

User this function before read a measured value!

◆ adc_getType()

RecordDescriptor_t adc_getType ( )

Return format specification of this senor.

Return values
formatspecification

◆ adc_init()

void adc_init ( void *  handle,
uint16_t  adc_dummy 
)

Initialization of ADC module.

Set-up the parameters of module as a formats, resolution and HW structure.

Parameters
handlepointer to initialized ADC_HandleTypeDef structure. In simulation mode use NULL.
adc_dummydummy param, due compatibility. Use DUMMY_VALUE value.

◆ adc_reset()

void adc_reset ( void  )

Reset ADC peripheral.

Do nothing.

◆ get_adc_sensor_id()

SensorID_t * get_adc_sensor_id ( uint8_t  index)

Return ID of sensor.

ID for ADC is hardcoded as 0x0432ADC

Parameters
indexNot used (due compatibility of other sensors)
Return values
pointerto SensorID_t structure

◆ get_adc_value()

SensorValue_t * get_adc_value ( )

Read measured value from ADC.

Note, that before this function, have to call measure method.

Return values
pointerto ref{SensorValue_t} that contains measured value

Variable Documentation

◆ adcSensor [1/2]

SensorInterface_t adcSensor
Initial value:

Interface to ADC sensor.

For details see SensorInterface_t

◆ adcSensor [2/2]

SensorInterface_t adcSensor

Interface to ADC sensor.

For details see SensorInterface_t

get_adc_value
SensorValue_t * get_adc_value()
Read measured value from ADC.
Definition: module_adc.c:105
adc_getType
RecordDescriptor_t adc_getType()
Return format specification of this senor.
Definition: module_adc.c:96
adc_reset
void adc_reset(void)
Reset ADC peripheral.
Definition: module_adc.c:135
get_adc_sensor_id
SensorID_t * get_adc_sensor_id(uint8_t index)
Return ID of sensor.
Definition: module_adc.c:78
adc_doMeasure
void adc_doMeasure(void)
Start the measure procedure in blocking mode.
Definition: module_adc.c:143
adc_count
uint8_t adc_count(void)
Return number of sensors in this peripheral.
Definition: module_adc.c:156
adc_init
void adc_init(void *, uint16_t)
Initialization of ADC module.
Definition: module_adc.c:55