Browse Source

Fix control function in I2C driver.

Wayne Lin 3 years ago
parent
commit
0b99eee439

+ 1 - 1
bsp/nuvoton/libraries/m031/rtt_port/drv_i2c.c

@@ -90,7 +90,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 1 - 1
bsp/nuvoton/libraries/m2354/rtt_port/drv_i2c.c

@@ -99,7 +99,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 1 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c

@@ -99,7 +99,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 4 - 0
bsp/nuvoton/libraries/n9h30/Driver/Include/nu_uart.h

@@ -770,4 +770,8 @@ void UART_SetLineConfig(UART_T *uart, uint32_t u32baudrate, uint32_t u32data_wid
 
 /*@}*/ /* end of group N9H30_Device_Driver */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

+ 1 - 1
bsp/nuvoton/libraries/n9h30/rtt_port/drv_i2c.c

@@ -516,7 +516,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     psNuI2cBus = (nu_i2c_bus_t) bus;
     psNuI2cDev = &psNuI2cBus->dev;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         nu_i2c_set_speed(psNuI2cDev, (int32_t)u32Value);

+ 3 - 4
bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c

@@ -49,10 +49,6 @@ typedef struct nu_vpost *nu_vpost_t;
 static volatile uint32_t g_u32VSyncBlank = 0;
 static struct rt_completion vsync_wq;
 
-RT_WEAK void nu_lcd_backlight_on(void) { }
-
-RT_WEAK void nu_lcd_backlight_off(void) { }
-
 static struct nu_vpost nu_fbdev[eVpost_Cnt] =
 {
     {
@@ -73,6 +69,9 @@ static struct nu_vpost nu_fbdev[eVpost_Cnt] =
 #endif
 };
 
+RT_WEAK void nu_lcd_backlight_on(void) { }
+
+RT_WEAK void nu_lcd_backlight_off(void) { }
 static rt_err_t vpost_layer_open(rt_device_t dev, rt_uint16_t oflag)
 {
     nu_vpost_t psVpost = (nu_vpost_t)dev;

+ 1 - 1
bsp/nuvoton/libraries/nuc980/rtt_port/drv_i2c.c

@@ -118,7 +118,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 1 - 2
bsp/nuvoton/nk-n9h30/board/board_dev.c

@@ -252,12 +252,11 @@ static void PlayRingTone(void)
     #include <drv_gpio.h>
 
     /* defined the LCM_BLEN pin: PH3 */
-    #define LCM_BLEN  NU_GET_PININDEX(NU_PH, 3)
+    #define LCM_BACKLIGHT_CTRL  NU_GET_PININDEX(NU_PH, 3)
 #endif
 
 #define PWM_DEV_NAME         "pwm0"
 #define LCM_PWM_CHANNEL      (0)
-#define LCM_BACKLIGHT_CTRL   NU_GET_PININDEX(NU_PH, 3)
 
 void nu_lcd_backlight_on(void)
 {