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.

Revision:
631:ff681937ffd8
Parent:
619:034e698bc035
--- a/targets/hal/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_uart.c	Mon Sep 28 10:45:10 2015 +0100
+++ b/targets/hal/TARGET_WIZNET/TARGET_W7500x/W7500x_Peripheral_Library/W7500x_uart.c	Mon Sep 28 13:00:10 2015 +0100
@@ -208,13 +208,24 @@
 uint32_t S_UART_Init(uint32_t baud)
 {
     uint32_t tmpreg=0x00;
-    uint32_t uartclock = 0x00, integer_baud = 0x00;
+
+    S_UART_SetBaud(baud);
 
-    assert_param(IS_UART_MODE(S_UART_InitStruct->UART_Mode));
+    tmpreg = UART2->CTRL;
+    tmpreg &= ~(S_UART_CTRL_RX_EN | S_UART_CTRL_TX_EN);
+    tmpreg |= (S_UART_CTRL_RX_EN | S_UART_CTRL_TX_EN);
+    UART2->CTRL = tmpreg;
+
+    return 0;
+}
+
+void S_UART_SetBaud(uint32_t baud)
+{
+    uint32_t uartclock = 0x00, integer_baud = 0x00;
 
     if(CRG->FCLK_SSR == CRG_FCLK_SSR_RCLK)
     {
-        uartclock = INTERN_XTAL;  
+        uartclock = INTERN_XTAL;
     }
     else if(CRG->FCLK_SSR == CRG_FCLK_SSR_OCLK)
     {
@@ -227,18 +238,11 @@
 
     integer_baud = (uint32_t)(uartclock / baud);
     UART2->BAUDDIV = integer_baud;
-
-    tmpreg = UART2->CTRL;
-    tmpreg &= ~(S_UART_CTRL_RX_EN | S_UART_CTRL_TX_EN);
-    tmpreg |= (S_UART_CTRL_RX_EN | S_UART_CTRL_TX_EN);
-    UART2->CTRL = tmpreg;
-
-    return 0;
 }
 
 void S_UART_SendData(uint16_t Data)
 {
-    while(UART2->STATE & S_UART_STATE_TX_BUF_FULL); 
+    while(UART2->STATE & S_UART_STATE_TX_BUF_FULL);
     UART2->DATA = Data;
 }
 
@@ -248,13 +252,13 @@
 }
 
 
-FlagStatus S_UART_GetFlagStatus(uint16_t S_UART_FLAG)
+FlagStatus S_UART_GetFlagStatus(uint16_t S_UART_STATE)
 {
     FlagStatus bitstatus = RESET;
 
-    assert_param(IS_S_UART_FLAG(S_UART_FLAG));
+    assert_param(IS_S_UART_STATE(S_UART_STATE));
 
-    if ((UART2->STATE & S_UART_FLAG) != (uint16_t)RESET)
+    if ((UART2->STATE & S_UART_STATE) != (FlagStatus)RESET)
     {
         bitstatus = SET;
     }
@@ -266,28 +270,40 @@
     return bitstatus;
 }
 
-
-void S_UART_ITConfig(uint16_t S_UART_IT, FunctionalState NewState)
+void S_UART_SetCTRL(uint16_t S_UART_CTRL, FunctionalState NewState)
 {
-    assert_param(IS_S_UART_IT_FLAG(S_UART_IT));
-
     if ( NewState != DISABLE )
     {
-        UART2->CTRL |= S_UART_IT;
+        UART2->CTRL |= S_UART_CTRL;
     }
     else
     {
-        UART2->CTRL &= ~(S_UART_IT);
+        UART2->CTRL &= ~(S_UART_CTRL);
     }
 }
 
-ITStatus S_UART_GetITStatus(uint16_t S_UART_IT)
+
+void S_UART_ITConfig(uint16_t S_UART_CTRL, FunctionalState NewState)
+{
+    assert_param(IS_S_UART_CTRL_FLAG(S_UART_CTRL));
+
+    if ( NewState != DISABLE )
+    {
+        UART2->CTRL |= S_UART_CTRL;
+    }
+    else
+    {
+        UART2->CTRL &= ~(S_UART_CTRL);
+    }
+}
+
+ITStatus S_UART_GetITStatus(uint16_t S_UART_INTSTATUS)
 {
     ITStatus bitstatus = RESET;
 
-    assert_param(IS_S_UART_IT_FLAG(S_UART_IT));
+    assert_param(IS_S_UART_INTSATUS(S_UART_INTSTATUS));
 
-    if ((UART2->INT.STATUS & (S_UART_IT >> 2)) != (uint16_t) RESET)
+    if ((UART2->INT.STATUS & (S_UART_INTSTATUS)) != (uint16_t) RESET)
     {
         bitstatus = SET;
     }
@@ -299,11 +315,11 @@
     return bitstatus;
 }
 
-void S_UART_ClearITPendingBit(uint16_t S_UART_IT)
+void S_UART_ClearITPendingBit(uint16_t S_UART_INTSTATUS)
 {
-    assert_param(IS_S_UART_IT_FLAG(S_UART_IT));
+    assert_param(IS_S_UART_INTSATUS(S_UART_INTSTATUS));
 
-    UART2->INT.CLEAR |= (S_UART_IT >> 2);
+    UART2->INT.CLEAR |= (S_UART_INTSTATUS);
 }