Skip to content

Commit 632d8ef

Browse files
dpgeorgepfalcon
authored andcommitted
esp8266: Add PWM support.
PWM implementation uses a timer and interrupts (FRC1), taken from Espressif's/NodeMCU's implementation and adapted for our use. 8 channels are supported, on pins 0, 2, 4, 5, 12, 13, 14, 15. Usage: import machine pwm0 = machine.PWM(machine.Pin(0)) pwm0.freq(1000) pwm0.duty(500) Frequency is shared (ie the same) for all channels. Frequency is between 1 and 1000. Duty is between 0 and 1023.
1 parent 82b95f6 commit 632d8ef

8 files changed

Lines changed: 628 additions & 0 deletions

File tree

esp8266/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,10 @@ SRC_C = \
5757
gccollect.c \
5858
lexerstr32.c \
5959
uart.c \
60+
esppwm.c \
6061
modpyb.c \
6162
modpybpin.c \
63+
modpybpwm.c \
6264
modpybrtc.c \
6365
modpybadc.c \
6466
modpybi2c.c \

esp8266/esp8266.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ SECTIONS
131131
*gchelper.o(.literal* .text*)
132132
*modpyb.o(.literal*, .text*)
133133
*modpybpin.o(.literal*, .text*)
134+
*modpybpwm.o(.literal*, .text*)
134135
*modpybrtc.o(.literal*, .text*)
135136
*modpybadc.o(.literal*, .text*)
136137
*modpybspi.o(.literal*, .text*)

0 commit comments

Comments
 (0)