Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
Buttons.cpp
00001 #include "devices.h" 00002 #include "Buttons.h" 00003 00004 //PinDetect nextButton(BUTTONNEXT); 00005 //PinDetect selectButton(BUTTONSELECT); // Input selectButton 00006 //PinDetect prevButton(BUTTONPREV); 00007 00008 Buttons::Buttons(void): 00009 which(0), pressed(false) 00010 { 00011 } 00012 00013 void Buttons::init() 00014 { 00015 /* 00016 // Set up button (plugs into two GPIOs, active low 00017 selectButton.mode(PullUp); 00018 selectButton.setSamplesTillAssert(50); 00019 selectButton.setAssertValue(0); // active low logic 00020 selectButton.setSampleFrequency(50); // us 00021 selectButton.attach_asserted( this, &Buttons::selectPressed ); 00022 00023 nextButton.mode(PullUp); 00024 nextButton.setSamplesTillAssert(50); 00025 nextButton.setAssertValue(0); // active low logic 00026 nextButton.setSampleFrequency(50); // us 00027 nextButton.attach_asserted( this, &Buttons::nextPressed ); 00028 00029 prevButton.mode(PullUp); 00030 prevButton.setSamplesTillAssert(50); 00031 prevButton.setAssertValue(0); // active low logic 00032 prevButton.setSampleFrequency(50); // us 00033 prevButton.attach_asserted( this, &Buttons::prevPressed ); 00034 */ 00035 } 00036 00037 void Buttons::nextPressed() 00038 { 00039 pressed = true; 00040 which = NEXT_BUTTON; 00041 } 00042 00043 void Buttons::prevPressed() 00044 { 00045 pressed = true; 00046 which = PREV_BUTTON; 00047 } 00048 00049 void Buttons::selectPressed() 00050 { 00051 pressed = true; 00052 which = SELECT_BUTTON; 00053 }
Generated on Tue Jul 12 2022 21:36:18 by
1.7.2