mbed library sources

Dependents:   Freedman_v2 Nucleo_i2c_OLED_BME280_copy

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Tue Jun 30 09:45:08 2015 +0100
Revision:
576:99a3d3d9c43f
Parent:
558:0880f51c4036
Child:
601:248b0d2dd755
Synchronized with git revision 1c13bc80fedd0fdfaedfab5c33183dc2b6f9b1bb

Full URL: https://github.com/mbedmicro/mbed/commit/1c13bc80fedd0fdfaedfab5c33183dc2b6f9b1bb/

Wiznet - Update and bug fix.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 558:0880f51c4036 1 /**
mbed_official 558:0880f51c4036 2 ******************************************************************************
mbed_official 558:0880f51c4036 3 * @file
mbed_official 558:0880f51c4036 4 * @author
mbed_official 558:0880f51c4036 5 * @version
mbed_official 558:0880f51c4036 6 * @date
mbed_official 558:0880f51c4036 7 * @brief This file contains all the functions prototypes for the GPIO
mbed_official 558:0880f51c4036 8 * firmware library.
mbed_official 558:0880f51c4036 9 ******************************************************************************
mbed_official 558:0880f51c4036 10 *
mbed_official 558:0880f51c4036 11 ******************************************************************************
mbed_official 558:0880f51c4036 12 */
mbed_official 558:0880f51c4036 13
mbed_official 558:0880f51c4036 14 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 558:0880f51c4036 15 #ifndef __W7500X_HAL_GPIO_H
mbed_official 558:0880f51c4036 16 #define __W7500X_HAL_GPIO_H
mbed_official 558:0880f51c4036 17
mbed_official 558:0880f51c4036 18 #ifdef __cplusplus
mbed_official 558:0880f51c4036 19 extern "C" {
mbed_official 558:0880f51c4036 20 #endif
mbed_official 558:0880f51c4036 21
mbed_official 558:0880f51c4036 22 /* Includes ------------------------------------------------------------------*/
mbed_official 558:0880f51c4036 23 #include "W7500x.h"
mbed_official 558:0880f51c4036 24
mbed_official 558:0880f51c4036 25 #define GPIO_Pin_0 (uint16_t)(0x01 << 0) // Pin 0 Selected
mbed_official 558:0880f51c4036 26 #define GPIO_Pin_1 (uint16_t)(0x01 << 1) // Pin 1 Selected
mbed_official 558:0880f51c4036 27 #define GPIO_Pin_2 (uint16_t)(0x01 << 2) // Pin 2 Selected
mbed_official 558:0880f51c4036 28 #define GPIO_Pin_3 (uint16_t)(0x01 << 3) // Pin 3 Selected
mbed_official 558:0880f51c4036 29 #define GPIO_Pin_4 (uint16_t)(0x01 << 4) // Pin 4 Selected
mbed_official 558:0880f51c4036 30 #define GPIO_Pin_5 (uint16_t)(0x01 << 5) // Pin 5 Selected
mbed_official 558:0880f51c4036 31 #define GPIO_Pin_6 (uint16_t)(0x01 << 6) // Pin 6 Selected
mbed_official 558:0880f51c4036 32 #define GPIO_Pin_7 (uint16_t)(0x01 << 7) // Pin 7 Selected
mbed_official 558:0880f51c4036 33 #define GPIO_Pin_8 (uint16_t)(0x01 << 8) // Pin 8 Selected
mbed_official 558:0880f51c4036 34 #define GPIO_Pin_9 (uint16_t)(0x01 << 9) // Pin 9 Selected
mbed_official 558:0880f51c4036 35 #define GPIO_Pin_10 (uint16_t)(0x01 << 10) // Pin 10 Selected
mbed_official 558:0880f51c4036 36 #define GPIO_Pin_11 (uint16_t)(0x01 << 11) // Pin 11 Selected
mbed_official 558:0880f51c4036 37 #define GPIO_Pin_12 (uint16_t)(0x01 << 12) // Pin 12 Selected
mbed_official 558:0880f51c4036 38 #define GPIO_Pin_13 (uint16_t)(0x01 << 13) // Pin 13 Selected
mbed_official 558:0880f51c4036 39 #define GPIO_Pin_14 (uint16_t)(0x01 << 14) // Pin 14 Selected
mbed_official 558:0880f51c4036 40 #define GPIO_Pin_15 (uint16_t)(0x01 << 15) // Pin 15 Selected
mbed_official 558:0880f51c4036 41 #define GPIO_Pin_All (uint16_t)(0xFFFF) // All pins Selected
mbed_official 558:0880f51c4036 42
mbed_official 558:0880f51c4036 43
mbed_official 558:0880f51c4036 44 #define IS_GPIO_PIN(PIN) ((PIN) != (uint16_t)0x00)
mbed_official 558:0880f51c4036 45 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || ((PIN) == GPIO_Pin_1) || \
mbed_official 558:0880f51c4036 46 (((PIN) == GPIO_Pin_2) || ((PIN) == GPIO_Pin_3) || \
mbed_official 558:0880f51c4036 47 (((PIN) == GPIO_Pin_4) || ((PIN) == GPIO_Pin_5) || \
mbed_official 558:0880f51c4036 48 (((PIN) == GPIO_Pin_6) || ((PIN) == GPIO_Pin_7) || \
mbed_official 558:0880f51c4036 49 (((PIN) == GPIO_Pin_8) || ((PIN) == GPIO_Pin_9) || \
mbed_official 558:0880f51c4036 50 (((PIN) == GPIO_Pin_10) || ((PIN) == GPIO_Pin_11) || \
mbed_official 558:0880f51c4036 51 (((PIN) == GPIO_Pin_12) || ((PIN) == GPIO_Pin_13) || \
mbed_official 558:0880f51c4036 52 (((PIN) == GPIO_Pin_14) || ((PIN) == GPIO_Pin_15) )
mbed_official 558:0880f51c4036 53
mbed_official 558:0880f51c4036 54
mbed_official 558:0880f51c4036 55 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || ((PERIPH) == GPIOB) || \
mbed_official 558:0880f51c4036 56 ((PERIPH) == GPIOC) || ((PERIPH) == GPIOD) )
mbed_official 558:0880f51c4036 57
mbed_official 558:0880f51c4036 58 typedef enum
mbed_official 558:0880f51c4036 59 {
mbed_official 558:0880f51c4036 60 GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */
mbed_official 558:0880f51c4036 61 GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */
mbed_official 558:0880f51c4036 62 GPIO_Mode_AF = 0x02 /*!< GPIO Alternate function Mode */
mbed_official 558:0880f51c4036 63 }GPIOMode_TypeDef;
mbed_official 558:0880f51c4036 64
mbed_official 558:0880f51c4036 65 typedef enum
mbed_official 558:0880f51c4036 66 {
mbed_official 558:0880f51c4036 67 GPIO_NO_PUPD = 0x0ul,
mbed_official 558:0880f51c4036 68 GPIO_PuPd_UP = Px_PCR_PUPD_UP,
mbed_official 558:0880f51c4036 69 GPIO_PuPd_DOWN = Px_PCR_PUPD_DOWN,
mbed_official 576:99a3d3d9c43f 70 GPIO_PuPd_Default = 0x0ul,
mbed_official 558:0880f51c4036 71 }GPIOPad_TypeDef;
mbed_official 558:0880f51c4036 72
mbed_official 558:0880f51c4036 73 typedef struct
mbed_official 558:0880f51c4036 74 {
mbed_official 558:0880f51c4036 75 uint32_t GPIO_Pin;
mbed_official 558:0880f51c4036 76 GPIOMode_TypeDef GPIO_Mode;
mbed_official 558:0880f51c4036 77 GPIOPad_TypeDef GPIO_Pad;
mbed_official 558:0880f51c4036 78 }GPIO_InitTypeDef;
mbed_official 558:0880f51c4036 79
mbed_official 558:0880f51c4036 80 typedef enum
mbed_official 558:0880f51c4036 81 {
mbed_official 558:0880f51c4036 82 Bit_RESET = 0,
mbed_official 558:0880f51c4036 83 Bit_SET
mbed_official 558:0880f51c4036 84 }BitAction;
mbed_official 558:0880f51c4036 85
mbed_official 558:0880f51c4036 86 typedef enum
mbed_official 558:0880f51c4036 87 {
mbed_official 558:0880f51c4036 88 PAD_PA = 0,
mbed_official 558:0880f51c4036 89 PAD_PB,
mbed_official 558:0880f51c4036 90 PAD_PC,
mbed_official 558:0880f51c4036 91 PAD_PD
mbed_official 558:0880f51c4036 92 }PAD_Type;
mbed_official 558:0880f51c4036 93
mbed_official 558:0880f51c4036 94 typedef enum
mbed_official 558:0880f51c4036 95 {
mbed_official 558:0880f51c4036 96 PAD_AF0 = Px_AFSR_AF0,
mbed_official 558:0880f51c4036 97 PAD_AF1 = Px_AFSR_AF1,
mbed_official 558:0880f51c4036 98 PAD_AF2 = Px_AFSR_AF2,
mbed_official 558:0880f51c4036 99 PAD_AF3 = Px_AFSR_AF3
mbed_official 558:0880f51c4036 100 }PAD_AF_TypeDef;
mbed_official 558:0880f51c4036 101
mbed_official 558:0880f51c4036 102 #define IS_PAD_TYPE(Px) (((Px) == PAD_PA) || ((Px) == PAD_PB) \
mbed_official 558:0880f51c4036 103 ((Px) == PAD_PC) || ((Px) == PAD_PD))
mbed_official 558:0880f51c4036 104
mbed_official 558:0880f51c4036 105 #define IS_PA_NUM(NUM) (((NUM)>=0) && ((NUM)<16))
mbed_official 558:0880f51c4036 106 #define IS_PB_NUM(NUM) (((NUM)>=0) && ((NUM)<16))
mbed_official 558:0880f51c4036 107 #define IS_PC_NUM(NUM) (((NUM)>=0) && ((NUM)<16))
mbed_official 558:0880f51c4036 108 #define IS_PD_NUM(NUM) (((NUM)>=0) && ((NUM)< 5))
mbed_official 558:0880f51c4036 109
mbed_official 558:0880f51c4036 110 #define IS_PAD_AF(AF) (((AF) == PAD_AF0) || ((AF) == PAD_AF1) || \
mbed_official 558:0880f51c4036 111 ((AF) == PAD_AF2) || ((AF) == PAD_AF3))
mbed_official 558:0880f51c4036 112
mbed_official 558:0880f51c4036 113
mbed_official 558:0880f51c4036 114 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION_ == Bit_RESET) || (ACTION) ==Bit_SET))
mbed_official 558:0880f51c4036 115
mbed_official 558:0880f51c4036 116 void HAL_GPIO_DeInit(GPIO_TypeDef* GPIOx);
mbed_official 558:0880f51c4036 117 void HAL_GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
mbed_official 558:0880f51c4036 118 void HAL_GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
mbed_official 558:0880f51c4036 119 uint8_t HAL_GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 558:0880f51c4036 120 uint8_t HAL_GPIO_ReadInputData(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 558:0880f51c4036 121 uint8_t HAL_GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 558:0880f51c4036 122 uint16_t HAL_GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
mbed_official 558:0880f51c4036 123 void HAL_GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 558:0880f51c4036 124 void HAL_GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
mbed_official 558:0880f51c4036 125 void HAL_GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
mbed_official 558:0880f51c4036 126 void HAL_GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
mbed_official 558:0880f51c4036 127 void HAL_PAD_AFConfig(PAD_Type Px, uint16_t Pnum, PAD_AF_TypeDef P_AF);
mbed_official 558:0880f51c4036 128
mbed_official 558:0880f51c4036 129
mbed_official 558:0880f51c4036 130 #ifdef __cplusplus
mbed_official 558:0880f51c4036 131 }
mbed_official 558:0880f51c4036 132 #endif
mbed_official 558:0880f51c4036 133
mbed_official 558:0880f51c4036 134 #endif // __W7500X_HAL_GPIO_H