00001
00044 #ifndef TIMER_TC_TIMER_XMEGA_H_INCLUDED
00045 #define TIMER_TC_TIMER_XMEGA_H_INCLUDED
00046
00047 #include <timer.h>
00048 #include <stdbool.h>
00049 #include <stdint.h>
00050
00069 void tc_timer_init(uint8_t tc_id, void *regs, struct timer *timer,
00070 timer_callback_t timer_callback);
00071 void tc_timer_start(uint8_t tc_id, struct timer *timer);
00072 void tc_timer_stop(uint8_t tc_id, struct timer *timer);
00073 void tc_timer_set_alarm(uint8_t tc_id, struct timer *timer, uint16_t delay);
00074 uint16_t tc_timer_get_time(uint8_t tc_id, struct timer *timer);
00075 timer_res_t tc_timer_set_resolution(uint8_t tc_id, uint32_t resolution);
00076 void tc_timer_write_resolution(uint8_t tc_id, struct timer *timer,
00077 timer_res_t resolution);
00078 uint32_t tc_timer_get_resolution(uint8_t tc_id, timer_res_t timer_res);
00079
00086 static inline uint16_t tc_timer_maximum_delta(void)
00087 {
00088 return (uint16_t)~0;
00089 }
00090
00099 static inline timer_res_t tc_timer_read_resolution(struct timer *timer)
00100 {
00101 return timer->clksel;
00102 }
00103
00105
00106 #endif