Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/APPLineFollower/src/States/ReadyState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void ReadyState::entry()

void ReadyState::process(StateMachine& sm)
{
IButton& button = Board::getInstance().getButton();
IButton& button = Board::getInstance().getButtonReset();

if (nullptr == m_lineSensors)
{
Expand Down
2 changes: 1 addition & 1 deletion lib/APPLineFollower/src/States/ReleaseTrackState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void ReleaseTrackState::entry()

void ReleaseTrackState::process(StateMachine& sm)
{
IButton& button = Board::getInstance().getButton();
IButton& button = Board::getInstance().getButtonReset();

/* Change parameter set? */
if (true == Util::isButtonTriggered(button, m_isButtonPressed))
Expand Down
2 changes: 1 addition & 1 deletion lib/APPLineFollower/src/States/StartupState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void StartupState::entry()

void StartupState::process(StateMachine& sm)
{
IButton& button = Board::getInstance().getButton();
IButton& button = Board::getInstance().getButtonReset();

switch (m_subState)
{
Expand Down
48 changes: 45 additions & 3 deletions lib/HALInterfaces/src/IBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,32 @@ class IBoard
virtual IBattery& getBattery() = 0;

/**
* Get button driver.
* Get button "Reset" driver.
*
* @return Button driver.
* @return Button "Reset" driver.
*/
virtual IButton& getButton() = 0;
virtual IButton& getButtonReset() = 0;

/**
* Get button "A" driver.
*
* @return Button "A" driver.
*/
virtual IButton& getButtonA() = 0;

/**
* Get button "B" driver.
*
* @return Button "B" driver.
*/
virtual IButton& getButtonB() = 0;

/**
* Get button "C" driver.
*
* @return Button "C" driver.
*/
virtual IButton& getButtonC() = 0;

/**
* Get red LED driver.
Expand All @@ -120,6 +141,27 @@ class IBoard
*/
virtual ILed& getBlueLed() = 0;

/**
* Get LED "A" driver.
*
* @return LED "A" driver.
*/
virtual ILed& getLedA() = 0;

/**
* Get LED "B" driver.
*
* @return LED "B" driver.
*/
virtual ILed& getLedB() = 0;

/**
* Get LED "C" driver.
*
* @return LED "C" driver.
*/
virtual ILed& getLedC() = 0;

/**
* Get Network driver.
*
Expand Down
8 changes: 7 additions & 1 deletion lib/HALSim/src/Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,16 @@ Board::Board() :
m_robot.getReceiver(RobotDeviceNames::RECEIVER_NAME_SERIAL)),
m_keyboard(m_simTime, m_robot.getKeyboard()),
m_battery(),
m_button(m_keyboard),
m_buttonReset(m_keyboard),
m_buttonA(m_keyboard),
m_buttonB(m_keyboard),
m_buttonC(m_keyboard),
m_ledBlue(),
m_ledGreen(),
m_ledRed(),
m_ledA(),
m_ledB(),
m_ledC(),
m_network(),
m_hostRobot(m_serialDrv),
m_configFilePath(),
Expand Down
94 changes: 89 additions & 5 deletions lib/HALSim/src/Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,15 @@
#include <WString.h>
#include "Battery.h"
#include "ButtonReset.h"
#include "ButtonA.h"
#include "ButtonB.h"
#include "ButtonC.h"
#include "LedBlue.h"
#include "LedGreen.h"
#include "LedRed.h"
#include "LedA.h"
#include "LedB.h"
#include "LedC.h"
#include "Network.h"
#include "Robot.h"
#include "WebotsSerialDrv.h"
Expand Down Expand Up @@ -107,13 +113,43 @@ class Board : public IBoard
}

/**
* Get button driver.
* Get button "Reset" driver.
*
* @return Button driver.
* @return Button "Reset" driver.
*/
IButton& getButton() final
IButton& getButtonReset() final
{
return m_button;
return m_buttonReset;
}

/**
* Get button "A" driver.
*
* @return Button "A" driver.
*/
IButton& getButtonA() final
{
return m_buttonA;
}

/**
* Get button "B" driver.
*
* @return Button "B" driver.
*/
IButton& getButtonB() final
{
return m_buttonB;
}

/**
* Get button "C" driver.
*
* @return Button "C" driver.
*/
IButton& getButtonC() final
{
return m_buttonC;
}

/**
Expand Down Expand Up @@ -146,6 +182,36 @@ class Board : public IBoard
return m_ledRed;
}

/**
* Get LED "A" driver.
*
* @return LED "A" driver.
*/
ILed& getLedA() final
{
return m_ledA;
}

/**
* Get LED "B" driver.
*
* @return LED "B" driver.
*/
ILed& getLedB() final
{
return m_ledB;
}

/**
* Get LED "C" driver.
*
* @return LED "C" driver.
*/
ILed& getLedC() final
{
return m_ledC;
}

/**
* Get Network driver.
*
Expand Down Expand Up @@ -212,7 +278,16 @@ class Board : public IBoard
Battery m_battery;

/** Button "Reset" driver */
ButtonReset m_button;
ButtonReset m_buttonReset;

/** Button "A" driver */
ButtonA m_buttonA;

/** Button "B" driver */
ButtonB m_buttonB;

/** Button "C" driver */
ButtonC m_buttonC;

/** Blue LED driver */
LedBlue m_ledBlue;
Expand All @@ -223,6 +298,15 @@ class Board : public IBoard
/** Red LED driver */
LedRed m_ledRed;

/** LED "A" driver */
LedA m_ledA;

/** LED "B" driver */
LedB m_ledB;

/** LED "C" driver */
LedC m_ledC;

/** Network driver */
Network m_network;

Expand Down
8 changes: 7 additions & 1 deletion lib/HALTargetCommon/src/Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,16 @@ void Board::process()
Board::Board() :
IBoard(),
m_battery(),
m_button(),
m_buttonReset(),
m_buttonA(),
m_buttonB(),
m_buttonC(),
m_ledBlue(),
m_ledGreen(),
m_ledRed(),
m_ledA(),
m_ledB(),
m_ledC(),
m_network(),
m_hostRobot(),
m_configFilePath(CONFIG_FILE_PATH)
Expand Down
94 changes: 89 additions & 5 deletions lib/HALTargetCommon/src/Board.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@
#include <IBoard.h>
#include "Battery.h"
#include "ButtonReset.h"
#include "ButtonA.h"
#include "ButtonB.h"
#include "ButtonC.h"
#include "LedBlue.h"
#include "LedGreen.h"
#include "LedRed.h"
#include "LedA.h"
#include "LedB.h"
#include "LedC.h"
#include "Network.h"
#include "ButtonDrv.h"
#include "Robot.h"
Expand Down Expand Up @@ -102,13 +108,43 @@ class Board : public IBoard
}

/**
* Get button driver.
* Get button "Reset" driver.
*
* @return Button driver.
* @return Button "Reset" driver.
*/
IButton& getButton() final
IButton& getButtonReset() final
{
return m_button;
return m_buttonReset;
}

/**
* Get button "A" driver.
*
* @return Button "A" driver.
*/
IButton& getButtonA() final
{
return m_buttonA;
}

/**
* Get button "B" driver.
*
* @return Button "B" driver.
*/
IButton& getButtonB() final
{
return m_buttonB;
}

/**
* Get button "C" driver.
*
* @return Button "C" driver.
*/
IButton& getButtonC() final
{
return m_buttonC;
}

/**
Expand Down Expand Up @@ -141,6 +177,36 @@ class Board : public IBoard
return m_ledRed;
}

/**
* Get LED "A" driver.
*
* @return LED "A" driver.
*/
ILed& getLedA() final
{
return m_ledA;
}

/**
* Get LED "B" driver.
*
* @return LED "B" driver.
*/
ILed& getLedB() final
{
return m_ledB;
}

/**
* Get LED "C" driver.
*
* @return LED "C" driver.
*/
ILed& getLedC() final
{
return m_ledC;
}

/**
* Get Network driver.
*
Expand Down Expand Up @@ -187,7 +253,16 @@ class Board : public IBoard
Battery m_battery;

/** Button "Reset" driver */
ButtonReset m_button;
ButtonReset m_buttonReset;

/** Button "A" driver */
ButtonA m_buttonA;

/** Button "B" driver */
ButtonB m_buttonB;

/** Button "C" driver */
ButtonC m_buttonC;

/** Blue LED driver */
LedBlue m_ledBlue;
Expand All @@ -198,6 +273,15 @@ class Board : public IBoard
/** Red LED driver */
LedRed m_ledRed;

/** LED "A" driver */
LedA m_ledA;

/** LED "B" driver */
LedB m_ledB;

/** LED "C" driver */
LedC m_ledC;

/** Network driver */
Network m_network;

Expand Down