33 #define IOCFGBIT_ACTIVELOW 0 //
34 #define IOCFGBIT_BOARDLED 1 //
35 #define IOCFGBIT_PWM 2
40 typedef struct PinInfo {
42 GPIO_TypeDef *
const port;
51 const uint8_t adcChannel;
69 typedef struct TimerChannelData {
74 volatile int risingEdge, pulseWidth, period;
75 volatile uint32_t lastRollover;
79 typedef struct TimerInfo {
80 TIM_TypeDef *
const TIMx;
86 volatile uint32_t numRollovers;
88 TimerChannelData *channelData;
92 typedef enum WiringPinMode {
93 OUTPUT, OUTPUT_OPEN_DRAIN,
94 INPUT, INPUT_ANALOG, INPUT_PULLUP, INPUT_PULLDOWN,
100 typedef enum LogicValue {
101 LOW = 0, HIGH = 1, TOGGLE = 2
105 typedef void (*ISRType)(void);
114 #define SERIAL_BUFFER_SIZE 80
116 typedef struct RingBuffer {
117 uint8_t buffer[SERIAL_BUFFER_SIZE];
118 volatile uint8_t head;
119 volatile uint8_t tail;
122 typedef void (*ByteFunc)(uint8_t);
124 typedef struct USARTInfo {
126 USART_TypeDef *USARTx;
127 IRQn_Type irqChannel;
128 uint8_t txPin, rxPin;
143 typedef enum InterruptTrigger {
144 RISING, FALLING, CHANGE
151 uint8_t bPwmIn, pinName;
152 volatile int risingEdgeMs, risingEdgeSubMs, pulsewidth, period;
157 #if defined ( __CC_ARM )
158 #define WEAK (__attribute__ ((weak)))
159 #elif defined ( __ICCARM__ )
161 #elif defined ( __GNUC__ )
162 #define WEAK __attribute__ ((weak))
167 extern PinInfo PIN_MAP[];
168 extern TimerInfo TIMER_MAP[];
169 extern TimebaseChannel TIMEBASE_MAP[];
171 extern USARTInfo USART_MAP[];
172 extern EXTIChannel EXTI_MAP[];
177 #endif // __cplusplus