A simple reminder program that can store up to 5 reminders, and has the ability to navigate between different pages through different functions.
Dependencies: Hexi_KW40Z Hexi_OLED_SSD1351 PWM_Tone_Library
Revision 0:63db1c7ee975, committed 2017-04-19
- Comitter:
- fusop
- Date:
- Wed Apr 19 14:57:15 2017 +0000
- Commit message:
- Final Version of the Reminder Program;
Changed in this revision
diff -r 000000000000 -r 63db1c7ee975 .gitignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.gitignore Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,4 @@ +.build +.mbed +projectfiles +*.py*
diff -r 000000000000 -r 63db1c7ee975 1Definitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/1Definitions.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,156 @@ + +//------------------------------------------------------------------------------ +// FUNCTION PROTOTYPES +//------------------------------------------------------------------------------ + +//Pages +void TimeSetup (void); +void TimeDisplay (void); +void ReminderList (void); +void AddReminder (void); +void DelReminder (void); +void MainDisp (void); + +//Interrupt +void InterruptAction (void const *n); + +//Buttons +void BU(void); +void BD(void); +void BL(void); +void BR(void); +void BS(void); +void B_attach(void); +void B_response(int); + +//Supplementary +int CharInput (int, int); +void DelayProg (int); +void TextInit (void); + +//------------------------------------------------------------------------------ +// GLOBAL VARIABLE DEFINITIONS +//------------------------------------------------------------------------------ + +//Vibration pin +DigitalOut vib(PTB9); + +//Debugging LEDs +DigitalOut red(LED1); +DigitalOut green(LED2); +DigitalOut blue(LED3); + +//Timer +RtosTimer masa(InterruptAction, osTimerOnce); //Keep it this way (non-periodic). + //Who knows you want to stop the + //interrupt for some reason + +//Buttons +KW40Z butt(PTE24, PTE25); //UART TX, UART RX + +//Buzzer +PwmOut buzz(PTA10); + +/* Instantiate the SSD1351 OLED Driver */ +SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6,PTD15); /*(MOSI,SCLK,POWER,CS,RST,DC)*/ +oled_text_properties_t tProp = {0}; + +//Buzzer at 1st Peripheral Position +PwmOut Buzzer(PTA10); + +//Variables +char str[20]; + +int butmem = 0; + +int numCount = -1; +int vibCount = 0; +int hours = 0; +int mins = 0; +int secs = 0; + +int fReCalc = 0; +int nDisp = 5; + +//Alarm parameters +int nAlarm = 0; //Entry pointer +int fAlarm = 0; //Alarm flag +int vAlarm = 0; //Vibration period + +//For certain delays in the program +double delay = 0; +int dummy = 0; + +//Interrupt Flags +int butflg = 0; +int vibflg = 0; +int delayflg = 0; + +//Sound Flags +int WSound = 0; +int CCSound = 0; +int SCSound = 0; +int DLSound = 0; + +//Reminder Variables +typedef struct reminderProperties +{ + char rText[11]; //The text of the reminder + int rExist; //Indicates whether the reminder exists or not + int rMins; //Time of the reminder + int rHours; +} remProp; + +int rNumber = 0; //How many reminders exist? + +remProp remData[5]; + +//Buttons Mnemonic +enum button_number { + BUT_UP = 1, + BUT_DOWN = 2, + BUT_LEFT = 3, + BUT_RIGHT = 4 +} butnum; + +//Texts +char remTxt[6][11]; +//Refer to Texts Initialization Function + +//Buzzer +float C3 = 1000000/Do3, + Cs3 = 1000000/Do3s, + D3 = 1000000/Re3, + Ds3 = 1000000/Re3s, + E3 = 1000000/Mi3, + F3 = 1000000/Fa3, + Fs3 = 1000000/Fa3s, + G3 = 1000000/So3, + Gs3 = 1000000/So3s, + A3 = 1000000/La3, + As3 = 1000000/La3s, + B3 = 1000000/Ti3, + C4 = 1000000/Do4, + Cs4 = 1000000/Do4s, + D4 = 1000000/Re4, + Ds4 = 1000000/Re4s, + E4 = 1000000/Mi4, + F4 = 1000000/Fa4, + Fs4 = 1000000/Fa4s, + G4 = 1000000/So4, + Gs4 = 1000000/So4s, + A4 = 1000000/La4, + As4 = 1000000/La4s, + B4 = 1000000/Ti4, + C5 = 1000000/Do5, + Cs5 = 1000000/Do5s, + D5 = 1000000/Re5, + Ds5 = 1000000/Re5s, + E5 = 1000000/Mi5, + F5 = 1000000/Fa5, + Fs5 = 1000000/Fa5s, + G5 = 1000000/So5, + Gs5 = 1000000/So5s, + A5 = 1000000/La5, + As5 = 1000000/La5s, + B5 = 1000000/Ti5; \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 2Buttons.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2Buttons.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,67 @@ + +//------------------------------------------------------------------------------ +// BUTTON DEFINTIIONS +//------------------------------------------------------------------------------ + +void BU(void) +{ + red = 1; + green = 1; + blue = 0; + + B_response(1); +} + +void BD(void) +{ + red = 0; + green = 1; + blue = 1; + + B_response(2); +} + +void BR(void) +{ + red = 1; + green = 0; + blue = 1; + + B_response(4); +} + +void BL(void) +{ + red = 1; + green = 1; + blue = 1; + + B_response(3); +} + +void BS(void) +{ + red = 0; + green = 0; + blue = 0; +} + +//Attach callback functions +void B_attach(void) +{ + butt.attach_buttonUp(&BU); + butt.attach_buttonDown(&BD); + butt.attach_buttonLeft(&BL); + butt.attach_buttonRight(&BR); + butt.attach_buttonSlide(&BS); +} + +void B_response(int k) +{ + butflg = 1; //For any program that needs button feedback + vibflg = 1; //For button haptic feedback + butmem = k; //Type of button pressed + + //Buzzer Part + Tune(buzz, Cs5, 2); +}
diff -r 000000000000 -r 63db1c7ee975 3Main.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3Main.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,82 @@ + +//------------------------------------------------------------------------------ +// MAIN PROGRAM +//------------------------------------------------------------------------------ +//Main program controls the navigation of menus +//------------------------------------------------------------------------------ + +int main (void) +{ + //Miscellanous Variables used for this function + int n; + + //-------------------------------------------------------------------------- + // INITIALIZATIONS + //-------------------------------------------------------------------------- + + //Attach Buttons Callback Functions + B_attach(); + + //Text Formatting in OLED + oled.GetTextProperties(&tProp); + oled.DimScreenOFF(); + oled.FillScreen(COLOR_BLACK); + tProp.fontColor = COLOR_WHITE; + tProp.alignParam = OLED_TEXT_ALIGN_CENTER; + oled.SetTextProperties(&tProp); + + //Flush all the reminder data for now. + for (n = 0; n < 5; n++) + { + remData[n].rExist = 0; + remData[n].rMins = 0; + remData[n].rHours = 0; + } + + //Initializations of Strings + TextInit(); + + //INTERRUPT STARTS HERE + masa.start(1); //In miliseconds + + + //-------------------------------------------------------------------------- + // MENU SELECTION + //-------------------------------------------------------------------------- + + TimeSetup(); + oled.FillScreen(COLOR_BLACK); + + TimeDisplay(); //Just display time for now + MainDisp(); //Setup the home screen for the first time + + ReminderList(); //Setup the data list display for the first time + + //Program Loop in here + while(1) + { + //Go into AddReminder() if the user enters Right + if (butflg == 1) + { + if (butmem == BUT_RIGHT) AddReminder(); + else if (butmem == BUT_LEFT) DelReminder(); + + //At the end of either functions, reset the screen to home screen, with first available + //data to display + if (fReCalc == 1 || fAlarm == 2) + { + for (nDisp = 0; nDisp < 5; nDisp++) + { + if (remData[nDisp].rExist == 1) break; + } + fReCalc = 0; //This solved the mystery + } + + //Update the list in the display + ReminderList(); + + //Prevent loop reentry + butflg = 0; + } + } +} \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 4Interrupt.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/4Interrupt.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,120 @@ + +//------------------------------------------------------------------------------ +// INTERRUPT ROUTINE +//------------------------------------------------------------------------------ + +void InterruptAction (void const *n) +{ + int num = 0; + //-------------------------------------------------------------------------- + // TIME UPDATE + //-------------------------------------------------------------------------- + if (numCount != -1) + { + if (numCount == 1000) + { + //Time increment Section-------------------------------------------- + numCount = 0; + //Check for Seconds + if (secs == 59) + { + secs = 0; + //Check for Minutes + if (mins == 59) + { + mins = 0; + //Check for Hours + if (hours == 23) hours = 0; + else hours++; + } + else + { + mins++; + TimeDisplay(); //Update time every minute + } //Always display time on all pages + } + else secs++; + + //Alarm Section----------------------------------------------------- + //Assuming the CPU can do this really really fast, I hope it won't affect + //the overall performance of the program + for (num = 0; num < 5; num++) + { + if (remData[num].rExist == 1) + { + if (remData[num].rHours == hours && remData[num].rMins == mins) + { + fAlarm = 1; + nAlarm = num; + num = 5; //Just to exit the loop + } + } + } + } + else numCount++; + } + + //-------------------------------------------------------------------------- + // ALERT DISPLAY FEEDBACK + //-------------------------------------------------------------------------- + + if (fAlarm == 1) //1st Stage: Display + { + oled.Label((uint8_t *) remData[nAlarm].rText, 10, 15); + + //Wipe the data from memmory + strcpy(remData[nAlarm].rText, " "); + remData[nAlarm].rHours = 0; + remData[nAlarm].rMins = 0; + remData[nAlarm].rExist = 0; + + //Preparation for the next stage + fAlarm = 2; + nAlarm = 10000; //Set to 10 seconds display + vAlarm = 5000; //Set to 5 seconds vibration + + //Start the mayhem: + vibflg = 1; + vib = 1; + } + else if (fAlarm == 2) //2nd Stage: Hold + { + nAlarm--; + if (nAlarm == 0) + { + oled.DrawBox(0, 15, 96, 15, COLOR_BLACK); //Clear Area + fAlarm = 0; //Reset Parameters + nAlarm = 0; + } + } + + //-------------------------------------------------------------------------- + // VIBRATION HAPTIC FEEDBACK + //-------------------------------------------------------------------------- + if (vibflg == 1) + { + if (vAlarm == 0) //Prevent overlapping functions with the above vibration function + { + vib = 1; + vibCount++; + if (vibCount == 100) + { + vibflg = 0; + vib = 0; + vibCount = 0; + } + } + else //Just to supress additional vibration + { + vAlarm--; + if (vAlarm == 0) + { + vibflg = 0; + vib = 0; + vibCount = 0; + } + } + } + + masa.start(1); +} \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 5Pages.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/5Pages.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,403 @@ +//------------------------------------------------------------------------------ +// PAGES FUNCTION DEFINITIONS +//------------------------------------------------------------------------------ + +void TimeSetup() +{ + //Variables + int point = 1; //Points to which digit + int valid = 0; //Exit confirmation + int num = 0; //Temporary number holder + int xc = 25; //Initial cursor's x-position + + //Screen Setup + oled.FillScreen(COLOR_BLACK); + + strcpy((char *) str, "Set time and date"); + oled.Label((uint8_t *) str, 0, 0); + + strcpy((char *) str, "HH:MM"); + oled.Label((uint8_t *) str, 30, 20); + + strcpy((char *) str, "Hours"); + oled.Label((uint8_t *) str, 2, 80); + + strcpy((char *) str, "Mins/OK"); + oled.Label((uint8_t *) str, 43, 80); + + while (valid != 1) //This is a loop for time input + { + if (butflg == 1) + { + if (butmem == BUT_RIGHT && point == 1) //Go right to minutes + { + hours = num; + num = mins; + point = 2; + xc = 45; + } + else if (butmem == BUT_RIGHT && point == 2 && valid == 0) //Exit + { + mins = num; + valid = 1; + } + else if (butmem == BUT_LEFT && point == 2 && valid == 0) //Go left to seconds + { + mins = num; + num = hours; + point = 1; + xc = 25; + } + + //Increases the number of the hours/minutes using the up or down button + if (butmem == BUT_UP && ((point == 1 && num != 23) || (point == 2 && num != 59))) num++; + else if (butmem == BUT_DOWN && num != 0) num--; + butflg = 0; + } + + //Updates the display + sprintf((char *) str, "%d", num); + oled.TextBox((uint8_t *) str, xc, 40, 15, 15); + Thread::wait(500); + } + + numCount = 0; //Activate the time flag +} + +void TimeDisplay() +{ + sprintf((char *) str, "%.2d : %.2d", hours, mins); + oled.Label((uint8_t *) str, 30, 0); +} + +void MainDisp() +{ + //This is the home screen + strcpy((char *) str, "Delete"); + oled.Label((uint8_t *) str, 5, 80); + + strcpy((char *) str, "Add"); + oled.Label((uint8_t *) str, 60, 80); +} + +void ReminderList() +{ + int m; + //For the other two buttons + if (nDisp == 5) + { + oled.DrawBox(0, 30, 96, 96-30-15, COLOR_BLACK); + strcpy((char *) str, "No Data"); + oled.Label((uint8_t *) str, 10, 45); + } + else + { + if (butmem == BUT_UP) + { + for (m = nDisp+1; m < 5; m++) + { + if (remData[m].rExist == 1) + { + nDisp = m; + break; + } + } + } + else if (butmem == BUT_DOWN) + { + for (m = nDisp-1; m >= 0; m--) + { + if (remData[m].rExist == 1) + { + nDisp = m; + break; + } + } + } + + //Display the result + oled.DrawBox(0, 30, 96, 96-30-15, COLOR_BLACK); + oled.Label((uint8_t *) remData[nDisp].rText, 10, 40); + sprintf((char *) str, " %d:%d", remData[nDisp].rHours, remData[nDisp].rMins); + oled.Label((uint8_t *) str, 20, 55); + } +} + +void AddReminder() +{ + //Temporary Variable for Input Acknowledgement + int inputAck = 0; + int xc = 25; + int num = 0; + int total = 0; + + //Clear Screen + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + + //Count how many reminders are in there + //For now, limit to 5 data + for (num = 0; num < 5; num++) total = total+remData[num].rExist; + + //Since num is used in the time input code block, clear it + num = 0; + + if (total == 5) + { + strcpy((char *) str, "Reminder Full"); + oled.Label((uint8_t *) str, 10, 45); + + DelayProg(6); + } + else //Here is the main program for AddReminder() + { + //First we offset to the first entry with rExist = 0; + + for (rNumber = 0; rNumber < 5; rNumber++) + { + if (remData[rNumber].rExist == 0) break; + } + + //Then we display whatever we need to display + + //Display Entry Number + sprintf((char *) str, "Entry #%d", rNumber+1); + oled.Label((uint8_t *) str, 0, 30); + + //Text Input--------------------------------------------- + strcpy((char *) str, "Agenda:"); + oled.Label((uint8_t *) str, 0, 45); + + inputAck = CharInput(60, rNumber); + //DelayProg(6); + + oled.DrawBox(0, 45, 96, 96-45, COLOR_BLACK); + + if (inputAck == 0) + { + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + + strcpy((char *) str, "Canceled"); + oled.Label((uint8_t *) str, 0, 45); + + DelayProg(6); + + //Break the hell out of this function. + goto AddRemExit; + } + + //Else, proceed to time input + + //Time input---------------------------------------------- + strcpy((char *) str, "Time(HH:MM):"); + oled.Label((uint8_t *) str, 0, 30); + + strcpy((char *) str, "Hours"); + oled.Label((uint8_t *) str, 2, 80); + + strcpy((char *) str, "Mins/OK"); + oled.Label((uint8_t *) str, 43, 80); + + //Breakdown of the variables + // xc = x-position, as well as the reference of hours or minutes + // inputAck + // num = temporary variable + + while (1) //This is a time input loop for reminders + { + if (butflg == 1) + { + if (butmem == BUT_RIGHT && xc == 25) //Go right to minutes + { + remData[rNumber].rHours = num; //num is recycled from previous functions + num = remData[rNumber].rMins; + xc = 45; + } + else if (butmem == BUT_LEFT && xc == 25) //Exit (Cancelled) + { + remData[rNumber].rHours = 0; + remData[rNumber].rMins = 0; + strcpy(remData[rNumber].rText, " "); + inputAck = 0; + break; //Don't forget this is the second 'if loop'. + } + else if (butmem == BUT_RIGHT && xc == 45) //Exit (Confirmed) + { + remData[rNumber].rMins = num; + inputAck = 1; + break; //Don't forget this is the second 'if loop'. + } + else if (butmem == BUT_LEFT && xc == 45) //Go left to seconds + { + remData[rNumber].rMins = num; + num = remData[rNumber].rHours; + xc = 25; + } + + //Increases the number of the hours/minutes using the up or down button + if (butmem == BUT_UP && ((xc == 25 && num != 23) || (xc == 45 && num != 59))) num++; + else if (butmem == BUT_DOWN && num != 0) num--; + butflg = 0; + } + + if (inputAck == 0) goto AddRemExit; //And this continues from the Exit (Cancelled) + + //Updates the display + sprintf((char *) str, "%d", num); + oled.TextBox((uint8_t *) str, xc, 60, 15, 15); + } + + if (inputAck == 0) + { + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + strcpy((char *) str, "Canceled"); + oled.Label((uint8_t *) str, 0, 45); + + DelayProg(6); + + //Break the hell out of this function. + goto AddRemExit; + } + + //All the details are confirmed ---------------------------------------- + + remData[rNumber].rExist = 1; + + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + strcpy((char *) str, "Reminder Added"); + oled.Label((uint8_t *) str, 0, 45); + + DelayProg(6); + } + +AddRemExit: + + //Setup Screen before exiting + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + MainDisp(); + + //Set this flag to 1 to recalculate the display data + fReCalc = 1; +} + +void DelReminder() +{ + int n; + int total = 0; + + //Clear Screen + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + + //If total is 0, then there is no data to delete, ain't it? + for (n = 0; n < 5; n++) total = total+remData[n].rExist; + + if (total == 0) + { + strcpy((char *) str, "No Data"); + oled.Label((uint8_t *) str, 10, 45); + + DelayProg(6); + } + else //Case when there is a Data to delete + { + //First we must offset to the first existing data + for (n = 0; n < 5; n++) + { + if (remData[n].rExist != 0) break; + } + + //Then we display whatever we need to display + + //We enter the navigation + + butmem = 0; + + //First thing that it should display + + sprintf((char *) str, "Entry #%d", n+1); //Entry Number + oled.Label((uint8_t *) str, 0, 30); + oled.Label((uint8_t *) remData[n].rText, 0, 45); //Its text + sprintf((char *) str, "%d:%d", remData[n].rHours, remData[n].rMins); //Its time, for SPARTAAAAAAA + + while (1) //NOTE: THIS IS TERRIBLY RISKY, BUT whatever + { + if (butflg == 1) + { + //There are two parts in this section + + //FIRST PART: DO I GO NEXT OR PREVIOUS? + if (butmem == BUT_UP) + { + //Let's recycle total here. total is used as pointer + //So if there is any data after the value n, we can move up + for (total = n+1; total < 5; total++) + { + if (remData[total].rExist != 0) break; + } + + if (total != 5) n = total; + total = 0; //For various reasons, reset total + } + else if (butmem == BUT_DOWN) + { + //Let's...you know what I'm gonna talk about + for (total = n-1; total >= 0; total--) + { + if (remData[total].rExist != 0) break; + } + + if (total != -1) n = total; + total = 0; //For the same reason as above, reset total + } + + //SECOND PART: DO I WANT TO DELETE OR NAH + if (butmem == BUT_LEFT) total = 0x11; //Uh, reasons + else if (butmem == BUT_RIGHT) total = 0x27; //Fav Number + //*That is why I need to reset total everytime* + + //THIRD PART(DID YOU NOT EXPECT THE SPANISH INQUISITION?) + //Display the stuff + + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + sprintf((char *) str, "Entry #%d", n+1); //Entry Number + oled.Label((uint8_t *) str, 0, 30); + oled.Label((uint8_t *) remData[n].rText, 0, 45); + sprintf((char *) str, "%d:%d", remData[n].rHours, remData[n].rMins); + oled.Label((uint8_t *) str, 0, 60); + + butflg = 0; + } + + //Delete Data and Exit + if (total == 0x27) + { + strcpy(remData[n].rText, " "); + remData[n].rHours = 0; + remData[n].rMins = 0; + remData[n].rExist = 0; + + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + + sprintf((char *) str, "Entry #%d Deleted", n+1); + oled.Label((uint8_t *) str, 0, 45); + + DelayProg(6); + + break; + } + //Exit this function + else if (total == 0x11) break; + + }//End of While Loop + + }//End of Else Loop + + //Setup Screen before exiting + oled.DrawBox(0, 30, 96, 96-30, COLOR_BLACK); + MainDisp(); + + //Set this flag to 1 to recalculate the display data + fReCalc = 1; + +}//End of GOSH HOW CAN YOU NOT KNOW WHAT END IS THIS? + \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 6Other_Functions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/6Other_Functions.h Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,116 @@ + +//------------------------------------------------------------------------------ +// SUPPLEMENTARY FUNCTION DEFINITIONS +//------------------------------------------------------------------------------ + +int CharInput (int y, int rNum) +{ + //Planned events: + //1. Wake Up + //2. Close Oven + //3. Do laundry + //4. OP Garage + //5. Meeting + //6. Call Mom + + int txtPt = 0; //Short for Text Pointer + int f = 1; //Annoying temp variable for while loop control + + //Setup the first text to appear + oled.Label((uint8_t *) remTxt[txtPt], 0, y); + + //Clear button memories + butmem = 0; + + //In the condition, alternatively, (butmem != BUT_LEFT & butmem != BUT_RIGHT) + //Basically, as long as left and right is not pressed, keep looping. + while (f == 1) + { + if (butflg == 1) + { + if (butmem == BUT_UP && txtPt != 5) txtPt++; + else if (butmem == BUT_DOWN && txtPt != 0) txtPt--; + + //To exit this loop + if (butmem == BUT_LEFT || butmem == BUT_RIGHT) f = 0; + + //The screen will only be updated for every keypress + oled.DrawBox(0, y, 96, 96-y, COLOR_BLACK); + oled.Label((uint8_t *) remTxt[txtPt], 0, y); + butflg = 0; + } + } + + //After an input has been decided + if (butmem == BUT_RIGHT) //Acknowledge input and add to database + { + strcpy(remData[rNum].rText, remTxt[txtPt]); + return 1; + } + else return 0; //Cancel input and go back to home screen + +} + +void DelayProg (int del) +{ + //A very sloppy delay program used in parallel with interrupt. + //Using interrupt might be a little messy, so it's better to have delay + //inside its own world. + + double delayCount = del*100000; + while (delayCount != 0) delayCount--; +} + +void TextInit (void) +{ + strcpy(remTxt[0], "WakeUp"); + strcpy(remTxt[1], "CloseOven"); + strcpy(remTxt[2], "DoLaundry"); + strcpy(remTxt[3], "OpenGarage"); + strcpy(remTxt[4], "Meeting"); + strcpy(remTxt[5], "CallMom"); +} + +/* OLD CHARINPUT FUNCTION BECAUSE I DON'T WANT TO WASTE TIME ON SINGLE ALPHANUMERIC INPUT +void CharInput (int y, int rNum) +{ + //Assumptions for this function: + //Text input always begins at the left + //y variable is vertical position of the text + //This function exits when exit character(ASCII 64 or @)is detected + //ASCII is used for this operation + + char textIn = 65; //A variable to control character input + int textPoint = 0; //Index position of string + char prevChar = '0'; //Stuff + + while (prevChar != '@') + { + if (butflg == 1) + { + //Character change navigation + if (butmem == BUT_UP && textIn != 95) textIn++; + else if (butmem == BUT_DOWN && textIn != 64) textIn--; + + //Position change navigation + else if (butmem == BUT_RIGHT && textPoint != 19) + { + prevChar = textIn; + textPoint++; + textIn = 65; + } + else if (butmem == BUT_LEFT && textPoint != 0) + { + prevChar = textIn; + textPoint--; + textIn = 65; + } + butmem = 0; + butflg = 0; + } + + remData[rNum].rText[textPoint] = textIn; + oled.Label((uint8_t *) remData[rNum].rText, 0, y); + } + +}*/ \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 Hexi_KW40Z.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hexi_KW40Z.lib Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/Hexiwear/code/Hexi_KW40Z/#3f5ed7abc5c7
diff -r 000000000000 -r 63db1c7ee975 Hexi_OLED_SSD1351.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Hexi_OLED_SSD1351.lib Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/teams/Hexiwear/code/Hexi_OLED_SSD1351/#9961c525e249
diff -r 000000000000 -r 63db1c7ee975 PWM_Tone_Library.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PWM_Tone_Library.lib Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/justinkim/code/PWM_Tone_Library/#d06af372d384
diff -r 000000000000 -r 63db1c7ee975 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,39 @@ +/* +Filarius Peter Usop +ECE450 Hexiwear +Reminder Program +Started: 3/30/2017 + +CODE SECTIONS Here (Please use CTRL+F to find code sections) + FUNCTION PROTOTYPES + GLOBAL VARIABLE DEFINITIONS + BUTTON DEFINITIONS + MAIN PROGRAM + INITIALIZATIONS + MENU SELECTION + INTERRUPT ROUTINE + TIME UPDATE + BUTTON DETECTION INTERVAL + VIBRATION HAPTIC FEEDBACK + PAGES FUNTION DEFINITIONS + TimeSetup() + TimeDisplay() + ReminderList() + AddReminder() + DelReminder() + SUPPLEMENTARY FUNCTION DEFINITIONS + CharInput() +*/ + +//This cpp file is literally just a linker file + +#include "mbed.h" +#include "Hexi_OLED_SSD1351.h" +#include "Hexi_KW40Z.h" +#include "pwm_tone.h" +#include "1Definitions.h" +#include "2Buttons.h" +#include "3Main.h" +#include "4Interrupt.h" +#include "5Pages.h" +#include "6Other_Functions.h" \ No newline at end of file
diff -r 000000000000 -r 63db1c7ee975 mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Wed Apr 19 14:57:15 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#50b3418e45484ebf442b88cd935a2d5355402d7d