bf0_hal_adc.h
Defines
-
HAL_ADC_STATE_RESET
HAL ADC state machine: ADC states definition (bitfields)
备注
ADC state machine is managed by bitfields, state must be compared with bit by bit. For example: “ if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_REG_BUSY)) “ “ if (HAL_IS_BIT_SET(HAL_ADC_GetState(hadc1), HAL_ADC_STATE_AWD1) ) “ ADC not yet initialized or disabled
-
HAL_ADC_STATE_READY
ADC peripheral ready for use
-
HAL_ADC_STATE_BUSY_INTERNAL
ADC is busy to internal process (initialization, calibration)
-
HAL_ADC_STATE_TIMEOUT
TimeOut occurrence
-
HAL_ADC_STATE_ERROR_INTERNAL
Internal error occurrence
-
HAL_ADC_STATE_ERROR_CONFIG
Configuration error occurrence
-
HAL_ADC_STATE_ERROR_DMA
DMA error occurrence
-
HAL_ADC_STATE_REG_BUSY
A conversion on group regular is ongoing or can occur (either by continuous mode, external trigger, low power auto power-on, multimode ADC master control)
-
HAL_ADC_STATE_REG_EOC
Conversion data available on group regular
-
HAL_ADC_STATE_REG_OVR
Overrun occurrence
-
HAL_ADC_START_IRQ_DONE
-
HAL_ADC_CALIB_CTX_F_LDOVREF_VALID
-
HAL_ADC_CALIB_CTX_F_FACTORY_VALID
-
ADC_RATIO_ACCURATE
Ratio accuracy multiplier Standard calibration voltages
-
ADC_BIG_RANGE_VOL1
Big range calibration voltage 1: 1000mV
-
ADC_BIG_RANGE_VOL2
Big range calibration voltage 2: 2500mV
-
ADC_SML_RANGE_VOL1
Small range calibration voltage 1: 300mV
-
ADC_SML_RANGE_VOL2
Small range calibration voltage 2: 800mV Max supported voltage
-
ADC_MAX_VOLTAGE_MV_1100
Max voltage 1.1V (for A0)
-
ADC_MAX_VOLTAGE_MV_3300
Max voltage 3.3V (for RPO) Default calibration parameters for different chip series
-
ADC_DEFAULT_OFFSET
Default offset
-
ADC_DEFAULT_RATIO
Default ratio
-
ADC_DEFAULT_RANGE_MODE
Default range mode: small range (X1)
-
ADC_DEFAULT_MAX_VOLTAGE_MV
-
ADC_DEFAULT_VBAT_FACTOR
Default battery voltage factor
-
HAL_ADC_USE_FLOAT
-
HAL_ADC_DEBUG
-
HAL_ADC_ERROR_NONE
No error
-
HAL_ADC_ERROR_INTERNAL
ADC IP internal error: if problem of clocking, enable/disable, erroneous state
-
HAL_ADC_ERROR_OVR
Overrun error
-
HAL_ADC_ERROR_DMA
DMA transfer error
-
ADC_RESOLUTION_10B
ADC 10-bit resolution
-
ADC_DATAALIGN_RIGHT
-
ADC_SCAN_DIRECTION_FORWARD
Scan direction forward: from channel 0 to channel 7
-
ADC_SCAN_DIRECTION_BACKWARD
Scan direction backward: from channel 7 to channel 0
-
ADC_SCAN_ENABLE
-
ADC_EXTERNALTRIGCONVEDGE_NONE
-
__HAL_ADC_GET_FLAG(__HANDLE__, __FLAG__)
Get the selected ADC’s flag status.
- 参数:
__HANDLE__ – ADC handle
__FLAG__ – ADC flag
- 返回值:
None –
-
__HAL_ADC_CLEAR_FLAG(__HANDLE__, __FLAG__)
Clear the ADC’s pending flags.
- 参数:
__HANDLE__ – ADC handle
__FLAG__ – ADC flag
- 返回值:
None –
-
__HAL_ADC_ENABLE_IRQ(__HANDLE__, __FLAG__)
Enable ADC irq.
- 参数:
__HANDLE__ – ADC handle
__FLAG__ – ADC irq flag
- 返回值:
None –
-
__HAL_ADC_DISABLE_IRQ(__HANDLE__, __FLAG__)
Disable ADC irq.
- 参数:
__HANDLE__ – ADC handle
__FLAG__ – ADC irq flag
- 返回值:
None –
-
__HAL_ADC_ENABLE_LDO_REF(__HANDLE__)
Enable ADC LdoRef.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_DISABLE_LDO_REF(__HANDLE__)
Disable ADC LdoRef.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_SET_LDO_REF_SEL(__HANDLE__, value)
Set ADC LdoRef Sel.
- 参数:
__HANDLE__ – ADC handle
LdoRef – Sel Value.
- 返回值:
None –
-
__HAL_ADC_RESET_HANDLE_STATE(__HANDLE__)
Reset ADC handle state.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_SET_SAMPLE_WIDTH(__HANDLE__, width)
Set ADC Sample width.
- 参数:
__HANDLE__ – ADC handle
width – Sample width in unit of PCLK cycles.
- 返回值:
None –
-
__HAL_ADC_SET_CONV_WIDTH(__HANDLE__, width)
Set ADC Conversion width.
- 参数:
__HANDLE__ – ADC handle
width – Conversion width in unit of PCLK cycles.
- 返回值:
None –
-
__HAL_ADC_SET_DATA_DELAY(__HANDLE__, delay)
Set ADC Data sample delay.
- 参数:
__HANDLE__ – ADC handle
delay – Delay for data in unit of PCLK cycles.
- 返回值:
None –
-
__HAL_ADC_START_CONV(__HANDLE__)
Start ADC convert.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_STOP_CONV(__HANDLE__)
Stop ADC convert, only work for infinite mode.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_SINGLE_END(__HANDLE__)
Set ADC to single end mode.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
__HAL_ADC_DIFF_MODE(__HANDLE__)
Set ADC to differential mode.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
ADC_IS_ENABLE(__HANDLE__)
Verification of ADC state: enabled or disabled.
- 参数:
__HANDLE__ – ADC handle
- 返回值:
SET – (ADC enabled) or RESET (ADC disabled)
-
ADC_STATE_CLR_SET
Simultaneously clears and sets specific bits of the handle State.
备注
: ADC_STATE_CLR_SET() macro is merely aliased to generic macro MODIFY_REG(), the first parameter is the ADC handle State, the second parameter is the bit field to clear, the third and last parameter is the bit field to set.
- 返回值:
None –
-
ADC_CLEAR_ERRORCODE(__HANDLE__)
Clear ADC error code (set it to error code: “no error”)
- 参数:
__HANDLE__ – ADC handle
- 返回值:
None –
-
ADC_CHSELR_CHANNEL(_CHANNEL_)
Configure the channel number into channel selection register.
- 参数:
_CHANNEL_ – ADC Channel
- 返回值:
None –
-
ADC_CFGR_CONTINUOUS(__HANDLE__, _CONTINUOUS_MODE_)
Enable ADC continuous conversion mode.
- 参数:
__HANDLE__ – ADC handle.
_CONTINUOUS_MODE_ – Continuous mode.
- 返回值:
None –
-
ADC_CFGR_DMACONTREQ(_DMACONTREQ_MODE_)
Enable the ADC DMA continuous request.
- 参数:
_DMACONTREQ_MODE_ – DMA continuous request mode.
- 返回值:
None –
-
ADC_DMA_ENABLE(__HANDLE__)
Enable ADC DMA mode.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_DMA_RAW_DATA(__HANDLE__)
ADC DMA output raw data.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_DMA_COMB_DATA(__HANDLE__)
ADC DMA output combined data.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_DMA_DISABLE(__HANDLE__)
Disable ADC DMA mode.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
IS_ADC_SRC_TIMER(__HANDLE__)
Check if timer triger enable.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
Not – 0 if timer triger enable
-
ADC_ENABLE_TIMER_TRIGER(__HANDLE__)
Enable timer triger.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_DISABLE_TIMER_TRIGER(__HANDLE__)
Enable timer triger.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_ENABLE_GPIO_TRIGER(__HANDLE__)
Enable GPIO triger.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_DISABLE_GPIO_TRIGER(__HANDLE__)
Enable GPIO triger.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_TIMER_TRIGER_LEVEL(__HANDLE__)
ADC TIMER triger with level mode, need edge detect.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_TIMER_TRIGER_PULSE(__HANDLE__)
ADC TIMER triger with pulse mode, no edge detect.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_FRC_EN(__HANDLE__)
Manual open ADC power.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_CLR_FRC_EN(__HANDLE__)
AUTO open ADC power.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_CHNL_SEL_FRC_EN(__HANDLE__)
Use auto chnel selet in configure register.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_CHNL_CLR_FRC_EN(__HANDLE__)
Disable channel auto select.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_SET_MUTE(__HANDLE__)
Set ADC mute.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
ADC_SET_UNMUTE(__HANDLE__)
Set ADC unmute.
- 参数:
__HANDLE__ – ADC handle.
- 返回值:
None –
-
IS_ADC_RANGE(RESOLUTION, ADC_VALUE)
-
IS_ADC_REGULAR_RANK(RANK)
Enums
-
enum HAL_ADC_SRC_TIME_T
ENUM definition of Timer source for timer triger.
备注
All timer is hardware timer id.
Values:
-
enumerator HAL_ADC_SRC_GPTIM1
-
enumerator HAL_ADC_SRC_GPTIM2
-
enumerator HAL_ADC_SRC_GPTIM3
-
enumerator HAL_ADC_SRC_BTIM1
-
enumerator HAL_ADC_SRC_BTIM2
-
enumerator HAL_ADC_SRC_TIMER_CNT
-
enumerator HAL_ADC_SRC_GPTIM1
-
enum HAL_ADC_SRC__T
ENUM definition of triger source.
备注
GPIO triger is not work for current version.
Values:
-
enumerator HAL_ADC_SRC_SW
-
enumerator HAL_ADC_SRC_GPIO
-
enumerator HAL_ADC_SRC_TIMER
-
enumerator HAL_ADC_SRC_SW
Functions
-
HAL_StatusTypeDef HAL_ADC_Init(ADC_HandleTypeDef *hadc)
Initializes the ADC peripheral and regular group according to parameters specified in structure “ADC_InitTypeDef”.
备注
As prerequisite, ADC clock must be configured at RCC top level depending on both possible clock sources: APB clock of HSI clock.
备注
Possibility to update parameters on the fly: The setting of these parameters is conditioned to ADC state. For parameters constraints, see comments of structure “ADC_InitTypeDef”.
备注
This function configures the ADC within 2 scopes: scope of entire ADC and scope of regular group. For parameters details, see comments of structure “ADC_InitTypeDef”.
- 参数:
hadc – ADC handle
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_ADC_DeInit(ADC_HandleTypeDef *hadc)
Deinitial ADC hardware.
- 参数:
hadc – ADC handle.
- 返回值:
HAL_StatusTypeDef –
-
void HAL_ADC_HwInit(bool cold_boot)
Init all ADC hardware to expected state @reture void.
-
HAL_StatusTypeDef HAL_ADC_Prepare(ADC_HandleTypeDef *hadc)
Prepare ADC setting before start triger.
- 参数:
hadc – ADC handle
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_ADC_Start(ADC_HandleTypeDef *hadc)
Enables ADC, starts conversion of regular group. Interruptions enabled in this function: None.
- 参数:
hadc – ADC handle
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_ADC_Stop(ADC_HandleTypeDef *hadc)
Stop ADC conversion of regular group, disable ADC peripheral.
- 参数:
hadc – ADC handle
- 返回值:
HAL – status.
-
HAL_StatusTypeDef HAL_ADC_PollForConversion(ADC_HandleTypeDef *hadc, uint32_t Timeout)
Wait for regular group conversion to be completed.
- 参数:
hadc – ADC handle
Timeout – Timeout value in millisecond.
- 返回值:
HAL – status
-
HAL_StatusTypeDef HAL_ADC_Start_IT(ADC_HandleTypeDef *hadc)
Start ADC with IRQ mode.
- 参数:
hadc – ADC handle.
- 返回值:
HAL_StatusTypeDef –
-
HAL_StatusTypeDef HAL_ADC_Stop_IT(ADC_HandleTypeDef *hadc)
Stop ADC irq mode.
- 参数:
hadc – ADC handle.
- 返回值:
HAL_StatusTypeDef –
-
void HAL_ADC_IRQHandler(ADC_HandleTypeDef *hadc)
Handle ADC interrupt request.
- 参数:
hadc – ADC handle.
- 返回值:
None –
-
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
Conversion complete callback in non blocking mode.
- 参数:
hadc – ADC handle
- 返回值:
None –
-
HAL_StatusTypeDef HAL_ADC_Start_DMA(ADC_HandleTypeDef *hadc, uint32_t *pData, uint32_t Length)
start ADC convert with dma mode.
- 参数:
hadc – ADC handle.
pData – data buffer.
Length – data lenght.
- 返回值:
HAL_StatusTypeDef –
-
HAL_StatusTypeDef HAL_ADC_Stop_DMA(ADC_HandleTypeDef *hadc)
Stop ADC DMA transmit.
- 参数:
hadc – ADC handle.
- 返回值:
HAL_StatusTypeDef –
-
HAL_StatusTypeDef HAL_ADC_DMA_PREPARE(ADC_HandleTypeDef *hadc)
Configure adc power before start dma.
- 参数:
hadc – ADC handle.
- 返回值:
HAL_StatusTypeDef –
-
HAL_StatusTypeDef HAL_ADC_DMA_WAIT_DONE(ADC_HandleTypeDef *hadc, uint32_t timeout)
Wait ADC DMA done by polling mode.
- 参数:
hadc – ADC handle.
timeout – wait time out in ms
- 返回值:
HAL_StatusTypeDef –
-
uint32_t HAL_ADC_GetValue(ADC_HandleTypeDef *hadc, uint32_t slot)
Get ADC convert result.
- 参数:
hadc – ADC handle.
slot – ADC slot number.
- 返回值:
ADC – convert result.
-
HAL_StatusTypeDef HAL_ADC_Get_All(ADC_HandleTypeDef *hadc, uint32_t *buf)
Get all ADC data register value.
- 参数:
hadc – ADC handle.
buf – all adc channel register value
- 返回值:
HAL_StatusTypeDeft. –
-
HAL_StatusTypeDef HAL_ADC_SetSource(ADC_HandleTypeDef *hadc, HAL_ADC_SRC__T src)
Set ADC triger mode.
- 参数:
hadc – ADC handle.
src – triger source mode.
- 返回值:
HAL_StatusTypeDef. –
-
HAL_StatusTypeDef HAL_ADC_SetTimer(ADC_HandleTypeDef *hadc, HAL_ADC_SRC_TIME_T src)
set ADC timer triger mode.
- 参数:
hadc – ADC handle.
src – timer index.
- 返回值:
HAL_StatusTypeDef. –
-
HAL_StatusTypeDef HAL_ADC_EnableSlot(ADC_HandleTypeDef *hadc, uint32_t slot, uint8_t en)
Enable/Disable ADC slot/channel.
- 参数:
hadc – ADC handle.
slot – ADC slot number.
en – enable 1 for disable 0.
- 返回值:
HAL_StatusTypeDef. –
-
HAL_StatusTypeDef HAL_ADC_Set_MultiMode(ADC_HandleTypeDef *hadc, uint8_t multi_mode)
Configure use multi slots or fixed slot.
- 参数:
hadc – ADC handle.
multi_mode – when set to 1 channels set to same slot number, when set to 0 fix use slot 0 for all channel.
- 返回值:
HAL_StatusTypeDef. –
-
int HAL_ADC_Get_Offset(ADC_HandleTypeDef *hadc)
Get GPADC offset.
- 参数:
hadc – ADC handle.
- 返回值:
adc – offset.
-
HAL_StatusTypeDef HAL_ADC_ConfigChannel(ADC_HandleTypeDef *hadc, ADC_ChannelConfTypeDef *sConfig)
Configures the the selected channel to be linked to the regular group.
备注
In case of usage of internal measurement channels: VrefInt/Vbat/TempSensor. Sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting). Refer to device datasheet for timings values, parameters TS_vrefint, TS_vbat, TS_temp (values rough order: 5us to 17us). These internal paths can be be disabled using function HAL_ADC_DeInit().
备注
Possibility to update parameters on the fly: This function initializes channel into regular group, following calls to this function can be used to reconfigure some parameters of structure “ADC_ChannelConfTypeDef” on the fly, without reseting the ADC. The setting of these parameters is conditioned to ADC state. For parameters constraints, see comments of structure “ADC_ChannelConfTypeDef”.
- 参数:
hadc – ADC handle
sConfig – Structure of ADC channel for regular group.
- 返回值:
HAL – status
-
uint32_t HAL_ADC_SetFreq(ADC_HandleTypeDef *hadc, uint32_t freq)
Set ADC sampling frequency.
- 参数:
hadc – ADC handle.
freq – frequence want to be set.
- 返回值:
actual – work frequency, 0 if fail.
-
HAL_StatusTypeDef HAL_ADC_CalibInit(HAL_ADC_CalibContextTypeDef *context)
Initialize ADC calibration context with default parameters.
- 参数:
context – Pointer to calibration context.
- 返回值:
HAL – status.
-
HAL_StatusTypeDef HAL_ADC_CalibLoad(ADC_HandleTypeDef *hadc, HAL_ADC_CalibContextTypeDef *context, HAL_ADC_CalibSource source, uint32_t flags)
Load factory calibration and update calibration context.
- 参数:
hadc – ADC handle, can be NULL if hardware apply is not needed.
context – Pointer to calibration context.
source – Calibration source.
flags – Bitmask of HAL_ADC_CalibFlags.
- 返回值:
HAL – status.
-
HAL_StatusTypeDef HAL_ADC_CalibGetFactoryInfo(HAL_ADC_CalibSource source, HAL_ADC_CalibFactoryInfoTypeDef *info)
Get decoded factory calibration information from OTP/config.
备注
This API is intended for logging/diagnostics. It does not modify ADC hardware.
- 参数:
source – Calibration source.
info – Output factory calibration information.
- 返回值:
HAL – status.
-
HAL_StatusTypeDef HAL_ADC_CalibSetCustom(HAL_ADC_CalibContextTypeDef *context, const HAL_ADC_CalibConfigTypeDef *config)
Apply custom two-point calibration.
- 参数:
context – Pointer to calibration context.
config – Calibration configuration with two calibration points.
- 返回值:
HAL – status.
-
HAL_StatusTypeDef HAL_ADC_CalibApply(ADC_HandleTypeDef *hadc, const HAL_ADC_CalibContextTypeDef *context)
Apply calibration context to ADC hardware settings.
- 参数:
hadc – ADC handle.
context – Pointer to calibration context.
- 返回值:
HAL – status.
-
int32_t HAL_ADC_RegToVoltage(uint32_t reg_value, const HAL_ADC_CalibContextTypeDef *context)
Convert ADC register value to voltage in mV by calibration context.
- 参数:
reg_value – ADC register value.
context – Pointer to calibration context.
- 返回值:
Voltage – in mV.
-
float HAL_ADC_RegToVoltageFloat(float reg_value, const HAL_ADC_CalibContextTypeDef *context)
Convert ADC register value to voltage in mV by calibration context (float version).
- 参数:
reg_value – ADC register value.
context – Pointer to calibration context.
- 返回值:
Voltage – in mV (float).
-
uint32_t HAL_ADC_GetState(ADC_HandleTypeDef *hadc)
Get ADC status.
- 参数:
hadc – ADC handle.
- 返回值:
current – status.
-
uint32_t HAL_ADC_GetError(ADC_HandleTypeDef *hadc)
Get ADC error code.
- 参数:
hadc – ADC handle.
- 返回值:
current – error code.
-
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
Initialize the ADC MSP.
- 参数:
hadc – pointer to a ADC_HandleTypeDef structure that contains the configuration information for ADC module.
- 返回值:
None –
-
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
De-Initialize the ADC MSP.
- 参数:
hadc – pointer to a ADC_HandleTypeDef structure that contains the configuration information for ADC module.
- 返回值:
None –
-
struct ADC_InitTypeDef
- #include <bf0_hal_adc.h>
Structure definition of ADC initialization and regular group.
备注
The setting of these parameters with function HAL_ADC_Init() is conditioned to ADC state. ADC state can be either:
For all parameters: ADC disabled (this is the only possible ADC state to modify parameter ‘ClockPrescaler’)
For all parameters except ‘ClockPrescaler’ and ‘resolution’: ADC enabled without conversion on going on regular group. If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly).
-
struct ADC_ChannelConfTypeDef
- #include <bf0_hal_adc.h>
Structure definition of ADC channel for regular group.
备注
The setting of these parameters with function HAL_ADC_ConfigChannel() is conditioned to ADC state. ADC state can be either:
For all parameters: ADC disabled or enabled without conversion on going on regular group. If ADC is not in the appropriate state to modify some parameters, these parameters setting is bypassed without error reporting (as it can be the expected behaviour in case of intended action to update another parameter (which fulfills the ADC state condition) on the fly).
-
struct ADC_HandleTypeDef
- #include <bf0_hal_adc.h>
ADC handle Structure definition.
Public Members
-
GPADC_TypeDef *Instance
Register base address
-
ADC_InitTypeDef Init
ADC required parameters
-
DMA_HandleTypeDef *DMA_Handle
Pointer DMA Handler
-
HAL_LockTypeDef Lock
ADC locking object
-
uint32_t State
ADC communication state (bitmap of ADC states)
-
uint32_t ErrorCode
ADC Error code
-
GPADC_TypeDef *Instance
-
struct HAL_ADC_CalibConfigTypeDef
- #include <bf0_hal_adc.h>
ADC calibration configuration structure definition.
备注
Used for two-point calibration
Public Members
-
uint32_t reg_value1
Register value at calibration point 1
-
uint32_t reg_value2
Register value at calibration point 2
-
uint32_t voltage1_mv
Actual voltage at point 1 in mV
-
uint32_t voltage2_mv
Actual voltage at point 2 in mV
-
uint8_t range_mode
Range mode: 0 for big range (X3), 1 for small range (X1)
-
uint32_t reg_value1
-
struct HAL_ADC_CalibContextTypeDef
- #include <bf0_hal_adc.h>
ADC calibration runtime context definition.
Public Members
-
float offset
Register value offset vs 0V
-
float ratio
Voltage (mV) per register bit, scaled by ADC_RATIO_ACCURATE
-
uint32_t threshold_reg
Register value for max supported voltage
-
uint8_t range_mode
Range mode: 0 for big range (X3), 1 for small range (X1)
-
float vbat_factor
Battery voltage correction factor
-
uint8_t ldovref_sel
LDO Vref selection value
-
uint8_t flags
Bit0: ldovref_valid, Bit1: has_factory_calib
-
float offset
-
struct HAL_ADC_CalibFactoryInfoTypeDef
- #include <bf0_hal_adc.h>
ADC factory calibration information (decoded, for logging/diagnostics)
备注
This structure represents the factory OTP calibration points and related parameters after decoding chip-specific encoding (e.g. bit15 flag).
Public Members
-
uint32_t voltage1_mv
Calibration voltage at point 1 in mV
-
uint32_t reg_value1
ADC register value at point 1
-
uint32_t voltage2_mv
Calibration voltage at point 2 in mV
-
uint32_t reg_value2
ADC register value at point 2
-
uint16_t vbat_reg
Factory VBAT reference register value (SF32LB52X only)
-
uint16_t vbat_mv
Factory VBAT reference voltage in mV (SF32LB52X only)
-
uint8_t ldovref_flag
LDO Vref calibrated flag (SF32LB52X only)
-
uint8_t ldovref_sel
LDO Vref selection value (SF32LB52X only)
-
uint8_t range_mode
Range mode: 0 for big range (X3), 1 for small range (X1)
-
uint32_t voltage1_mv