diff options
Diffstat (limited to 'stmhal')
| -rw-r--r-- | stmhal/Makefile | 2 | ||||
| -rw-r--r-- | stmhal/adc.c | 3 | ||||
| -rw-r--r-- | stmhal/boards/stm32f4xx_prefix.c | 2 | ||||
| -rw-r--r-- | stmhal/can.c | 2 | ||||
| -rw-r--r-- | stmhal/extint.c | 2 | ||||
| -rw-r--r-- | stmhal/i2c.c | 2 | ||||
| -rw-r--r-- | stmhal/irq.c | 3 | ||||
| -rw-r--r-- | stmhal/led.c | 3 | ||||
| -rw-r--r-- | stmhal/main.c | 2 | ||||
| -rw-r--r-- | stmhal/modmachine.c | 2 | ||||
| -rw-r--r-- | stmhal/modnwwiznet5k.c | 2 | ||||
| -rw-r--r-- | stmhal/moduselect.c | 2 | ||||
| -rw-r--r-- | stmhal/mpconfigport.h | 2 | ||||
| -rw-r--r-- | stmhal/mphalport.c (renamed from stmhal/mphal.c) | 6 | ||||
| -rw-r--r-- | stmhal/mphalport.h (renamed from stmhal/mphal.h) | 9 | ||||
| -rw-r--r-- | stmhal/pin.c | 2 | ||||
| -rw-r--r-- | stmhal/pin_defs_stmhal.c | 1 | ||||
| -rw-r--r-- | stmhal/pin_named_pins.c | 2 | ||||
| -rw-r--r-- | stmhal/printf.c | 4 | ||||
| -rw-r--r-- | stmhal/pybstdio.c | 2 | ||||
| -rw-r--r-- | stmhal/pyexec.c | 4 | ||||
| -rw-r--r-- | stmhal/spi.c | 2 | ||||
| -rw-r--r-- | stmhal/stm32_it.c | 2 | ||||
| -rw-r--r-- | stmhal/timer.c | 1 | ||||
| -rw-r--r-- | stmhal/uart.c | 2 | ||||
| -rw-r--r-- | stmhal/usbd_desc.c | 2 | ||||
| -rw-r--r-- | stmhal/usrsw.c | 2 |
27 files changed, 27 insertions, 43 deletions
diff --git a/stmhal/Makefile b/stmhal/Makefile index 222e19b32..8c0cd2175 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -113,7 +113,7 @@ SRC_C = \ usbd_desc.c \ usbd_cdc_interface.c \ usbd_msc_storage.c \ - mphal.c \ + mphalport.c \ irq.c \ pendsv.c \ systick.c \ diff --git a/stmhal/adc.c b/stmhal/adc.c index c70d88eaf..d8ce90cb3 100644 --- a/stmhal/adc.c +++ b/stmhal/adc.c @@ -25,16 +25,15 @@ */ #include <stdio.h> -#include STM32_HAL_H #include <string.h> #include "py/nlr.h" #include "py/runtime.h" #include "py/binary.h" +#include "py/mphal.h" #include "adc.h" #include "pin.h" #include "genhdr/pins.h" -#include "mphal.h" #include "timer.h" /// \moduleref pyb diff --git a/stmhal/boards/stm32f4xx_prefix.c b/stmhal/boards/stm32f4xx_prefix.c index 529e0f0c3..f4ffdab68 100644 --- a/stmhal/boards/stm32f4xx_prefix.c +++ b/stmhal/boards/stm32f4xx_prefix.c @@ -3,8 +3,8 @@ #include <stdio.h> #include "py/obj.h" +#include "py/mphal.h" #include "pin.h" -#include MICROPY_HAL_H #define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \ { \ diff --git a/stmhal/can.c b/stmhal/can.c index 18fd31eeb..38ddf7448 100644 --- a/stmhal/can.c +++ b/stmhal/can.c @@ -33,10 +33,10 @@ #include "py/objtuple.h" #include "py/runtime.h" #include "py/gc.h" +#include "py/mphal.h" #include "bufhelper.h" #include "can.h" #include "pybioctl.h" -#include MICROPY_HAL_H #if MICROPY_HW_ENABLE_CAN diff --git a/stmhal/extint.c b/stmhal/extint.c index ebd9d3e39..1fcf587db 100644 --- a/stmhal/extint.c +++ b/stmhal/extint.c @@ -31,7 +31,7 @@ #include "py/nlr.h" #include "py/runtime.h" #include "py/gc.h" -#include MICROPY_HAL_H +#include "py/mphal.h" #include "pin.h" #include "extint.h" diff --git a/stmhal/i2c.c b/stmhal/i2c.c index af37abf44..eb6716ce3 100644 --- a/stmhal/i2c.c +++ b/stmhal/i2c.c @@ -29,13 +29,13 @@ #include "py/nlr.h" #include "py/runtime.h" +#include "py/mphal.h" #include "irq.h" #include "pin.h" #include "genhdr/pins.h" #include "bufhelper.h" #include "dma.h" #include "i2c.h" -#include MICROPY_HAL_H #if !defined(MICROPY_HW_I2C_BAUDRATE_DEFAULT) #define MICROPY_HW_I2C_BAUDRATE_DEFAULT 400000 diff --git a/stmhal/irq.c b/stmhal/irq.c index 7a265a52b..749e4813c 100644 --- a/stmhal/irq.c +++ b/stmhal/irq.c @@ -26,10 +26,9 @@ #include "py/nlr.h" #include "py/obj.h" +#include "py/mphal.h" #include "irq.h" -#include MICROPY_HAL_H - /// \moduleref pyb /// \function wfi() diff --git a/stmhal/led.c b/stmhal/led.c index e3dbdb594..ca52931e3 100644 --- a/stmhal/led.c +++ b/stmhal/led.c @@ -25,15 +25,14 @@ */ #include <stdio.h> -#include STM32_HAL_H #include "py/nlr.h" #include "py/runtime.h" +#include "py/mphal.h" #include "timer.h" #include "led.h" #include "pin.h" #include "genhdr/pins.h" -#include "mphal.h" #if defined(MICROPY_HW_LED1) diff --git a/stmhal/main.c b/stmhal/main.c index fe4b4c20c..de52cac8f 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -34,6 +34,7 @@ #include "py/runtime.h" #include "py/stackctrl.h" #include "py/gc.h" +#include "py/mphal.h" #include "lib/fatfs/ff.h" @@ -60,7 +61,6 @@ #include "dac.h" #include "can.h" #include "modnetwork.h" -#include MICROPY_HAL_H void SystemClock_Config(void); diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c index fa6a1f9dd..6a0c4a9fc 100644 --- a/stmhal/modmachine.c +++ b/stmhal/modmachine.c @@ -29,6 +29,7 @@ #include "modmachine.h" #include "py/gc.h" #include "py/runtime.h" +#include "py/mphal.h" #include "lib/fatfs/ff.h" #include "lib/fatfs/diskio.h" #include "gccollect.h" @@ -38,7 +39,6 @@ #include "pin.h" #include "timer.h" #include "usb.h" -#include MICROPY_HAL_H // machine.info([dump_alloc_table]) // Print out lots of information about the board. diff --git a/stmhal/modnwwiznet5k.c b/stmhal/modnwwiznet5k.c index 48d9be170..2feb9b953 100644 --- a/stmhal/modnwwiznet5k.c +++ b/stmhal/modnwwiznet5k.c @@ -32,12 +32,12 @@ #include "py/nlr.h" #include "py/objlist.h" #include "py/runtime.h" +#include "py/mphal.h" #include "netutils.h" #include "modnetwork.h" #include "pin.h" #include "genhdr/pins.h" #include "spi.h" -#include MICROPY_HAL_H #include "ethernet/wizchip_conf.h" #include "ethernet/socket.h" diff --git a/stmhal/moduselect.c b/stmhal/moduselect.c index 0ba595488..232520ec4 100644 --- a/stmhal/moduselect.c +++ b/stmhal/moduselect.c @@ -30,8 +30,8 @@ #include "py/nlr.h" #include "py/obj.h" #include "py/objlist.h" +#include "py/mphal.h" #include "pybioctl.h" -#include MICROPY_HAL_H /// \module select - Provides select function to wait for events on a stream /// diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 52032135c..3848daa8f 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -199,7 +199,6 @@ typedef void *machine_ptr_t; // must be of pointer size typedef const void *machine_const_ptr_t; // must be of pointer size typedef long mp_off_t; -void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len); #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len) // We have inlined IRQ functions for efficiency (they are generally @@ -242,7 +241,6 @@ static inline mp_uint_t disable_irq(void) { // We need to provide a declaration/definition of alloca() #include <alloca.h> -#define MICROPY_HAL_H "mphal.h" #define MICROPY_PIN_DEFS_PORT_H "pin_defs_stmhal.h" #endif // __INCLUDED_MPCONFIGPORT_H diff --git a/stmhal/mphal.c b/stmhal/mphalport.c index 145ed8a1f..147a8682d 100644 --- a/stmhal/mphal.c +++ b/stmhal/mphalport.c @@ -2,9 +2,9 @@ #include <string.h> #include "py/mpstate.h" +#include "py/mphal.h" #include "usb.h" #include "uart.h" -#include "mphal.h" // this table converts from HAL_StatusTypeDef to POSIX errno const byte mp_hal_status_to_errno_table[4] = { @@ -48,7 +48,7 @@ void mp_hal_stdout_tx_str(const char *str) { mp_hal_stdout_tx_strn(str, strlen(str)); } -void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { +void mp_hal_stdout_tx_strn(const char *str, size_t len) { if (MP_STATE_PORT(pyb_stdio_uart) != NULL) { uart_tx_strn(MP_STATE_PORT(pyb_stdio_uart), str, len); } @@ -60,7 +60,7 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { } } -void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len) { +void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) { // send stdout to UART and USB CDC VCP if (MP_STATE_PORT(pyb_stdio_uart) != NULL) { uart_tx_strn_cooked(MP_STATE_PORT(pyb_stdio_uart), str, len); diff --git a/stmhal/mphal.h b/stmhal/mphalport.h index bafee7b13..652f1e7be 100644 --- a/stmhal/mphal.h +++ b/stmhal/mphalport.h @@ -8,7 +8,7 @@ #elif defined(MCU_SERIES_F7) #define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff0f420) #else -#error mphal.h: Unrecognized MCU_SERIES +#error mphalport.h: Unrecognized MCU_SERIES #endif // Basic GPIO functions @@ -24,15 +24,10 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio); -extern const byte mp_hal_status_to_errno_table[4]; +extern const unsigned char mp_hal_status_to_errno_table[4]; NORETURN void mp_hal_raise(HAL_StatusTypeDef status); void mp_hal_set_interrupt_char(int c); // -1 to disable -int mp_hal_stdin_rx_chr(void); -void mp_hal_stdout_tx_str(const char *str); -void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len); -void mp_hal_stdout_tx_strn_cooked(const char *str, mp_uint_t len); - #define mp_hal_delay_ms HAL_Delay #define mp_hal_ticks_ms HAL_GetTick diff --git a/stmhal/pin.c b/stmhal/pin.c index 3aba94975..a0f3994f7 100644 --- a/stmhal/pin.c +++ b/stmhal/pin.c @@ -30,7 +30,7 @@ #include "py/nlr.h" #include "py/runtime.h" -#include MICROPY_HAL_H +#include "py/mphal.h" #include "pin.h" /// \moduleref pyb diff --git a/stmhal/pin_defs_stmhal.c b/stmhal/pin_defs_stmhal.c index 6dfefb6bb..0aef5f95f 100644 --- a/stmhal/pin_defs_stmhal.c +++ b/stmhal/pin_defs_stmhal.c @@ -1,6 +1,5 @@ #include "py/obj.h" #include "pin.h" -#include MICROPY_HAL_H // Returns the pin mode. This value returned by this macro should be one of: // GPIO_MODE_INPUT, GPIO_MODE_OUTPUT_PP, GPIO_MODE_OUTPUT_OD, diff --git a/stmhal/pin_named_pins.c b/stmhal/pin_named_pins.c index d0cf8adc8..9e5f9593b 100644 --- a/stmhal/pin_named_pins.c +++ b/stmhal/pin_named_pins.c @@ -28,7 +28,7 @@ #include <string.h> #include "py/runtime.h" -#include MICROPY_HAL_H +#include "py/mphal.h" #include "pin.h" STATIC void pin_named_pins_obj_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { diff --git a/stmhal/printf.c b/stmhal/printf.c index 87cf4f0f9..611ad2df4 100644 --- a/stmhal/printf.c +++ b/stmhal/printf.c @@ -29,9 +29,7 @@ #include <stdarg.h> #include "py/obj.h" -#ifdef MICROPY_HAL_H -#include MICROPY_HAL_H -#endif +#include "py/mphal.h" #if MICROPY_PY_BUILTINS_FLOAT #include "py/formatfloat.h" diff --git a/stmhal/pybstdio.c b/stmhal/pybstdio.c index de0a3a0e3..72c164b36 100644 --- a/stmhal/pybstdio.c +++ b/stmhal/pybstdio.c @@ -30,7 +30,7 @@ #include "py/obj.h" #include "py/stream.h" -#include MICROPY_HAL_H +#include "py/mphal.h" // TODO make stdin, stdout and stderr writable objects so they can // be changed by Python code. This requires some changes, as these diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c index f5de90422..116a41d35 100644 --- a/stmhal/pyexec.c +++ b/stmhal/pyexec.c @@ -33,9 +33,7 @@ #include "py/runtime.h" #include "py/repl.h" #include "py/gc.h" -#ifdef MICROPY_HAL_H -#include MICROPY_HAL_H -#endif +#include "py/mphal.h" #if defined(USE_DEVICE_MODE) #include "irq.h" #include "usb.h" diff --git a/stmhal/spi.c b/stmhal/spi.c index 864463df2..7458da627 100644 --- a/stmhal/spi.c +++ b/stmhal/spi.c @@ -29,13 +29,13 @@ #include "py/nlr.h" #include "py/runtime.h" +#include "py/mphal.h" #include "irq.h" #include "pin.h" #include "genhdr/pins.h" #include "bufhelper.h" #include "dma.h" #include "spi.h" -#include MICROPY_HAL_H // The following defines are for compatability with the '405 #if !defined(MICROPY_HW_SPI1_NSS) diff --git a/stmhal/stm32_it.c b/stmhal/stm32_it.c index dfc33b7c2..1c510d35f 100644 --- a/stmhal/stm32_it.c +++ b/stmhal/stm32_it.c @@ -92,7 +92,7 @@ extern PCD_HandleTypeDef pcd_handle; #if REPORT_HARD_FAULT_REGS -#include "mphal.h" +#include "py/mphal.h" char *fmt_hex(uint32_t val, char *buf) { const char *hexDig = "0123456789abcdef"; diff --git a/stmhal/timer.c b/stmhal/timer.c index f88229b8a..18c027cf3 100644 --- a/stmhal/timer.c +++ b/stmhal/timer.c @@ -35,7 +35,6 @@ #include "py/nlr.h" #include "py/runtime.h" #include "py/gc.h" -#include MICROPY_HAL_H #include "timer.h" #include "servo.h" #include "pin.h" diff --git a/stmhal/uart.c b/stmhal/uart.c index 177318aec..79c272bdb 100644 --- a/stmhal/uart.c +++ b/stmhal/uart.c @@ -32,9 +32,9 @@ #include "py/nlr.h" #include "py/runtime.h" #include "py/stream.h" +#include "py/mphal.h" #include "uart.h" #include "pybioctl.h" -#include MICROPY_HAL_H //TODO: Add UART7/8 support for MCU_SERIES_F7 diff --git a/stmhal/usbd_desc.c b/stmhal/usbd_desc.c index 32e4fd043..1ad960b46 100644 --- a/stmhal/usbd_desc.c +++ b/stmhal/usbd_desc.c @@ -35,7 +35,7 @@ // need these headers just for MP_HAL_UNIQUE_ID_ADDRESS #include "py/misc.h" -#include MICROPY_HAL_H +#include "py/mphal.h" // So we don't clash with existing ST boards, we use the unofficial FOSS VID. // This needs a proper solution. diff --git a/stmhal/usrsw.c b/stmhal/usrsw.c index 225373ca8..69b0ca9ab 100644 --- a/stmhal/usrsw.c +++ b/stmhal/usrsw.c @@ -27,10 +27,10 @@ #include <stdio.h> #include "py/runtime.h" +#include "py/mphal.h" #include "extint.h" #include "pin.h" #include "genhdr/pins.h" -#include "mphal.h" #include "usrsw.h" #if MICROPY_HW_HAS_SWITCH |
