User Input/Output - buttons, frob, beeper and battery. More...
Defines | |
#define | FROB_BITS (10) |
#define | FROB_MIN (0) |
#define | FROB_MAX (1 << FROB_BITS) |
Functions | |
uint8_t | go_press () |
uint8_t | stop_press () |
int | either_click () |
void | go_click () |
void | stop_click () |
uint16_t | frob_read () |
uint16_t | frob_read_range (uint16_t min, uint16_t max) |
uint16_t | read_battery () |
void | beep (uint16_t freq, uint16_t duration) |
This file contains various functions needed for the pushbuttons, frobknob, and beeper (found in previous revisions of the happyboard). It also allows the user to read the battery voltage.
#define FROB_BITS (10) |
Bits of precision for the frob knob.
#define FROB_MIN (0) |
Min value of frob knob.
void beep | ( | uint16_t | freq, |
uint16_t | duration | ||
) |
Beep at a given frequency for a given duration.
freq | Frequency to beep |
duration | Duration of beep |
int either_click | ( | ) |
Wait for the user to click one of the two buttons. Returns 0 if Stop was pressed.
uint16_t frob_read | ( | ) |
Read a value from the Frob knob.
uint16_t frob_read_range | ( | uint16_t | min, |
uint16_t | max | ||
) |
Read the from the frob and scale into the range min<=frob<=max
min | minimum scaled value |
max | maximum scaled value |
void go_click | ( | ) |
Wait for the user to click the 'Go' button. This will loop until the 'Go' button is pressed and released.
uint8_t go_press | ( | ) |
Check if the 'Go' button is pressed.
uint16_t read_battery | ( | ) |
Read the battery voltage. Returns a value in decivolts. @ return The battery voltage in decivolts.
void stop_click | ( | ) |
Wait for the user to click the 'Stop' button. This will loop until the 'Stop' button is pressed and released.
uint8_t stop_press | ( | ) |
Check if the 'Stop' button is pressed.