diff --git a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c index 8be1abef1fff0..83e45d4afb5c1 100644 --- a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c @@ -32,6 +32,7 @@ #include "py/stream.h" #include "shared-bindings/_bleio/__init__.h" +#include "shared-bindings/_bleio/CharacteristicBuffer.h" #include "shared-bindings/_bleio/Connection.h" #include "supervisor/shared/tick.h" #include "common-hal/_bleio/CharacteristicBuffer.h" diff --git a/devices/ble_hci/common-hal/_bleio/Connection.h b/devices/ble_hci/common-hal/_bleio/Connection.h index 2933bb87a5550..185a8b3517584 100644 --- a/devices/ble_hci/common-hal/_bleio/Connection.h +++ b/devices/ble_hci/common-hal/_bleio/Connection.h @@ -85,5 +85,6 @@ typedef struct { uint16_t bleio_connection_get_conn_handle(bleio_connection_obj_t *self); mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *connection); bleio_connection_internal_t *bleio_conn_handle_to_connection(uint16_t conn_handle); +void bleio_connection_clear(bleio_connection_internal_t *self); #endif // MICROPY_INCLUDED_BLE_HCI_COMMON_HAL_CONNECTION_H diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index 5a3eb94737087..b84f7b25377a1 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -924,7 +924,7 @@ STATIC void process_find_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl } } -void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) { +static void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, uint8_t data[]) { struct bt_att_read_group_req *req = (struct bt_att_read_group_req *)data; uint16_t type_uuid = req->uuid[0] | (req->uuid[1] << 8); diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c index 7410ac1e5d0e3..b61d40ac7c4dc 100644 --- a/lib/utils/interrupt_char.c +++ b/lib/utils/interrupt_char.c @@ -26,6 +26,7 @@ #include "py/obj.h" #include "py/mpstate.h" +#include "lib/utils/interrupt_char.h" #if MICROPY_KBD_EXCEPTION diff --git a/lib/utils/sys_stdio_mphal.c b/lib/utils/sys_stdio_mphal.c index e2e1999c25d65..f1667e90d5406 100644 --- a/lib/utils/sys_stdio_mphal.c +++ b/lib/utils/sys_stdio_mphal.c @@ -52,7 +52,7 @@ typedef struct _sys_stdio_obj_t { STATIC const sys_stdio_obj_t stdio_buffer_obj; #endif -void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +static void stdio_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { sys_stdio_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_printf(print, "", self->fd); } diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c index 5e7bb82c77719..2d809c258c498 100644 --- a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c +++ b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c @@ -26,6 +26,7 @@ */ #include "common-hal/analogio/AnalogIn.h" +#include "shared-bindings/analogio/AnalogIn.h" #include "shared-bindings/microcontroller/Pin.h" #include diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.c b/ports/mimxrt10xx/common-hal/busio/I2C.c index 74639d0ef169e..65b8eaeeef364 100644 --- a/ports/mimxrt10xx/common-hal/busio/I2C.c +++ b/ports/mimxrt10xx/common-hal/busio/I2C.c @@ -30,6 +30,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/busio/I2C.h" +#include "common-hal/busio/I2C.h" #include "py/mperrno.h" #include "py/runtime.h" #include "periph.h" diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.h b/ports/mimxrt10xx/common-hal/busio/I2C.h index 789f01a5f5d6b..6b37255fe3dd8 100644 --- a/ports/mimxrt10xx/common-hal/busio/I2C.h +++ b/ports/mimxrt10xx/common-hal/busio/I2C.h @@ -41,4 +41,6 @@ typedef struct { const mcu_periph_obj_t *sda; } busio_i2c_obj_t; +void i2c_reset(void); + #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_BUSIO_I2C_H diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index ec0296156ad2c..a8a430e67269b 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -65,7 +65,7 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) { | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } -void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *user_data) { +static void LPUART_UserCallback(LPUART_Type *base, lpuart_handle_t *handle, status_t status, void *user_data) { busio_uart_obj_t *self = (busio_uart_obj_t *)user_data; if (status == kStatus_LPUART_RxIdle) { diff --git a/ports/mimxrt10xx/common-hal/busio/UART.h b/ports/mimxrt10xx/common-hal/busio/UART.h index 604fef2cf31cc..000b142d365df 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.h +++ b/ports/mimxrt10xx/common-hal/busio/UART.h @@ -51,4 +51,6 @@ typedef struct { const mcu_periph_obj_t *rts; } busio_uart_obj_t; +void uart_reset(void); + #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_BUSIO_UART_H diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c index 445ffa91c5e04..9c63487b36b1c 100644 --- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c +++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -40,7 +40,7 @@ #define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U -void pin_config(const mcu_pin_obj_t *pin, bool open_drain, digitalio_pull_t pull) { +static void pin_config(const mcu_pin_obj_t *pin, bool open_drain, digitalio_pull_t pull) { IOMUXC_SetPinConfig(0, 0, 0, 0, pin->cfg_reg, IOMUXC_SW_PAD_CTL_PAD_HYS(1) | IOMUXC_SW_PAD_CTL_PAD_PUS((pull == PULL_UP) ? 2 : 0) diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index b097133d5791c..697d97ca432a6 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -28,6 +28,7 @@ #include #include "common-hal/microcontroller/Processor.h" +#include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" #include "fsl_tempmon.h" diff --git a/ports/mimxrt10xx/common-hal/os/__init__.c b/ports/mimxrt10xx/common-hal/os/__init__.c index dd1d186f1c5b6..e2c43e43faf14 100644 --- a/ports/mimxrt10xx/common-hal/os/__init__.c +++ b/ports/mimxrt10xx/common-hal/os/__init__.c @@ -31,6 +31,8 @@ #include "py/objtuple.h" #include "py/qstr.h" +#include "shared-bindings/os/__init__.h" + #include "fsl_trng.h" STATIC const qstr os_uname_info_fields[] = { @@ -58,7 +60,7 @@ mp_obj_t common_hal_os_uname(void) { return (mp_obj_t)&os_uname_info_obj; } -bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { +bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { trng_config_t trngConfig; TRNG_GetDefaultConfig(&trngConfig); diff --git a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.h b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.h index da022b738dc06..b3b39d5487ee8 100644 --- a/ports/mimxrt10xx/common-hal/pulseio/PulseOut.h +++ b/ports/mimxrt10xx/common-hal/pulseio/PulseOut.h @@ -40,6 +40,6 @@ typedef struct { } pulseio_pulseout_obj_t; void pulseout_reset(void); -// void pulseout_interrupt_handler(uint8_t index); +void pulseout_interrupt_handler(uint8_t index); #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_PULSEIO_PULSEOUT_H diff --git a/ports/mimxrt10xx/common-hal/rtc/RTC.c b/ports/mimxrt10xx/common-hal/rtc/RTC.c index aabe2b09f26bf..2173389e0d84b 100644 --- a/ports/mimxrt10xx/common-hal/rtc/RTC.c +++ b/ports/mimxrt10xx/common-hal/rtc/RTC.c @@ -31,6 +31,8 @@ #include "py/runtime.h" #include "lib/timeutils/timeutils.h" #include "shared-bindings/rtc/__init__.h" +#include "shared-bindings/rtc/RTC.h" +#include "common-hal/rtc/RTC.h" #include "supervisor/shared/translate.h" #include "fsl_snvs_hp.h" diff --git a/ports/mimxrt10xx/mphalport.c b/ports/mimxrt10xx/mphalport.c index ff7a880ab7c0e..ad0fb4d9ba050 100644 --- a/ports/mimxrt10xx/mphalport.c +++ b/ports/mimxrt10xx/mphalport.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ +#include "py/mphal.h" #include "py/mpstate.h" #include "py/smallint.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c index e6354386a9db6..3502516ca0134 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c @@ -34,6 +34,7 @@ #include "fsl_clock.h" #include "fsl_iomuxc.h" +#include "clocks.h" #define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ #define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ diff --git a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c index 251e6f9acd693..ae238cede0484 100644 --- a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c +++ b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c @@ -12,7 +12,7 @@ #include "boards/flash_config.h" #include "supervisor/linker.h" -status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t baseAddr) +status_t PLACE_IN_ITCM(static flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t baseAddr) { flexspi_transfer_t flashXfer; status_t status; @@ -29,7 +29,7 @@ status_t PLACE_IN_ITCM(flexspi_nor_write_enable)(FLEXSPI_Type * base, uint32_t b return status; } -status_t PLACE_IN_ITCM(flexspi_nor_wait_bus_busy)(FLEXSPI_Type * base) +static status_t PLACE_IN_ITCM(flexspi_nor_wait_bus_busy)(FLEXSPI_Type * base) { /* Wait status ready. */ bool isBusy; diff --git a/ports/mimxrt10xx/supervisor/internal_flash.h b/ports/mimxrt10xx/supervisor/internal_flash.h index ae33fd134fa84..1682ef9280c4d 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.h +++ b/ports/mimxrt10xx/supervisor/internal_flash.h @@ -31,6 +31,8 @@ #include "py/mpconfig.h" +#include "fsl_common.h" + #define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms #define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2) @@ -41,4 +43,8 @@ #define ROM_INDEX_PAGEPROGRAM 9 #define ROM_INDEX_READSTATUSREG 1 +extern status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address); +extern status_t flexspi_nor_flash_page_program(FLEXSPI_Type *base, uint32_t dstAddr, const uint32_t *src); +extern status_t flexspi_nor_enable_quad_mode(FLEXSPI_Type *base); + #endif // MICROPY_INCLUDED_MIMXRT10XX_INTERNAL_FLASH_H diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index 57f038799004f..67fbea51b55c2 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -26,6 +26,7 @@ */ #include "fsl_clock.h" +#include "fsl_device_registers.h" #include "tusb.h" #include "supervisor/usb.h" @@ -52,6 +53,7 @@ void init_usb_hardware(void) { usb_phy->TX = phytx; } +extern void USB_OTG1_IRQHandler(void); void USB_OTG1_IRQHandler(void) { usb_irq_handler(); } diff --git a/shared-bindings/_bleio/CharacteristicBuffer.h b/shared-bindings/_bleio/CharacteristicBuffer.h index e82e96ca96a7e..39a3f9b23f129 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.h +++ b/shared-bindings/_bleio/CharacteristicBuffer.h @@ -36,7 +36,7 @@ uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer uint32_t common_hal_bleio_characteristic_buffer_rx_characters_available(bleio_characteristic_buffer_obj_t *self); void common_hal_bleio_characteristic_buffer_clear_rx_buffer(bleio_characteristic_buffer_obj_t *self); bool common_hal_bleio_characteristic_buffer_deinited(bleio_characteristic_buffer_obj_t *self); -int common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_obj_t *self); +void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_obj_t *self); bool common_hal_bleio_characteristic_buffer_connected(bleio_characteristic_buffer_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H diff --git a/shared-bindings/_bleio/ScanEntry.h b/shared-bindings/_bleio/ScanEntry.h index b37cb610972e9..766ba25deff2b 100644 --- a/shared-bindings/_bleio/ScanEntry.h +++ b/shared-bindings/_bleio/ScanEntry.h @@ -39,6 +39,6 @@ mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_ mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self); bool common_hal_bleio_scanentry_get_connectable(bleio_scanentry_obj_t *self); bool common_hal_bleio_scanentry_get_scan_response(bleio_scanentry_obj_t *self); -bool common_hal_bleio_scanentry_matches(bleio_scanentry_obj_t *self, uint8_t *prefixes, size_t prefixes_len, bool all); +bool common_hal_bleio_scanentry_matches(bleio_scanentry_obj_t *self, const uint8_t *prefixes, size_t prefixes_len, bool all); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_SCANENTRY_H diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 06b3a899d8089..05346296fd442 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -49,7 +49,7 @@ //| #if BOARD_I2C -mp_obj_t board_i2c(void) { +static mp_obj_t board_i2c(void) { mp_obj_t singleton = common_hal_board_get_i2c(); if (singleton != NULL && !common_hal_busio_i2c_deinited(singleton)) { return singleton; @@ -59,7 +59,7 @@ mp_obj_t board_i2c(void) { return common_hal_board_create_i2c(); } #else -mp_obj_t board_i2c(void) { +static mp_obj_t board_i2c(void) { mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_I2C); return NULL; } @@ -73,7 +73,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c); //| ... //| #if BOARD_SPI -mp_obj_t board_spi(void) { +static mp_obj_t board_spi(void) { mp_obj_t singleton = common_hal_board_get_spi(); if (singleton != NULL && !common_hal_busio_spi_deinited(singleton)) { return singleton; @@ -84,7 +84,7 @@ mp_obj_t board_spi(void) { return common_hal_board_create_spi(); } #else -mp_obj_t board_spi(void) { +static mp_obj_t board_spi(void) { mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_SPI); return NULL; } @@ -101,7 +101,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi); //| ... //| #if BOARD_UART -mp_obj_t board_uart(void) { +static mp_obj_t board_uart(void) { mp_obj_t singleton = common_hal_board_get_uart(); if (singleton != NULL) { return singleton; @@ -113,7 +113,7 @@ mp_obj_t board_uart(void) { return common_hal_board_create_uart(); } #else -mp_obj_t board_uart(void) { +static mp_obj_t board_uart(void) { mp_raise_NotImplementedError_varg(translate("No default %q bus"), MP_QSTR_UART); return NULL; } diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 798f3c361f6d7..9d49a4d623ca2 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -68,7 +68,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); //| """Change current directory.""" //| ... //| -mp_obj_t os_chdir(mp_obj_t path_in) { +STATIC mp_obj_t os_chdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_chdir(path); return mp_const_none; @@ -79,7 +79,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir); //| """Get the current directory.""" //| ... //| -mp_obj_t os_getcwd(void) { +STATIC mp_obj_t os_getcwd(void) { return common_hal_os_getcwd(); } MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); @@ -88,7 +88,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... //| -mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t os_listdir(size_t n_args, const mp_obj_t *args) { const char *path; if (n_args == 1) { path = mp_obj_str_get_str(args[0]); @@ -103,7 +103,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir); //| """Create a new directory.""" //| ... //| -mp_obj_t os_mkdir(mp_obj_t path_in) { +STATIC mp_obj_t os_mkdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_mkdir(path); return mp_const_none; @@ -114,7 +114,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir); //| """Remove a file.""" //| ... //| -mp_obj_t os_remove(mp_obj_t path_in) { +STATIC mp_obj_t os_remove(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_remove(path); return mp_const_none; @@ -125,7 +125,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove); //| """Remove a directory.""" //| ... //| -mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { +STATIC mp_obj_t os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { const char *old_path = mp_obj_str_get_str(old_path_in); const char *new_path = mp_obj_str_get_str(new_path_in); common_hal_os_rename(old_path, new_path); @@ -137,7 +137,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename); //| """Rename a file.""" //| ... //| -mp_obj_t os_rmdir(mp_obj_t path_in) { +STATIC mp_obj_t os_rmdir(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); common_hal_os_rmdir(path); return mp_const_none; @@ -153,7 +153,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir); //| which is the number of seconds corresponding to 1999-12-31.""" //| ... //| -mp_obj_t os_stat(mp_obj_t path_in) { +STATIC mp_obj_t os_stat(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); return common_hal_os_stat(path); } @@ -180,7 +180,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat); //| in a port-specific implementation.""" //| ... //| -mp_obj_t os_statvfs(mp_obj_t path_in) { +STATIC mp_obj_t os_statvfs(mp_obj_t path_in) { const char *path = mp_obj_str_get_str(path_in); return common_hal_os_statvfs(path); } diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 612203b56d583..817405ad75668 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -107,7 +107,7 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg //| //| :return: The number of 512-byte blocks, as a number""" //| -mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { +STATIC mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; return mp_obj_new_int_from_ull(common_hal_sdcardio_sdcard_get_blockcount(self)); } @@ -118,7 +118,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count); //| //| :return: None""" //| -mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { +STATIC mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; common_hal_sdcardio_sdcard_deinit(self); return mp_const_none; @@ -136,7 +136,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| :return: None""" //| -mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); @@ -160,7 +160,7 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdcardio_sdcard_readblocks_obj, sdcardio_sdcard_readbl //| :return: None""" //| -mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { +STATIC mp_obj_t sdcardio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 7b436a4df17b3..3f7355ee4210b 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -51,7 +51,7 @@ //| :param bool readonly: True when the filesystem should be readonly to CircuitPython.""" //| ... //| -mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t storage_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_readonly }; static const mp_arg_t allowed_args[] = { { MP_QSTR_readonly, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, @@ -87,7 +87,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(storage_mount_obj, 2, storage_mount); //| This is the CircuitPython analog to the UNIX ``umount`` command.""" //| ... //| -mp_obj_t storage_umount(mp_obj_t mnt_in) { +STATIC mp_obj_t storage_umount(mp_obj_t mnt_in) { if (MP_OBJ_IS_STR(mnt_in)) { common_hal_storage_umount_path(mp_obj_str_get_str(mnt_in)); } else { @@ -108,7 +108,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); //| filesystem will be corrupted.""" //| ... //| -mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_readonly, ARG_disable_concurrent_write_protection }; static const mp_arg_t allowed_args[] = { { MP_QSTR_readonly, MP_ARG_BOOL, {.u_bool = false} }, @@ -132,7 +132,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(storage_remount_obj, 1, storage_remount); //| """Retrieves the mount object associated with the mount path""" //| ... //| -mp_obj_t storage_getmount(const mp_obj_t mnt_in) { +STATIC mp_obj_t storage_getmount(const mp_obj_t mnt_in) { return common_hal_storage_getmount(mp_obj_str_get_str(mnt_in)); } MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); @@ -152,7 +152,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); //| ... //| -mp_obj_t storage_erase_filesystem(void) { +STATIC mp_obj_t storage_erase_filesystem(void) { common_hal_storage_erase_filesystem(); return mp_const_none; } diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 87f766db260af..78aee2a272ac3 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -79,7 +79,7 @@ STATIC mp_obj_t time_sleep(mp_obj_t seconds_o) { MP_DEFINE_CONST_FUN_OBJ_1(time_sleep_obj, time_sleep); #if MICROPY_PY_COLLECTIONS -mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { +static mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { if (n_args != 1 || (kw_args != NULL && kw_args->used > 0)) { return namedtuple_make_new(type, n_args, args, kw_args); } diff --git a/shared-module/_bleio/ScanEntry.c b/shared-module/_bleio/ScanEntry.c index 28ff215a35860..89cd0bdb5560c 100644 --- a/shared-module/_bleio/ScanEntry.c +++ b/shared-module/_bleio/ScanEntry.c @@ -29,6 +29,7 @@ #include #include "shared-bindings/_bleio/Address.h" +#include "shared-bindings/_bleio/ScanEntry.h" #include "shared-module/_bleio/Address.h" #include "shared-module/_bleio/ScanEntry.h" diff --git a/shared-module/_pixelbuf/PixelBuf.c b/shared-module/_pixelbuf/PixelBuf.c index df160b1ffa0e5..97446dfcffcda 100644 --- a/shared-module/_pixelbuf/PixelBuf.c +++ b/shared-module/_pixelbuf/PixelBuf.c @@ -140,7 +140,7 @@ void common_hal__pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_float_t b } } -uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { +static uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { if (MP_OBJ_IS_SMALL_INT(obj)) { return MP_OBJ_SMALL_INT_VALUE(obj); } else if (MP_OBJ_IS_INT(obj)) { @@ -152,7 +152,7 @@ uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { translate("can't convert %q to %q"), mp_obj_get_type_qstr(obj), MP_QSTR_int); } -void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { +static void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { pixelbuf_byteorder_details_t *byteorder = &self->byteorder; // w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have // per-pixel brightness). Set the defaults here in case it isn't set below. @@ -197,7 +197,7 @@ void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_ } } -void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { +static void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { // DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right // by three to leave the top five bits. if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) { @@ -235,7 +235,7 @@ void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint } } -void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { +static void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { uint8_t r; uint8_t g; uint8_t b; diff --git a/shared-module/audiocore/WaveFile.c b/shared-module/audiocore/WaveFile.c index 4864004d52e21..28a59d8a8edb5 100644 --- a/shared-module/audiocore/WaveFile.c +++ b/shared-module/audiocore/WaveFile.c @@ -160,14 +160,6 @@ uint8_t common_hal_audioio_wavefile_get_channel_count(audioio_wavefile_obj_t *se return self->channel_count; } -bool audioio_wavefile_samples_signed(audioio_wavefile_obj_t *self) { - return self->bits_per_sample > 8; -} - -uint32_t audioio_wavefile_max_buffer_length(audioio_wavefile_obj_t *self) { - return 512; -} - void audioio_wavefile_reset_buffer(audioio_wavefile_obj_t *self, bool single_channel, uint8_t channel) { diff --git a/shared-module/audiomixer/MixerVoice.c b/shared-module/audiomixer/MixerVoice.c index 34fa907a5b527..bb58b0c111171 100644 --- a/shared-module/audiomixer/MixerVoice.c +++ b/shared-module/audiomixer/MixerVoice.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ #include "shared-bindings/audiomixer/Mixer.h" +#include "shared-bindings/audiomixer/MixerVoice.h" #include "shared-module/audiomixer/MixerVoice.h" #include diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index 2b623233e0d08..6c9be601ab4ed 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -290,10 +290,6 @@ uint8_t common_hal_audiomp3_mp3file_get_channel_count(audiomp3_mp3file_obj_t *se return self->channel_count; } -bool audiomp3_mp3file_samples_signed(audiomp3_mp3file_obj_t *self) { - return true; -} - void audiomp3_mp3file_reset_buffer(audiomp3_mp3file_obj_t *self, bool single_channel, uint8_t channel) { diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 4c8b8872006cd..74935ae07ea10 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -216,17 +216,6 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16 } } -int16_t constrain(int16_t input, int16_t min, int16_t max) { - // constrain the input between the min and max values - if (input < min) { - return min; - } - if (input > max) { - return max; - } - return input; -} - void common_hal_bitmaptools_fill_region(displayio_bitmap_t *destination, int16_t x1, int16_t y1, int16_t x2, int16_t y2, diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 9dbca48fd1916..e9e794f516fc9 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -29,6 +29,9 @@ #include "mpconfigboard.h" #include "py/runtime.h" +#include "shared-bindings/board/__init__.h" +#include "shared-module/board/__init__.h" + #if CIRCUITPY_BUSIO #include "shared-bindings/busio/I2C.h" #include "shared-bindings/busio/SPI.h" diff --git a/shared-module/busio/OneWire.c b/shared-module/busio/OneWire.c index 80c55c7b2ba7b..de3a49d3411a0 100644 --- a/shared-module/busio/OneWire.c +++ b/shared-module/busio/OneWire.c @@ -27,6 +27,7 @@ // Wraps the bitbangio implementation of OneWire for use in busio. #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/bitbangio/OneWire.h" +#include "shared-bindings/busio/OneWire.h" #include "shared-module/busio/OneWire.h" void common_hal_busio_onewire_construct(busio_onewire_obj_t *self, diff --git a/shared-module/gamepad/__init__.c b/shared-module/gamepad/__init__.c index c707886065a86..d35a577c8c06c 100644 --- a/shared-module/gamepad/__init__.c +++ b/shared-module/gamepad/__init__.c @@ -27,8 +27,9 @@ #include #include "py/mpstate.h" -#include "shared-bindings/gamepad/__init__.h" #include "shared-bindings/gamepad/GamePad.h" +#include "shared-bindings/gamepad/__init__.h" +#include "shared-module/gamepad/__init__.h" #include "supervisor/shared/tick.h" #include "shared-bindings/digitalio/DigitalInOut.h" diff --git a/shared-module/random/__init__.c b/shared-module/random/__init__.c index 95ac3bc659936..0dfa36a97e7e5 100644 --- a/shared-module/random/__init__.c +++ b/shared-module/random/__init__.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "shared-bindings/os/__init__.h" #include "shared-bindings/time/__init__.h" +#include "shared-bindings/random/__init__.h" // Yasmarang random number generator // by Ilya Levin diff --git a/shared-module/struct/__init__.c b/shared-module/struct/__init__.c index 7a7ea845e7e27..86751bdd90130 100644 --- a/shared-module/struct/__init__.c +++ b/shared-module/struct/__init__.c @@ -33,7 +33,7 @@ #include "py/parsenum.h" #include "supervisor/shared/translate.h" -void struct_validate_format(char fmt) { +static void struct_validate_format(char fmt) { #if MICROPY_NONSTANDARD_TYPECODES if (fmt == 'S' || fmt == 'O') { mp_raise_RuntimeError(translate("'S' and 'O' are not supported format types")); @@ -41,7 +41,7 @@ void struct_validate_format(char fmt) { #endif } -char get_fmt_type(const char **fmt) { +static char get_fmt_type(const char **fmt) { char t = **fmt; switch (t) { case '!': @@ -60,7 +60,7 @@ char get_fmt_type(const char **fmt) { return t; } -mp_uint_t get_fmt_num(const char **p) { +static mp_uint_t get_fmt_num(const char **p) { const char *num = *p; uint len = 1; while (unichar_isdigit(*++num)) { @@ -71,7 +71,7 @@ mp_uint_t get_fmt_num(const char **p) { return val; } -mp_uint_t calcsize_items(const char *fmt) { +static mp_uint_t calcsize_items(const char *fmt) { mp_uint_t cnt = 0; while (*fmt) { int num = 1; diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c index 8ef2acd1caebe..8a9deb5d288a6 100644 --- a/shared-module/terminalio/Terminal.c +++ b/shared-module/terminalio/Terminal.c @@ -25,6 +25,7 @@ */ #include "shared-module/terminalio/Terminal.h" +#include "shared-bindings/terminalio/Terminal.h" #include "shared-module/fontio/BuiltinFont.h" #include "shared-bindings/displayio/TileGrid.h" diff --git a/shared-module/time/__init__.c b/shared-module/time/__init__.c index c79a5f3ae7af6..b4575b18a2cf1 100644 --- a/shared-module/time/__init__.c +++ b/shared-module/time/__init__.c @@ -27,6 +27,7 @@ #include "py/mphal.h" #include "supervisor/port.h" #include "supervisor/shared/tick.h" +#include "shared-bindings/time/__init__.h" uint64_t common_hal_time_monotonic_ms(void) { return supervisor_ticks_ms64(); diff --git a/shared-module/usb_midi/PortIn.c b/shared-module/usb_midi/PortIn.c index e00a5124cfe0e..2f04915681383 100644 --- a/shared-module/usb_midi/PortIn.c +++ b/shared-module/usb_midi/PortIn.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "shared-module/usb_midi/PortIn.h" +#include "shared-bindings/usb_midi/PortIn.h" #include "supervisor/shared/translate.h" #include "tusb.h" diff --git a/shared-module/usb_midi/PortOut.c b/shared-module/usb_midi/PortOut.c index f453a67671e3d..20ac2f43848d3 100644 --- a/shared-module/usb_midi/PortOut.c +++ b/shared-module/usb_midi/PortOut.c @@ -25,6 +25,7 @@ */ #include "shared-module/usb_midi/PortOut.h" +#include "shared-bindings/usb_midi/PortOut.h" #include "supervisor/shared/translate.h" #include "tusb.h" diff --git a/shared-module/usb_midi/__init__.c b/shared-module/usb_midi/__init__.c index 0684112b72656..b77aefea9476a 100644 --- a/shared-module/usb_midi/__init__.c +++ b/shared-module/usb_midi/__init__.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/usb_midi/__init__.h" +#include "shared-module/usb_midi/__init__.h" #include "genhdr/autogen_usb_descriptor.h" #include "py/obj.h" diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 0dafb5398d145..6d9008f588a57 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -30,6 +30,7 @@ #include "py/mpconfig.h" #include "supervisor/background_callback.h" #include "supervisor/linker.h" +#include "supervisor/port.h" #include "supervisor/shared/tick.h" #include "shared-bindings/microcontroller/__init__.h" diff --git a/supervisor/shared/bluetooth.c b/supervisor/shared/bluetooth.c index 00095c4f6b339..f01f277b5fc88 100644 --- a/supervisor/shared/bluetooth.c +++ b/supervisor/shared/bluetooth.c @@ -25,6 +25,9 @@ */ #if !CIRCUITPY_BLE_FILE_SERVICE + +#include "supervisor/shared/bluetooth.h" + void supervisor_start_bluetooth(void) { } diff --git a/supervisor/shared/flash.c b/supervisor/shared/flash.c index 33314adf1adb2..7f155999bdf09 100644 --- a/supervisor/shared/flash.c +++ b/supervisor/shared/flash.c @@ -29,6 +29,7 @@ #include "py/runtime.h" #include "lib/oofatfs/ff.h" #include "supervisor/shared/tick.h" +#include "supervisor/flash.h" #define VFS_INDEX 0 @@ -46,7 +47,7 @@ STATIC mp_obj_t supervisor_flash_obj_make_new(const mp_obj_type_t *type, size_t return (mp_obj_t)&supervisor_flash_obj; } -uint32_t flash_get_block_count(void) { +static uint32_t flash_get_block_count(void) { return PART1_START_BLOCK + supervisor_flash_get_block_count(); } @@ -86,7 +87,7 @@ static void build_partition(uint8_t *buf, int boot, int type, uint32_t start_blo buf[15] = num_blocks >> 24; } -mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) { +static mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) { if (block_num == 0) { // fake the MBR so we can decide on our own partition table @@ -114,7 +115,7 @@ mp_uint_t flash_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_bloc volatile bool filesystem_dirty = false; -mp_uint_t flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) { +static mp_uint_t flash_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t num_blocks) { if (block_num == 0) { if (num_blocks > 1) { return 1; // error @@ -160,7 +161,7 @@ STATIC mp_obj_t supervisor_flash_obj_writeblocks(mp_obj_t self, mp_obj_t block_n } STATIC MP_DEFINE_CONST_FUN_OBJ_3(supervisor_flash_obj_writeblocks_obj, supervisor_flash_obj_writeblocks); -bool flash_ioctl(size_t cmd, mp_int_t *out_value) { +static bool flash_ioctl(size_t cmd, mp_int_t *out_value) { *out_value = 0; switch (cmd) { case BP_IOCTL_INIT: diff --git a/supervisor/shared/micropython.c b/supervisor/shared/micropython.c index c68c4bf7e993d..0b53ff1482638 100644 --- a/supervisor/shared/micropython.c +++ b/supervisor/shared/micropython.c @@ -29,6 +29,7 @@ #include "supervisor/serial.h" #include "lib/oofatfs/ff.h" #include "py/mpconfig.h" +#include "py/mphal.h" #include "py/mpstate.h" #include "py/runtime.h" diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index f3077b46c3d68..d1dc66d18c2b6 100644 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -43,7 +43,7 @@ static size_t stack_length = 0; #define EXCEPTION_STACK_SIZE 1024 -void allocate_stack(void) { +static void allocate_stack(void) { if (port_has_fixed_stack()) { stack_limit = port_stack_get_limit(); diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index f40151988e98d..e09209eaac419 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -27,6 +27,7 @@ #include "supervisor/shared/tick.h" #include "lib/utils/interrupt_char.h" +#include "py/mphal.h" #include "py/mpstate.h" #include "py/runtime.h" #include "supervisor/linker.h" @@ -35,6 +36,7 @@ #include "supervisor/port.h" #include "supervisor/shared/autoreload.h" #include "supervisor/shared/stack.h" +#include "supervisor/shared/tick.h" #if CIRCUITPY_BLEIO #include "supervisor/shared/bluetooth.h" @@ -72,7 +74,7 @@ static background_callback_t tick_callback; volatile uint64_t last_finished_tick = 0; -void supervisor_background_tasks(void *unused) { +static void supervisor_background_tasks(void *unused) { port_start_background_task(); assert_heap_ok(); diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index ea5faaf06bcf8..ed7875826cbd7 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -57,7 +57,7 @@ static bool web_serial_connected = false; // descriptor. extern uint16_t usb_serial_number[1 + COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2]; -void load_serial_number(void) { +static void load_serial_number(void) { // create serial number based on device unique id uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; common_hal_mcu_processor_get_uid(raw_id); diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index 409bf0ea6cd33..e328ea0e3506e 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -36,6 +36,7 @@ #include "supervisor/filesystem.h" #include "supervisor/shared/autoreload.h" +#include "supervisor/usb.h" #define MSC_FLASH_BLOCK_SIZE 512 diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 4986c09570301..f572a3dc7393e 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -27,6 +27,7 @@ #include #include "py/mpconfig.h" #include "tusb.h" +#include "supervisor/shared/workflow.h" void supervisor_workflow_reset(void) { }