Skip to content

Commit 7fee653

Browse files
authored
[nuvoton] Update drivers and project setting. (#5726)
1 parent 66d5101 commit 7fee653

File tree

41 files changed

+2160
-2065
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2160
-2065
lines changed

bsp/nuvoton/libraries/m031/rtt_port/drv_rtc.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929

3030
/* rtc date upper bound reaches the year of 2099. */
3131
#define RTC_TM_UPPER_BOUND \
32-
{ .tm_year = CONV_TO_TM_YEAR(2099), \
33-
.tm_mon = CONV_TO_TM_MON(12), \
34-
.tm_mday = 31, \
35-
.tm_hour = 23, \
36-
.tm_min = 59, \
37-
.tm_sec = 59, \
32+
{ .tm_year = CONV_TO_TM_YEAR(2038), \
33+
.tm_mon = CONV_TO_TM_MON(1), \
34+
.tm_mday = 19, \
35+
.tm_hour = 3, \
36+
.tm_min = 14, \
37+
.tm_sec = 07, \
3838
}
3939

4040
/* rtc date lower bound reaches the year of 2000. */
@@ -57,8 +57,8 @@ static rt_size_t nu_rtc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_siz
5757
static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
5858
#endif
5959

60-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t);
61-
static void nu_rtc_init(void);
60+
static rt_err_t nu_rtc_is_date_valid(const time_t t);
61+
static rt_err_t nu_rtc_init(void);
6262

6363
#if defined(RT_USING_ALARM)
6464
static void nu_rtc_alarm_reset(void);
@@ -74,7 +74,7 @@ extern rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t secon
7474
static struct rt_device device_rtc;
7575

7676

77-
static void nu_rtc_init(void)
77+
static rt_err_t nu_rtc_init(void)
7878
{
7979
/* hw rtc initialise */
8080
RTC_Open(NULL);
@@ -86,6 +86,8 @@ static void nu_rtc_init(void)
8686
RTC_EnableInt(RTC_INTEN_ALMIEN_Msk);
8787
NVIC_EnableIRQ(RTC_IRQn);
8888
#endif
89+
90+
return RT_EOK;
8991
}
9092

9193

@@ -173,7 +175,7 @@ static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer,
173175
#endif
174176

175177

176-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
178+
static rt_err_t nu_rtc_is_date_valid(const time_t t)
177179
{
178180
static struct tm tm_upper = RTC_TM_UPPER_BOUND;
179181
static struct tm tm_lower = RTC_TM_LOWER_BOUND;
@@ -188,7 +190,7 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
188190
}
189191

190192
/* check the date is supported by rtc. */
191-
if ((*t > t_upper) || (*t < t_lower))
193+
if ((t > t_upper) || (t < t_lower))
192194
return -(RT_EINVAL);
193195

194196
return RT_EOK;
@@ -230,11 +232,11 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
230232
case RT_DEVICE_CTRL_RTC_SET_TIME:
231233

232234
time = (time_t *) args;
233-
tm_in = gmtime(time);
234235

235-
if (nu_rtc_is_date_valid(time) != RT_EOK)
236-
return RT_ERROR;
236+
if (nu_rtc_is_date_valid(*time) != RT_EOK)
237+
return -(RT_ERROR);
237238

239+
tm_in = gmtime(time);
238240
hw_time.u32Year = CONV_FROM_TM_YEAR(tm_in->tm_year);
239241
hw_time.u32Month = CONV_FROM_TM_MON(tm_in->tm_mon);
240242
hw_time.u32Day = tm_in->tm_mday;

bsp/nuvoton/libraries/m2354/rtt_port/drv_rtc.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929

3030
/* rtc date upper bound reaches the year of 2099. */
3131
#define RTC_TM_UPPER_BOUND \
32-
{ .tm_year = CONV_TO_TM_YEAR(2099), \
33-
.tm_mon = CONV_TO_TM_MON(12), \
34-
.tm_mday = 31, \
35-
.tm_hour = 23, \
36-
.tm_min = 59, \
37-
.tm_sec = 59, \
32+
{ .tm_year = CONV_TO_TM_YEAR(2038), \
33+
.tm_mon = CONV_TO_TM_MON(1), \
34+
.tm_mday = 19, \
35+
.tm_hour = 3, \
36+
.tm_min = 14, \
37+
.tm_sec = 07, \
3838
}
3939

4040
/* rtc date lower bound reaches the year of 2000. */
@@ -57,8 +57,8 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args);
5757
static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
5858
#endif
5959

60-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t);
61-
static void nu_rtc_init(void);
60+
static rt_err_t nu_rtc_is_date_valid(const time_t t);
61+
static rt_err_t nu_rtc_init(void);
6262

