SmartSnippets DA1459x SDK
Functions

Access to specific hw_gpadc_config_t structure members and other essential configuration tweaks. More...

Functions

__STATIC_INLINE void hw_gpadc_set_continuous (bool enabled)
 Set continuous mode. More...
 
__STATIC_INLINE bool hw_gpadc_get_continuous (void)
 Get continuous mode state. More...
 
__STATIC_INLINE void hw_gpadc_set_input_mode (HW_GPADC_INPUT_MODE mode)
 Set input mode. More...
 
__STATIC_INLINE HW_GPADC_INPUT_MODE hw_gpadc_get_input_mode (void)
 Get the current input mode. More...
 
__STATIC_INLINE void hw_gpadc_set_oversampling (HW_GPADC_OVERSAMPLING n_samples)
 Set oversampling. More...
 
__STATIC_INLINE HW_GPADC_OVERSAMPLING hw_gpadc_get_oversampling (void)
 Get the current oversampling. More...
 
__STATIC_INLINE void hw_gpadc_set_mute (bool enabled)
 Set input mute state. More...
 
__STATIC_INLINE bool hw_gpadc_get_mute (void)
 Get the current input mute state. More...
 
__STATIC_INLINE void hw_gpadc_set_sign_change (bool enabled)
 Set input and output sign change. More...
 
__STATIC_INLINE bool hw_gpadc_get_sign_change (void)
 Get the current input and output sign change. More...
 
__STATIC_INLINE void hw_gpadc_set_chopping (bool enabled)
 Set chopping state. More...
 
__STATIC_INLINE bool hw_gpadc_get_chopping (void)
 Get the current chopping state. More...
 
__STATIC_INLINE void hw_gpadc_set_mint (bool enabled)
 Set masked interrupt. More...
 
__STATIC_INLINE bool hw_gpadc_get_mint (void)
 Get masked interrupt state. More...
 
__STATIC_INLINE void hw_gpadc_set_ldo_constant_current (bool enabled)
 Set state of constant 20uA load current on ADC LDO output. More...
 
__STATIC_INLINE bool hw_gpadc_get_ldo_constant_current (void)
 Get the current state of constant 20uA load current on ADC LDO output. More...
 
__STATIC_INLINE void hw_gpadc_set_interval (uint8_t mult)
 Set interval between conversions in continuous mode. More...
 
__STATIC_INLINE uint8_t hw_gpadc_get_interval (void)
 Get the current interval between conversions in continuous mode. More...
 
__STATIC_INLINE void hw_gpadc_set_dma_functionality (bool enabled)
 Set DMA functionality. More...
 
__STATIC_INLINE bool hw_gpadc_get_dma_functionality (void)
 Get current state of DMA functionality. More...
 
__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. n: n*4x ADC_CLK period. More...
 
__STATIC_INLINE void hw_gpadc_set_store_delay (HW_GPADC_STORE_DELAY delay)
 Set STORE_DEL field. More...
 
__STATIC_INLINE void hw_gpadc_set_positive (HW_GPADC_INPUT_POSITIVE channel)
 Set positive input channel. More...
 
__STATIC_INLINE HW_GPADC_INPUT_POSITIVE hw_gpadc_get_positive (void)
 Get the current positive input channel. More...
 
__STATIC_INLINE void hw_gpadc_set_negative (HW_GPADC_INPUT_NEGATIVE channel)
 Set negative input channel. More...
 
__STATIC_INLINE HW_GPADC_INPUT_NEGATIVE hw_gpadc_get_negative (void)
 Get the current negative input channel. More...
 
__STATIC_INLINE void hw_gpadc_set_input_attenuator_state (HW_GPADC_MAX_INPUT_VOLTAGE vmax)
 Set state of input attenuator. More...
 
__STATIC_INLINE HW_GPADC_MAX_INPUT_VOLTAGE hw_gpadc_get_input_attenuator_state (void)
 Get the current state of input attenuator. More...
 
__STATIC_INLINE void hw_gpadc_set_sample_time (uint8_t mult)
 Set sample time. More...
 
__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. More...
 
__STATIC_INLINE void hw_gpadc_set_die_temp (bool enabled)
 Set DIE_TEMP_EN field. More...
 
__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. More...
 
__STATIC_INLINE void hw_gpadc_set_ldo_hold (bool enabled)
 Set the mode of bandgap reference. More...
 
__STATIC_INLINE bool hw_gpadc_get_ldo_hold (void)
 Get the current mode of bandgap reference. More...
 

Detailed Description

Access to specific hw_gpadc_config_t structure members and other essential configuration tweaks.

Function Documentation

◆ hw_gpadc_get_chopping()

