diff options
author | Joey Castillo <jose.castillo@gmail.com> | 2021-05-02 13:07:51 -0400 |
---|---|---|
committer | Joey Castillo <jose.castillo@gmail.com> | 2021-05-02 13:07:51 -0400 |
commit | 9b381ef6ae36844e32452047b05b01f15893a2dc (patch) | |
tree | 8394c04b96f625dec258385c529f9aeae03d7483 /Smol Watch Project/My Project/driver_init.c | |
parent | 68bada3006a627e704680c0161f597e585b37e7f (diff) | |
download | Sensor-Watch-9b381ef6ae36844e32452047b05b01f15893a2dc.tar.gz Sensor-Watch-9b381ef6ae36844e32452047b05b01f15893a2dc.tar.bz2 Sensor-Watch-9b381ef6ae36844e32452047b05b01f15893a2dc.zip |
WIP timer wakeup stuff
Diffstat (limited to 'Smol Watch Project/My Project/driver_init.c')
-rw-r--r-- | Smol Watch Project/My Project/driver_init.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Smol Watch Project/My Project/driver_init.c b/Smol Watch Project/My Project/driver_init.c index c4223ebc..39e68e84 100644 --- a/Smol Watch Project/My Project/driver_init.c +++ b/Smol Watch Project/My Project/driver_init.c @@ -13,6 +13,7 @@ #include <hpl_adc_base.h> +struct timer_descriptor TIMER_0; struct slcd_sync_descriptor SEGMENT_LCD_0; struct adc_sync_descriptor ADC_0; @@ -158,6 +159,19 @@ void delay_driver_init(void) delay_init(SysTick); } +/** + * \brief Timer initialization function + * + * Enables Timer peripheral, clocks and initializes Timer driver + */ +void TIMER_0_init(void) +{ + hri_mclk_set_APBCMASK_TC0_bit(MCLK); + hri_gclk_write_PCHCTRL_reg(GCLK, TC0_GCLK_ID, CONF_GCLK_TC0_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); + + timer_init(&TIMER_0, TC0, _tc_get_timer()); +} + void PWM_0_PORT_init(void) { @@ -324,6 +338,7 @@ void system_init(void) delay_driver_init(); + TIMER_0_init(); PWM_0_init(); PWM_1_init(); |