STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
Adc Driver More...
Go to the source code of this file.
Data Structures | |
struct | Adc_ConfigType |
Adc configuration structure More... | |
struct | _Adc_HwUnit |
Hardware control unit structure More... | |
Typedefs | |
typedef uint8 | Adc_ChannelType |
Numeric ID of an ADC channel. (Size tbd) | |
typedef uint8 | Adc_GroupType |
Numeric ID of an ADC channel group. (Size tbd) | |
typedef uint8 | Adc_ValueGroupType |
Type for reading the converted values of a channel group (raw, without further scaling, alignment according precompile switch ADC_RESULT_ALIGNMENT). (Size tbd) | |
typedef uint8 | Adc_PrescaleType |
Type of clock prescaler factor. (Size tbd) | |
typedef uint8 | Adc_ConversionTimeType |
Type of conversion time, i.e. the time during which the sampled analogue value is converted into digital representation. (Size tbd) | |
typedef uint8 | Adc_SamplingTimeType |
Type of sampling time, i.e. the time during which the value is sampled, (in clock-cycles). (Size tbd) | |
typedef uint8 | Adc_ResolutionType |
Type of channel resolution in number of bits. | |
typedef uint8 | Adc_GroupPriorityType |
Priority level of the channel. Lowest priority is 0. | |
typedef uint8 | Adc_GroupDefType |
Type for assignment of channels to a channel group. (size tbd) | |
typedef uint8 | Adc_StreamNumSampleType |
Type for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1). | |
typedef uint8 | Adc_HwTriggerTimerType |
Type for the reload value of the ADC module embedded timer (only if supported by the ADC hardware). (size tbd) | |
typedef struct _Adc_HwUnit | Adc_HwUnit |
Hardware control unit structure | |
Enumerations | |
enum | Adc_StatusType { ADC_IDLE = 0 , ADC_BUSY , ADC_COMPLETED , ADC_STREAM_COMPLETED } |
Current status of the conversion of the requested ADC Channel group. More... | |
enum | Adc_TriggerSourceType { ADC_TRIGG_SRC_SW = 0 , ADC_TRIGG_SRC_HW } |
Type for configuring the trigger source for an ADC Channel group. More... | |
enum | Adc_GroupConvModeType { ADC_CONV_MODE_ONESHOT = 0 , ADC_CONV_MODE_CONTINUOUS } |
Type for configuring the conversion mode of an ADC Channel group. More... | |
enum | Adc_StreamBufferModeType { ADC_STREAM_BUFFER_LINEAR = 0 , ADC_STREAM_BUFFER_CIRCULAR } |
Type for configuring the streaming access mode buffer type. More... | |
enum | Adc_GroupAccessModeType { ADC_ACCESS_MODE_SINGLE = 0 , ADC_ACCESS_MODE_STREAMING } |
Type for configuring the access mode to group conversion results. More... | |
enum | Adc_HwTriggerSignalType { ADC_HW_TRIG_RISING_EDGE = 0 , ADC_HW_TRIG_FALLING_EDGE , ADC_HW_TRIG_BOTH_EDGES } |
Type for configuring on which edge of the hardware trigger signal the driver should react, i.e. start the conversion (only if supported by the ADC hardware) More... | |
enum | Adc_PriorityImplementationType { ADC_PRIORITY_NONE = 0 , ADC_PRIORITY_HW , ADC_PRIORITY_HW_SW } |
Type for configuring the prioritization mechanism. More... | |
enum | Adc_GroupReplacementType { ADC_GROUP_REPL_ABORT_RESTART = 0 , ADC_GROUP_REPL_SUSPEND_RESUME } |
Replacement mechanism, which is used on ADC group level, if a group conversion is interrupted by a group which has a higher priority. More... | |
enum | Adc_ChannelRangeSelectType { ADC_RANGE_UNDER_LOW = 0 , ADC_RANGE_BETWEEN , ADC_RANGE_OVER_HIGH , ADC_RANGE_ALWAYS , ADC_RANGE_NOT_UNDER_LOW , ADC_RANGE_NOT_BETWEEN , ADC_RANGE_NOT_OVER_HIGH } |
In case of active limit checking: defines which conversion values are taken into account related to the boardes defineed with AdcChannelLowLimit and AdcChannelHighLimit. More... | |
enum | Adc_ResultAlignmentType { ADC_ALIGN_LEFT = 0 , ADC_ALIGN_RIGHT } |
Type for alignment of ADC raw results in ADC result buffer (left/right alignment). More... | |
enum | Adc_PowerStateType { ADC_FULL_POWER = 0 , DECREASING_POWER } |
Power state currently active or set as target power state. More... | |
enum | Adc_PowerStateRequestResultType { ADC_SERVICE_ACCEPTED = 0 , ADC_NOT_INIT , ADC_SEQUENCE_ERROR , ADC_HW_FAILURE , ADC_POWER_STATE_NOT_SUPP , ADC_TRANS_NOT_POSSIBLE } |
Result of the requests related to power state transitions. More... | |
enum | Group_IDType { GROUP_0 = 0 , GROUP_1 , GROUP_2 , GROUP_3 , GROUP_4 , GROUP_5 , GROUP_6 , GROUP_7 , GROUP_8 , GROUP_9 , GROUP_10 } |
For ennumarate the Ids of the different groups. More... | |
enum | PowerStateType { PWR_STATE_0 = 0 , PWR_STATE_1 , PWR_STATE_2 , PWR_STATE_3 , PWR_STATE_4 , PWR_STATE_5 , PWR_STATE_6 , PWR_STATE_7 , PWR_STATE_8 , PWR_STATE_9 , PWR_STATE_10 } |
For ennumarate the states of power for the ADC HW unit. More... | |
Adc Driver
The header contains the type definitions for the Adc module. The file is implemnted as a means of abstraction from the hardware, this way we can avoid to include Arch headers in the actual driver header, making the low level interfaces available for upper layers.
typedef uint8 Adc_ChannelType |
Numeric ID of an ADC channel. (Size tbd)
typedef uint8 Adc_ConversionTimeType |
Type of conversion time, i.e. the time during which the sampled analogue value is converted into digital representation. (Size tbd)
typedef uint8 Adc_GroupDefType |
Type for assignment of channels to a channel group. (size tbd)
typedef uint8 Adc_GroupPriorityType |
Priority level of the channel. Lowest priority is 0.
typedef uint8 Adc_GroupType |
Numeric ID of an ADC channel group. (Size tbd)
typedef uint8 Adc_HwTriggerTimerType |
Type for the reload value of the ADC module embedded timer (only if supported by the ADC hardware). (size tbd)
typedef struct _Adc_HwUnit Adc_HwUnit |
Hardware control unit structure
This structure contains the hardware unit configuration and the state of the hardware unit pointers to control structures.
typedef uint8 Adc_PrescaleType |
Type of clock prescaler factor. (Size tbd)
typedef uint8 Adc_ResolutionType |
Type of channel resolution in number of bits.
typedef uint8 Adc_SamplingTimeType |
Type of sampling time, i.e. the time during which the value is sampled, (in clock-cycles). (Size tbd)
typedef uint8 Adc_StreamNumSampleType |
Type for configuring the number of group conversions in streaming access mode (in single access mode, parameter is 1).
typedef uint8 Adc_ValueGroupType |
Type for reading the converted values of a channel group (raw, without further scaling, alignment according precompile switch ADC_RESULT_ALIGNMENT). (Size tbd)
In case of active limit checking: defines which conversion values are taken into account related to the boardes defineed with AdcChannelLowLimit and AdcChannelHighLimit.
Type for configuring the access mode to group conversion results.
Enumerator | |
---|---|
ADC_ACCESS_MODE_SINGLE | Single value access mode. |
ADC_ACCESS_MODE_STREAMING | Streaming access mode. |
Type for configuring the conversion mode of an ADC Channel group.
Replacement mechanism, which is used on ADC group level, if a group conversion is interrupted by a group which has a higher priority.
Type for configuring on which edge of the hardware trigger signal the driver should react, i.e. start the conversion (only if supported by the ADC hardware)
Result of the requests related to power state transitions.
Enumerator | |
---|---|
ADC_SERVICE_ACCEPTED | Power state change executed. |
ADC_NOT_INIT | ADC Module not initialized. |
ADC_SEQUENCE_ERROR | Wrong API call sequence. |
ADC_HW_FAILURE | The HW module has a failure which prevents it to enter the required power state. |
ADC_POWER_STATE_NOT_SUPP | ADC Module does not support the requested power state. |
ADC_TRANS_NOT_POSSIBLE | ADC Module cannot transition directly from the current power state to the requested power state or the HW peripheral is still busy. |
enum Adc_PowerStateType |
Power state currently active or set as target power state.
Enumerator | |
---|---|
ADC_FULL_POWER | Full Power |
DECREASING_POWER | Power modes with decreasing power consumptions. Other 254 values tdb |
Type for configuring the prioritization mechanism.
Enumerator | |
---|---|
ADC_PRIORITY_NONE | Priority mechanism is not available |
ADC_PRIORITY_HW | Hardware priority mechanism is available only |
ADC_PRIORITY_HW_SW | Hardware and software priority mechanism is available |
Type for alignment of ADC raw results in ADC result buffer (left/right alignment).
Enumerator | |
---|---|
ADC_ALIGN_LEFT | left alignment |
ADC_ALIGN_RIGHT | right alignment |
enum Adc_StatusType |
Current status of the conversion of the requested ADC Channel group.
Type for configuring the streaming access mode buffer type.
Type for configuring the trigger source for an ADC Channel group.
Enumerator | |
---|---|
ADC_TRIGG_SRC_SW | Group is triggered by a software API call. |
ADC_TRIGG_SRC_HW | Group is triggered by a hardware event. |
enum Group_IDType |
For ennumarate the Ids of the different groups.
enum PowerStateType |
For ennumarate the states of power for the ADC HW unit.