buttons.h File Reference

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 ()
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)

Detailed Description

This file contains various functions needed for the pushbuttons, frobknob, and beeper. It also allows the user to read the battery voltage.

Define Documentation

#define FROB_BITS   (10)

Bits of precision for the frob knob.

#define FROB_MAX   (1 << FROB_BITS)

Max value of frob knob.

#define FROB_MIN   (0)

Min value of frob knob.


Function Documentation

void beep ( uint16_t  freq,
uint16_t  duration 
)

Beep at a given frequency for a given duration.

Parameters:
freq Frequency to beep
duration Duration of beep

uint16_t frob_read (  ) 

Read a value from the Frob knob.

Returns:
The position of the frob knob (value 0 to 1023).

uint16_t frob_read_range ( uint16_t  min,
uint16_t  max 
)

Read the from the frob and scale into the range min<=frob<=max

Parameters:
min minimum scaled value
max maximum scaled value
Returns:
return the scaled position of the frob

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.

Returns:
true if go 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.

Returns:
true if stop is pressed.