Mercurial > louis > kiibohd-controller
comparison Scan/STLcd/lcd_scan.c @ 353:c6613db89cbe
Adding capability to set default image on LCD
author | Jacob Alexander <haata@kiibohd.com> |
---|---|
date | Sat, 01 Aug 2015 23:13:19 -0700 |
parents | 99b567a3b1f2 |
children | 40bbbc667399 |
comparison
equal
deleted
inserted
replaced
352:99b567a3b1f2 | 353:c6613db89cbe |
---|---|
56 | 56 |
57 | 57 |
58 | 58 |
59 // ----- Variables ----- | 59 // ----- Variables ----- |
60 | 60 |
61 // Default Image - Displays on startup | |
62 const uint8_t STLcdDefaultImage[] = { STLcdDefaultImage_define }; | |
63 | |
61 // Full Toggle State | 64 // Full Toggle State |
62 uint8_t cliFullToggleState = 0; | 65 uint8_t cliFullToggleState = 0; |
63 | 66 |
64 // Normal/Reverse Toggle State | 67 // Normal/Reverse Toggle State |
65 uint8_t cliNormalReverseToggleState = 0; | 68 uint8_t cliNormalReverseToggleState = 0; |
275 PORTC_PCR8 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); | 278 PORTC_PCR8 = PORT_PCR_SRE | PORT_PCR_DSE | PORT_PCR_MUX(1); |
276 GPIOC_PSOR |= (1<<8); | 279 GPIOC_PSOR |= (1<<8); |
277 | 280 |
278 // Run LCD intialization sequence | 281 // Run LCD intialization sequence |
279 LCD_initialize(); | 282 LCD_initialize(); |
283 | |
284 // Write default image to LCD | |
285 for ( uint8_t page = 0; page < LCD_TOTAL_VISIBLE_PAGES; page++ ) | |
286 LCD_writeDisplayReg( page, (uint8_t*)&STLcdDefaultImage[page * LCD_PAGE_LEN], LCD_PAGE_LEN ); | |
280 | 287 |
281 // Setup Backlight | 288 // Setup Backlight |
282 // TODO Expose default settings | 289 // TODO Expose default settings |
283 SIM_SCGC6 |= SIM_SCGC6_FTM0; | 290 SIM_SCGC6 |= SIM_SCGC6_FTM0; |
284 FTM0_CNT = 0; // Reset counter | 291 FTM0_CNT = 0; // Reset counter |
336 | 343 |
337 // ----- CLI Command Functions ----- | 344 // ----- CLI Command Functions ----- |
338 | 345 |
339 void cliFunc_lcdInit( char* args ) | 346 void cliFunc_lcdInit( char* args ) |
340 { | 347 { |
341 print( NL ); // No \r\n by default after the command is entered | |
342 LCD_initialize(); | 348 LCD_initialize(); |
343 } | 349 } |
344 | 350 |
345 void cliFunc_lcdTest( char* args ) | 351 void cliFunc_lcdTest( char* args ) |
346 { | 352 { |
347 print( NL ); // No \r\n by default after the command is entered | 353 // Write default image |
348 | |
349 //LCD_initialize(); | |
350 // Test pattern | |
351 uint8_t pattern[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; | |
352 | |
353 | |
354 uint8_t logo[] = { | |
355 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
356 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
357 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
358 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
359 }; | |
360 //uint8_t pattern[] = { 0xFF, 0x00, 0x96, 0xFF, 0x00, 0xFF, 0x00 }; | |
361 | |
362 // Write to page D0 | |
363 //LCD_writeDisplayReg( 0, pattern, sizeof( pattern ) ); | |
364 | |
365 for ( uint8_t page = 0; page < LCD_TOTAL_VISIBLE_PAGES; page++ ) | 354 for ( uint8_t page = 0; page < LCD_TOTAL_VISIBLE_PAGES; page++ ) |
366 { | 355 LCD_writeDisplayReg( page, (uint8_t *)&STLcdDefaultImage[page * LCD_PAGE_LEN], LCD_PAGE_LEN ); |
367 LCD_writeDisplayReg( page, &logo[page * LCD_PAGE_LEN], LCD_PAGE_LEN ); | |
368 } | |
369 } | 356 } |
370 | 357 |
371 void cliFunc_lcdCmd( char* args ) | 358 void cliFunc_lcdCmd( char* args ) |
372 { | 359 { |
373 char* curArgs; | 360 char* curArgs; |
426 | 413 |
427 // Set PWM channels | 414 // Set PWM channels |
428 FTM0_C0V = rgb[0]; | 415 FTM0_C0V = rgb[0]; |
429 FTM0_C1V = rgb[1]; | 416 FTM0_C1V = rgb[1]; |
430 FTM0_C2V = rgb[2]; | 417 FTM0_C2V = rgb[2]; |
431 | 418 } |
432 print( NL ); // No \r\n by default after the command is entered | 419 |
433 } | |
434 |