sdk&ui&lcm&fm presentation 報告人 : 侯欽堅. 2 page excel your idea to silicon...

41
SDK&UI&LCM&FM SDK&UI&LCM&FM Presentation Presentation 報報報 報報報 : : 報報報 報報報

Post on 20-Dec-2015

217 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

SDK&UI&LCM&FM SDK&UI&LCM&FM Presentation Presentation

SDK&UI&LCM&FM SDK&UI&LCM&FM Presentation Presentation

報告人報告人 : : 侯欽堅侯欽堅

Page 2: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 3: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 4: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 5: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 6: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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()

Page 7: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

7PageExcel Your Idea to Silicon

Pin define

Page 8: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

8PageExcel Your Idea to Silicon

Command support

0xE20xA2

0xA00xC0

0x230x810x03

0x2C 0x2E 0x2F 0xE0

0x4X

0xAF

0xBX0x1X

0x0X

E R/w

Page 9: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

9PageExcel Your Idea to Silicon

LCM Hardware

Page 10: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 11: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

11PageExcel Your Idea to Silicon

FM SPEC & Hardware

I2C Protocol FM Register

Page 12: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 13: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

13PageExcel Your Idea to Silicon

I2C : Start & Stop

Page 14: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 15: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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.

Page 16: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

16PageExcel Your Idea to Silicon

FM SPEC

Page 17: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

17PageExcel Your Idea to Silicon

FM SPEC

0x80, 0x00, 0x00, 0x40, 0x00

Page 18: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

18PageExcel Your Idea to Silicon

FM SPEC

Page 19: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

19PageExcel Your Idea to Silicon

FM SPEC

Page 20: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

20PageExcel Your Idea to Silicon

FM SPEC

Page 21: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

21PageExcel Your Idea to Silicon

FM Hardware

Page 22: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 23: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

23PageExcel Your Idea to Silicon

UI Hardware

(1) 128Pin (2)100Pin

Page 24: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

24PageExcel Your Idea to Silicon

UI Code -- Button

Page 25: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

25PageExcel Your Idea to Silicon

UI Code -- Button

Page 26: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 27: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

27PageExcel Your Idea to Silicon

UI Code -- GUI

Page 28: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 29: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 30: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 31: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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

Page 32: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

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)

Page 33: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

33PageExcel Your Idea to Silicon

End~~

Page 34: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

34PageExcel Your Idea to Silicon

0xC0, 0x80, 0x00, 0x00, 0x40, 0x00

B

Page 35: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

35PageExcel Your Idea to Silicon

0x00,

B

Page 36: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

36PageExcel Your Idea to Silicon

B

Page 37: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

37PageExcel Your Idea to Silicon

B

Page 38: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

38PageExcel Your Idea to Silicon

back

b

Page 39: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

39PageExcel Your Idea to Silicon

back

Page 40: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

40PageExcel Your Idea to Silicon

back

b

Page 41: SDK&UI&LCM&FM Presentation 報告人 : 侯欽堅. 2 Page Excel Your Idea to Silicon Outline  SDK Structure & Code Flow  LCM SPEC & Hardware  LCM Code  FM

41PageExcel Your Idea to Silicon back