int main(void) { /* Rectangle for custom character */ /* xxx means doesn't care, lower 5 bits are important for LCD */ uint8_t customChar[] = { 0x1F, /* xxx 11111 */ 0x11, /* xxx 10001 */ 0x11, /* xxx 10001 */ 0x11, /* xxx 10001 */ 0x11, /* xxx 10001 */ 0x11, /* xxx 10001 */ 0x11, /* xxx 10001 */ 0x1F /* xxx 11111 */ }; /* Initialize system */ SystemInit(); /* Initialize LCD 20 cols x 4 rows */ TM_HD44780_Init(20, 4); /* Save custom character on location 0 in LCD */ TM_HD44780_CreateChar(0, &customChar[0]); /* Put string to LCD */ TM_HD44780_Puts(0, 0, "STM32F4/29 Discovery"); TM_HD44780_Puts(2, 1, "20x4 HD44780 LCD"); TM_HD44780_Puts(0, 2, "stm32f4-\n\r discovery.com"); /* Wait a little */ Delayms(3000); /* Clear LCD */ TM_HD44780_Clear(); /* Show cursor */ TM_HD44780_CursorOn(); /* Write new text */ TM_HD44780_Puts(6, 2, "CLEARED!"); /* Wait a little */ Delayms(1000); /* Enable cursor blinking */ TM_HD44780_BlinkOn(); /* Show custom character at x = 1, y = 2 from RAM location 0 */ TM_HD44780_PutCustom(1, 2, 0); while (1) { } }
/*APRIMORAR E TESTAR*/ void menu(void){ int b1, b2, digital = 0; int menu = 0; while(!digital){ digital = readJSButton(); b1 = readButtons('1'); b2 = readButtons('2'); if(b1||b2){ menu++; menu %= 2; } if(menu == 0){ TM_HD44780_Clear(); TM_HD44780_Puts(0, 0, "MODO AUTONOMO"); TM_HD44780_PutCustom(15, 0, 0); TM_HD44780_Puts(0, 1, "MODO MANUAL"); Delayms(50); }else if(menu == 1){ TM_HD44780_Clear(); TM_HD44780_Puts(0, 0, "MODO AUTONOMO"); TM_HD44780_Puts(0, 1, "MODO MANUAL"); TM_HD44780_PutCustom(15, 1, 0); Delayms(50); } TM_HD44780_Clear(); } if(menu == 0){ modoPerfuracao(); //setDesenhaQuadrado(); }else if(menu == 1){ manualControl(); } }
void HDStartSeq(void) { TM_HD44780_CreateChar(0, &customChar[0]); TM_HD44780_Puts(0, 0, "Servo Driver\n\rSTM32F4"); Delayms(3000); TM_HD44780_Clear(); TM_HD44780_Puts(3, 0, "MANY FUN!"); TM_HD44780_Puts(6, 1, "WOW!"); Delayms(1000); TM_HD44780_PutCustom(0, 0, 0); TM_HD44780_PutCustom(14, 0, 0); TM_HD44780_PutCustom(1, 1, 0); TM_HD44780_PutCustom(15, 1, 0); Delayms(1000); TM_HD44780_Clear(); }