STM32G0 MCAL 0.0.1
Tiny MCAL for educational purpose.
|
ADC Driver More...
Go to the source code of this file.
ADC Driver
The ADC module provides the functionality API and the configuration of the AUTOSAR Basic Software module ADC Driver. The ADC driver is targeting Successive Approximation ADC Hardware. Delta Sigma ADC conversion use cases are out of scope of this module.
void Adc_DeInit | ( | void | ) |
ADC Deinitialization
This function Returns all ADC HW Units to a state comparable to their power on reset state.
void Adc_DisableGroupNotification | ( | Adc_GroupType | Group | ) |
ADC Disable Group Notification
Disables the notification mechanism for the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
void Adc_DisableHardwareTrigger | ( | Adc_GroupType | Group | ) |
ADC Disable Hardware Trigger
Disables the hardware trigger for the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
void Adc_EnableGroupNotification | ( | Adc_GroupType | Group | ) |
ADC Enable Group Notification
Enables the notification mechanism for the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
void Adc_EnableHardwareTrigger | ( | Adc_GroupType | Group | ) |
ADC Enable Hardware Trigger
Enables the hardware trigger for the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
Std_ReturnType Adc_GetCurrentPowerState | ( | Adc_PowerStateType * | CurrentPowerState, |
Adc_PowerStateRequestResultType * | Result ) |
ADC Get Current Power State
This API returns the current power state of the ADC HW unit.
CurrentPowerState | The current power mode of the ADC HW Unit is returned in this parameter. |
Result | If the API returns E_OK: ADC_SERVICE_ACCEPTED: Current power mode was returned. If the API returns E_NOT_OK: ADC_NOT_INIT: ADC Module not initialized. |
E_OK | Mode could be read E_NOT_OK: Service is rejected |
Adc_StatusType Adc_GetGroupStatus | ( | Adc_GroupType | Group | ) |
ADC Get Group Status
Returns the conversion status of the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
Conversion | status for the requested group. |
Adc_StreamNumSampleType Adc_GetStreamLastPointer | ( | Adc_GroupType | Group, |
Adc_ValueGroupType ** | PtrToSamplePtr ) |
ADC Get Stream Last Pointer
Returns the number of valid samples per channel, stored in the result buffer. Reads a pointer, pointing to a position in the group result buffer. With the pointer position, the results of all group channels of the last completed conversion round can be accessed. With the pointer and the return value, all valid group conversion results can be accessed (the user has to take the layout of the result buffer into account).
Group | Numeric ID of requested ADC Channel group. |
PtrToSamplePtr | Pointer to result buffer pointer. |
Number | of valid samples per channel. |
Std_ReturnType Adc_GetTargetPowerState | ( | Adc_PowerStateType * | TargetPowerState, |
Adc_PowerStateRequestResultType * | Result ) |
ADC Get Target Power State
This API returns the Target power state of the ADC HW unit.
TargetPowerState | The Target power mode of the ADC HW Unit is returned in this parameter. |
Result | If the API returns E_OK: ADC_SERVICE_ACCEPTED:Target power mode was returned. If the API returns E_NOT_OK: ADC_NOT_INIT: ADC Module not initialized. |
E_OK | Mode could be read E_NOT_OK: Service is rejected |
void Adc_GetVersionInfo | ( | Std_VersionInfoType * | versioninfo | ) |
ADC Get Version Info
Returns the version information of this module.
versioninfo | Pointer to where to store the version information of this module. |
void Adc_Init | ( | const Adc_ConfigType * | ConfigPtr | ) |
ADC Initialization
This function Initializes the ADC hardware units and driver.
ConfigPtr | Pointer to configuration set in Variant PB (Variant PC requires a NULL_PTR). |
Std_ReturnType Adc_PreparePowerState | ( | Adc_PowerStateType | PowerState, |
Adc_PowerStateRequestResultType * | Result ) |
ADC Prepare Power State
This API starts the needed process to allow the ADC HW module to enter the requested power state
PowerState | The target power state intended to be attained. |
Result | If the API returns E_OK: ADC_SERVICE_ACCEPTED: ADC Module power state preparation was started. If the API returns E_NOT_OK: ADC_NOT_INIT: ADC Module not initialized. ADC_SEQUENCE_ERROR: wrong API call sequence (Current Power State = Target 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. |
E_OK | Mode could be read E_NOT_OK: Service is rejected |
Std_ReturnType Adc_ReadGroup | ( | Adc_GroupType | Group, |
Adc_ValueGroupType * | DataBufferPtr ) |
ADC Read Group
Reads the group conversion result of the last completed conversion round of the requested group and stores the channel values starting at the DataBufferPtr address. The group channel values are stored in ascending channel number order (in contrast to the storage layout of the result buffer if streaming access is configured).
Group | Numeric ID of requested ADC channel group. |
DataBufferPtr | ADC results of all channels of the selected group are stored in the data buffer addressed with the pointer. |
E_OK | results are available and written to the data buffer E_NOT_OK: no results are available or development error occured |
Std_ReturnType Adc_SetPowerState | ( | Adc_PowerStateRequestResultType * | Result | ) |
ADC Set Power State
This API configures the Adc module so that it enters the already prepared power state, chosen between a predefined set of configured ones.
Result | If the API returns E_OK: ADC_SERVICE_ACCEPTED: Power state change executed. If the API returns E_NOT_OK: 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. |
E_OK | Power Mode changed E_NOT_OK: request rejected |
Std_ReturnType Adc_SetupResultBuffer | ( | Adc_GroupType | Group, |
Adc_ValueGroupType * | DataBufferPtr ) |
ADC Result Buffer
This function initializes ADC driver with the group specific result buffer start address where the conversion results will be stored. The application has to ensure that the application buffer, where DataBufferPtr points to, can hold all the conversion results of the specified group. The initialization with Adc_SetupResultBuffer is required after reset, before a group conversion can be started.
Group | Numeric ID of requested ADC channel group. |
DataBufferPtr | Pointer to result data buffer. |
E_OK | result buffer pointer initialized correctly E_NOT_OK: operation failed or development error occured |
void Adc_StartGroupConversion | ( | Adc_GroupType | Group | ) |
ADC Start Group Conversion
Starts the conversion of all channels of the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |
void Adc_StopGroupConversion | ( | Adc_GroupType | Group | ) |
ADC Stop Group Conversion
Stops the conversion of the requested ADC Channel group.
Group | Numeric ID of requested ADC Channel group. |