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 Jul 31 14:15:09 2015 +0100
Revision:
600:7d17ca308cd1
Parent:
558:0880f51c4036
Synchronized with git revision e4cd8bbd3e05b68e5a7f466c74035a85743d45e0

Full URL: https://github.com/mbedmicro/mbed/commit/e4cd8bbd3e05b68e5a7f466c74035a85743d45e0/

Enable LPC8xx usart when configuring it

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 558:0880f51c4036 1 #include "W7500x.h"
mbed_official 558:0880f51c4036 2
mbed_official 558:0880f51c4036 3
mbed_official 558:0880f51c4036 4
mbed_official 558:0880f51c4036 5 /**
mbed_official 558:0880f51c4036 6 * @brief Deinitializes the EXTI peripheral registers to their default reset values.
mbed_official 558:0880f51c4036 7 * @param None
mbed_official 558:0880f51c4036 8 * @retval None
mbed_official 558:0880f51c4036 9 */
mbed_official 558:0880f51c4036 10 void EXTI_DeInit(void)
mbed_official 558:0880f51c4036 11 {
mbed_official 558:0880f51c4036 12 uint32_t i, loop =16;
mbed_official 558:0880f51c4036 13 for(i=0; i<loop; i++)
mbed_official 558:0880f51c4036 14 {
mbed_official 558:0880f51c4036 15 EXTI_PA->Port[i] = 0x00;
mbed_official 558:0880f51c4036 16 EXTI_PB->Port[i] = 0x00;
mbed_official 558:0880f51c4036 17 EXTI_PC->Port[i] = 0x00;
mbed_official 558:0880f51c4036 18 }
mbed_official 558:0880f51c4036 19 for(i=0; i<5; i++)
mbed_official 558:0880f51c4036 20 {
mbed_official 558:0880f51c4036 21 EXTI_PD->Port[i] = 0x00;
mbed_official 558:0880f51c4036 22 }
mbed_official 558:0880f51c4036 23 }
mbed_official 558:0880f51c4036 24
mbed_official 558:0880f51c4036 25 /**
mbed_official 558:0880f51c4036 26 * @brief Initializes the EXTI peripheral according to the specified
mbed_official 558:0880f51c4036 27 * parameters in the EXTI_InitStruct.
mbed_official 558:0880f51c4036 28 * @param EXTI_InitStruct: pointer to a EXTI_InitTypeDef structure
mbed_official 558:0880f51c4036 29 * that contains the configuration information for the EXTI peripheral.
mbed_official 558:0880f51c4036 30 * @retval None
mbed_official 558:0880f51c4036 31 */
mbed_official 558:0880f51c4036 32 void EXTI_Init(PAD_Type Px, EXTI_InitTypeDef* EXTI_InitStruct)
mbed_official 558:0880f51c4036 33 {
mbed_official 558:0880f51c4036 34 uint32_t pinpos = 0x00, pos = 0x00, currentpin = 0x00, loop = 16;
mbed_official 558:0880f51c4036 35 P_Port_Def *px_exti;
mbed_official 558:0880f51c4036 36
mbed_official 558:0880f51c4036 37 assert_param(IS_PAD_TYPE(Px));
mbed_official 558:0880f51c4036 38
mbed_official 558:0880f51c4036 39 if (Px == PAD_PA) px_exti = EXTI_PA;
mbed_official 558:0880f51c4036 40 else if (Px == PAD_PB) px_exti = EXTI_PB;
mbed_official 558:0880f51c4036 41 else if (Px == PAD_PC) px_exti = EXTI_PC;
mbed_official 558:0880f51c4036 42 else
mbed_official 558:0880f51c4036 43 {
mbed_official 558:0880f51c4036 44 px_exti = (P_Port_Def*)EXTI_PD;
mbed_official 558:0880f51c4036 45 loop = 5;
mbed_official 558:0880f51c4036 46 }
mbed_official 558:0880f51c4036 47
mbed_official 558:0880f51c4036 48 for(pinpos = 0x00; pinpos < loop; pinpos++)
mbed_official 558:0880f51c4036 49 {
mbed_official 558:0880f51c4036 50 pos = ((uint32_t)0x01) << pinpos;
mbed_official 558:0880f51c4036 51
mbed_official 558:0880f51c4036 52 currentpin = (EXTI_InitStruct->EXTI_Line) & pos;
mbed_official 558:0880f51c4036 53 if(currentpin == pos)
mbed_official 558:0880f51c4036 54 {
mbed_official 558:0880f51c4036 55 px_exti->Port[pinpos] |= EXTI_Px_INTEN_ENABLE;
mbed_official 558:0880f51c4036 56
mbed_official 558:0880f51c4036 57 if(EXTI_InitStruct->EXTI_Trigger == EXTI_Trigger_Rising)
mbed_official 558:0880f51c4036 58 px_exti->Port[pinpos] |= EXTI_Px_INTPOR_RISING_EDGE;
mbed_official 558:0880f51c4036 59 else
mbed_official 558:0880f51c4036 60 px_exti->Port[pinpos] |= EXTI_Px_INTPOR_FALLING_EDGE;
mbed_official 558:0880f51c4036 61 }
mbed_official 558:0880f51c4036 62 }
mbed_official 558:0880f51c4036 63
mbed_official 558:0880f51c4036 64 }
mbed_official 558:0880f51c4036 65
mbed_official 558:0880f51c4036 66 void EXTI_Polarity_Set(PAD_Type Px, uint16_t GPIO_Pin, uint16_t Polarity )
mbed_official 558:0880f51c4036 67 {
mbed_official 558:0880f51c4036 68 uint32_t pinpos = 0x00, pos = 0x00, currentpin = 0x00, loop = 16;
mbed_official 558:0880f51c4036 69 P_Port_Def *px_exti;
mbed_official 558:0880f51c4036 70
mbed_official 558:0880f51c4036 71 assert_param(IS_PAD_TYPE(Px));
mbed_official 558:0880f51c4036 72
mbed_official 558:0880f51c4036 73 if (Px == PAD_PA) px_exti = EXTI_PA;
mbed_official 558:0880f51c4036 74 else if (Px == PAD_PB) px_exti = EXTI_PB;
mbed_official 558:0880f51c4036 75 else if (Px == PAD_PC) px_exti = EXTI_PC;
mbed_official 558:0880f51c4036 76 else
mbed_official 558:0880f51c4036 77 {
mbed_official 558:0880f51c4036 78 px_exti = (P_Port_Def*)EXTI_PD;
mbed_official 558:0880f51c4036 79 loop = 5;
mbed_official 558:0880f51c4036 80 }
mbed_official 558:0880f51c4036 81
mbed_official 558:0880f51c4036 82 for(pinpos = 0x00; pinpos < loop; pinpos++)
mbed_official 558:0880f51c4036 83 {
mbed_official 558:0880f51c4036 84 pos = ((uint32_t)0x01) << pinpos;
mbed_official 558:0880f51c4036 85
mbed_official 558:0880f51c4036 86 currentpin = GPIO_Pin & pos;
mbed_official 558:0880f51c4036 87 if(currentpin == pos)
mbed_official 558:0880f51c4036 88 {
mbed_official 558:0880f51c4036 89 if(Polarity == EXTI_Trigger_Rising)
mbed_official 558:0880f51c4036 90 px_exti->Port[pinpos] |= EXTI_Px_INTPOR_RISING_EDGE;
mbed_official 558:0880f51c4036 91 else
mbed_official 558:0880f51c4036 92 px_exti->Port[pinpos] |= EXTI_Px_INTPOR_FALLING_EDGE;
mbed_official 558:0880f51c4036 93 }
mbed_official 558:0880f51c4036 94 }
mbed_official 558:0880f51c4036 95
mbed_official 558:0880f51c4036 96 }
mbed_official 558:0880f51c4036 97
mbed_official 558:0880f51c4036 98 /**
mbed_official 558:0880f51c4036 99 * @brief Fills each EXTI_InitStruct member with its reset value.
mbed_official 558:0880f51c4036 100 * @param EXTI_InitStruct: pointer to a EXTI_InitTypeDef structure which will
mbed_official 558:0880f51c4036 101 * be initialized.
mbed_official 558:0880f51c4036 102 * @retval None
mbed_official 558:0880f51c4036 103 */
mbed_official 558:0880f51c4036 104 void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct)
mbed_official 558:0880f51c4036 105 {
mbed_official 558:0880f51c4036 106 EXTI_InitStruct->EXTI_Line = 0xFF;
mbed_official 558:0880f51c4036 107 EXTI_InitStruct->EXTI_Mode = EXTI_Mode_Interrupt;
mbed_official 558:0880f51c4036 108 EXTI_InitStruct->EXTI_Trigger = EXTI_Trigger_Falling;
mbed_official 558:0880f51c4036 109 }
mbed_official 558:0880f51c4036 110
mbed_official 558:0880f51c4036 111 uint16_t EXTI_Px_GetEXTEN(PAD_Type Px)
mbed_official 558:0880f51c4036 112 {
mbed_official 558:0880f51c4036 113 uint32_t i, loop = 16;
mbed_official 558:0880f51c4036 114 uint16_t ret=0;
mbed_official 558:0880f51c4036 115 P_Port_Def *px_exti;
mbed_official 558:0880f51c4036 116
mbed_official 558:0880f51c4036 117 assert_param(IS_PAD_TYPE(Px));
mbed_official 558:0880f51c4036 118
mbed_official 558:0880f51c4036 119 if (Px == PAD_PA) px_exti = EXTI_PA;
mbed_official 558:0880f51c4036 120 else if (Px == PAD_PB) px_exti = EXTI_PB;
mbed_official 558:0880f51c4036 121 else if (Px == PAD_PC) px_exti = EXTI_PC;
mbed_official 558:0880f51c4036 122 else
mbed_official 558:0880f51c4036 123 {
mbed_official 558:0880f51c4036 124 px_exti = (P_Port_Def*)EXTI_PD;
mbed_official 558:0880f51c4036 125 loop = 5;
mbed_official 558:0880f51c4036 126 }
mbed_official 558:0880f51c4036 127
mbed_official 558:0880f51c4036 128 for(i = 0x00; i < loop; i++)
mbed_official 558:0880f51c4036 129 {
mbed_official 558:0880f51c4036 130 ret |= (((px_exti->Port[i]&0x2)>>1)<<i);
mbed_official 558:0880f51c4036 131 }
mbed_official 558:0880f51c4036 132 return ret;
mbed_official 558:0880f51c4036 133 }
mbed_official 558:0880f51c4036 134
mbed_official 558:0880f51c4036 135 uint16_t EXTI_Px_GetEXTINTPOL(PAD_Type Px)
mbed_official 558:0880f51c4036 136 {
mbed_official 558:0880f51c4036 137 uint32_t i, loop = 16;
mbed_official 558:0880f51c4036 138 uint16_t ret=0;
mbed_official 558:0880f51c4036 139 P_Port_Def *px_exti;
mbed_official 558:0880f51c4036 140
mbed_official 558:0880f51c4036 141 assert_param(IS_PAD_TYPE(Px));
mbed_official 558:0880f51c4036 142
mbed_official 558:0880f51c4036 143 if (Px == PAD_PA) px_exti = EXTI_PA;
mbed_official 558:0880f51c4036 144 else if (Px == PAD_PB) px_exti = EXTI_PB;
mbed_official 558:0880f51c4036 145 else if (Px == PAD_PC) px_exti = EXTI_PC;
mbed_official 558:0880f51c4036 146 else
mbed_official 558:0880f51c4036 147 {
mbed_official 558:0880f51c4036 148 px_exti = (P_Port_Def*)EXTI_PD;
mbed_official 558:0880f51c4036 149 loop = 5;
mbed_official 558:0880f51c4036 150 }
mbed_official 558:0880f51c4036 151
mbed_official 558:0880f51c4036 152 for(i = 0x00; i < loop; i++)
mbed_official 558:0880f51c4036 153 {
mbed_official 558:0880f51c4036 154 ret |= ((px_exti->Port[i]&0x1)<<i);
mbed_official 558:0880f51c4036 155 }
mbed_official 558:0880f51c4036 156 return ret;
mbed_official 558:0880f51c4036 157 }