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
2Buttons.h@0:63db1c7ee975, 2017-04-19 (annotated)
- Committer:
- fusop
- Date:
- Wed Apr 19 14:57:15 2017 +0000
- Revision:
- 0:63db1c7ee975
Final Version of the Reminder Program;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fusop | 0:63db1c7ee975 | 1 | |
fusop | 0:63db1c7ee975 | 2 | //------------------------------------------------------------------------------ |
fusop | 0:63db1c7ee975 | 3 | // BUTTON DEFINTIIONS |
fusop | 0:63db1c7ee975 | 4 | //------------------------------------------------------------------------------ |
fusop | 0:63db1c7ee975 | 5 | |
fusop | 0:63db1c7ee975 | 6 | void BU(void) |
fusop | 0:63db1c7ee975 | 7 | { |
fusop | 0:63db1c7ee975 | 8 | red = 1; |
fusop | 0:63db1c7ee975 | 9 | green = 1; |
fusop | 0:63db1c7ee975 | 10 | blue = 0; |
fusop | 0:63db1c7ee975 | 11 | |
fusop | 0:63db1c7ee975 | 12 | B_response(1); |
fusop | 0:63db1c7ee975 | 13 | } |
fusop | 0:63db1c7ee975 | 14 | |
fusop | 0:63db1c7ee975 | 15 | void BD(void) |
fusop | 0:63db1c7ee975 | 16 | { |
fusop | 0:63db1c7ee975 | 17 | red = 0; |
fusop | 0:63db1c7ee975 | 18 | green = 1; |
fusop | 0:63db1c7ee975 | 19 | blue = 1; |
fusop | 0:63db1c7ee975 | 20 | |
fusop | 0:63db1c7ee975 | 21 | B_response(2); |
fusop | 0:63db1c7ee975 | 22 | } |
fusop | 0:63db1c7ee975 | 23 | |
fusop | 0:63db1c7ee975 | 24 | void BR(void) |
fusop | 0:63db1c7ee975 | 25 | { |
fusop | 0:63db1c7ee975 | 26 | red = 1; |
fusop | 0:63db1c7ee975 | 27 | green = 0; |
fusop | 0:63db1c7ee975 | 28 | blue = 1; |
fusop | 0:63db1c7ee975 | 29 | |
fusop | 0:63db1c7ee975 | 30 | B_response(4); |
fusop | 0:63db1c7ee975 | 31 | } |
fusop | 0:63db1c7ee975 | 32 | |
fusop | 0:63db1c7ee975 | 33 | void BL(void) |
fusop | 0:63db1c7ee975 | 34 | { |
fusop | 0:63db1c7ee975 | 35 | red = 1; |
fusop | 0:63db1c7ee975 | 36 | green = 1; |
fusop | 0:63db1c7ee975 | 37 | blue = 1; |
fusop | 0:63db1c7ee975 | 38 | |
fusop | 0:63db1c7ee975 | 39 | B_response(3); |
fusop | 0:63db1c7ee975 | 40 | } |
fusop | 0:63db1c7ee975 | 41 | |
fusop | 0:63db1c7ee975 | 42 | void BS(void) |
fusop | 0:63db1c7ee975 | 43 | { |
fusop | 0:63db1c7ee975 | 44 | red = 0; |
fusop | 0:63db1c7ee975 | 45 | green = 0; |
fusop | 0:63db1c7ee975 | 46 | blue = 0; |
fusop | 0:63db1c7ee975 | 47 | } |
fusop | 0:63db1c7ee975 | 48 | |
fusop | 0:63db1c7ee975 | 49 | //Attach callback functions |
fusop | 0:63db1c7ee975 | 50 | void B_attach(void) |
fusop | 0:63db1c7ee975 | 51 | { |
fusop | 0:63db1c7ee975 | 52 | butt.attach_buttonUp(&BU); |
fusop | 0:63db1c7ee975 | 53 | butt.attach_buttonDown(&BD); |
fusop | 0:63db1c7ee975 | 54 | butt.attach_buttonLeft(&BL); |
fusop | 0:63db1c7ee975 | 55 | butt.attach_buttonRight(&BR); |
fusop | 0:63db1c7ee975 | 56 | butt.attach_buttonSlide(&BS); |
fusop | 0:63db1c7ee975 | 57 | } |
fusop | 0:63db1c7ee975 | 58 | |
fusop | 0:63db1c7ee975 | 59 | void B_response(int k) |
fusop | 0:63db1c7ee975 | 60 | { |
fusop | 0:63db1c7ee975 | 61 | butflg = 1; //For any program that needs button feedback |
fusop | 0:63db1c7ee975 | 62 | vibflg = 1; //For button haptic feedback |
fusop | 0:63db1c7ee975 | 63 | butmem = k; //Type of button pressed |
fusop | 0:63db1c7ee975 | 64 | |
fusop | 0:63db1c7ee975 | 65 | //Buzzer Part |
fusop | 0:63db1c7ee975 | 66 | Tune(buzz, Cs5, 2); |
fusop | 0:63db1c7ee975 | 67 | } |