1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-10 18:24:11 +01:00
LibrePilot/flight/PiOS/inc/pios_tim_priv.h
Stacey Sheldon 2f86e4dd4f Make PWM/PPM and Servo drivers play nicely together
PWM and PPM can now coexist in the same load and be
selected at boot time via the hwsettings UAVObject.

This is basically a complete restructuring of the
way the drivers interact with the TIM peripheral in
the STM32.

As a side effect, the PWM and PPM drivers are now
ready to support multiple instances of each.

This also provides the first step toward being able
to reassign some of the PWM input pins to be servo
output pins.  Still more work required, but this is
a good start.
2011-08-27 21:39:56 -04:00

29 lines
807 B
C

#ifndef PIOS_TIM_PRIV_H
#define PIOS_TIM_PRIV_H
#include <pios_stm32.h>
struct pios_tim_clock_cfg {
TIM_TypeDef * timer;
const TIM_TimeBaseInitTypeDef * time_base_init;
struct stm32_irq irq;
};
struct pios_tim_channel {
TIM_TypeDef * timer;
uint8_t timer_chan;
struct stm32_gpio pin;
uint32_t remap;
};
struct pios_tim_callbacks {
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);
};
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);
#endif /* PIOS_TIM_PRIV_H */