libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
libopencm3 Defined Constants and Types for the STM32F4xx Low Power Timer More...
Macros | |
#define | LPTIM_ISR(tim_base) MMIO32((tim_base) + 0x00) |
#define | LPTIM_ICR(tim_base) MMIO32((tim_base) + 0x04) |
#define | LPTIM_IER(tim_base) MMIO32((tim_base) + 0x08) |
#define | LPTIM_CFGR(tim_base) MMIO32((tim_base) + 0x0C) |
#define | LPTIM_CR(tim_base) MMIO32((tim_base) + 0x10) |
#define | LPTIM_CMP(tim_base) MMIO32((tim_base) + 0x14) |
#define | LPTIM_ARR(tim_base) MMIO32((tim_base) + 0x18) |
#define | LPTIM_CNT(tim_base) MMIO32((tim_base) + 0x1C) |
#define | LPTIM1_ISR LPTIM_ISR(LPTIM1_BASE) |
#define | LPTIM1_ICR LPTIM_ICR(LPTIM1_BASE) |
#define | LPTIM1_IER LPTIM_IER(LPTIM1_BASE) |
#define | LPTIM1_CFGR LPTIM_CFGR(LPTIM1_BASE) |
#define | LPTIM1_CR LPTIM_CR(LPTIM1_BASE) |
#define | LPTIM1_CMP LPTIM_CMP(LPTIM1_BASE) |
#define | LPTIM1_ARR LPTIM_ARR(LPTIM1_BASE) |
#define | LPTIM1_CNT LPTIM_CNT(LPTIM1_BASE) |
Functions | |
void | lptimer_enable (uint32_t timer_peripheral) |
Enable lptimer. More... | |
void | lptimer_disable (uint32_t timer_peripheral) |
Disable lptimer. More... | |
void | lptimer_start_counter (uint32_t timer_peripheral, uint32_t mode) |
Start lptimer in a given mode. More... | |
void | lptimer_set_counter (uint32_t timer_peripheral, uint16_t count) |
Set lptimer Counter. More... | |
uint16_t | lptimer_get_counter (uint32_t timer_peripheral) |
Read lptimer Counter. More... | |
void | lptimer_set_compare (uint32_t timer_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_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... | |
void | lptimer_set_prescaler (uint32_t timer_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_internal_clock_source (uint32_t timer_peripheral) |
Set lptimer Internal Clock source. More... | |
void | lptimer_set_external_clock_source (uint32_t timer_peripheral) |
Set lptimer External Clock source. More... | |
void | lptimer_clear_flag (uint32_t timer_peripheral, uint32_t flag) |
Clear lptimer Status Flag. More... | |
bool | lptimer_get_flag (uint32_t timer_peripheral, uint32_t flag) |
Read lptimer Status Flag. More... | |
void | lptimer_enable_irq (uint32_t timer_peripheral, uint32_t irq) |
Enable lptimer interrupts. More... | |
void | lptimer_disable_irq (uint32_t timer_peripheral, uint32_t irq) |
Disable lptimer Interrupts. More... | |
libopencm3 Defined Constants and Types for the STM32F4xx Low Power Timer
LGPL License Terms libopencm3 License
#define LPTIM1_ARR LPTIM_ARR(LPTIM1_BASE) |
Definition at line 52 of file lptimer_common_all.h.
#define LPTIM1_CFGR LPTIM_CFGR(LPTIM1_BASE) |
Definition at line 49 of file lptimer_common_all.h.
#define LPTIM1_CMP LPTIM_CMP(LPTIM1_BASE) |
Definition at line 51 of file lptimer_common_all.h.
#define LPTIM1_CNT LPTIM_CNT(LPTIM1_BASE) |
Definition at line 53 of file lptimer_common_all.h.
#define LPTIM1_CR LPTIM_CR(LPTIM1_BASE) |
Definition at line 50 of file lptimer_common_all.h.
#define LPTIM1_ICR LPTIM_ICR(LPTIM1_BASE) |
Definition at line 47 of file lptimer_common_all.h.
#define LPTIM1_IER LPTIM_IER(LPTIM1_BASE) |
Definition at line 48 of file lptimer_common_all.h.
#define LPTIM1_ISR LPTIM_ISR(LPTIM1_BASE) |
Definition at line 46 of file lptimer_common_all.h.
#define LPTIM_ARR | ( | tim_base | ) | MMIO32((tim_base) + 0x18) |
Definition at line 43 of file lptimer_common_all.h.
#define LPTIM_CFGR | ( | tim_base | ) | MMIO32((tim_base) + 0x0C) |
Definition at line 40 of file lptimer_common_all.h.
#define LPTIM_CMP | ( | tim_base | ) | MMIO32((tim_base) + 0x14) |
Definition at line 42 of file lptimer_common_all.h.
#define LPTIM_CNT | ( | tim_base | ) | MMIO32((tim_base) + 0x1C) |
Definition at line 44 of file lptimer_common_all.h.
#define LPTIM_CR | ( | tim_base | ) | MMIO32((tim_base) + 0x10) |
Definition at line 41 of file lptimer_common_all.h.
#define LPTIM_ICR | ( | tim_base | ) | MMIO32((tim_base) + 0x04) |
Definition at line 38 of file lptimer_common_all.h.
#define LPTIM_IER | ( | tim_base | ) | MMIO32((tim_base) + 0x08) |
Definition at line 39 of file lptimer_common_all.h.
#define LPTIM_ISR | ( | tim_base | ) | MMIO32((tim_base) + 0x00) |
Definition at line 37 of file lptimer_common_all.h.
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.