|
SmartSnippets DA1459x SDK
|
Go to the documentation of this file.
38 #if dg_configUSE_HW_GPADC
58 #define HW_GPADC_DIE_TEMP_SMPL_TIME 0x04
66 #define HW_GPADC_DIE_TEMP_INIT_DELAY 0x68
83 #define HW_GPADC_VREF_MILLIVOLT (900)
106 HW_GPADC_INPUT_ADC0 = 0,
110 HW_GPADC_INPUT_ADC4 = 0x0A,
111 HW_GPADC_INPUT_ADC5 = 0x0B,
112 HW_GPADC_INPUT_ADC6 = 0x0C,
113 HW_GPADC_INPUT_ADC7 = 0x0D,
114 HW_GPADC_INPUT_RES1 = 0x0E,
115 HW_GPADC_INPUT_RES2 = 0x0F,
116 } HW_GPADC_GPIO_INPUT;
170 #if HW_GPADC_DMA_SUPPORT
171 gpadc_dma_cfg *dma_setup;
202 REG_SETF(GPADC, GP_ADC_CTRL3_REG, GP_ADC_EN_DEL, delay);
222 REG_SETF(GPADC, GP_ADC_CTRL2_REG, GP_ADC_STORE_DEL, delay);
233 REG_SETF(GPADC, GP_ADC_SEL_REG, GP_ADC_SEL_P, channel);
244 return REG_GETF(GPADC, GP_ADC_SEL_REG, GP_ADC_SEL_P);
255 REG_SETF(GPADC, GP_ADC_SEL_REG, GP_ADC_SEL_N, channel);
266 return REG_GETF(GPADC, GP_ADC_SEL_REG, GP_ADC_SEL_N);
281 REG_SETF(GPADC, GP_ADC_CTRL2_REG, GP_ADC_ATTN, vmax);
292 return REG_GETF(GPADC, GP_ADC_CTRL2_REG, GP_ADC_ATTN);
306 REG_SETF(GPADC, GP_ADC_CTRL2_REG, GP_ADC_SMPL_TIME, mult);
319 return REG_GETF(GPADC, GP_ADC_CTRL2_REG, GP_ADC_SMPL_TIME);
333 REG_SETF(GPADC, GP_ADC_CTRL_REG, DIE_TEMP_EN, !!enabled);
346 return REG_GETF(GPADC, GP_ADC_CTRL_REG, DIE_TEMP_EN);
360 REG_SETF(GPADC, GP_ADC_CTRL_REG, GP_ADC_LDO_HOLD, !!enabled);
373 return (
bool)
REG_GETF(GPADC, GP_ADC_CTRL_REG, GP_ADC_LDO_HOLD);
__STATIC_INLINE void hw_gpadc_set_ldo_hold(bool enabled)
Set the mode of bandgap reference.
Definition: hw_gpadc_v2.h:356
__STATIC_INLINE HW_GPADC_MAX_INPUT_VOLTAGE hw_gpadc_get_input_attenuator_state(void)
Get the current state of input attenuator.
Definition: hw_gpadc_v2.h:288
__STATIC_INLINE void hw_gpadc_set_die_temp(bool enabled)
Set DIE_TEMP_EN field.
Definition: hw_gpadc_v2.h:329
Definition: hw_gpadc_v2.h:98
#define REG_SETF(base, reg, field, new_val)
Set the value of a register field.
Definition: sdk_defs.h:738
Definition: hw_gpadc_v2.h:75
int16_t hw_gpadc_convert_to_celsius_x100_util(const hw_gpadc_config_t *cfg, uint16_t raw_val)
Convert a 16-bit, left-aligned, raw value to temperature. For accurate conversions using this functio...
__STATIC_INLINE void hw_gpadc_set_input_attenuator_state(HW_GPADC_MAX_INPUT_VOLTAGE vmax)
Set state of input attenuator.
Definition: hw_gpadc_v2.h:277
#define ASSERT_ERROR(a)
Assert as error macro.
Definition: sdk_defs.h:422
Definition: hw_gpadc_v2.h:74
__STATIC_INLINE uint8_t hw_gpadc_get_sample_time(void)
Get the current sample time. The sample time is calculated, based on this register field value.
Definition: hw_gpadc_v2.h:315
Definition: hw_gpadc_v2.h:124
Definition: hw_gpadc_v2.h:97
__STATIC_INLINE void hw_gpadc_set_positive(HW_GPADC_INPUT_POSITIVE channel)
Set positive input channel.
Definition: hw_gpadc_v2.h:229
Definition: hw_gpadc_v2.h:126
Definition: hw_gpadc_v2.h:133
Definition: hw_gpadc_v2.h:92
HW_GPADC_STORE_DELAY
Store delay.
Definition: hw_gpadc_v2.h:90
Central include header file with platform definitions.
HW_GPADC_INPUT_MODE
ADC input mode.
Definition: hw_gpadc.h:120
Definition: hw_gpadc_v2.h:131
Definition: hw_gpadc_v2.h:122
__STATIC_INLINE bool hw_gpadc_get_die_temp(void)
Get the current status of the die-temperature sensor. Output can be measured on GPADC input 4.
Definition: hw_gpadc_v2.h:342
Definition: hw_gpadc_v2.h:145
HW_GPADC_INPUT_POSITIVE
ADC input - Positive side.
Definition: hw_gpadc_v2.h:121
Definition: hw_gpadc_v2.h:151
Definition: hw_gpadc_v2.h:123
int16_t hw_gpadc_get_voltage(void)
Get the measured voltage in mVolt.
Definition: hw_gpadc_v2.h:96
Definition: hw_gpadc_v2.h:73
Definition: hw_gpadc_v2.h:152
Definition: hw_gpadc_v2.h:134
Definition: hw_gpadc_v2.h:93
Definition: hw_gpadc_v2.h:125
__STATIC_INLINE void hw_gpadc_set_sample_time(uint8_t mult)
Set sample time.
Definition: hw_gpadc_v2.h:302
Definition: hw_gpadc_v2.h:137
Definition: hw_gpadc_v2.h:130
Definition: hw_gpadc_v2.h:95
Definition: hw_gpadc_v2.h:72
__STATIC_INLINE void hw_gpadc_set_ldo_delay(uint32_t delay)
Set the delay required to enable the ADC_LDO. 0: Not allowed 1: 4x ADC_CLK period....
Definition: hw_gpadc_v2.h:196
Definition: hw_gpadc_v2.h:91
Definition: hw_gpadc_v2.h:135
HW_GPADC_OVERSAMPLING
GPADC oversampling.
Definition: hw_gpadc.h:132
Definition: hw_gpadc_v2.h:136
__STATIC_INLINE void hw_gpadc_set_store_delay(HW_GPADC_STORE_DELAY delay)
Set STORE_DEL field.
Definition: hw_gpadc_v2.h:218
ADC configuration.
Definition: hw_gpadc_v2.h:159
__STATIC_INLINE void hw_gpadc_set_negative(HW_GPADC_INPUT_NEGATIVE channel)
Set negative input channel.
Definition: hw_gpadc_v2.h:251
Definition: hw_gpadc_v2.h:146
Definition: hw_gpadc_v2.h:129
Definition: hw_gpadc_v2.h:132
Definition: hw_gpadc_v2.h:94
Definition: hw_gpadc_v2.h:149
void hw_gpadc_store_ambient_calibration_point(uint16_t raw_val, int16_t temp)
Store temperature calibration point at ambient temperature.
#define REG_GETF(base, reg, field)
Return the value of a register field.
Definition: sdk_defs.h:711
uint16_t hw_gpadc_convert_celsius_x100_to_raw_val_util(const hw_gpadc_config_t *cfg, int16_t temperature)
Convert a temperature value to raw GPADC value.
HW_GPADC_INPUT_NEGATIVE
ADC input - Negative side.
Definition: hw_gpadc_v2.h:144
HW_GPADC_MAX_INPUT_VOLTAGE
GPADC input voltages.
Definition: hw_gpadc_v2.h:71
__STATIC_INLINE HW_GPADC_INPUT_POSITIVE hw_gpadc_get_positive(void)
Get the current positive input channel.
Definition: hw_gpadc_v2.h:240
__STATIC_INLINE HW_GPADC_INPUT_NEGATIVE hw_gpadc_get_negative(void)
Get the current negative input channel.
Definition: hw_gpadc_v2.h:262
Definition: hw_gpadc_v2.h:150
__STATIC_INLINE bool hw_gpadc_get_ldo_hold(void)
Get the current mode of bandgap reference.
Definition: hw_gpadc_v2.h:369
Definition: hw_gpadc_v2.h:148
Definition: hw_gpadc_v2.h:147