1 2 #ifndef _PINNAMES_H_ 3 #define _PINNAMES_H_ 4 5 #include "cmsis.h" 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #define PIN_DATA(PUPD, FUNC) (((PUPD) << 6) | (FUNC)) 12 #define PIN_PIN_PUPD(X) ((X) & 0x03) /* PullNone/PullUp/PullDown */ 13 #define PIN_FUNC(X) ((X) & 0x0F) /* PINMUX_FUNCTION_XXXX */ 14 15 typedef enum { 16 PORT_A = 0, 17 PORT_B = 1, 18 } GPIO_PORT; 19 20 typedef enum { 21 PIN_INPUT=0, 22 PIN_OUTPUT 23 } PinDirection; 24 25 /* (((port)<<5)|(pin)) */ 26 typedef enum { 27 PA_0 = (PORT_A<<5|0), 28 PA_1 = (PORT_A<<5|1), 29 PA_2 = (PORT_A<<5|2), 30 PA_3 = (PORT_A<<5|3), 31 PA_4 = (PORT_A<<5|4), 32 PA_5 = (PORT_A<<5|5), 33 PA_6 = (PORT_A<<5|6), 34 PA_7 = (PORT_A<<5|7), 35 PA_8 = (PORT_A<<5|8), 36 PA_9 = (PORT_A<<5|9), 37 PA_10 = (PORT_A<<5|10), 38 PA_11 = (PORT_A<<5|11), 39 PA_12 = (PORT_A<<5|12), 40 PA_13 = (PORT_A<<5|13), 41 PA_14 = (PORT_A<<5|14), 42 PA_15 = (PORT_A<<5|15), 43 PA_16 = (PORT_A<<5|16), 44 PA_17 = (PORT_A<<5|17), 45 PA_18 = (PORT_A<<5|18), 46 PA_19 = (PORT_A<<5|19), 47 PA_20 = (PORT_A<<5|20), 48 PA_21 = (PORT_A<<5|21), 49 PA_22 = (PORT_A<<5|22), 50 PA_23 = (PORT_A<<5|23), 51 PA_24 = (PORT_A<<5|24), 52 PA_25 = (PORT_A<<5|25), 53 PA_26 = (PORT_A<<5|26), 54 PA_27 = (PORT_A<<5|27), 55 PA_28 = (PORT_A<<5|28), 56 PA_29 = (PORT_A<<5|29), 57 PA_30 = (PORT_A<<5|30), 58 PA_31 = (PORT_A<<5|31), 59 60 PB_0 = (PORT_B<<5|0), 61 PB_1 = (PORT_B<<5|1), 62 PB_2 = (PORT_B<<5|2), 63 PB_3 = (PORT_B<<5|3), 64 PB_4 = (PORT_B<<5|4), 65 PB_5 = (PORT_B<<5|5), 66 PB_6 = (PORT_B<<5|6), 67 PB_7 = (PORT_B<<5|7), 68 PB_8 = (PORT_B<<5|8), 69 PB_9 = (PORT_B<<5|9), 70 PB_10 = (PORT_B<<5|10), 71 PB_11 = (PORT_B<<5|11), 72 PB_12 = (PORT_B<<5|12), 73 PB_13 = (PORT_B<<5|13), 74 PB_14 = (PORT_B<<5|14), 75 PB_15 = (PORT_B<<5|15), 76 PB_16 = (PORT_B<<5|16), 77 PB_17 = (PORT_B<<5|17), 78 PB_18 = (PORT_B<<5|18), 79 PB_19 = (PORT_B<<5|19), 80 PB_20 = (PORT_B<<5|20), 81 PB_21 = (PORT_B<<5|21), 82 PB_22 = (PORT_B<<5|22), 83 PB_23 = (PORT_B<<5|23), 84 PB_24 = (PORT_B<<5|24), 85 PB_25 = (PORT_B<<5|25), 86 PB_26 = (PORT_B<<5|26), 87 PB_27 = (PORT_B<<5|27), 88 PB_28 = (PORT_B<<5|28), 89 PB_29 = (PORT_B<<5|29), 90 PB_30 = (PORT_B<<5|30), 91 PB_31 = (PORT_B<<5|31), 92 93 VBAT_MEAS = (0x7<<5|2), 94 AD_0 = PB_4, //CH0 95 AD_1 = PB_5, //CH1 96 AD_2 = PB_6, //CH2 97 AD_3 = PB_7, //CH3 98 AD_4 = PB_1, //CH4 99 AD_5 = PB_2, //CH5 100 AD_6 = PB_3, //CH6 101 AD_7 = VBAT_MEAS,//CH7 102 103 // Not connected 104 NC = (uint32_t)0xFFFFFFFF 105 } PinName; 106 107 typedef enum { 108 PullNone = 0, //IN HIGHZ 109 PullUp = 1, 110 PullDown = 2, 111 PullDefault = PullNone 112 } PinMode; 113 114 115 116 #ifdef __cplusplus 117 } 118 #endif 119 120 #endif 121