6363
#if defined(RT_USING_ALARM)
6464
static void nu_rtc_alarm_reset(void);
@@ -74,7 +74,7 @@ static void nu_rtc_init(void);
7474
static struct rt_device device_rtc;
7575

7676

77-
static void nu_rtc_init(void)
77+
static rt_err_t nu_rtc_init(void)
7878
{
7979
/* hw rtc initialise */
8080
RTC_Open(NULL);
@@ -89,6 +89,8 @@ static void nu_rtc_init(void)
8989
RTC_EnableInt(RTC_INTEN_ALMIEN_Msk);
9090
NVIC_EnableIRQ(RTC_IRQn);
9191
#endif
92+
93+
return RT_EOK;
9294
}
9395

9496

@@ -176,7 +178,7 @@ static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer,
176178
#endif
177179

178180

179-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
181+
static rt_err_t nu_rtc_is_date_valid(const time_t t)
180182
{
181183
static struct tm tm_upper = RTC_TM_UPPER_BOUND;
182184
static struct tm tm_lower = RTC_TM_LOWER_BOUND;
@@ -191,7 +193,7 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
191193
}
192194

193195
/* check the date is supported by rtc. */
194-
if ((*t > t_upper) || (*t < t_lower))
196+
if ((t > t_upper) || (t < t_lower))
195197
return -(RT_EINVAL);
196198

197199
return RT_EOK;
@@ -233,11 +235,11 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
233235
case RT_DEVICE_CTRL_RTC_SET_TIME:
234236

235237
time = (time_t *) args;
236-
tm_in = gmtime(time);
237238

238-
if (nu_rtc_is_date_valid(time) != RT_EOK)
239-
return RT_ERROR;
239+
if (nu_rtc_is_date_valid(*time) != RT_EOK)
240+
return -(RT_ERROR);
240241

242+
tm_in = gmtime(time);
241243
hw_time.u32Year = CONV_FROM_TM_YEAR(tm_in->tm_year);
242244
hw_time.u32Month = CONV_FROM_TM_MON(tm_in->tm_mon);
243245
hw_time.u32Day = tm_in->tm_mday;

bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929

3030
/* rtc date upper bound reaches the year of 2099. */
3131
#define RTC_TM_UPPER_BOUND \
32-
{ .tm_year = CONV_TO_TM_YEAR(2099), \
33-
.tm_mon = CONV_TO_TM_MON(12), \
34-
.tm_mday = 31, \
35-
.tm_hour = 23, \
36-
.tm_min = 59, \
37-
.tm_sec = 59, \
32+
{ .tm_year = CONV_TO_TM_YEAR(2038), \
33+
.tm_mon = CONV_TO_TM_MON(1), \
34+
.tm_mday = 19, \
35+
.tm_hour = 3, \
36+
.tm_min = 14, \
37+
.tm_sec = 07, \
3838
}
3939

4040
/* rtc date lower bound reaches the year of 2000. */
@@ -57,8 +57,8 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args);
5757
static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
5858
#endif
5959

60-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t);
61-
static void nu_rtc_init(void);
60+
static rt_err_t nu_rtc_is_date_valid(const time_t t);
61+
static rt_err_t nu_rtc_init(void);
6262

