GlobLib
HAL and API libraries for MCUs and hardware.
attiny13a_timer.h
Go to the documentation of this file.
1 #ifndef ATTINY13A_TIMERS_H_
2 #define ATTINY13A_TIMERS_H_
3 
55 #include "attiny13a_gpio.h"
56 #include "attiny13a_debug.h"
57 #include "attiny13a_clock.h"
58 #include <stdint.h>
59 
60 #ifndef IC_PIN
61 #define IC_PIN PIN4
62 #endif
63 
68 typedef enum{
69 
71 }timer_main;
76 typedef enum{
77 
81 
100 mcu_error TIMER_setupCount(timer_main timerNumber, uint16_t frequency, void (*handler)(void));
122 mcu_error TIMER_setupIC(timer_main timerNumber, timer_channel timerChannel);
145 mcu_error TIMER_setupPWM(timer_main timerNumber, timer_channel timerChannel, uint16_t frequency, uint8_t duty);
168 mcu_error TIMER_setupPulse(timer_main timerNumber, timer_channel timerChannel, uint16_t frequency, uint16_t pulse);
187 mcu_error TIMER_setPeriod(timer_main timerNumber, uint32_t period);
205 mcu_error TIMER_setFrequency(timer_main timerNumber, uint16_t frequency);
214 mcu_error TIMER_setDuty(timer_main timerNumber, timer_channel channel, uint8_t duty);
232 mcu_error TIMER_setPulse(timer_main timerNumber, timer_channel channel, uint16_t pulse);
240 uint8_t TIMER_getCount(timer_main timerNumber);
249 mcu_error TIMER_setCount(timer_main timerNumber, uint8_t count);
261 uint16_t TIMER_getIC(timer_main timerNumber, timer_channel channel);
273 mcu_error TIMER_enableISR(timer_main timerNumber, void(*handler)(void));
293 mcu_error TIMER_pause(timer_main timerNumber);
304 mcu_error TIMER_resume(timer_main timerNumber);
305 
308 #endif
uint8_t TIMER_getCount(timer_main timerNumber)
Get the current value of a running timer.
mcu_error TIMER_setCount(timer_main timerNumber, uint8_t count)
Set the current value of a running timer.
Header file for attiny13a DEBUG.
Header file for attiny13a CLOCK.
mcu_error TIMER_setupPWM(timer_main timerNumber, timer_channel timerChannel, uint16_t frequency, uint8_t duty)
Initialize given timer for PWM mode.
Timer 0.
mcu_error TIMER_resume(timer_main timerNumber)
Resume a paused timer.
Header file for attiny13a GPIO.
mcu_error TIMER_pause(timer_main timerNumber)
Pause an already running timer.
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.
mcu_error TIMER_setFrequency(timer_main timerNumber, uint16_t frequency)
Set the frequency for the timer. (in hertz)
Channel 2.
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_setupPulse(timer_main timerNumber, timer_channel timerChannel, uint16_t frequency, uint16_t pulse)
Initialize given timer for Pulse mode.
mcu_error TIMER_setupIC(timer_main timerNumber, timer_channel timerChannel)
Initialize given timer for input capture.
mcu_error TIMER_setPulse(timer_main timerNumber, timer_channel channel, uint16_t pulse)
Set the pulse width for the output. (in milliseconds)
mcu_error TIMER_setupCount(timer_main timerNumber, uint16_t frequency, void(*handler)(void))
Initialize given timer for standard count with interrupt trigging the function handler on timeout...
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.