summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/mphal.h
blob: fb567d141113f69a2e07410ae6fdd90c17a3db41 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
// We use the ST Cube HAL library for most hardware peripherals
#include <stm32f4xx_hal.h>

// Basic GPIO functions
#define GPIO_read_pin(gpio, pin)        (((gpio)->IDR >> (pin)) & 1)
#define GPIO_set_pin(gpio, pin_mask)    (((gpio)->BSRRL) = (pin_mask))
#define GPIO_clear_pin(gpio, pin_mask)  (((gpio)->BSRRH) = (pin_mask))
#define GPIO_read_output_pin(gpio, pin) (((gpio)->ODR >> (pin)) & 1)

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