From 632d8efa0552a1dfb2615d29afc727e339b72574 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Mar 2016 13:37:27 +0000 Subject: 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. --- esp8266/modmachine.c | 1 + 1 file changed, 1 insertion(+) (limited to 'esp8266/modmachine.c') diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c index 41f246993..817b5a244 100644 --- a/esp8266/modmachine.c +++ b/esp8266/modmachine.c @@ -142,6 +142,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_Timer), MP_ROM_PTR(&esp_timer_type) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&pyb_pin_type) }, + { MP_ROM_QSTR(MP_QSTR_PWM), MP_ROM_PTR(&pyb_pwm_type) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&pyb_i2c_type) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&pyb_spi_type) }, }; -- cgit v1.2.3