GlobLib
HAL and API libraries for MCUs and hardware.
stm32f103cb_timer.h
Go to the documentation of this file.
1 #ifndef STM32F103CB_TIMERS_H_
2 #define STM32F103CB_TIMERS_H_
3 
78 #include "stm32f103cb_gpio.h"
79 #include "stm32f103cb_debug.h"
80 #include "stm32f103cb_clock.h"
81 #include <libopencm3/stm32/timer.h>
82 #include <stdint.h>
83 
88 typedef enum{
89 
94 }timer_main;
99 typedef enum{
100 
106 
119 mcu_error TIMER_setupCount(timer_main timerNumber, uint32_t frequency, void (*handler)(void));
133 mcu_error TIMER_setupIC(timer_main timerNumber, timer_channel timerChannel);
147 mcu_error TIMER_setupPWM(timer_main timerNumber, timer_channel timerChannel, uint32_t frequency, uint8_t duty);
161 mcu_error TIMER_setupPulse(timer_main timerNumber, timer_channel timerChannel, uint32_t frequency, uint32_t pulse);
171 mcu_error TIMER_setPeriod(timer_main timerNumber, uint32_t period);
181 mcu_error TIMER_setFrequency(timer_main timerNumber, uint32_t frequency);
191 mcu_error TIMER_setDuty(timer_main timerNumber, timer_channel channel, uint8_t duty);
202 mcu_error TIMER_setPulse(timer_main timerNumber, timer_channel channel, uint32_t pulse);
212 uint16_t TIMER_getCount(timer_main timerNumber);
223 mcu_error TIMER_setCount(timer_main timerNumber, uint16_t count);
237 uint16_t TIMER_getIC(timer_main timerNumber, timer_channel channel);
249 mcu_error TIMER_enableISR(timer_main timerNumber, void(*handler)(void));
269 mcu_error TIMER_pause(timer_main timerNumber);
279 mcu_error TIMER_resume(timer_main timerNumber);
280 
283 #endif
Timer 2.
mcu_error TIMER_setupPulse(timer_main timerNumber, timer_channel timerChannel, uint32_t frequency, uint32_t pulse)
Initialize given timer for Pulse mode.
mcu_error TIMER_setFrequency(timer_main timerNumber, uint32_t frequency)
Set the frequency for the timer. (in hertz)
Timer 1.
Header file for stm32f103cb DEBUG.
Header file for stm32f103 GPIO.
Channel 4.
Timer 3.
mcu_error TIMER_resume(timer_main timerNumber)
Resume a paused timer.
mcu_error TIMER_pause(timer_main timerNumber)
Pause an already running timer.
mcu_error TIMER_setCount(timer_main timerNumber, uint16_t count)
Set the current value of a running timer.
mcu_error TIMER_setupCount(timer_main timerNumber, uint32_t frequency, void(*handler)(void))
Initialize given timer for standard count with interrupt on timeout.
mcu_error TIMER_enableISR(timer_main timerNumber, void(*handler)(void))
Set the ISR target for timeout.
mcu_error TIMER_setPeriod(timer_main timerNumber, uint32_t period)
Set the period for the timer. (in microseconds)
timer_main
Main timers available on the MCU.
mcu_error TIMER_disableISR(timer_main timerNumber)
Disable the timeout IRQ.
Channel 2.
mcu_error TIMER_setupPWM(timer_main timerNumber, timer_channel timerChannel, uint32_t frequency, uint8_t duty)
Initialize given timer for PWM mode.
timer_channel
Timers channels available for each timer.
Channel 1.
mcu_error TIMER_setDuty(timer_main timerNumber, timer_channel channel, uint8_t duty)
Set the duty cycle for the waveform (PWM only, 0 - 100%).
mcu_error TIMER_setPulse(timer_main timerNumber, timer_channel channel, uint32_t pulse)
Set the pulse width for the output. (in microseconds)
uint16_t TIMER_getCount(timer_main timerNumber)
Get the current value of a running timer.
Header file for stm32f103 CLOCK.
mcu_error TIMER_setupIC(timer_main timerNumber, timer_channel timerChannel)
Initialize given timer for input capture.
Timer 4.
Channel 3.
mcu_error
Error enumerators for the Debug peripheral.
uint16_t TIMER_getIC(timer_main timerNumber, timer_channel channel)
Get the last input capture time from a channel of a timer.