Skip to content

Commit 92f9fef

Browse files
Merge pull request #397 from runger1101001/dev
fix RP2040 compile problems with earlehillpower
2 parents 26c631d + 14f6726 commit 92f9fef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/drivers/hardware_specific/rp2040/rp2040_mcu.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
#pragma message("SimpleFOC: compiling for RP2040")
1414
#pragma message("")
1515

16-
16+
#if !defined(SIMPLEFOC_DEBUG_RP2040)
1717
#define SIMPLEFOC_DEBUG_RP2040
18+
#endif
1819

1920
#include "../../hardware_api.h"
2021
#include "hardware/pwm.h"
2122
#include "hardware/clocks.h"
23+
#if defined(USE_ARDUINO_PINOUT)
2224
#include <pinDefinitions.h>
25+
#endif
2326

2427
#define _PWM_FREQUENCY 24000
2528
#define _PWM_FREQUENCY_MAX 66000
@@ -35,7 +38,11 @@ uint16_t wrapvalues[NUM_PWM_SLICES];
3538
// TODO add checks which channels are already used...
3639

3740
void setupPWM(int pin_nr, long pwm_frequency, bool invert, RP2040DriverParams* params, uint8_t index) {
41+
#if defined(USE_ARDUINO_PINOUT)
3842
uint pin = (uint)digitalPinToPinName(pin_nr); // we could check for -DBOARD_HAS_PIN_REMAP ?
43+
#else
44+
uint pin = (uint)pin_nr;
45+
#endif
3946
gpio_set_function(pin, GPIO_FUNC_PWM);
4047
uint slice = pwm_gpio_to_slice_num(pin);
4148
uint chan = pwm_gpio_to_channel(pin);

0 commit comments

Comments
 (0)