aboutsummaryrefslogtreecommitdiff
path: root/stmhal/mphal.h
diff options
context:
space:
mode:
authorDamien George2015-10-30 23:03:58 +0000
committerPaul Sokolovsky2015-10-31 19:14:30 +0300
commit731f359292c0e2630873df1a19c5baac7287024f (patch)
tree3aef09fd15b82baa9fff7c72fe3bc7e05a869614 /stmhal/mphal.h
parent0bd3f3291d3ea0252a91653a1edcbfa83d524834 (diff)
all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such as stdio and delay/ticks, which ports should provide definitions for. A port will also provide mphalport.h with further HAL declarations.
Diffstat (limited to 'stmhal/mphal.h')
-rw-r--r--stmhal/mphal.h38
1 files changed, 0 insertions, 38 deletions
diff --git a/stmhal/mphal.h b/stmhal/mphal.h
deleted file mode 100644
index bafee7b13..000000000
--- a/stmhal/mphal.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// We use the ST Cube HAL library for most hardware peripherals
-#include STM32_HAL_H
-
-// The unique id address differs per MCU. Ideally this define should
-// go in some MCU-specific header, but for now it lives here.
-#if defined(MCU_SERIES_F4)
-#define MP_HAL_UNIQUE_ID_ADDRESS (0x1fff7a10)
-#elif defined(MCU_SERIES_F7)
-#define MP_HAL_UNIQUE_ID_ADDRESS (0x1ff0f420)
-#else
-#error mphal.h: Unrecognized MCU_SERIES
-#endif
-
-// Basic GPIO functions
-#define GPIO_read_pin(gpio, pin) (((gpio)->IDR >> (pin)) & 1)
-#if defined(MCU_SERIES_F7)
-#define GPIO_set_pin(gpio, pin_mask) (((gpio)->BSRR) = (pin_mask))
-#define GPIO_clear_pin(gpio, pin_mask) (((gpio)->BSRR) = ((pin_mask) << 16))
-#else
-#define GPIO_set_pin(gpio, pin_mask) (((gpio)->BSRRL) = (pin_mask))
-#define GPIO_clear_pin(gpio, pin_mask) (((gpio)->BSRRH) = (pin_mask))
-#endif
-#define GPIO_read_output_pin(gpio, pin) (((gpio)->ODR >> (pin)) & 1)
-
-void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio);
-
-extern const byte 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