__STATIC_INLINE bool hw_gpadc_get_chopping ( void  )

Get the current chopping state.

Returns
chopping state

◆ hw_gpadc_get_continuous()

__STATIC_INLINE bool hw_gpadc_get_continuous ( void  )

Get continuous mode state.

Returns
continuous mode state

◆ hw_gpadc_get_die_temp()

__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.

Returns
current die-temperature sensor status
See also
HW_GPADC_INPUT_POSITIVE

◆ hw_gpadc_get_dma_functionality()

__STATIC_INLINE bool hw_gpadc_get_dma_functionality ( void  )

Get current state of DMA functionality.

Returns
DMA functionality state

◆ hw_gpadc_get_input_attenuator_state()

__STATIC_INLINE HW_GPADC_MAX_INPUT_VOLTAGE hw_gpadc_get_input_attenuator_state ( void  )

Get the current state of input attenuator.

Returns
attenuator state

◆ hw_gpadc_get_input_mode()

__STATIC_INLINE HW_GPADC_INPUT_MODE hw_gpadc_get_input_mode ( void  )

Get the current input mode.

return input mode

◆ hw_gpadc_get_interval()

__STATIC_INLINE uint8_t hw_gpadc_get_interval ( void  )

Get the current interval between conversions in continuous mode.

Returns
multiplier (interval = multiplier x 1024 ms)
See also
hw_gpadc_set_interval

◆ hw_gpadc_get_ldo_constant_current()

__STATIC_INLINE bool hw_gpadc_get_ldo_constant_current ( void  )

Get the current state of constant 20uA load current on ADC LDO output.

Returns
load current current state
See also
hw_gpadc_set_ldo_constant_current

◆ hw_gpadc_get_ldo_hold()

__STATIC_INLINE bool hw_gpadc_get_ldo_hold ( void  )

Get the current mode of bandgap reference.

Returns
current ldo bandgap reference mode
See also
hw_gpadc_set_ldo_hold

◆ hw_gpadc_get_mint()

__STATIC_INLINE bool hw_gpadc_get_mint ( void  )

Get masked interrupt state.

Returns
masked interrupt enabled or disabled

◆ hw_gpadc_get_mute()

__STATIC_INLINE bool hw_gpadc_get_mute ( void  )

Get the current input mute state.

Returns
mute state
See also
hw_gpadc_set_mute

◆ hw_gpadc_get_negative()

__STATIC_INLINE HW_GPADC_INPUT_NEGATIVE hw_gpadc_get_negative ( void  )

Get the current negative input channel.

Returns
negative input channel

◆ hw_gpadc_get_oversampling()

__STATIC_INLINE HW_GPADC_OVERSAMPLING hw_gpadc_get_oversampling ( void  )

Get the current oversampling.

Returns
number of samples to be taken
See also
hw_gpadc_set_oversampling

◆ hw_gpadc_get_positive()

__STATIC_INLINE HW_GPADC_INPUT_POSITIVE hw_gpadc_get_positive ( void  )

Get the current positive input channel.

Returns
positive input channel

◆ hw_gpadc_get_sample_time()

__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.

Returns
multiplier (sample time = multiplier x 8 x ADC_CLK)
See also
hw_gpadc_set_sample_time

◆ hw_gpadc_get_sign_change()

__STATIC_INLINE bool hw_gpadc_get_sign_change ( void  )

Get the current input and output sign change.

Returns
sign change state

◆ hw_gpadc_set_chopping()

__STATIC_INLINE void hw_gpadc_set_chopping ( bool  enabled)

Set chopping state.

Once enabled, two samples with opposite polarity are taken to cancel offset.

Parameters
[in]enabledchopping state

◆ hw_gpadc_set_continuous()

__STATIC_INLINE void hw_gpadc_set_continuous ( bool  enabled)

Set continuous mode.

With continuous mode enabled ADC will automatically restart conversion once completed. It's still required to start 1st conversion using hw_gpadc_start(). Interval between subsequent conversions can be adjusted using hw_gpadc_set_interval().

Parameters
[in]enabledcontinuous mode state
See also
hw_gpadc_start
hw_gpadc_set_interval

◆ hw_gpadc_set_die_temp()

__STATIC_INLINE void hw_gpadc_set_die_temp ( bool  enabled)

Set DIE_TEMP_EN field.

Enables the die-temperature sensor. Output can be measured on GPADC input 4.

Parameters
[in]enabledenable/disable the die-temperature sensor
See also
HW_GPADC_INPUT_POSITIVE

◆ hw_gpadc_set_dma_functionality()

__STATIC_INLINE void hw_gpadc_set_dma_functionality ( bool  enabled)

