Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/check valid pins #2910

Closed
wants to merge 17 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "added asserts for allowable pins"
This reverts commit 4110000.
pljakobs committed Nov 2, 2024
commit ef5f1058f4c3c61f386bbfba8217b6af591b6c0d
11 changes: 1 addition & 10 deletions Sming/Arch/Esp32/Core/HardwarePWM.cpp
Original file line number Diff line number Diff line change
@@ -142,19 +142,10 @@ HardwarePWM::HardwarePWM(uint8_t* pins, uint8_t no_of_pins) : channel_count(no_o
{
assert(no_of_pins > 0 && no_of_pins <= SOC_LEDC_CHANNEL_NUM);
no_of_pins = std::min(uint8_t(SOC_LEDC_CHANNEL_NUM), no_of_pins);
debug_i("initializing PERIPH_LEDC_MODULE");

periph_module_enable(PERIPH_LEDC_MODULE);

for(uint8_t i = 0; i < no_of_pins; i++) {
//make sure we don't try to use pins unavailable for the SoC
#if defined(__riscv)
//esp32c3
assert((pins[i] >= 0 && pins[i] <= 9) || (pins[i] >= 18 && pins[i] <= 21));
#elif
//esp32
if((pins[i] >= 0 && pins[i] <= 19) || (pins[i] >= 22 && pins[i] <= 28) || (pins[i] >= 32 && pins[i] <= 39))
;
#endif
channels[i] = pins[i];

/*
Loading