1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2023-12-02 Meco Man the first version 9 */ 10 11 #ifndef __DRV_GPIO_H__ 12 #define __DRV_GPIO_H__ 13 14 #include <rtdef.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #define PIN_LOW 0x00 21 #define PIN_HIGH 0x01 22 23 #define PIN_MODE_OUTPUT 0x00 24 #define PIN_MODE_INPUT 0x01 25 #define PIN_MODE_INPUT_PULLUP 0x02 26 #define PIN_MODE_INPUT_PULLDOWN 0x03 27 #define PIN_MODE_OUTPUT_OD 0x04 28 29 #define GET_PIN(PORTx,PIN) (rt_uint64_t)((((rt_uint64_t)GPIO_PIN_##PIN) << 32) | (rt_uint64_t)(rt_ubase_t)GPIO##PORTx) 30 31 void rt_pin_mode(rt_uint64_t pin, rt_uint8_t mode); 32 void rt_pin_write(rt_uint64_t pin, rt_uint8_t value); 33 rt_int8_t rt_pin_read(rt_uint64_t pin); 34 35 #ifdef __cplusplus 36 } 37 #endif 38 39 #endif /* __DRV_GPIO_H__ */ 40