Skip to content

Commit 9966f19

Browse files
ttnwosayBernardXiong
authored andcommitted
Support LVGLv81 RTT music demo for N9H30 and NUC980.
1 parent 5716532 commit 9966f19

File tree

35 files changed

+1984
-457
lines changed

35 files changed

+1984
-457
lines changed

bsp/nuvoton/libraries/m480/StdDriver/src/nu_can.c

Lines changed: 74 additions & 74 deletions
Large diffs are not rendered by default.

bsp/nuvoton/libraries/m480/StdDriver/src/nu_qspi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ uint32_t QSPI_SetBusClock(QSPI_T *qspi, uint32_t u32BusClock)
322322
u32ClkSrc = __HIRC; /* Clock source is HIRC */
323323
}
324324
}
325+
else
326+
{
327+
return 0;
328+
}
325329

326330
if (u32BusClock >= u32HCLKFreq)
327331
{

bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ void vpostMPUWriteAddr(uint16_t uscmd);
231231
void vpostMPUWriteData(uint16_t usdata);
232232
uint32_t vpostMPUReadData(void);
233233
VPOST_T *vpostLCMGetInstance(uint32_t u32DisplayPanelID);
234+
void vpostSetFrameBuffer(uint8_t *pu8BufPtr);
235+
void vpostSetOSDBuffer(uint8_t *pu8BufPtr);
236+
uint8_t *vpostGetMultiOSDBuffer(uint32_t u32Cnt);
234237

235238
/*@}*/ /* end of group N9H30_LCD_EXPORTED_FUNCTIONS */
236239

bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,12 @@ uint8_t *vpostGetFrameBuffer(void)
234234
return (uint8_t *)((uint32_t)u8BufPtr | 0x80000000);
235235
}
236236

237+
void vpostSetFrameBuffer(uint8_t *pu8BufPtr)
238+
{
239+
outpw(REG_LCM_VA_BADDR0, (uint32_t)((uint32_t)pu8BufPtr | 0x80000000));
240+
outpw(REG_LCM_VA_FBCTRL, inpw(REG_LCM_VA_FBCTRL) & ~(1 << 30) & ~VPOSTB_DB_EN);
241+
}
242+
237243

238244
/**
239245
* @brief Get the pointer of frame buffer
@@ -535,6 +541,56 @@ uint8_t *vpostGetOSDBuffer(void)
535541
return (uint8_t *)((uint32_t)u8BufPtr | 0x80000000);
536542
}
537543

544+
/**
545+
* @brief Get the pointer of OSD buffer
546+
* @param[in] u32Cnt is the frame buffer count to allocate. Min value is 1.
547+
* @return pointer of frame buffer
548+
* @retval NULL fail.
549+
* @note before calling this function, display width, height and source format must be set first.
550+
*/
551+
uint8_t *vpostGetMultiOSDBuffer(uint32_t u32Cnt)
552+
{
553+
uint32_t u32BytePerPixel;
554+
uint8_t *u8BufPtr;
555+
556+
if ((curOSDDev.nOSDWidth == 0) || (curOSDDev.nOSDHeight == 0))
557+
{
558+
return NULL;
559+
}
560+
561+
switch (curOSDDev.ucOSDSrcFormat)
562+
{
563+
case OSD_SRC_YUV422:
564+
case OSD_SRC_YCBCR422:
565+
case OSD_SRC_RGB565:
566+
u32BytePerPixel = 2;
567+
break;
568+
569+
case OSD_SRC_RGB666:
570+
case OSD_SRC_RGB888:
571+
u32BytePerPixel = 4;
572+
break;
573+
574+
default:
575+
u32BytePerPixel = 2;
576+
}
577+
578+
u8BufPtr = (uint8_t *)malloc((curOSDDev.nOSDWidth * curOSDDev.nOSDHeight * u32BytePerPixel) * u32Cnt + 32);
579+
if (u8BufPtr == NULL)
580+
return NULL;
581+
u8BufPtr = (uint8_t *)shift_pointer((uint32_t)u8BufPtr, 32);
582+
583+
outpw(REG_LCM_OSD_BADDR, (uint32_t)((uint32_t)u8BufPtr | 0x80000000));
584+
585+
return (uint8_t *)((uint32_t)u8BufPtr | 0x80000000);
586+
587+
}
588+
589+
void vpostSetOSDBuffer(uint8_t *u8BufPtr)
590+
{
591+
outpw(REG_LCM_OSD_BADDR, (uint32_t)((uint32_t)u8BufPtr | 0x80000000));
592+
}
593+
538594
/**
539595
* @brief Enable OSD function
540596
* @param none

bsp/nuvoton/libraries/n9h30/Driver/Source/nu_sdh.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ uint32_t SDH_CardDetection(SDH_T *sdh, SDH_INFO_T *pSD, uint32_t card_num)
283283
u32INTSTS_CDSTS_Msk = SDH_INTSTS_CDSTS1_Msk;
284284
u32CTL_CLKKEEP_Msk = SDH_CTL_CLKKEEP1_Msk;
285285
}
286+
else
287+
{
288+
return FALSE;
289+
}
286290

287291
if ((sdh->INTEN & u32INTEN_CDSRC_Msk) == u32INTEN_CDSRC_Msk) /* Card detect pin from GPIO */
288292
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ static void adc_touch_entry(void *parameter)
216216
|| touch_point.event == RT_TOUCH_EVENT_UP
217217
|| touch_point.event == RT_TOUCH_EVENT_MOVE)
218218
{
219-
#if defined(PKG_USING_LITTLEVGL2RTT)
219+
#if defined(PKG_USING_LITTLEVGL2RTT) || defined(PKG_USING_LVGL)
220220
extern void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
221221
littlevgl2rtt_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
222222
#endif

0 commit comments

Comments
 (0)