void SabreController::setAndPrintYear( uint8_t value ) { cli(); uint8_t tempYear = Year - 2000; Helper::SetPointerValue(value, &tempYear, 99, 1); Year = tempYear + 2000; printYear(); sei(); }
int main(void ) { ListName *names = NULL; ListYear *years = NULL; int choice = 0; int year; char name[512]; readFile(&years, &names); do { printf("Do you want to find a name or a year?\n1) Year 2)Name 0) Exit\nChoice : "); scanf("%d", &choice); switch( choice ) { case 1: printf("Insert the year that you will look for : "); scanf("%d", &year); printf(" The year %d %s\n", year, ( checkYear(years, year) == 1 ) ? "was found!" : "was not found!"); printYear(years); break; case 2: printf("Insert the name that you will look for : "); scanf("%s", name); printf(" The name %s %s\n", name, ( checkName(names, name) == 1 ) ? "was found!" : "was not found!"); break; case 0: printf("You are exiting...\n"); break; } }while ( choice != 0 ); getchar(); return EXIT_SUCCESS; }
void SabreController::setDateCursor( uint8_t value ) { cli(); if (this->CursorPosition != 0 && value != 0) { if (CursorPosition == 1) { printDay(); } else if (CursorPosition == 2) { printMonth(); } else { printYear(); } } Helper::SetPointerValue(value, &CursorPosition, 3, 0); if (this->CursorPosition > 0 && this->TimerEnabled == false) { this->TimerEnabled = true; printLockSymbol(0, 1); //set timer1 interrupt at 1Hz startTimer(); } else if (this->CursorPosition == 0 && this->TimerEnabled) { OLED.write(0x20); printPointer(); stopTimer(); // stop timer saveDateTime(); } if (CursorPosition == 1) { OLED.setCursor(4, 2); if (value == 0) { OLED.write(0x5F); OLED.write(0x5F); } } else if (CursorPosition == 2) { OLED.setCursor(7, 2); if (value == 0) { OLED.write(0x5F); OLED.write(0x5F); } } else if (CursorPosition == 3) { OLED.setCursor(10, 2); if (value == 0) { for (uint8_t i = 0; i < 4; i++) { OLED.write(0x5F); } } } sei(); }