libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
Functions | |
void | lptimer_set_counter (uint32_t lptimer_peripheral, uint16_t count) |
Set lptimer Counter. More... | |
uint16_t | lptimer_get_counter (uint32_t lptimer_peripheral) |
Read lptimer Counter. More... | |
void | lptimer_clear_flag (uint32_t lptimer_peripheral, uint32_t flag) |
Clear lptimer Status Flag. More... | |
bool | lptimer_get_flag (uint32_t lptimer_peripheral, uint32_t flag) |
Read lptimer Status Flag. More... | |
void | lptimer_enable_irq (uint32_t lptimer_peripheral, uint32_t irq) |
Enable lptimer interrupts. More... | |
void | lptimer_disable_irq (uint32_t lptimer_peripheral, uint32_t irq) |
Disable lptimer Interrupts. More... | |
void | lptimer_enable (uint32_t lptimer_peripheral) |
Enable lptimer. More... | |
void | lptimer_disable (uint32_t lptimer_peripheral) |
Disable lptimer. More... | |
void | lptimer_start_counter (uint32_t lptimer_peripheral, uint32_t mode) |
Start lptimer in a given mode. More... | |
void | lptimer_set_prescaler (uint32_t lptimer_peripheral, uint32_t prescaler) |
Set lptimer clock prescaler. More... | |
void | lptimer_enable_trigger (uint32_t lptimer_peripheral, uint32_t trigen) |
Enable lptimer External Trigger. More... | |
void | lptimer_select_trigger_source (uint32_t lptimer_peripheral, uint32_t trigger_source) |
Select lptimer Trigger Source. More... | |
void | lptimer_set_compare (uint32_t lptimer_peripheral, uint16_t compare_value) |
Set lptimer counter Compare Value. More... | |
void | lptimer_set_period (uint32_t lptimer_peripheral, uint16_t period_value) |
Set lptimer period. More... | |
void | lptimer_enable_preload (uint32_t lptimer_peripheral) |
Enable lptimer Preload mode. More... | |
void | lptimer_disable_preload (uint32_t lptimer_peripheral) |
Disable lptimer Preload mode. More... | |
void | lptimer_set_internal_clock_source (uint32_t lptimer_peripheral) |
Set lptimer Internal Clock source. More... | |
void | lptimer_set_external_clock_source (uint32_t lptimer_peripheral) |
Set lptimer External Clock source. More... | |
void | lptimer_set_waveform_polarity_high (uint32_t lptimer_peripheral) |
Set lptimer Waveform Output Polarity High. More... | |
void | lptimer_set_waveform_polarity_low (uint32_t lptimer_peripheral) |
Set lptimer Waveform Output Polarity Low. More... | |
LGPL License Terms libopencm3 License
Example: LPTIM1 with 2x clock prescaler, from internal clock (LSE), irq on match and reload.
Note: LPTIM internal clock source selection is device specific, see clock tree and rcc section of reference manual.
void lptimer_clear_flag | ( | uint32_t | lptimer_peripheral, |
uint32_t | flag | ||
) |
Clear lptimer Status Flag.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | flag | Status Register clear flag (LPTIM_ICR Interrupt Clear Register) |
Definition at line 90 of file lptimer_common_all.c.
References LPTIM_ICR.
void lptimer_disable | ( | uint32_t | lptimer_peripheral | ) |
Disable lptimer.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 141 of file lptimer_common_all.c.
References LPTIM_CR.
void lptimer_disable_irq | ( | uint32_t | lptimer_peripheral, |
uint32_t | irq | ||
) |
Disable lptimer Interrupts.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | irq | Logical or of all interrupt enable bits to be cleared (LPTIM_IER Interrupt Enable Register) |
Definition at line 123 of file lptimer_common_all.c.
References LPTIM_IER.
void lptimer_disable_preload | ( | uint32_t | lptimer_peripheral | ) |
Disable lptimer Preload mode.
Disable lptimer preload mode, ensureing updated period and compare registers values are taken in account immediatly.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 246 of file lptimer_common_all.c.
References LPTIM_CFGR.
void lptimer_enable | ( | uint32_t | lptimer_peripheral | ) |
Enable lptimer.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 132 of file lptimer_common_all.c.
References LPTIM_CR, and LPTIM_CR_ENABLE.
void lptimer_enable_irq | ( | uint32_t | lptimer_peripheral, |
uint32_t | irq | ||
) |
Enable lptimer interrupts.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | irq | Logical or of all interrupt enable bits to be set (LPTIM_IER Interrupt Enable Register) |
Definition at line 112 of file lptimer_common_all.c.
References LPTIM_IER.
void lptimer_enable_preload | ( | uint32_t | lptimer_peripheral | ) |
Enable lptimer Preload mode.
Enable lptimer preload mode, delaying update of period and compare registers to the end of current period.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 234 of file lptimer_common_all.c.
References LPTIM_CFGR, and LPTIM_CFGR_PRELOAD.
void lptimer_enable_trigger | ( | uint32_t | lptimer_peripheral, |
uint32_t | trigen | ||
) |
Enable lptimer External Trigger.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | trigen | Enable Trigger |
Definition at line 181 of file lptimer_common_all.c.
References LPTIM_CFGR, LPTIM_CFGR_TRIGEN_MASK, and LPTIM_CFGR_TRIGEN_SHIFT.
uint16_t lptimer_get_counter | ( | uint32_t | lptimer_peripheral | ) |
Read lptimer Counter.
Read back the value of lptimer counter.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 80 of file lptimer_common_all.c.
References LPTIM_CNT.
bool lptimer_get_flag | ( | uint32_t | lptimer_peripheral, |
uint32_t | flag | ||
) |
Read lptimer Status Flag.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | flag | Status Register flag (LPTIM_ISR Interrupt and Status Register) |
Definition at line 101 of file lptimer_common_all.c.
References LPTIM_ISR.
void lptimer_select_trigger_source | ( | uint32_t | lptimer_peripheral, |
uint32_t | trigger_source | ||
) |
Select lptimer Trigger Source.
Select timer external trigger source.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | trigger_source | Trigger selector (LPTIM_CFGR TRIGSEL Trigger selector) |
Definition at line 195 of file lptimer_common_all.c.
References LPTIM_CFGR, LPTIM_CFGR_TRIGSEL_MASK, and LPTIM_CFGR_TRIGSEL_SHIFT.
void lptimer_set_compare | ( | uint32_t | lptimer_peripheral, |
uint16_t | compare_value | ||
) |
Set lptimer counter Compare Value.
Set the timer compare value. Must only be set with timer enabled.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | compare_value | Compare value. |
Definition at line 209 of file lptimer_common_all.c.
References LPTIM_CMP.
void lptimer_set_counter | ( | uint32_t | lptimer_peripheral, |
uint16_t | count | ||
) |
Set lptimer Counter.
Set the value of a lptimer counter.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | count | Counter value. |
Definition at line 68 of file lptimer_common_all.c.
References LPTIM_CNT.
void lptimer_set_external_clock_source | ( | uint32_t | lptimer_peripheral | ) |
Set lptimer External Clock source.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 265 of file lptimer_common_all.c.
References LPTIM_CFGR, and LPTIM_CFGR_CKSEL.
void lptimer_set_internal_clock_source | ( | uint32_t | lptimer_peripheral | ) |
Set lptimer Internal Clock source.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 256 of file lptimer_common_all.c.
References LPTIM_CFGR.
void lptimer_set_period | ( | uint32_t | lptimer_peripheral, |
uint16_t | period_value | ||
) |
Set lptimer period.
Set the timer period in the auto-reload register. Must only be set with timer enabled.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | period_value | Autoreload value. Must be greater that CMP value. |
Definition at line 222 of file lptimer_common_all.c.
References LPTIM_ARR.
void lptimer_set_prescaler | ( | uint32_t | lptimer_peripheral, |
uint32_t | prescaler | ||
) |
Set lptimer clock prescaler.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | prescaler | Clock prescaler (LPTIM_CFGR PRESC Clock prescaler) |
Definition at line 169 of file lptimer_common_all.c.
References LPTIM_CFGR, LPTIM_CFGR_PRESC_MASK, and LPTIM_CFGR_PRESC_SHIFT.
void lptimer_set_waveform_polarity_high | ( | uint32_t | lptimer_peripheral | ) |
Set lptimer Waveform Output Polarity High.
Set lptimer waveform output to reflect compare result between LPTIN_CNT and LPTIM_CMP.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 277 of file lptimer_common_all.c.
References LPTIM_CFGR, and LPTIM_CFGR_WAVPOL.
void lptimer_set_waveform_polarity_low | ( | uint32_t | lptimer_peripheral | ) |
Set lptimer Waveform Output Polarity Low.
Set lptimer waveform output to reflect the inverse of the compare result between LPTIN_CNT and LPTIM_CMP.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
Definition at line 289 of file lptimer_common_all.c.
References LPTIM_CFGR.
void lptimer_start_counter | ( | uint32_t | lptimer_peripheral, |
uint32_t | mode | ||
) |
Start lptimer in a given mode.
Starts the timer in specified mode - Either Single (LPTIM_CR_SNGSTRT) or Continuous mode (LPTIM_CR_CNTSTRT). In Single mode, the timer will stop at next match on compare or period value. If LPTIM_CR_SNGSTRT is set while timer is started in countious mode, it will stop at next match on compare or period value. If Software trigger is disabled, start will be delayed until programmed triggers is detected.
[in] | lptimer_peripheral | lptimer base address (Low Power Timer register base addresses) |
[in] | mode | lptimer start mode (LPTIM_CR_SNGSTRT or LPTIM_CR_CNTSTRT) |
Definition at line 159 of file lptimer_common_all.c.
References LPTIM_CR.