Skip to content

Commit 6bab69b

Browse files
committed
πŸš‘ Migrate to Arduino esp32 v3 (#246)
**πŸ’₯ Breaking Changes to Arduino primitives interface** Removes the following primitives: chip_ledc_setup chip_ledc_attach_pin Adds the following primitives: chip_ledc_attach supported version: arduino-cli v0.35.3
1 parent ef6226d commit 6bab69b

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

β€Žsrc/Primitives/arduino.cpp

+4-15
Original file line numberDiff line numberDiff line change
@@ -591,25 +591,15 @@ def_prim(chip_ledc_set_duty, threeToNoneU32) {
591591
return true;
592592
}
593593

594-
def_prim(chip_ledc_setup, threeToNoneU32) {
594+
def_prim(chip_ledc_attach, threeToNoneU32) {
595595
uint32_t channel = arg2.uint32;
596596
uint32_t freq = arg1.uint32;
597-
uint32_t ledc_timer = arg0.uint32;
598-
// printf("chip_ledc_setup(%u, %u, %u)\n", channel, freq, ledc_timer);
599-
ledcSetup(channel, freq, ledc_timer);
597+
uint32_t resolution = arg0.uint32;
598+
ledcAttach(channel, freq, resolution);
600599
pop_args(3);
601600
return true;
602601
}
603602

604-
def_prim(chip_ledc_attach_pin, twoToNoneU32) {
605-
uint32_t pin = arg1.uint32;
606-
uint32_t channel = arg0.uint32;
607-
// printf("chip_ledc_attach_pin(%u,%u)\n", pin, channel);
608-
ledcAttachPin(pin, channel);
609-
pop_args(2);
610-
return true;
611-
}
612-
613603
// INTERRUPTS
614604

615605
def_prim(subscribe_interrupt, threeToNoneU32) {
@@ -992,8 +982,7 @@ void install_primitives() {
992982

993983
// temporary primitives needed for analogWrite in ESP32
994984
install_primitive(chip_analog_write);
995-
install_primitive(chip_ledc_setup);
996-
install_primitive(chip_ledc_attach_pin);
985+
install_primitive(chip_ledc_attach);
997986
install_primitive(chip_ledc_set_duty);
998987

999988
dbg_info("INSTALLING ISRs\n");

0 commit comments

Comments
Β (0)