stmhal/mphalport: Implement mp_hal_pin_{input,output,write}.
This commit is contained in:
parent
d434ce3fca
commit
077dbf4a86
@ -45,7 +45,10 @@ void mp_hal_set_interrupt_char(int c); // -1 to disable
|
||||
#include "stmhal/pin.h"
|
||||
#define mp_hal_pin_obj_t pin_obj_t*
|
||||
#define mp_hal_get_pin_obj(o) (pin_obj_t*)pin_find(o)
|
||||
#define mp_hal_pin_input(p) mp_hal_gpio_config((p)->gpio, (p)->pin, 0, 0, 0)
|
||||
#define mp_hal_pin_output(p) mp_hal_gpio_config((p)->gpio, (p)->pin, 1, 0, 0)
|
||||
#define mp_hal_pin_open_drain(p) mp_hal_gpio_config((p)->gpio, (p)->pin, 5, 0, 0)
|
||||
#define mp_hal_pin_od_low(p) GPIO_clear_pin((p)->gpio, (p)->pin_mask)
|
||||
#define mp_hal_pin_od_high(p) GPIO_set_pin((p)->gpio, (p)->pin_mask)
|
||||
#define mp_hal_pin_read(p) GPIO_read_pin((p)->gpio, (p)->pin)
|
||||
#define mp_hal_pin_write(p, v) do { if (v) { GPIO_set_pin((p)->gpio, (p)->pin); } else { GPIO_clear_pin((p)->gpio, (p)->pin); } } while (0)
|
||||
|
Loading…
Reference in New Issue
Block a user