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
Fork of el17ajf by
Input/Input.cpp
- Committer:
- el17ajf
- Date:
- 2019-04-13
- Revision:
- 31:69fedaa9b171
- Parent:
- 25:bf47fe41883a
File content as of revision 31:69fedaa9b171:
#include "Input.h"
#include "SampledIn.h"
namespace Input {
SampledIn a_button(PTB9);
SampledIn b_button(PTD0);
SampledIn x_button(PTC17);
SampledIn y_button(PTC12);
SampledIn l_button(PTB18);
SampledIn r_button(PTB3);
SampledIn back_button(PTB19);
SampledIn start_button(PTC5);
bool buttonHit(Button button) {
switch (button) {
case LEFT:
return a_button.hit_frame();
case RIGHT:
return y_button.hit_frame();
case UP:
return x_button.hit_frame();
case DOWN:
return b_button.hit_frame();
case START:
return start_button.hit_frame();
default:
return false;
}
}
int getSeed() {
AnalogIn noise(PTB11); // get noise from joystick horizontal axis
return noise.read_u16();
}
};
