101 lines
2 KiB
C++
101 lines
2 KiB
C++
#include <qfix/qfix.h>
|
|
|
|
|
|
#ifndef qfixSoccerBoard_h
|
|
#define qfixSoccerBoard_h
|
|
|
|
|
|
/**
|
|
* \class SoccerBoard
|
|
* \brief Represents the controller board "SoccerBoard".
|
|
* \author Stefan Enderle
|
|
*
|
|
* The class SoccerBoard represents the
|
|
* physical SoccerBoard with all its inputs and outputs.
|
|
* With this class it is possible to drive the motors,
|
|
* put on LEDs, check the buttons and get data from the
|
|
* analog and digital inputs.
|
|
*/
|
|
|
|
class SoccerBoard
|
|
{
|
|
|
|
public:
|
|
/** Constructor for the SoccerBoard class.
|
|
*/
|
|
SoccerBoard();
|
|
|
|
/** Puts on LED i. i must be 0 or 1.
|
|
*/
|
|
void ledOn(int i);
|
|
|
|
/** Puts off LED i. i must be 0 or 1.
|
|
*/
|
|
void ledOff(int i);
|
|
|
|
/** Puts off all LEDs.
|
|
*/
|
|
void ledsOff();
|
|
|
|
/** Puts LED i on if state is true, else off. i must be 0 or 1.
|
|
*/
|
|
void led(int i, bool state);
|
|
|
|
/** Puts the power output i on
|
|
*/
|
|
void powerOn(int i);
|
|
|
|
/** Puts the power output i off
|
|
*/
|
|
void powerOff(int i);
|
|
|
|
/** Puts the power output i on if state is true, else off.
|
|
*/
|
|
void power(int i, bool state);
|
|
|
|
/** Checks the state of button i. If it is pressed, true is returned,
|
|
* else false.
|
|
*/
|
|
bool button(int i);
|
|
|
|
/** Uses the four LEDs on the board to display the value i
|
|
* with 0 <= i <= 255
|
|
*/
|
|
void ledMeter(int i,int maxvalue);
|
|
|
|
/** Sets motor i to the given speed. -255 <= speed <= 255.
|
|
*/
|
|
void motor(int i, int speed);
|
|
|
|
void stop(int i);
|
|
|
|
/** Puts off all motors.
|
|
*/
|
|
void motorsOff();
|
|
|
|
/** returns the value of the analog port i. 0 <= value <= 255.
|
|
*/
|
|
int analog(int i);
|
|
|
|
/** returns true if the digital port is logical high, else false.
|
|
*/
|
|
bool digital(int i);
|
|
|
|
/** Waits until button i is pressed and released again.
|
|
*/
|
|
void waitForButton(int i);
|
|
|
|
void beep(int freq);
|
|
void beep(int freq, long msecs);
|
|
void beepOff();
|
|
|
|
void setTimer(unsigned long msecs);
|
|
bool timer();
|
|
|
|
void sleep(unsigned long msecs);
|
|
};
|
|
|
|
|
|
void initTimer();
|
|
|
|
#endif
|