~ruther/uni-mam-arm

uni-mam-arm/arm03/include/timer.h -rw-r--r-- 817 bytes
f80d4fd6 — Rutherther chore(arm07): add few image upload commands 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stm32f4xx.h>

#ifndef TIMER_H
#define TIMER_H

typedef struct {
  TIM_TypeDef* periph;
  uint8_t idx;
} timer_t;

void timer_init(timer_t* timer, TIM_TypeDef* peripheral, uint8_t timer_idx);
void timer_enable(timer_t* timer);
void timer_disable(timer_t* timer);
uint32_t timer_is_enabled(timer_t *timer);

void timer_set_refresh(timer_t* timer, uint32_t refresh_value);
void timer_set_counter(timer_t* timer, uint32_t counter);

// TODO: rest of parameters...?
void timer_configure(timer_t* timer, uint8_t buffered_reload, uint16_t prescaler, uint8_t one_pulse_mode);

uint16_t timer_count(timer_t* timer);

void timer_enable_interrupt(timer_t* timer);
void timer_disable_interrupt(timer_t* timer);
uint32_t timer_is_interrupt(timer_t* timer);
void timer_clear_interrupt(timer_t* timer);

#endif // TIMER_H
Do not follow this link