1 /* 2 * Copyright (c) 2006-2022, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2018-04-12 RT-Thread the first version 9 */ 10 11 #ifndef __DRV_PIN_H__ 12 #define __DRV_PIN_H__ 13 14 #include <hal_gpio.h> 15 16 /* IO port */ 17 enum gpio_port 18 { 19 GPIO_PORT_RESERVED0 = 0, 20 GPIO_PORT_B, 21 GPIO_PORT_C, 22 GPIO_PORT_D, 23 GPIO_PORT_E, 24 GPIO_PORT_F, 25 GPIO_PORT_G, 26 GPIO_PORT_NUM, 27 }; 28 29 /* IO pin */ 30 enum gpio_pin 31 { 32 GPIO_PIN_0 = 0, 33 GPIO_PIN_1, 34 GPIO_PIN_2, 35 GPIO_PIN_3, 36 GPIO_PIN_4, 37 GPIO_PIN_5, 38 GPIO_PIN_6, 39 GPIO_PIN_7, 40 GPIO_PIN_8, 41 GPIO_PIN_9, 42 GPIO_PIN_10, 43 GPIO_PIN_11, 44 GPIO_PIN_12, 45 GPIO_PIN_13, 46 GPIO_PIN_14, 47 GPIO_PIN_15, 48 GPIO_PIN_16, 49 GPIO_PIN_17, 50 GPIO_PIN_18, 51 GPIO_PIN_19, 52 GPIO_PIN_20, 53 GPIO_PIN_21, 54 GPIO_PIN_22, 55 GPIO_PIN_NUM, 56 }; 57 58 #define HAL_GPIO(bank,num) GPIO_P##bank##num 59 60 #define GET_GPIO_PORT(PIN) (PIN / 32) 61 #define GET_GPIO_PIN(PIN) (PIN % 32) 62 #define GET_PIN(PORTx, PIN) (rt_base_t)(32 * PORTx + PIN) 63 64 #endif 65