| 13 | #include <hardware/platform_defs.h> |
| 14 | |
| 15 | static void pico_pin_mode(struct rt_device *dev, rt_base_t pin, rt_uint8_t mode) |
| 16 | { |
| 17 | RT_ASSERT((0 <= pin) && (pin < NUM_BANK0_GPIOS)); |
| 18 | |
| 19 | gpio_init(pin); |
| 20 | switch (mode) |
| 21 | { |
| 22 | case PIN_MODE_OUTPUT: |
| 23 | gpio_set_dir(pin, GPIO_OUT); |
| 24 | break; |
| 25 | case PIN_MODE_INPUT: |
| 26 | gpio_set_dir(pin, GPIO_IN); |
| 27 | break; |
| 28 | case PIN_MODE_INPUT_PULLUP: |
| 29 | gpio_pull_up(pin); |
| 30 | break; |
| 31 | case PIN_MODE_INPUT_PULLDOWN: |
| 32 | gpio_pull_down(pin); |
| 33 | break; |
| 34 | case PIN_MODE_OUTPUT_OD: |
| 35 | gpio_disable_pulls(pin); |
| 36 | break; |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | static void pico_pin_write(struct rt_device *dev, rt_base_t pin, rt_uint8_t value) |
| 41 | { |
nothing calls this directly
no test coverage detected