libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
ADC Analog watchdog API

ADC analog watchdog API definitions. More...

Collaboration diagram for ADC Analog watchdog API:

Functions

void adc_enable_analog_watchdog_on_all_channels (uint32_t adc)
 ADC Enable Analog Watchdog for All Channels. More...
 
void adc_enable_analog_watchdog_on_selected_channel (uint32_t adc, uint8_t chan)
 ADC Enable Analog Watchdog for a Selected Channel. More...
 
void adc_disable_analog_watchdog (uint32_t adc)
 ADC Disable Analog Watchdog. More...
 
void adc_set_watchdog_high_threshold (uint32_t adc, uint16_t threshold)
 ADC Set Analog Watchdog Upper Threshold. More...
 
void adc_set_watchdog_low_threshold (uint32_t adc, uint16_t threshold)
 ADC Set Analog Watchdog Lower Threshold. More...
 

Detailed Description

ADC analog watchdog API definitions.

The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Analog watchdog is disabled by default.

Warning
Comparison is done before data alignment takes place, so the thresholds are left-aligned.

Example 1: Enable watchdog checking on all channels

// in configuration
// in the main application thread
// the converted signal is out of AWD ranges
}
void adc_clear_watchdog_flag(uint32_t adc)
ADC Clear Analog Watchdog Flag.
Definition: adc.c:239
bool adc_get_watchdog_flag(uint32_t adc)
ADC Read the Analog Watchdog Flag.
Definition: adc.c:228
void adc_set_watchdog_high_threshold(uint32_t adc, uint16_t threshold)
ADC Set Analog Watchdog Upper Threshold.
Definition: adc.c:519
void adc_enable_analog_watchdog_on_all_channels(uint32_t adc)
ADC Enable Analog Watchdog for All Channels.
Definition: adc.c:481
void adc_set_watchdog_low_threshold(uint32_t adc, uint16_t threshold)
ADC Set Analog Watchdog Lower Threshold.
Definition: adc.c:531
#define ADC1
Definition: f0/adc.h:48

Example 2: Enable watchdog checking on channel 5

// in configuration
// in the main application thread
// the converted signal is out of AWD ranges
}
void adc_enable_analog_watchdog_on_selected_channel(uint32_t adc, uint8_t chan)
ADC Enable Analog Watchdog for a Selected Channel.
Definition: adc.c:494

Function Documentation

◆ adc_disable_analog_watchdog()

void adc_disable_analog_watchdog ( uint32_t  adc)

ADC Disable Analog Watchdog.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 507 of file adc.c.

References ADC_CFGR1.

◆ adc_enable_analog_watchdog_on_all_channels()

void adc_enable_analog_watchdog_on_all_channels ( uint32_t  adc)

ADC Enable Analog Watchdog for All Channels.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)

Definition at line 481 of file adc.c.

References ADC_CFGR1, and ADC_CFGR1_AWD1EN.

◆ adc_enable_analog_watchdog_on_selected_channel()

void adc_enable_analog_watchdog_on_selected_channel ( uint32_t  adc,
uint8_t  chan 
)

ADC Enable Analog Watchdog for a Selected Channel.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]chanUnsigned int8. ADC channel number adc_api_channel

Definition at line 494 of file adc.c.

References ADC_CFGR1, ADC_CFGR1_AWD1CH_VAL, ADC_CFGR1_AWD1EN, and ADC_CFGR1_AWD1SGL.

◆ adc_set_watchdog_high_threshold()

void adc_set_watchdog_high_threshold ( uint32_t  adc,
uint16_t  threshold 
)

ADC Set Analog Watchdog Upper Threshold.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]thresholdUpper threshold value

Definition at line 519 of file adc.c.

References ADC_TR1, and ADC_TR1_HT_VAL.

◆ adc_set_watchdog_low_threshold()

void adc_set_watchdog_low_threshold ( uint32_t  adc,
uint16_t  threshold 
)

ADC Set Analog Watchdog Lower Threshold.

Parameters
[in]adcUnsigned int32. ADC base address (ADC register base addresses)
[in]thresholdLower threshold value

Definition at line 531 of file adc.c.

References ADC_TR1, and ADC_TR1_LT_VAL.