6363
#if defined(RT_USING_ALARM)
6464
static void nu_rtc_alarm_reset(void);
@@ -74,7 +74,7 @@ static void nu_rtc_init(void);
7474
static struct rt_device device_rtc;
7575

7676

77-
static void nu_rtc_init(void)
77+
static rt_err_t nu_rtc_init(void)
7878
{
7979
/* hw rtc initialise */
8080
RTC_Open(NULL);
@@ -88,6 +88,8 @@ static void nu_rtc_init(void)
8888
RTC_EnableInt(RTC_INTEN_ALMIEN_Msk);
8989
NVIC_EnableIRQ(RTC_IRQn);
9090
#endif
91+
92+
return RT_EOK;
9193
}
9294

9395

@@ -175,7 +177,7 @@ static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer,
175177
#endif
176178

177179

178-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
180+
static rt_err_t nu_rtc_is_date_valid(const time_t t)
179181
{
180182
static struct tm tm_upper = RTC_TM_UPPER_BOUND;
181183
static struct tm tm_lower = RTC_TM_LOWER_BOUND;
@@ -190,7 +192,7 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
190192
}
191193

192194
/* check the date is supported by rtc. */
193-
if ((*t > t_upper) || (*t < t_lower))
195+
if ((t > t_upper) || (t < t_lower))
194196
return -(RT_EINVAL);
195197

196198
return RT_EOK;
@@ -232,11 +234,11 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
232234
case RT_DEVICE_CTRL_RTC_SET_TIME:
233235

234236
time = (time_t *) args;
235-
tm_in = gmtime(time);
236237

237-
if (nu_rtc_is_date_valid(time) != RT_EOK)
238-
return RT_ERROR;
238+
if (nu_rtc_is_date_valid(*time) != RT_EOK)
239+
return -(RT_ERROR);
239240

241+
tm_in = gmtime(time);
240242
hw_time.u32Year = CONV_FROM_TM_YEAR(tm_in->tm_year);
241243
hw_time.u32Month = CONV_FROM_TM_MON(tm_in->tm_mon);
242244
hw_time.u32Day = tm_in->tm_mday;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
LOAD %L INCREMENTAL
2+
$ = 0
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
3+
LR_IROM1 0x00000000 { ; load region size_region
4+
ER_IROM1 0x00000000 { ; load address = execution address
5+
*.o (NUC_INIT, +First)
6+
*(InRoot$$Sections)
7+
.ANY (+RO)
8+
}
9+
RW_RAM1 +0 { ; RW_RAM1 start address is after ER_ROM1
10+
.ANY (+RW +ZI)
11+
}
12+
}

bsp/nuvoton/libraries/n9h30/rtt_port/drv_rtc.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030

3131
/* rtc date upper bound reaches the year of 2099. */
3232
#define RTC_TM_UPPER_BOUND \
33-
{ .tm_year = CONV_TO_TM_YEAR(2099), \
34-
.tm_mon = CONV_TO_TM_MON(12), \
35-
.tm_mday = 31, \
36-
.tm_hour = 23, \
37-
.tm_min = 59, \
38-
.tm_sec = 59, \
33+
{ .tm_year = CONV_TO_TM_YEAR(2038), \
34+
.tm_mon = CONV_TO_TM_MON(1), \
35+
.tm_mday = 19, \
36+
.tm_hour = 3, \
37+
.tm_min = 14, \
38+
.tm_sec = 07, \
3939
}
4040

4141
/* rtc date lower bound reaches the year of 2000. */
@@ -58,8 +58,8 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args);
5858
static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size);
5959
#endif
6060

61-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t);
62-
static void nu_rtc_init(void);
61+
static rt_err_t nu_rtc_is_date_valid(const time_t t);
62+
static rt_err_t nu_rtc_init(void);
6363

6464
#if defined(RT_USING_ALARM)
6565
static void nu_rtc_alarm_reset(void);
@@ -76,7 +76,7 @@ static void nu_rtc_init(void);
7676
static struct rt_device device_rtc;
7777

7878

