The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_WIZWIKI_W7500ECO/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_gpio.h@169:a7c7b631e539, 2018-06-22 (annotated)
- Committer:
- Anna Bridge
- Date:
- Fri Jun 22 15:38:59 2018 +0100
- Revision:
- 169:a7c7b631e539
- Parent:
- 109:9296ab0bfc11
- Child:
- 170:e95d10626187
mbed library. Release version 162
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 109:9296ab0bfc11 | 1 | /** |
Kojto | 109:9296ab0bfc11 | 2 | ****************************************************************************** |
Kojto | 109:9296ab0bfc11 | 3 | * @file |
Kojto | 109:9296ab0bfc11 | 4 | * @author |
Kojto | 109:9296ab0bfc11 | 5 | * @version |
Kojto | 109:9296ab0bfc11 | 6 | * @date |
Kojto | 109:9296ab0bfc11 | 7 | * @brief This file contains all the functions prototypes for the GPIO |
Kojto | 109:9296ab0bfc11 | 8 | * firmware library. |
Kojto | 109:9296ab0bfc11 | 9 | ****************************************************************************** |
Kojto | 109:9296ab0bfc11 | 10 | * |
Kojto | 109:9296ab0bfc11 | 11 | ****************************************************************************** |
Kojto | 109:9296ab0bfc11 | 12 | */ |
Kojto | 109:9296ab0bfc11 | 13 | |
Kojto | 109:9296ab0bfc11 | 14 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 109:9296ab0bfc11 | 15 | #ifndef __W7500X_HAL_GPIO_H |
Kojto | 109:9296ab0bfc11 | 16 | #define __W7500X_HAL_GPIO_H |
Kojto | 109:9296ab0bfc11 | 17 | |
Kojto | 109:9296ab0bfc11 | 18 | #ifdef __cplusplus |
Kojto | 109:9296ab0bfc11 | 19 | extern "C" { |
Kojto | 109:9296ab0bfc11 | 20 | #endif |
Kojto | 109:9296ab0bfc11 | 21 | |
Kojto | 109:9296ab0bfc11 | 22 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 109:9296ab0bfc11 | 23 | #include "W7500x.h" |
Kojto | 109:9296ab0bfc11 | 24 | |
Kojto | 109:9296ab0bfc11 | 25 | #define GPIO_Pin_0 (uint16_t)(0x01 << 0) // Pin 0 Selected |
Kojto | 109:9296ab0bfc11 | 26 | #define GPIO_Pin_1 (uint16_t)(0x01 << 1) // Pin 1 Selected |
Kojto | 109:9296ab0bfc11 | 27 | #define GPIO_Pin_2 (uint16_t)(0x01 << 2) // Pin 2 Selected |
Kojto | 109:9296ab0bfc11 | 28 | #define GPIO_Pin_3 (uint16_t)(0x01 << 3) // Pin 3 Selected |
Kojto | 109:9296ab0bfc11 | 29 | #define GPIO_Pin_4 (uint16_t)(0x01 << 4) // Pin 4 Selected |
Kojto | 109:9296ab0bfc11 | 30 | #define GPIO_Pin_5 (uint16_t)(0x01 << 5) // Pin 5 Selected |
Kojto | 109:9296ab0bfc11 | 31 | #define GPIO_Pin_6 (uint16_t)(0x01 << 6) // Pin 6 Selected |
Kojto | 109:9296ab0bfc11 | 32 | #define GPIO_Pin_7 (uint16_t)(0x01 << 7) // Pin 7 Selected |
Kojto | 109:9296ab0bfc11 | 33 | #define GPIO_Pin_8 (uint16_t)(0x01 << 8) // Pin 8 Selected |
Kojto | 109:9296ab0bfc11 | 34 | #define GPIO_Pin_9 (uint16_t)(0x01 << 9) // Pin 9 Selected |
Kojto | 109:9296ab0bfc11 | 35 | #define GPIO_Pin_10 (uint16_t)(0x01 << 10) // Pin 10 Selected |
Kojto | 109:9296ab0bfc11 | 36 | #define GPIO_Pin_11 (uint16_t)(0x01 << 11) // Pin 11 Selected |
Kojto | 109:9296ab0bfc11 | 37 | #define GPIO_Pin_12 (uint16_t)(0x01 << 12) // Pin 12 Selected |
Kojto | 109:9296ab0bfc11 | 38 | #define GPIO_Pin_13 (uint16_t)(0x01 << 13) // Pin 13 Selected |
Kojto | 109:9296ab0bfc11 | 39 | #define GPIO_Pin_14 (uint16_t)(0x01 << 14) // Pin 14 Selected |
Kojto | 109:9296ab0bfc11 | 40 | #define GPIO_Pin_15 (uint16_t)(0x01 << 15) // Pin 15 Selected |
Kojto | 109:9296ab0bfc11 | 41 | #define GPIO_Pin_All (uint16_t)(0xFFFF) // All pins Selected |
Kojto | 109:9296ab0bfc11 | 42 | |
Kojto | 109:9296ab0bfc11 | 43 | |
Kojto | 109:9296ab0bfc11 | 44 | #define IS_GPIO_PIN(PIN) ((PIN) != (uint16_t)0x00) |
Kojto | 109:9296ab0bfc11 | 45 | #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || ((PIN) == GPIO_Pin_1) || \ |
Kojto | 109:9296ab0bfc11 | 46 | (((PIN) == GPIO_Pin_2) || ((PIN) == GPIO_Pin_3) || \ |
Kojto | 109:9296ab0bfc11 | 47 | (((PIN) == GPIO_Pin_4) || ((PIN) == GPIO_Pin_5) || \ |
Kojto | 109:9296ab0bfc11 | 48 | (((PIN) == GPIO_Pin_6) || ((PIN) == GPIO_Pin_7) || \ |
Kojto | 109:9296ab0bfc11 | 49 | (((PIN) == GPIO_Pin_8) || ((PIN) == GPIO_Pin_9) || \ |
Kojto | 109:9296ab0bfc11 | 50 | (((PIN) == GPIO_Pin_10) || ((PIN) == GPIO_Pin_11) || \ |
Kojto | 109:9296ab0bfc11 | 51 | (((PIN) == GPIO_Pin_12) || ((PIN) == GPIO_Pin_13) || \ |
Kojto | 109:9296ab0bfc11 | 52 | (((PIN) == GPIO_Pin_14) || ((PIN) == GPIO_Pin_15) ) |
Kojto | 109:9296ab0bfc11 | 53 | |
Kojto | 109:9296ab0bfc11 | 54 | |
Kojto | 109:9296ab0bfc11 | 55 | #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || ((PERIPH) == GPIOB) || \ |
Kojto | 109:9296ab0bfc11 | 56 | ((PERIPH) == GPIOC) || ((PERIPH) == GPIOD) ) |
Kojto | 109:9296ab0bfc11 | 57 | |
Kojto | 109:9296ab0bfc11 | 58 | typedef enum |
Kojto | 109:9296ab0bfc11 | 59 | { |
Kojto | 109:9296ab0bfc11 | 60 | GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */ |
Kojto | 109:9296ab0bfc11 | 61 | GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */ |
Kojto | 109:9296ab0bfc11 | 62 | GPIO_Mode_AF = 0x02 /*!< GPIO Alternate function Mode */ |
Kojto | 109:9296ab0bfc11 | 63 | }GPIOMode_TypeDef; |
Kojto | 109:9296ab0bfc11 | 64 | |
Kojto | 109:9296ab0bfc11 | 65 | typedef enum |
Kojto | 109:9296ab0bfc11 | 66 | { |
Kojto | 109:9296ab0bfc11 | 67 | GPIO_NO_PUPD = 0x0ul, |
Kojto | 109:9296ab0bfc11 | 68 | GPIO_PuPd_UP = Px_PCR_PUPD_UP, |
Kojto | 109:9296ab0bfc11 | 69 | GPIO_PuPd_DOWN = Px_PCR_PUPD_DOWN, |
Kojto | 109:9296ab0bfc11 | 70 | GPIO_PuPd_Default = 0x0ul, |
Kojto | 109:9296ab0bfc11 | 71 | }GPIOPad_TypeDef; |
Kojto | 109:9296ab0bfc11 | 72 | |
Kojto | 109:9296ab0bfc11 | 73 | typedef struct |
Kojto | 109:9296ab0bfc11 | 74 | { |
Kojto | 109:9296ab0bfc11 | 75 | uint32_t GPIO_Pin; |
Kojto | 109:9296ab0bfc11 | 76 | GPIOMode_TypeDef GPIO_Mode; |
Kojto | 109:9296ab0bfc11 | 77 | GPIOPad_TypeDef GPIO_Pad; |
Kojto | 109:9296ab0bfc11 | 78 | }GPIO_InitTypeDef; |
Kojto | 109:9296ab0bfc11 | 79 | |
Kojto | 109:9296ab0bfc11 | 80 | typedef enum |
Kojto | 109:9296ab0bfc11 | 81 | { |
Kojto | 109:9296ab0bfc11 | 82 | Bit_RESET = 0, |
Kojto | 109:9296ab0bfc11 | 83 | Bit_SET |
Kojto | 109:9296ab0bfc11 | 84 | }BitAction; |
Kojto | 109:9296ab0bfc11 | 85 | |
Kojto | 109:9296ab0bfc11 | 86 | |
Kojto | 109:9296ab0bfc11 | 87 | #define IS_PAD_TYPE(Px) (((Px) == PAD_PA) || ((Px) == PAD_PB) \ |
Kojto | 109:9296ab0bfc11 | 88 | ((Px) == PAD_PC) || ((Px) == PAD_PD)) |
Kojto | 109:9296ab0bfc11 | 89 | |
Kojto | 109:9296ab0bfc11 | 90 | #define IS_PA_NUM(NUM) (((NUM)>=0) && ((NUM)<16)) |
Kojto | 109:9296ab0bfc11 | 91 | #define IS_PB_NUM(NUM) (((NUM)>=0) && ((NUM)<16)) |
Kojto | 109:9296ab0bfc11 | 92 | #define IS_PC_NUM(NUM) (((NUM)>=0) && ((NUM)<16)) |
Kojto | 109:9296ab0bfc11 | 93 | #define IS_PD_NUM(NUM) (((NUM)>=0) && ((NUM)< 5)) |
Kojto | 109:9296ab0bfc11 | 94 | |
Kojto | 109:9296ab0bfc11 | 95 | #define IS_PAD_AF(AF) (((AF) == PAD_AF0) || ((AF) == PAD_AF1) || \ |
Kojto | 109:9296ab0bfc11 | 96 | ((AF) == PAD_AF2) || ((AF) == PAD_AF3)) |
Kojto | 109:9296ab0bfc11 | 97 | |
Kojto | 109:9296ab0bfc11 | 98 | |
Kojto | 109:9296ab0bfc11 | 99 | #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION_ == Bit_RESET) || (ACTION) ==Bit_SET)) |
Kojto | 109:9296ab0bfc11 | 100 | |
Kojto | 109:9296ab0bfc11 | 101 | void HAL_GPIO_DeInit(GPIO_TypeDef* GPIOx); |
Kojto | 109:9296ab0bfc11 | 102 | void HAL_GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct); |
Kojto | 109:9296ab0bfc11 | 103 | void HAL_GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct); |
Kojto | 109:9296ab0bfc11 | 104 | uint8_t HAL_GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 105 | uint16_t HAL_GPIO_ReadInputData(GPIO_TypeDef* GPIOx); |
Kojto | 109:9296ab0bfc11 | 106 | uint8_t HAL_GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 107 | uint16_t HAL_GPIO_ReadOutputData(GPIO_TypeDef* GPIOx); |
Kojto | 109:9296ab0bfc11 | 108 | void HAL_GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 109 | void HAL_GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 110 | void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal); |
Kojto | 109:9296ab0bfc11 | 111 | void HAL_GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal); |
Kojto | 109:9296ab0bfc11 | 112 | void HAL_PAD_AFConfig(PAD_Type Px, uint16_t Pnum, PAD_AF_TypeDef P_AF); |
Kojto | 109:9296ab0bfc11 | 113 | |
Kojto | 109:9296ab0bfc11 | 114 | void GPIO_OutEnClr(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 115 | void GPIO_OutEnSet(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
Kojto | 109:9296ab0bfc11 | 116 | |
Kojto | 109:9296ab0bfc11 | 117 | |
Kojto | 109:9296ab0bfc11 | 118 | #ifdef __cplusplus |
Kojto | 109:9296ab0bfc11 | 119 | } |
Kojto | 109:9296ab0bfc11 | 120 | #endif |
Kojto | 109:9296ab0bfc11 | 121 | |
Kojto | 109:9296ab0bfc11 | 122 | #endif // __W7500X_HAL_GPIO_H |