void SabreController::setAndPrintMonth( uint8_t value ) { cli(); Helper::SetPointerValue(value, &Month, 12, 1); printMonth(); sei(); }
void printCalendar(int day, int year) { //prints each month. also, keeps track of what day of the week the next month will start on int numOfDays; int k = 0; for (k = 0; k<12; k++) { numOfDays = printMonthName(k,year); //gets the number of days in the month that is about to be printed day = printMonth(day,numOfDays); } }
int main() { //variable deceleration int month = 0, year = 0, maxMonth, maxYear, minMonth, minYear; float price, minPrice = 1000.00f, maxPrice = 0; //loop to gather input and test to see what the max and min price while(month >= 0) { scanf("%d %d %f", &month, &year, &price); if(price > maxPrice) { maxPrice = price; maxMonth = month; maxYear = year; } if(price < minPrice) { minPrice = price; minMonth = month; minYear = year; } } //printing maximum price and month printf("Maximum Price\t$%6.2f ", maxPrice); printMonth(maxMonth); printf("%6d\n", maxYear); //printing min month printf("Minimum Price\t$%6.2f ", minPrice); printMonth(minMonth); printf("%6d\n", minYear); }
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(); }
void printCalendar(int year, char startDay){ int i; for(i=0; i<12; i++){ startDay = printMonth(year, i, startDay); } }