/*--------------------------------------------------------------------------- Set Lights function controls LEDs and LCD display *---------------------------------------------------------------------------*/ void SetLights (uint32_t light, uint32_t on) { osMutexWait(mut_GLCD, osWaitForever); GLCD_SetBackColor(White); if (light == RED) { GLCD_SetTextColor(Red); if (on == 0) { GLCD_DisplayChar(4, 15, __FI, 0x80+0); } else { GLCD_DisplayChar(4, 15, __FI, 0x80+1); } } if (light == YELLOW) { GLCD_SetTextColor(Yellow); if (on == 0) { GLCD_DisplayChar(5, 15, __FI, 0x80+0); } else { GLCD_DisplayChar(5, 15, __FI, 0x80+1); } } if (light == GREEN) { GLCD_SetTextColor(Green); if (on == 0) { GLCD_DisplayChar(6, 15, __FI, 0x80+0); } else { GLCD_DisplayChar(6, 15, __FI, 0x80+1); } } if (light == STOP) { GLCD_SetTextColor(Red); if (on == 0) { GLCD_DisplayChar(5, 13, __FI, 0x80+12); } else { GLCD_DisplayChar(5, 13, __FI, 0x80+13); } } if (light == WALK) { GLCD_SetTextColor(Green); if (on == 0) { GLCD_DisplayChar(6, 13, __FI, 0x80+14); } else { GLCD_DisplayChar(6, 13, __FI, 0x80+15); } } osMutexRelease(mut_GLCD); if (on == 0) { LED_Off (light); } else { LED_On (light); } }
/* This function prints and records the input character. just_record: If just_record is true, the character won't be printed and just recorded in the cache. */ void append_char(uint8_t _char) { int last_line_to_append; //Reached to the end of row if( last_col_cahche >= LCD_WIDTH ) { last_col_cahche = 0; ++cache_size; if( cache_size >= CACHE_LINE_CAP ) { cache_start = (cache_start + 1) % CACHE_LINE_CAP; --cache_size; } if( window_size >= LCD_HEIGTH - 1 ) { window_start = ( window_start + 1 ) % CACHE_LINE_CAP; --window_size; refresh_lcd(); } ++window_size; } if(_char == '\n') { last_col_cahche = LCD_WIDTH + 1; } else { last_line_to_append = window_size; GLCD_DisplayChar ( last_line_to_append, last_col_cahche, FONT_SIZE, _char); chache[last_line()][last_col_cahche] = _char; ++last_col_cahche; chache[last_line()][last_col_cahche] = 0x0; } }
void GLCD_DisplayString (unsigned int ln, unsigned int col, unsigned char *s) { GLCD_WindowMax(); while (*s) { GLCD_DisplayChar(ln, col++, *s++); } }
/*---------------------------------------------------------------------------- switch LED off *---------------------------------------------------------------------------*/ void LED_off (unsigned char led) { LED_Off(led); osMutexWait(mut_GLCD, osWaitForever); GLCD_SetBackColor(White); GLCD_SetTextColor(Green); GLCD_DisplayChar(4, 5+led, __FI, 0x80+0); /* Circle Empty */ osMutexRelease(mut_GLCD); }
/*---------------------------------------------------------------------------- * switch LED off *---------------------------------------------------------------------------*/ void LED_Off (unsigned char led) { LED_off(led); os_mut_wait(mut_GLCD, 0xffff); GLCD_SetBackColor(White); /* Set the Back Color */ GLCD_SetTextColor(Green); /* Set the Text Color */ GLCD_DisplayChar(4, 5+led, 1, 0x80+0); /* Circle Empty */ os_mut_release(mut_GLCD); }
void lcdPutChar(char_t c) { if(c == '\r') { lcdColumn = 0; } else if(c == '\n') { lcdColumn = 0; lcdLine++; } else if(lcdLine < 10 && lcdColumn < 20) { //Display current character GLCD_DisplayChar(lcdLine, lcdColumn, 1, c); //Advance the cursor position if(++lcdColumn >= 20) { lcdColumn = 0; lcdLine++; } } }