diff --git a/esp8266/Makefile b/esp8266/Makefile index 245f95b409..3fce1788ca 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 5fb6f13796..20b259dff2 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 7a71c0f032..1622667f93 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 797ec0bd22..22bb45b158 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 b87906f789..9c84f04e45 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 62da4a721a..456d6cb046 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 8916da64f6..205c58aaee 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 871e4c3dd7..5d30f09656 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 d69fc47a8e..54eeea6f6e 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 25320fa1e7..80e10d1310 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 827907d42b..207422b67d 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 0ab3c122b7..29a72f7e4a 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 c23a119e8d..df7953ecb6 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 0d8958ceee..1bf7722409 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 ba53e71b37..9fe8039bc6 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 5b9d9fc766..0000000000 --- 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 1bd1c489d8..2adb6c563b 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"