F0: fix compilation problems
This commit is contained in:
parent
0ee335cf3b
commit
6b435f6e6e
|
@ -106,13 +106,19 @@ void pwmWrite(uint8_t pin, int dutyCycle, int frequency, int durationMillis) {
|
|||
pinMode(pin, OUTPUT);
|
||||
}
|
||||
|
||||
#ifdef STM32F0 // TODO better condition for when there is no pclk2
|
||||
uint32_t timerFreq = HAL_RCC_GetPCLK1Freq();
|
||||
#else
|
||||
uint32_t timerFreq = HAL_RCC_GetPCLK2Freq();
|
||||
#endif
|
||||
|
||||
pwm_config[i].port = variant_pin_list[pin].port;
|
||||
pwm_config[i].pin_mask = variant_pin_list[pin].pin_mask;
|
||||
pwm_config[i].waveLengthCycles = HAL_RCC_GetPCLK2Freq() / frequency;
|
||||
pwm_config[i].waveLengthCycles = timerFreq / frequency;
|
||||
pwm_config[i].dutyCycle = (uint64_t)pwm_config[i].waveLengthCycles * dutyCycle >> 16;
|
||||
|
||||
if (durationMillis > 0) {
|
||||
pwm_config[i].counterCycles = HAL_RCC_GetPCLK2Freq() / 1000 * durationMillis;
|
||||
pwm_config[i].counterCycles = timerFreq / 1000 * durationMillis;
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
#include "stm32_gpio_af.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
#ifndef I2C1_EV_IRQn
|
||||
#define I2C1_EV_IRQn I2C1_IRQn
|
||||
#endif
|
||||
#ifndef I2C2_EV_IRQn
|
||||
#define I2C2_EV_IRQn I2C1_IRQn
|
||||
#endif
|
||||
|
||||
/** TwoWire object used when in slave interrupt
|
||||
*/
|
||||
TwoWire *slaveTwoWire[4];
|
||||
|
|
|
@ -168,19 +168,24 @@ extern void DMA2_Stream7_IRQHandler() {
|
|||
|
||||
|
||||
// F0
|
||||
#ifndef DMA1_Ch1_IRQHandler
|
||||
extern void DMA1_Ch1_IRQHandler() {
|
||||
HAL_DMA_IRQHandler(dmaHandles[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// F0
|
||||
#ifndef DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler
|
||||
extern void DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler() {
|
||||
HAL_DMA_IRQHandler(dmaHandles[2]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[3]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[1 + 8]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[2 + 8]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// F0
|
||||
#ifndef DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler
|
||||
extern void DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler() {
|
||||
HAL_DMA_IRQHandler(dmaHandles[4]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[5]);
|
||||
|
@ -191,6 +196,7 @@ extern void DMA1_Ch4_7_DMA2_Ch3_5_IRQHandler() {
|
|||
HAL_DMA_IRQHandler(dmaHandles[4 + 8]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[5 + 8]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// F0, F1, F3, L0, L1, L4
|
||||
extern void DMA1_Channel1_IRQHandler() {
|
||||
|
@ -214,12 +220,14 @@ extern void DMA1_Channel3_IRQHandler() {
|
|||
}
|
||||
|
||||
// F0, L0
|
||||
#ifndef DMA1_Channel4_5_6_7_IRQHandler
|
||||
extern void DMA1_Channel4_5_6_7_IRQHandler() {
|
||||
HAL_DMA_IRQHandler(dmaHandles[4]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[5]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[6]);
|
||||
HAL_DMA_IRQHandler(dmaHandles[7]);
|
||||
}
|
||||
#endif
|
||||
|
||||
// F0
|
||||
extern void DMA1_Channel4_5_IRQHandler() {
|
||||
|
|
|
@ -5,6 +5,17 @@
|
|||
// F3 RM0316 http://www.st.com/content/ccc/resource/technical/document/reference_manual/4a/19/6e/18/9d/92/43/32/DM00043574.pdf/files/DM00043574.pdf/jcr:content/translations/en.DM00043574.pdf#page=272
|
||||
// L1 RM0038 http://www.st.com/content/ccc/resource/technical/document/reference_manual/cc/f9/93/b2/f0/82/42/57/CD00240193.pdf/files/CD00240193.pdf/jcr:content/translations/en.CD00240193.pdf#page=255
|
||||
|
||||
#ifndef DMA1_Channel2_IRQn
|
||||
#define DMA1_Channel2_IRQn DMA1_Channel2_3_IRQn
|
||||
#define DMA1_Channel3_IRQn DMA1_Channel2_3_IRQn
|
||||
#endif
|
||||
|
||||
#ifndef DMA1_Channel4_IRQn
|
||||
#define DMA1_Channel4_IRQn DMA1_Channel4_5_6_7_IRQn
|
||||
#define DMA1_Channel5_IRQn DMA1_Channel4_5_6_7_IRQn
|
||||
#define DMA1_Channel6_IRQn DMA1_Channel4_5_6_7_IRQn
|
||||
#define DMA1_Channel7_IRQn DMA1_Channel4_5_6_7_IRQn
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue