Skip to content

Commit

Permalink
PWM doesn't initialise GPIO correctly
Browse files Browse the repository at this point in the history
Bug introduced in #2752
  • Loading branch information
mikee47 committed Oct 17, 2024
1 parent 199f17c commit dfcda27
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Sming/Arch/Esp8266/Core/HardwarePWM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@

extern const uint8_t esp8266_pinmuxOffset[];

static const uint8_t gpioPinFunc[]{
FUNC_GPIO0, //
FUNC_GPIO1, //
FUNC_GPIO2, //
FUNC_GPIO3, //
FUNC_GPIO4, //
FUNC_GPIO5, //
FUNC_GPIO6, //
FUNC_GPIO7, //
FUNC_GPIO8, //
FUNC_GPIO9, //
FUNC_GPIO10, //
FUNC_GPIO11, //
FUNC_GPIO12, //
FUNC_GPIO13, //
FUNC_GPIO14, //
FUNC_GPIO15, //
};

HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t noOfPins) : channel_count(noOfPins)
{
if(noOfPins == 0) {
Expand All @@ -49,7 +68,7 @@ HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t noOfPins) : channel_count(noOfPi
continue;
}
ioInfo[pinCount][0] = PERIPHS_IO_MUX + esp8266_pinmuxOffset[pin];
ioInfo[pinCount][1] = esp8266_gpioToFn[pin];
ioInfo[pinCount][1] = gpioPinFunc[pin];
ioInfo[pinCount][2] = pin;
pwmDutyInit[pinCount] = 0; // Start with zero output
channels[pinCount] = pin;
Expand Down

0 comments on commit dfcda27

Please sign in to comment.