79-
static void nu_rtc_init(void)
79+
static rt_err_t nu_rtc_init(void)
8080
{
8181
S_RTC_TIME_DATA_T sInitTime = {0};
8282

@@ -114,6 +114,8 @@ static void nu_rtc_init(void)
114114
rt_hw_interrupt_umask(IRQ_RTC);
115115

116116
#endif
117+
118+
return RT_EOK;
117119
}
118120

119121

@@ -194,7 +196,7 @@ static rt_size_t nu_rtc_write(rt_device_t dev, rt_off_t pos, const void *buffer,
194196
#endif
195197

196198

197-
static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
199+
static rt_err_t nu_rtc_is_date_valid(const time_t t)
198200
{
199201
static struct tm tm_upper = RTC_TM_UPPER_BOUND;
200202
static struct tm tm_lower = RTC_TM_LOWER_BOUND;
@@ -209,7 +211,7 @@ static rt_err_t nu_rtc_is_date_valid(const time_t *const t)
209211
}
210212

211213
/* check the date is supported by rtc. */
212-
if ((*t > t_upper) || (*t < t_lower))
214+
if ((t > t_upper) || (t < t_lower))
213215
return -(RT_EINVAL);
214216

215217
return RT_EOK;
@@ -255,11 +257,11 @@ static rt_err_t nu_rtc_control(rt_device_t dev, int cmd, void *args)
255257
case RT_DEVICE_CTRL_RTC_SET_TIME:
256258

257259
time = (time_t *) args;
258-
tm_in = gmtime(time);
259260

260-
if (nu_rtc_is_date_valid(time) != RT_EOK)
261+
if (nu_rtc_is_date_valid(*time) != RT_EOK)
261262
return -(RT_ERROR);
262263

264+
tm_in = gmtime(time);
263265
hw_time.u32Year = CONV_FROM_TM_YEAR(tm_in->tm_year);
264266
hw_time.u32cMonth = CONV_FROM_TM_MON(tm_in->tm_mon);
265267
hw_time.u32cDay = tm_in->tm_mday;

bsp/nuvoton/libraries/nu_packages/Kconfig

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,29 @@ menu "Nuvoton Packages Config"
136136

137137
endif
138138

139-
config NU_PKG_USING_ILI_TPC
140-
bool "ILI Series TPC"
139+
config NU_PKG_USING_TPC
140+
bool "Support Touch Panel Controller over I2C"
141141
select RT_USING_TOUCH
142+
select RT_TOUCH_PIN_IRQ
142143
select RT_USING_I2C
143-
select BSP_USING_I2C
144-
default n
144+
145+
if NU_PKG_USING_TPC
146+
choice
147+
prompt "Select TPC drivers"
148+
config NU_PKG_USING_TPC_ILI
149+
bool "ILI Series TPC"
150+
default n
151+
152+
config NU_PKG_USING_TPC_GT911
153+
bool "GT911 TPC"
154+
default n
155+
endchoice
156+
endif
145157

146158
config NU_PKG_USING_ADC_TOUCH
147159
bool "ADC touch function"
148160
default n
161+
149162

150163
if NU_PKG_USING_ADC_TOUCH
151164
config NU_PKG_USING_ADC_TOUCH_SW

bsp/nuvoton/libraries/nu_packages/SSD1963/lcd_ssd1963.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#endif
2525

2626
#define ssd1963_delay_ms(ms) rt_thread_mdelay(ms)
27+
static void ssd1963_fillscreen(rt_uint16_t color);
2728

2829
static struct rt_device_graphic_info g_SSD1963Info =
2930
{
@@ -125,6 +126,8 @@ static rt_err_t ssd1963_lcd_init(rt_device_t dev)
125126
ssd1963_send_cmd(0x29); //SET display on
126127
ssd1963_delay_ms(5);
127128

129+
ssd1963_fillscreen(0);
130+
128131
SET_DISP_ON;
129132

130133
SET_BACKLIGHT_ON;

0 commit comments

Comments
 (0)