Set DMA functionality.

Parameters
[in]enabledTrue to enable DMA functionality, false to disable it

◆ hw_gpadc_set_input_attenuator_state()

__STATIC_INLINE void hw_gpadc_set_input_attenuator_state ( HW_GPADC_MAX_INPUT_VOLTAGE  vmax)

Set state of input attenuator.

Enabling the internal attenuator scales input voltage, increasing the effective input scale from 0-1.2V to 0-3.6V in single ended mode or from -1.2-1.2V to -3.6-3.6V in differential mode.

Parameters
[in]vmaxattenuator state

◆ hw_gpadc_set_input_mode()

__STATIC_INLINE void hw_gpadc_set_input_mode ( HW_GPADC_INPUT_MODE  mode)

Set input mode.

Parameters
[in]modeinput mode

◆ hw_gpadc_set_interval()

__STATIC_INLINE void hw_gpadc_set_interval ( uint8_t  mult)

Set interval between conversions in continuous mode.

Interval time is mult x 1.024ms. Valid values are 0-255.

Parameters
[in]multmultiplier
See also
hw_gpadc_set_continuous

◆ hw_gpadc_set_ldo_constant_current()

__STATIC_INLINE void hw_gpadc_set_ldo_constant_current ( bool  enabled)

Set state of constant 20uA load current on ADC LDO output.

Constant 20uA load current on LDO output can be enabled so that the current will not drop to 0.

Parameters
[in]enabledload current state

◆ hw_gpadc_set_ldo_delay()

__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. n: n*4x ADC_CLK period.

param [in] LDO enable delay

◆ hw_gpadc_set_ldo_hold()

__STATIC_INLINE void hw_gpadc_set_ldo_hold ( bool  enabled)

Set the mode of bandgap reference.

0: GPADC LDO tracking bandgap reference (default) 1: GPADC LDO hold sampled bandgap reference

Parameters
[in]enabledldo bandgap reference mode

◆ hw_gpadc_set_mint()

__STATIC_INLINE void hw_gpadc_set_mint ( bool  enabled)

Set masked interrupt.

Parameters
[in]enabledmasked interrupt

◆ hw_gpadc_set_mute()

__STATIC_INLINE void hw_gpadc_set_mute ( bool  enabled)

Set input mute state.

Once enabled, samples are taken at mid-scale to determine internal offset and/or notice of the ADC with regards to VDD_REF.

Parameters
[in]enabledmute state
See also
hw_gpadc_offset_calibrate

◆ hw_gpadc_set_negative()

__STATIC_INLINE void hw_gpadc_set_negative ( HW_GPADC_INPUT_NEGATIVE  channel)

Set negative input channel.

Parameters
[in]channelnegative input channel

◆ hw_gpadc_set_oversampling()

__STATIC_INLINE void hw_gpadc_set_oversampling ( HW_GPADC_OVERSAMPLING  n_samples)

Set oversampling.

With oversampling enabled multiple successive conversions will be executed and results are added together to increase effective number of bits in result.

Number of samples taken is 2n_samples. Valid values for n_samples are 0-7 thus at most 128 samples can be taken. In this case, 17bits of result are generated with the least significant bit being discarded.

Parameters
[in]n_samplesnumber of samples to be taken

◆ hw_gpadc_set_positive()

__STATIC_INLINE void hw_gpadc_set_positive ( HW_GPADC_INPUT_POSITIVE  channel)

Set positive input channel.

Parameters
[in]channelpositive input channel

◆ hw_gpadc_set_sample_time()

__STATIC_INLINE void hw_gpadc_set_sample_time ( uint8_t  mult)

Set sample time.

Sample time is mult x 8 clock cycles or 1 clock cycle when mult is 0. Valid values are 0-15.

Parameters
[in]multmultiplier

◆ hw_gpadc_set_sign_change()

__STATIC_INLINE void hw_gpadc_set_sign_change ( bool  enabled)

Set input and output sign change.

Once enabled, sign of ADC input and output is changed.

Parameters
[in]enabledsign change state

◆ hw_gpadc_set_store_delay()

__STATIC_INLINE void hw_gpadc_set_store_delay ( HW_GPADC_STORE_DELAY  delay)

Set STORE_DEL field.

0: Data is stored after handshake synchronization 1-3: Reserved 4: Data is stored 5 ADC_CLK cycles after internal start trigger 7: Data is stored 8 ADC_CLK cycles after internal start trigger

Parameters
[in]delaystore delay setting
Note
The application should be very careful with this bitfield as it could easily read outdated conversion data if the value is set too optimistic. Setting it too pessimistic is only slowing down the conversion time. The zero default value is strongly recommended to be used.