mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Sep 04 09:30:10 2015 +0100
Revision:
619:034e698bc035
Synchronized with git revision 92d1bfad30082571776c810a56fd471d30514ccf

Full URL: https://github.com/mbedmicro/mbed/commit/92d1bfad30082571776c810a56fd471d30514ccf/

Change directory structure and move files.

Who changed what in which revision?

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