FIlarius Peter Usop / Mbed OS Simple_Stopwatch

Dependencies:   Hexi_KW40Z Hexi_OLED_SSD1351

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Functions.h Source File

Functions.h

00001 
00002 
00003 extern void Button_Init (void);
00004 extern void StartHP (void);
00005 extern void StopHP (void const *n);
00006 extern DigitalOut hp(PTB9);
00007 extern KW40Z kw40z_device(PTE24, PTE25);
00008 extern RtosTimer hpTime(StopHP, osTimerOnce);
00009 extern int but;
00010 
00011 void StartHP (void);
00012 void StopHP (void const *n);
00013 
00014 int but = 1;
00015 
00016 //Buttons-------------------------------
00017 
00018 void ButtonUp(void) 
00019 {
00020     StartHP();
00021 }
00022 
00023 void ButtonDown(void) 
00024 {
00025     StartHP();
00026     but = 0;
00027 }
00028 
00029 void ButtonRight(void) 
00030 {
00031     StartHP();
00032     but = 1;
00033 }
00034 
00035 void ButtonLeft(void) 
00036 {
00037     StartHP();
00038     but = 2;
00039 }
00040 
00041 void ButtonSlide(void) 
00042 {
00043     StartHP();
00044 }
00045 
00046 void Button_Init (void)
00047 {
00048     kw40z_device.attach_buttonUp(&ButtonUp);
00049     kw40z_device.attach_buttonDown(&ButtonDown);
00050     kw40z_device.attach_buttonLeft(&ButtonLeft);
00051     kw40z_device.attach_buttonRight(&ButtonRight);
00052 }
00053 
00054 //Haptic -----------------------------------------
00055 
00056 void StartHP(void)
00057 {
00058     hpTime.start(50);
00059     hp = 1;
00060 }
00061 
00062 void StopHP(void const *n)
00063 {
00064     hp = 0;
00065     hpTime.stop();
00066 }