diff --git a/drivers/dht/dht.c b/drivers/dht/dht.c index 81754ac15f..73afdee581 100644 --- a/drivers/dht/dht.c +++ b/drivers/dht/dht.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "extmod/machine_pulse.h" +#include "extmod/modmachine.h" #include "drivers/dht/dht.h" // Allow the open-drain-high call to be DHT specific for ports that need it diff --git a/extmod/machine_bitstream.c b/extmod/machine_bitstream.c index 30f1ff1ea3..af093a4b54 100644 --- a/extmod/machine_bitstream.c +++ b/extmod/machine_bitstream.c @@ -27,7 +27,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "extmod/machine_bitstream.h" +#include "extmod/modmachine.h" #if MICROPY_PY_MACHINE_BITSTREAM diff --git a/extmod/machine_bitstream.h b/extmod/machine_bitstream.h deleted file mode 100644 index 2e759aedd5..0000000000 --- a/extmod/machine_bitstream.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2021 Jim Mussared - * Copyright (c) 2021 Damien P. George - * - * 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. - */ -#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_BITSTREAM_H -#define MICROPY_INCLUDED_EXTMOD_MACHINE_BITSTREAM_H - -#include "py/obj.h" -#include "py/mphal.h" - -void machine_bitstream_high_low(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len); - -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bitstream_obj); - -#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_BITSTREAM_H diff --git a/extmod/machine_pinbase.c b/extmod/machine_pinbase.c index 8607e6ed3d..90c17d7ab6 100644 --- a/extmod/machine_pinbase.c +++ b/extmod/machine_pinbase.c @@ -27,10 +27,9 @@ #include "py/mpconfig.h" #if MICROPY_PY_MACHINE -#include "py/obj.h" #include "py/runtime.h" +#include "extmod/modmachine.h" #include "extmod/virtpin.h" -#include "extmod/machine_pinbase.h" // PinBase class diff --git a/extmod/machine_pinbase.h b/extmod/machine_pinbase.h deleted file mode 100644 index c96abbc46c..0000000000 --- a/extmod/machine_pinbase.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Paul Sokolovsky - * - * 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. - */ -#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H -#define MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H - -#include "py/obj.h" - -extern const mp_obj_type_t machine_pinbase_type; - -#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PINBASE_H diff --git a/extmod/machine_pulse.c b/extmod/machine_pulse.c index 7178b22d79..157566d984 100644 --- a/extmod/machine_pulse.c +++ b/extmod/machine_pulse.c @@ -26,7 +26,7 @@ #include "py/runtime.h" #include "py/mperrno.h" -#include "extmod/machine_pulse.h" +#include "extmod/modmachine.h" #if MICROPY_PY_MACHINE_PULSE diff --git a/extmod/machine_pulse.h b/extmod/machine_pulse.h deleted file mode 100644 index e303dca02e..0000000000 --- a/extmod/machine_pulse.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Damien P. George - * - * 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. - */ -#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H -#define MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H - -#include "py/obj.h" -#include "py/mphal.h" - -mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us); - -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_time_pulse_us_obj); - -#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_PULSE_H diff --git a/extmod/machine_signal.c b/extmod/machine_signal.c index 7922ed7077..63fd0fe479 100644 --- a/extmod/machine_signal.c +++ b/extmod/machine_signal.c @@ -29,10 +29,9 @@ #include -#include "py/obj.h" #include "py/runtime.h" +#include "extmod/modmachine.h" #include "extmod/virtpin.h" -#include "extmod/machine_signal.h" // Signal class diff --git a/extmod/machine_signal.h b/extmod/machine_signal.h deleted file mode 100644 index df1c3e2e90..0000000000 --- a/extmod/machine_signal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Paul Sokolovsky - * - * 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. - */ -#ifndef MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H -#define MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H - -#include "py/obj.h" - -extern const mp_obj_type_t machine_signal_type; - -#endif // MICROPY_INCLUDED_EXTMOD_MACHINE_SIGNAL_H diff --git a/extmod/modmachine.h b/extmod/modmachine.h index 2a7ce336e9..4ef2bb3adb 100644 --- a/extmod/modmachine.h +++ b/extmod/modmachine.h @@ -27,6 +27,7 @@ #ifndef MICROPY_INCLUDED_EXTMOD_MODMACHINE_H #define MICROPY_INCLUDED_EXTMOD_MODMACHINE_H +#include "py/mphal.h" #include "py/obj.h" // Whether to enable the ADC.init() method. @@ -97,11 +98,19 @@ extern const mp_obj_type_t machine_adc_type; extern const mp_obj_type_t machine_i2c_type; extern const mp_obj_type_t machine_i2s_type; extern const mp_obj_type_t machine_pin_type; +extern const mp_obj_type_t machine_pinbase_type; extern const mp_obj_type_t machine_pwm_type; extern const mp_obj_type_t machine_rtc_type; +extern const mp_obj_type_t machine_signal_type; extern const mp_obj_type_t machine_spi_type; extern const mp_obj_type_t machine_timer_type; extern const mp_obj_type_t machine_uart_type; extern const mp_obj_type_t machine_wdt_type; +void machine_bitstream_high_low(mp_hal_pin_obj_t pin, uint32_t *timing_ns, const uint8_t *buf, size_t len); +mp_uint_t machine_time_pulse_us(mp_hal_pin_obj_t pin, int pulse_level, mp_uint_t timeout_us); + +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_bitstream_obj); +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(machine_time_pulse_us_obj); + #endif // MICROPY_INCLUDED_EXTMOD_MODMACHINE_H diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c index 96df32d435..bed29f7c04 100644 --- a/ports/esp32/modmachine.c +++ b/ports/esp32/modmachine.c @@ -40,10 +40,7 @@ #include "py/runtime.h" #include "shared/runtime/pyexec.h" #include "drivers/dht/dht.h" -#include "extmod/machine_bitstream.h" #include "extmod/machine_mem.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" diff --git a/ports/esp8266/modmachine.c b/ports/esp8266/modmachine.c index d7e8ed0333..a28c7c87fe 100644 --- a/ports/esp8266/modmachine.c +++ b/ports/esp8266/modmachine.c @@ -36,10 +36,7 @@ // This needs to be set before we include the RTOS headers #define USE_US_TIMER 1 -#include "extmod/machine_bitstream.h" #include "extmod/machine_mem.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" diff --git a/ports/esp8266/modos.c b/ports/esp8266/modos.c index 0194bf25f0..0ddcba2a32 100644 --- a/ports/esp8266/modos.c +++ b/ports/esp8266/modos.c @@ -35,7 +35,6 @@ #include "extmod/vfs_fat.h" #include "extmod/vfs_lfs.h" #include "genhdr/mpversion.h" -#include "esp_mphal.h" #include "user_interface.h" STATIC const char *mp_os_uname_release(void) { diff --git a/ports/mimxrt/modmachine.c b/ports/mimxrt/modmachine.c index ab7f1de485..c7d507074f 100644 --- a/ports/mimxrt/modmachine.c +++ b/ports/mimxrt/modmachine.c @@ -27,11 +27,8 @@ #include "py/runtime.h" #include "drivers/dht/dht.h" -#include "extmod/machine_bitstream.h" #include "extmod/machine_mem.h" #include "extmod/machine_i2c.h" -#include "extmod/machine_pulse.h" -#include "extmod/machine_signal.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" #include "shared/runtime/pyexec.h" diff --git a/ports/nrf/modules/machine/modmachine.c b/ports/nrf/modules/machine/modmachine.c index 4d39a29b03..df2662c62c 100644 --- a/ports/nrf/modules/machine/modmachine.c +++ b/ports/nrf/modules/machine/modmachine.c @@ -31,7 +31,6 @@ #include "py/runtime.h" #include "py/mphal.h" #include "extmod/machine_mem.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/modmachine.h" #include "shared/runtime/pyexec.h" diff --git a/ports/qemu-arm/modmachine.c b/ports/qemu-arm/modmachine.c index 0d712f792e..026ab8974d 100644 --- a/ports/qemu-arm/modmachine.c +++ b/ports/qemu-arm/modmachine.c @@ -25,8 +25,7 @@ */ #include "extmod/machine_mem.h" -#include "extmod/machine_pinbase.h" -#include "extmod/machine_signal.h" +#include "extmod/modmachine.h" #if MICROPY_PY_MACHINE diff --git a/ports/renesas-ra/modmachine.c b/ports/renesas-ra/modmachine.c index 62c9a392c0..8dbace21da 100644 --- a/ports/renesas-ra/modmachine.c +++ b/ports/renesas-ra/modmachine.c @@ -36,8 +36,6 @@ #include "py/mperrno.h" #include "py/mphal.h" #include "extmod/machine_mem.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" diff --git a/ports/rp2/modmachine.c b/ports/rp2/modmachine.c index 94d87cf314..a111da0f00 100644 --- a/ports/rp2/modmachine.c +++ b/ports/rp2/modmachine.c @@ -28,11 +28,8 @@ #include "py/mphal.h" #include "drivers/dht/dht.h" #include "shared/runtime/pyexec.h" -#include "extmod/machine_bitstream.h" #include "extmod/machine_i2c.h" #include "extmod/machine_mem.h" -#include "extmod/machine_pulse.h" -#include "extmod/machine_signal.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" diff --git a/ports/samd/modmachine.c b/ports/samd/modmachine.c index 97718401a3..4060ea5153 100644 --- a/ports/samd/modmachine.c +++ b/ports/samd/modmachine.c @@ -25,11 +25,8 @@ */ #include "py/runtime.h" -#include "extmod/machine_bitstream.h" #include "extmod/machine_mem.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" -#include "extmod/machine_signal.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" #include "drivers/dht/dht.h" diff --git a/ports/stm32/machine_bitstream.c b/ports/stm32/machine_bitstream.c index 3e1a7d6f1b..ed5cf1802e 100644 --- a/ports/stm32/machine_bitstream.c +++ b/ports/stm32/machine_bitstream.c @@ -26,7 +26,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "extmod/machine_bitstream.h" +#include "extmod/modmachine.h" #if MICROPY_PY_MACHINE_BITSTREAM diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 3bbac66879..98456dc6cb 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -32,10 +32,7 @@ #include "py/mperrno.h" #include "py/mphal.h" #include "drivers/dht/dht.h" -#include "extmod/machine_bitstream.h" #include "extmod/machine_mem.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h" diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c index dd3cbf96c0..2c1e0bed60 100644 --- a/ports/unix/modmachine.c +++ b/ports/unix/modmachine.c @@ -32,9 +32,7 @@ #include "py/obj.h" #include "extmod/machine_mem.h" -#include "extmod/machine_pinbase.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" +#include "extmod/modmachine.h" #if MICROPY_PLAT_DEV_MEM #include diff --git a/ports/zephyr/modmachine.c b/ports/zephyr/modmachine.c index 14ddf027ad..8498db1f03 100644 --- a/ports/zephyr/modmachine.c +++ b/ports/zephyr/modmachine.c @@ -33,8 +33,6 @@ #include "py/obj.h" #include "py/runtime.h" #include "extmod/machine_mem.h" -#include "extmod/machine_signal.h" -#include "extmod/machine_pulse.h" #include "extmod/machine_i2c.h" #include "extmod/machine_spi.h" #include "extmod/modmachine.h"