can't push chnages :(
Dependencies: PinDetect TextLCD mbed
Fork of FBRDash by
src/Gears.cpp
- Committer:
- intrinseca
- Date:
- 2012-06-25
- Revision:
- 1:b3907b8d9f65
- Child:
- 2:825f572902c6
File content as of revision 1:b3907b8d9f65:
#include "Gears.h" #include "mbed.h" #include "PinDetect.h" #include "Comms.h" Gears::Gears(PinName up, PinName neutral, PinName down, unsigned char* _currentGear, Comms* _remote) { currentGear = _currentGear; remote = _remote; btnUp = new PinDetect(up, PullUp); btnNeutral = new PinDetect(neutral, PullUp); btnDown = new PinDetect(down, PullUp); btnUp->setAssertValue(0); btnDown->setAssertValue(0); btnNeutral->setAssertValue(0); btnUp->attach_asserted(this, &Gears::up); btnDown->attach_asserted(this, &Gears::down); btnNeutral->attach_asserted(this, &Gears::neutral); btnUp->setSampleFrequency(); btnDown->setSampleFrequency(); btnNeutral->setSampleFrequency(); } void Gears::up() { remote->send(2); if(*currentGear < 6) (*currentGear)++; } void Gears::neutral() { remote->send(0); *currentGear = 0; } void Gears::down() { remote->send(1); if(*currentGear > 0) { (*currentGear)--; } }