SDK&UI&LCM&FM SDK&UI&LCM&FM Presentation Presentation
SDK&UI&LCM&FM SDK&UI&LCM&FM Presentation Presentation
報告人報告人 : : 侯欽堅侯欽堅
2PageExcel Your Idea to Silicon
OutlineOutline
1. SDK Structure & Code Flow
2. LCM SPEC & Hardware
3. LCM Code
4. FM SPEC & Hardware
5. FM Code
6. UI Hardware
7. UI Code
8. API Structure & Code Flow
3PageExcel Your Idea to Silicon
SDK Structure & Code Flow
SDK : Software Development Kit
User’s Development : Song , UI , LCM , FM Module , Lyrics…
\RAM_user\example2\Lcd_controller2.c, funentry.c, i2c.c, song.c, fm_tea5767.c, gpio.c, lrc_parser.c
與 Kernel 的連接方式 : a. Customize Function Entry: api_bCustomizeFunEntry() b. APIs
4PageExcel Your Idea to Silicon
api_bCustomizeFunEntry()
To process the event from the Kernel
A. EVENT_QUARTER_SECOND: LCM Display , Timer
B. EVENT_LOOP_EPILOG : Song events, Key process
C. EVENT_USB_STATUS_CHANGE : USB Status show
D. USB_CABLE_IN : Cable in process
E. USB_CABLE_OUT : Cable out process
F. SYS_INIT_PROLOG : LCD & Radio initial
G. SYS_INIT_EPILOG : GUI & Song & Display initial
5PageExcel Your Idea to Silicon
Example Code Flow
1. funentry.c : api_bCustomizeFunEntry()2. Lcd_controller2.c : LCM Basic process3. i2c.c : I2C Driver4. fm_tea5767.c : FM Driver5. gpio.c : Button basic process6. song.c : LCD Display , UI flow control 7. lrc_parser.c : Lyrics show
6PageExcel Your Idea to Silicon
LCM SPEC NT7502 65x132 RAM-Map LCD Controller
.....
.....
..... ..... .....
vLcdSetAddrX(0)
vLcdSetAddrX(3)
vLcdSetAddrY(0) vLcdSetAddrY(95)
32 pixels
96 pixels
bit0
bit7
vWriteLCDData()
7PageExcel Your Idea to Silicon
Pin define
8PageExcel Your Idea to Silicon
Command support
0xE20xA2
0xA00xC0
0x230x810x03
0x2C 0x2E 0x2F 0xE0
0x4X
0xAF
0xBX0x1X
0x0X
E R/w
9PageExcel Your Idea to Silicon
LCM Hardware
10PageExcel Your Idea to Silicon
LCM Code
vWriteLCDCommand() write command to LCD controller
vWriteLCDData() write data to LCD controller
u8ReadLCDStatus() read the status of LCD controller
vLcdInit() do LCD initiation
vLCDSetBrightness() set the V0 output voltage electronic volume register
vLcdSetAddrX() set page address
vLcdSetAddrY() set column address
vLcdClearLine() clear a page-line
vLcdClearDisplay() clear screen
vLcdPut8x8Char() put a 8x8 bitmap on the screen
vLcdPut16x16Char() put a 16x16 bitmap on the screen
vLcdOutString() put a specific string on the screen
.....
.....
..... ..... .....
vLcdSetAddrX(0)
vLcdSetAddrX(3)
vLcdSetAddrY(0) vLcdSetAddrY(95)
32 pixels
96 pixels
bit0
bit7
vWriteLCDData()
back
11PageExcel Your Idea to Silicon
FM SPEC & Hardware
I2C Protocol FM Register
12PageExcel Your Idea to Silicon
I2C Protocol SDA : Serial Data line SCL : Serial Clock line Every device has its own unique address Start Stop Send BYTE Receive BYTE
13PageExcel Your Idea to Silicon
I2C : Start & Stop
14PageExcel Your Idea to Silicon
I2C : Send BYTE Once the start condition has been sent, a
byte can be transmitted by the MASTER to the SLAVE.
This first byte after a start condition will identify the slave on the bus (address) and will select the mode of operation.
ACK
15PageExcel Your Idea to Silicon
I2C : Receive BYTE All the master has to do is generate a rising edge on the SCL line (2), read
the level on SDA (3) and generate a falling edge on the SCL line (4). The slave will not change the data during the time that SCL is high.
16PageExcel Your Idea to Silicon
FM SPEC
17PageExcel Your Idea to Silicon
FM SPEC
0x80, 0x00, 0x00, 0x40, 0x00
18PageExcel Your Idea to Silicon
FM SPEC
19PageExcel Your Idea to Silicon
FM SPEC
20PageExcel Your Idea to Silicon
FM SPEC
21PageExcel Your Idea to Silicon
FM Hardware
22PageExcel Your Idea to Silicon
FM Code
bRadioInit() initiation
bSetFmFrequency() set the specific frequency
bFmFrequencyUp() increase 0.1 MHz
bFmFrequencyDown() decrease 0.1 MHz
bFmAutoSearch() up/down to search radio station auto
bRadioStop() stop the radio
23PageExcel Your Idea to Silicon
UI Hardware
(1) 128Pin (2)100Pin
24PageExcel Your Idea to Silicon
UI Code -- Button
25PageExcel Your Idea to Silicon
UI Code -- Button
26PageExcel Your Idea to Silicon
UI Code -- bGui_xxx()
bGui_CheckLvl0(GPIO_KEY ekey)
GUI_LEVEL0_MP3
GUI_LEVEL0_REC
GUI_LEVEL0_RPL
AY
GUI_LEVEL0_FM
vSong_KeyProcess(GPIO_KEY ekey)
GUI_LEVEL0_SYS_DELETE
GUI_LEVEL0_SYS_MEMOR
Y
GUI_LEVEL0_DIRE
CTORY
bGui_SelectDirectory(GPIO_KEY ekey)
bGui_SysMem(GPIO_KEY ekey) Check Key
Check Key
bGui_SysDel(GPIO_KEY ekey) Check Key
tGuiState.u8MenuLevel
bGui_FM(ekey)
bGui_FM_CheckLvl1(ekey)
0: only FM
1: FM & Recording
KEY_EOS == ekey
YES
NO
依照Repeat mode播放下一首歌曲
tGuiState.u8MenuLevel
0 : STOP
1 : PLAYING
2 : Mode Select
bGui_Mp3(ekey)
bGui_Mp3_CheckLvl1(ekey)
bGui_Mp3_CheckLvl2(ekey)
tGuiState.u8MenuLevel
bGui_Rec_CheckLvl1(ekey)
bGui_Rec(ekey)0 : STOP
>1 : Recording
tGuiState.u8MenuLevel
bGui_Rplay(ekey)
bGui_Rplay_CheckLvl1(ekey)
0 : STOP
1 : Replaying
tGuiState.u8MenuState[2]
tGuiState.u8MenuState[1]
NEXT,PREV
0:PLAY bGui_Mp3_Play(ekey)
bGui_Mp3_Pause(ekey)
1:PUASE
0:REPEAT bGui_Mp3_Lvl2Repeat(ekey)
bGui_Mp3_Lvl2Mode(ekey)
1:EQ
NEXT,PREV
tGuiState.u8MenuState[0]
Check Key
Check Key
Check Key
Check Key
Check Key
Check Key
Check Key
Check Key
Check Key
27PageExcel Your Idea to Silicon
UI Code -- GUI
28PageExcel Your Idea to Silicon
UI Code -- vLcd_xxx() vLcd_Disp_AllLvl(void) Show All LCM Display
void vLcd_Part_Lvl0(void)Show Line 1 include : Menu mode, Repeat mode, EQ
mode, Battery Remain
vLcd_Disp_RepeatMode() Repeat mode Display
vLcd_Disp_EqualizerMode() EQ mode Display
vLcd_Disp_Battery() Get Remain Battery & Display
vLcd_Disp_Exception(void) Show Error Message to LCM
vLcd_Disp_FMfreq(INT8U* sz) FM Frequency Display
void vLcd_Disp_showMode(void) Show Repeat and EQ mode select
vLcd_Disp_Volume(void) Volume Display
void vLcd_FileName() Filename Display
vLcd_Part_Icon(INT8U u8icon) Show ICON like PLA,STOP,PAUSE…
vLcd_PConLine(void) Show PC connect
vLcd_SongTimeOn(SONG_TIME_TYPE etime) Show Playing Time
vLcd_PlayTimeUpdate(void) Playing Time Update
vLcd_SongName() Show Title&Artist&Album or Song name vLcd_ScollDataUpdate(void) Update Display Scroll Data
29PageExcel Your Idea to Silicon
API Structure
RAM CODEDSP Mailbox driver
Font ManagerPlayback control
Format/Directory Manager(\RAM_kernel\*.*)
ram_api()
0x80000x9000
0xFFFF
CODE(?PR?*?ramapi (0x9000))
LCD driverFM driver
GUI control(\RAM_user\*.*)
SDK APIs
API.c
30PageExcel Your Idea to Silicon
API Code
Music Playing Mode
api_bChangeSystemMode(SYSTEM_MODE_MUSIC)
bFindAgoodMusic(0, SELECT_CUR) api_bPlay()Key
PLAY
api_bStop()STOP
api_bPause()
bFindAgoodMusic(1, SELECT_CUR)
bFindAgoodMusic(-1, SELECT_CUR)
PAUSE
NEXT
PREV
Wave Playing Mode
api_bChangeSystemMode(SYSTEM_MODE_ADPCM)
bFindAgoodMusic(0, SELECT_CUR)api_bADPCMsetMode(ADPCM_MODE_DECODE_ONLY) api_bPlay()Key
PLAY
api_bStop()STOP
api_bPause()
bFindAgoodMusic(1, SELECT_CUR)
bFindAgoodMusic(-1, SELECT_CUR)
PAUSE
NEXT
PREV
31PageExcel Your Idea to Silicon
API Code
Wave Recording Mode
api_bChangeSystemMode(SYSTEM_MODE_ADPCM)
api_bSetRecordFrequence(8000) api_bRecordStart() api_bSetADsource(AD_SOURCE_FROM_MICROPHONE) api_bADPCMsetMode(ADPCM_MODE_ENCODE_DECODE)
Key
PLAY : Record
api_bRecordStop()STOP
api_bPause()PAUSE
FM Mode
api_bChangeSystemMode(SYSTEM_MODE_FM)api_bSetADsource(AD_SOURCE_FROM_FM)
api_bADPCMsetMode(ADPCM_MODE_BYPASS) bRadioInit()
bSetFmFrequency(u32RadioFrequency)
api_bStop() api_bSetRecordFrequence(8000) api_bRecordStart() api_bSetADsource(AD_SOURCE_FROM_FM) api_bADPCMsetMode(ADPCM_MODE_ENCODE_DECODE)
Key PLAY : Record
api_bRecordStop()STOP
api_bPause()PAUSE
32PageExcel Your Idea to Silicon
API Code
bGui_SysDel(GPIO_KEY ekey)
Check Keyapi_bDeleteFile()
api_bSelectFile(0, SELECT_CUR)
bLcdRefresh = TRUE; tGuiState.u8MenuState[0] = GUI_LEVEL0_SYS_MEMORY;
PLAY
MENU
api_bSelectFile(1, SELECT_CUR)
api_bSelectFile(1, SELECT_CUR)
NEXT
PREV
vLcd_FileName();
File Deletion Mode
api_bChangeSystemMode(SYSTEM_MODE_FILE)
bGui_SelectDirectory(GPIO_KEY ekey)
Check Key
api_bChangeSystemMode(SYSTEM_MODE_MUSIC);
api_bSearchFileFromCurrentDir()bSongInit()
api_bSelectDirectory(1, SELECT_CUR)
api_bSelectDirectory(-1, SELECT_CUR)
api_bSearchDirInCurrentDir()api_bSelectDirectory(0, SELECT_SET)
MENU
PLAY
NEXT
PREV
STOP
Directory Mode
api_bChangeSystemMode(SYSTEM_MODE_DIRECTORY)
33PageExcel Your Idea to Silicon
End~~
34PageExcel Your Idea to Silicon
0xC0, 0x80, 0x00, 0x00, 0x40, 0x00
B
35PageExcel Your Idea to Silicon
0x00,
B
36PageExcel Your Idea to Silicon
B
37PageExcel Your Idea to Silicon
B
38PageExcel Your Idea to Silicon
back
b
39PageExcel Your Idea to Silicon
back
40PageExcel Your Idea to Silicon
back
b
41PageExcel Your Idea to Silicon back
Top Related