Subversion Repositories svn.mios32

Compare Revisions

Ignore whitespace Rev 1944 → Rev 1945

/trunk/apps/mios32_test/app_lcd/dog_g/app.c
35,6 → 35,34
/////////////////////////////////////////////////////////////////////////////
void APP_Background(void)
{
#define MAX_LCDS 16
int num_lcds = mios32_lcd_parameters.num_x * mios32_lcd_parameters.num_y;
if( num_lcds > MAX_LCDS ) {
MIOS32_MIDI_SendDebugMessage("WARNING: this application only supports up to 16 displays!\n");
num_lcds = MAX_LCDS;
}
 
// clear LCDs
{
u8 n;
for(n=0; n<num_lcds; ++n) {
MIOS32_LCD_DeviceSet(n);
MIOS32_LCD_Clear();
}
}
 
u8 vmeter_icon_ctr[MAX_LCDS][2] = {{0,5},{3,14},{7,1},{3,9},{13,6},{10,2},{1,4},{6,2},{13,6},{10,2},{1,4},{6,2},{1,2},{13,14},{5,5},{6,1}}; // memo: 28 icons (14 used)
u8 vmeter_icon_dir[MAX_LCDS][2] = {{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1},{1,1}};
u8 vmeter_icon_delay_ctr[MAX_LCDS][2] = {{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4},{1,4}};
const u8 vmeter_icon_x[2] = {0, 120}; // memo: icon width 8
const u8 vmeter_icon_y[2] = {12, 12}; // memo: icon height 32
 
u8 hmeter_icon_ctr[MAX_LCDS][2] = {{6,11},{2,27},{23,1},{15,6},{18,9},{10,12},{3,25},{26,7},{18,9},{10,12},{3,25},{26,7},{6,9},{18,18},{20,10},{3,10}}; // memo: 28 icons (14 used)
u8 hmeter_icon_dir[MAX_LCDS][2] = {{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0},{1,0}};
u8 hmeter_icon_delay_ctr[MAX_LCDS][2] = {{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2},{4,2}};
const u8 hmeter_icon_x[2] = {20, 80}; // memo: icon width 28
const u8 hmeter_icon_y[2] = {60, 60}; // memo: icon height 8
 
// print configured LCD parameters
MIOS32_MIDI_SendDebugMessage("\n");
MIOS32_MIDI_SendDebugMessage("\n");
59,31 → 87,89
// clear LCD
MIOS32_LCD_Clear();
 
// print static screen
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_NORMAL);
 
// endless loop - LED will flicker on each iteration
while( 1 ) {
// wait some mS
MIOS32_DELAY_Wait_uS(10000);
 
// toggle the state of all LEDs (allows to measure the execution speed with a scope)
MIOS32_BOARD_LED_Set(0xffffffff, ~MIOS32_BOARD_LED_Get());
 
// X/Y "position" of displays (see also comments in $MIOS32_PATH/modules/app_lcd/dog_g/README.txt)
const u8 lcd_x[8] = {0, 1, 0, 1, 0, 1, 0, 1}; // CS#0..7
const u8 lcd_y[8] = {0, 0, 1, 1, 2, 2, 3, 3};
u8 n;
for(n=0; n<num_lcds; ++n) {
int i;
#if 0
// X/Y "position" of displays
const u8 lcd_x[MAX_LCDS] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // CS#0..7
const u8 lcd_y[MAX_LCDS] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7};
 
u8 i;
for(i=0; i<1; ++i) {
u16 x_offset = 128*lcd_x[i];
u16 y_offset = 64*lcd_y[i];
// X/Y "position" of displays
u8 x_offset = 128*lcd_x[n];
u8 y_offset = 64*lcd_y[n];
#else
// TK: expired! LCDs now addressed via MIOS32_LCD_DeviceSet()
u8 x_offset = 0;
u8 y_offset = 0;
MIOS32_LCD_DeviceSet(n);
#endif
 
// print text
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_NORMAL);
MIOS32_LCD_GCursorSet(x_offset + 16, y_offset + 1*8);
MIOS32_LCD_PrintFormattedString(" DOGM128 #%d", i+1);
MIOS32_LCD_GCursorSet(x_offset + 6*6, y_offset + 1*8);
MIOS32_LCD_PrintFormattedString("DOGM128 #%d", n+1);
 
MIOS32_LCD_GCursorSet(x_offset + 16, y_offset + 2*8);
MIOS32_LCD_PrintString(" powered by ");
MIOS32_LCD_GCursorSet(x_offset + 6*6, y_offset + 2*8);
MIOS32_LCD_PrintString("powered by ");
 
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_BIG);
MIOS32_LCD_GCursorSet(x_offset + 16, y_offset + 4*8);
MIOS32_LCD_GCursorSet(x_offset + 3*6, y_offset + 3*8);
MIOS32_LCD_PrintString("MIOS32");
 
// print vmeter icons
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_METER_ICONS_V); // memo: 28 icons, 14 used, icon size: 8x32
for(i=0; i<2; ++i) {
if( ++vmeter_icon_delay_ctr[n][i] ) {
vmeter_icon_delay_ctr[n][i] = 0;
if( vmeter_icon_dir[n][i] ) {
if( ++vmeter_icon_ctr[n][i] >= 13 )
vmeter_icon_dir[n][i] = 0;
} else {
if( --vmeter_icon_ctr[n][i] < 1 )
vmeter_icon_dir[n][i] = 1;
}
}
MIOS32_LCD_GCursorSet(vmeter_icon_x[i]+x_offset, vmeter_icon_y[i]+y_offset);
MIOS32_LCD_PrintChar(vmeter_icon_ctr[n][i]);
}
 
// print hmeter icons
for(i=0; i<2; ++i) {
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_METER_ICONS_H); // memo: 28 icons, 14 used, icon size: 28x8
if( ++hmeter_icon_delay_ctr[n][i] > 7 ) {
hmeter_icon_delay_ctr[n][i] = 0;
if( hmeter_icon_dir[n][i] ) {
if( ++hmeter_icon_ctr[n][i] >= 13 )
hmeter_icon_dir[n][i] = 0;
} else {
if( --hmeter_icon_ctr[n][i] < 1 )
hmeter_icon_dir[n][i] = 1;
}
}
MIOS32_LCD_GCursorSet(hmeter_icon_x[i]+x_offset, hmeter_icon_y[i]+y_offset);
MIOS32_LCD_PrintChar(hmeter_icon_ctr[n][i]);
 
MIOS32_LCD_FontInit((u8 *)GLCD_FONT_NORMAL);
if( i == 0 ) {
MIOS32_LCD_GCursorSet(0+x_offset, hmeter_icon_y[i]+y_offset);
MIOS32_LCD_PrintFormattedString("%d", hmeter_icon_ctr[n][i]*4);
} else {
MIOS32_LCD_GCursorSet(128-3*6+x_offset, hmeter_icon_y[i]+y_offset);
MIOS32_LCD_PrintFormattedString("%3d", hmeter_icon_ctr[n][i]*4);
}
}
}
}
}