diff --git a/esp8266/Makefile b/esp8266/Makefile index 245f95b4096ff13d4bd7bcc98dc01aeeaf32c306..3fce1788caeeee0b50ed73ec1a6b7b839d665a8b 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -78,19 +78,19 @@ SRC_C = \ espapa102.c \ intr.c \ modpyb.c \ - modpybpin.c \ - modpybpwm.c \ - modpybrtc.c \ - modpybadc.c \ - modpybuart.c \ - modmachinewdt.c \ - modpybspi.c \ - modpybhspi.c \ + modmachine.c \ + machine_pin.c \ + machine_pwm.c \ + machine_rtc.c \ + machine_adc.c \ + machine_uart.c \ + machine_wdt.c \ + machine_spi.c \ + machine_hspi.c \ modesp.c \ modnetwork.c \ modutime.c \ moduos.c \ - modmachine.c \ modonewire.c \ ets_alt_task.c \ fatfs_port.c \ diff --git a/esp8266/esp8266.ld b/esp8266/esp8266.ld index 5fb6f13796a1241297398f139a943cce0491f0c3..20b259dff267254d574c68d8c4a074d6892c73e9 100644 --- a/esp8266/esp8266.ld +++ b/esp8266/esp8266.ld @@ -137,16 +137,16 @@ SECTIONS *lexerstr32.o(.literal* .text*) *utils.o(.literal* .text*) *modpyb.o(.literal*, .text*) - *modpybpin.o(.literal*, .text*) - *modpybpwm.o(.literal*, .text*) - *modpybrtc.o(.literal*, .text*) - *modpybadc.o(.literal*, .text*) - *modpybuart.o(.literal*, .text*) + *machine_pin.o(.literal*, .text*) + *machine_pwm.o(.literal*, .text*) + *machine_rtc.o(.literal*, .text*) + *machine_adc.o(.literal*, .text*) + *machine_uart.o(.literal*, .text*) *modpybi2c.o(.literal*, .text*) *modmachine.o(.literal*, .text*) - *modmachinewdt.o(.literal*, .text*) - *modpybspi.o(.literal*, .text*) - *modpybhspi.o(.literal*, .text*) + *machine_wdt.o(.literal*, .text*) + *machine_spi.o(.literal*, .text*) + *machine_hspi.o(.literal*, .text*) *hspi.o(.literal*, .text*) *modesp.o(.literal* .text*) *modnetwork.o(.literal* .text*) diff --git a/esp8266/esp_mphal.h b/esp8266/esp_mphal.h index 7a71c0f0327cd37bb99170ba7df4dd36c0cfb8f1..1622667f9379e895571c82c1d028f9f309a925d4 100644 --- a/esp8266/esp_mphal.h +++ b/esp8266/esp_mphal.h @@ -75,7 +75,7 @@ void ets_event_poll(void); // C-level pin HAL #include "etshal.h" #include "gpio.h" -#include "esp8266/modpyb.h" +#include "esp8266/modmachine.h" #define mp_hal_pin_obj_t uint32_t #define mp_hal_get_pin_obj(o) mp_obj_get_pin(o) void mp_hal_pin_input(mp_hal_pin_obj_t pin); diff --git a/esp8266/esponewire.c b/esp8266/esponewire.c index 797ec0bd224b0e91ff225ca66b9445e76bc8929c..22bb45b158acd83265eb72f2e20dfa54acbaed9b 100644 --- a/esp8266/esponewire.c +++ b/esp8266/esponewire.c @@ -28,7 +28,7 @@ #include "etshal.h" #include "user_interface.h" -#include "modpyb.h" +#include "modmachine.h" #include "esponewire.h" #define TIMING_RESET1 (0) diff --git a/esp8266/fatfs_port.c b/esp8266/fatfs_port.c index b87906f789e093b13dc8716649816d2882bb629c..9c84f04e45ce09df44da99061464144acd8eaa79 100644 --- a/esp8266/fatfs_port.c +++ b/esp8266/fatfs_port.c @@ -27,7 +27,7 @@ #include "py/obj.h" #include "lib/fatfs/ff.h" #include "timeutils.h" -#include "modpybrtc.h" +#include "modmachine.h" DWORD get_fattime(void) { diff --git a/esp8266/intr.c b/esp8266/intr.c index 62da4a721a04c5298f03a114178f4ed1c296a5b4..456d6cb0464f9d566abaef4c5d2c3483987aa7a5 100644 --- a/esp8266/intr.c +++ b/esp8266/intr.c @@ -27,7 +27,7 @@ #include "etshal.h" #include "ets_alt_task.h" -#include "modpyb.h" +#include "modmachine.h" // this is in a separate file so it can go in iRAM void pin_intr_handler_iram(void *arg) { diff --git a/esp8266/modpybadc.c b/esp8266/machine_adc.c similarity index 100% rename from esp8266/modpybadc.c rename to esp8266/machine_adc.c diff --git a/esp8266/modpybhspi.c b/esp8266/machine_hspi.c similarity index 100% rename from esp8266/modpybhspi.c rename to esp8266/machine_hspi.c diff --git a/esp8266/modpybpin.c b/esp8266/machine_pin.c similarity index 99% rename from esp8266/modpybpin.c rename to esp8266/machine_pin.c index 8916da64f67e2ace89922723e7c379f3bc15deac..205c58aaeeaa834cb91e883cf52c3d96e20b96e0 100644 --- a/esp8266/modpybpin.c +++ b/esp8266/machine_pin.c @@ -37,7 +37,7 @@ #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" -#include "modpyb.h" +#include "modmachine.h" #define GET_TRIGGER(phys_port) \ GPIO_PIN_INT_TYPE_GET(GPIO_REG_READ(GPIO_PIN_ADDR(phys_port))) diff --git a/esp8266/modpybpwm.c b/esp8266/machine_pwm.c similarity index 99% rename from esp8266/modpybpwm.c rename to esp8266/machine_pwm.c index 871e4c3dd7acacd436cd9766a402a44e48246b0c..5d30f09656351903454244c58045e8907f75217c 100644 --- a/esp8266/modpybpwm.c +++ b/esp8266/machine_pwm.c @@ -31,7 +31,7 @@ #include "py/nlr.h" #include "py/runtime.h" -#include "modpyb.h" +#include "modmachine.h" typedef struct _pyb_pwm_obj_t { mp_obj_base_t base; diff --git a/esp8266/modpybrtc.c b/esp8266/machine_rtc.c similarity index 99% rename from esp8266/modpybrtc.c rename to esp8266/machine_rtc.c index d69fc47a8edd2e82d7d57291491b6397356afd9b..54eeea6f6e1ba198087fb6201f8a3b0eb1964249 100644 --- a/esp8266/modpybrtc.c +++ b/esp8266/machine_rtc.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "timeutils.h" #include "user_interface.h" -#include "modpyb.h" +#include "modmachine.h" typedef struct _pyb_rtc_obj_t { mp_obj_base_t base; diff --git a/esp8266/modpybspi.c b/esp8266/machine_spi.c similarity index 100% rename from esp8266/modpybspi.c rename to esp8266/machine_spi.c diff --git a/esp8266/modpybuart.c b/esp8266/machine_uart.c similarity index 99% rename from esp8266/modpybuart.c rename to esp8266/machine_uart.c index 25320fa1e78301272037e84fd16243f2863f547e..80e10d13102e0420a55beacd18b95c1753978664 100644 --- a/esp8266/modpybuart.c +++ b/esp8266/machine_uart.c @@ -34,7 +34,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mperrno.h" -#include "modpyb.h" +#include "modmachine.h" // UartDev is defined and initialized in rom code. extern UartDevice UartDev; diff --git a/esp8266/modmachinewdt.c b/esp8266/machine_wdt.c similarity index 100% rename from esp8266/modmachinewdt.c rename to esp8266/machine_wdt.c diff --git a/esp8266/modesp.c b/esp8266/modesp.c index 827907d42bd6e20a8e16578c409e82b1de757354..207422b67d16a763153d0dae92982066c66170f5 100644 --- a/esp8266/modesp.c +++ b/esp8266/modesp.c @@ -45,8 +45,7 @@ #include "mem.h" #include "espneopixel.h" #include "espapa102.h" -#include "modpyb.h" -#include "modpybrtc.h" +#include "modmachine.h" #define MODESP_ESPCONN (0) diff --git a/esp8266/modmachine.c b/esp8266/modmachine.c index 0ab3c122b7eaa756dba0969423f6238566f65878..29a72f7e4a3c7ef96c7f2e747c88fba886e271d8 100644 --- a/esp8266/modmachine.c +++ b/esp8266/modmachine.c @@ -33,8 +33,7 @@ #include "extmod/machine_mem.h" #include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" -#include "modpyb.h" -#include "modpybrtc.h" +#include "modmachine.h" #include "xtirq.h" #include "os_type.h" diff --git a/esp8266/modpyb.h b/esp8266/modmachine.h similarity index 82% rename from esp8266/modpyb.h rename to esp8266/modmachine.h index c23a119e8dc0c1e07d665b487afa50d045556002..df7953ecb69e194b5b989293f3bc5d0271f7d164 100644 --- a/esp8266/modpyb.h +++ b/esp8266/modmachine.h @@ -33,4 +33,11 @@ pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in); int pin_get(uint pin); void pin_set(uint pin, int value); +extern uint32_t pyb_rtc_alarm0_wake; +extern uint64_t pyb_rtc_alarm0_expiry; + +void pyb_rtc_set_us_since_2000(uint64_t nowus); +uint64_t pyb_rtc_get_us_since_2000(); +void rtc_prepare_deepsleep(uint64_t sleep_us); + #endif // __MICROPY_INCLUDED_ESP8266_MODPYB_H__ diff --git a/esp8266/modonewire.c b/esp8266/modonewire.c index 0d8958ceeec4d5abfaddf0bb026f5f18f8372f53..1bf77224096e0fa85e284789edcbb01807560f11 100644 --- a/esp8266/modonewire.c +++ b/esp8266/modonewire.c @@ -29,7 +29,7 @@ #include "py/obj.h" #include "py/mphal.h" -#include "modpyb.h" +#include "modmachine.h" #include "esponewire.h" STATIC mp_obj_t onewire_timings(mp_obj_t timings_in) { diff --git a/esp8266/modpyb.c b/esp8266/modpyb.c index ba53e71b37db7c4565bed2da84d2c588865b87c9..9fe8039bc602260c0d105d33dfbef98ca86b5265 100644 --- a/esp8266/modpyb.c +++ b/esp8266/modpyb.c @@ -28,12 +28,12 @@ #include "py/gc.h" #include "gccollect.h" -#include "modpyb.h" +#include "modmachine.h" // The pyb module no longer exists since all functionality now appears // elsewhere, in more standard places (eg time, machine modules). The // only remaining function is pyb.info() which has been moved to the -// esp module, pending deletion/renaming/moving elsewher. +// esp module, pending deletion/renaming/moving elsewhere. STATIC mp_obj_t pyb_info(mp_uint_t n_args, const mp_obj_t *args) { // print info about memory diff --git a/esp8266/modpybrtc.h b/esp8266/modpybrtc.h deleted file mode 100644 index 5b9d9fc766f6b4a9a591de04d3f8accc285789ec..0000000000000000000000000000000000000000 --- a/esp8266/modpybrtc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2015 Josef Gajdusek - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -extern uint32_t pyb_rtc_alarm0_wake; -extern uint64_t pyb_rtc_alarm0_expiry; - -void pyb_rtc_set_us_since_2000(uint64_t nowus); - -uint64_t pyb_rtc_get_us_since_2000(); - -void rtc_prepare_deepsleep(uint64_t sleep_us); diff --git a/esp8266/modutime.c b/esp8266/modutime.c index 1bd1c489d88046f478e8210b641248b344cb5090..2adb6c563b378047b50627d68ec4d0214847959a 100644 --- a/esp8266/modutime.c +++ b/esp8266/modutime.c @@ -34,8 +34,7 @@ #include "py/runtime.h" #include "py/mphal.h" #include "py/smallint.h" -#include "modpyb.h" -#include "modpybrtc.h" +#include "modmachine.h" #include "timeutils.h" #include "user_interface.h" #include "extmod/utime_mphal.h"