2011-08-13 05:23:16 +02:00
|
|
|
#ifndef PIOS_TIM_PRIV_H
|
|
|
|
#define PIOS_TIM_PRIV_H
|
|
|
|
|
|
|
|
#include <pios_stm32.h>
|
|
|
|
|
|
|
|
struct pios_tim_clock_cfg {
|
2013-05-19 16:37:30 +02:00
|
|
|
TIM_TypeDef *timer;
|
|
|
|
const TIM_TimeBaseInitTypeDef *time_base_init;
|
|
|
|
struct stm32_irq irq;
|
2011-08-13 05:23:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pios_tim_channel {
|
2013-05-19 16:37:30 +02:00
|
|
|
TIM_TypeDef *timer;
|
|
|
|
uint8_t timer_chan;
|
2011-08-13 05:23:16 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
struct stm32_gpio pin;
|
|
|
|
uint32_t remap;
|
2011-08-13 05:23:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct pios_tim_callbacks {
|
2013-05-19 16:37:30 +02:00
|
|
|
void (*overflow)(uint32_t tim_id, uint32_t context, uint8_t chan_idx, uint16_t count);
|
|
|
|
void (*edge)(uint32_t tim_id, uint32_t context, uint8_t chan_idx, uint16_t count);
|
2011-08-13 05:23:16 +02:00
|
|
|
};
|
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
extern int32_t PIOS_TIM_InitClock(const struct pios_tim_clock_cfg *cfg);
|
|
|
|
extern int32_t PIOS_TIM_InitChannels(uint32_t *tim_id, const struct pios_tim_channel *channels, uint8_t num_channels, const struct pios_tim_callbacks *callbacks, uint32_t context);
|
2011-08-13 05:23:16 +02:00
|
|
|
|
2013-05-19 16:37:30 +02:00
|
|
|
#endif /* PIOS_TIM_PRIV_H */
|