HiveMind
BittyBuzzBytecode.h
Go to the documentation of this file.
1 
2 #ifndef __BITTYBUZZBYTECODE_H_
3 #define __BITTYBUZZBYTECODE_H_
4 
6 #include <cstdint>
7 #include <logger/ILogger.h>
8 
10  public:
11  BittyBuzzBytecode(ILogger& logger, const uint8_t* bytecode, uint16_t bytecodeLength);
12 
13  ~BittyBuzzBytecode() = default;
14 
15  bbzvm_bcode_fetch_fun getBytecodeFetchFunction() const override;
16 
17  uint16_t getBytecodeLength() const override;
18 
19  private:
21  const uint8_t* m_bytecode;
22  const uint16_t m_bytecodeLength;
23 };
24 
25 #endif // __BITTYBUZZBYTECODE_H_
BittyBuzzBytecode::getBytecodeLength
uint16_t getBytecodeLength() const override
Get the size of the BittyBuzz byte code.
Definition: BittyBuzzBytecode.cpp:38
ButtonCallbackRegister::ButtonCallbackRegister
ButtonCallbackRegister(IApplicationInterface &appInterface, Button button)
Definition: ButtonCallbackRegister.cpp:3
ApplicationInterface::setSystemDeviceState
void setSystemDeviceState(DeviceState state) override
set the system Connection state and set the seven segment accordingly
Definition: ApplicationInterface.cpp:41
ButtonCallbackRegister.h
HostHandshakeUI.h
ConnectionState::Error
@ Error
IApplicationInterface::setSystemConnectionState
virtual void setSystemConnectionState(ConnectionState state)=0
set the system Connection state and light the necessary LED the right color
BittyBuzzBytecode::~BittyBuzzBytecode
~BittyBuzzBytecode()=default
SystemStates
Definition: SystemStates.h:25
RemoteHandshakeUI
Definition: RemoteHandshakeUI.h:7
HostHandshakeUI
Definition: HostHandshakeUI.h:7
ApplicationInterface::s_remoteLed
static constexpr LED s_remoteLed
Definition: ApplicationInterface.h:36
BSPContainer.h
IUserInterface::setButtonCallback
virtual void setButtonCallback(Button button, buttonCallbackFunction_t callback, void *context)=0
Sets the callback associated with a given button press.
Button::BUTTON_0
@ BUTTON_0
RemoteHandshakeUI::RemoteHandshakeUI
RemoteHandshakeUI(IApplicationInterface &appInterface)
Definition: RemoteHandshakeUI.cpp:3
ApplicationInterface::getUserStates
UserStates getUserStates() const override
get the user states
Definition: ApplicationInterface.cpp:76
BittyBuzzBytecode::BittyBuzzBytecode
BittyBuzzBytecode(ILogger &logger, const uint8_t *bytecode, uint16_t bytecodeLength)
Definition: BittyBuzzBytecode.cpp:25
BSPContainer::getUserInterface
IUserInterface & getUserInterface()
Returns an instance of the platform dependent UserInterface.
Definition: BSPContainer.cpp:19
HostHandshakeUI::HostHandshakeUI
HostHandshakeUI(IApplicationInterface &appInterface)
Definition: HostHandshakeUI.cpp:3
UserUI
Definition: UserUI.h:6
UserUI::m_appInterface
IApplicationInterface & m_appInterface
Definition: UserUI.h:17
UserUI::setLed
void setLed(bool state) override
Set the led on or off.
Definition: UserUI.cpp:5
IApplicationInterface
Definition: IApplicationInterface.h:7
BittyBuzzBytecode::m_logger
ILogger & m_logger
Definition: BittyBuzzBytecode.h:20
IApplicationInterface::setUserLed
virtual void setUserLed(bool state)=0
set the user LED
ApplicationInterfaceContainer.h
ConnectionState::USB
@ USB
ButtonCallbackRegister::m_appInterface
IApplicationInterface & m_appInterface
Definition: ButtonCallbackRegister.h:14
RemoteHandshakeUI.h
UserUI::setSegment
void setSegment(UserSegment segment) override
Set the user seven segment to a value.
Definition: UserUI.cpp:7
UserStates
Definition: UserStates.h:23
HostHandshakeUI::handshake
void handshake(bool handshaked) override
Sets the handshake status of the device.
Definition: HostHandshakeUI.cpp:6
ApplicationInterface::getApplicationState
ApplicationStates getApplicationState() const override
get the application states
Definition: ApplicationInterface.cpp:81
UserStates::m_userLed
bool m_userLed
Definition: UserStates.h:24
SystemStates::m_connection
ConnectionState m_connection
the state of the connection with the host
Definition: SystemStates.h:33
ApplicationStates
Definition: ApplicationStates.h:7
RemoteHandshakeUI::handshake
void handshake(bool handshaked) override
Sets the handshake status of the device.
Definition: RemoteHandshakeUI.cpp:6
IUserInterface::setHexDisplay
virtual void setHexDisplay(uint8_t value)=0
Sets the hex display to a given 8 bit value (not available on the HiveSight)
ApplicationInterface::ApplicationInterface
ApplicationInterface(IUserInterface &userInterface, IMutex &mutex)
Definition: ApplicationInterface.cpp:4
ApplicationInterfaceContainer::getButton1CallbackRegister
ButtonCallbackRegister & getButton1CallbackRegister()
get the button 1 callback register
Definition: ApplicationInterfaceContainer.cpp:17
IApplicationInterface::setSystemButtonCallback
virtual void setSystemButtonCallback(Button button, buttonCallbackFunction_t callback, void *context)=0
set the systems button to a callback
IApplicationInterface::setSystemRemoteHandshaked
virtual void setSystemRemoteHandshaked(bool handshaked)=0
set the system Remote handshake and light the necessary LED
BittyBuzzBytecode::m_bytecode
const uint8_t * m_bytecode
Definition: BittyBuzzBytecode.h:21
IApplicationInterface::setSystemHostHandshaked
virtual void setSystemHostHandshaked(bool handshaked)=0
set the system Host handshake and light the necessary LED
ApplicationInterfaceContainer::getHostHandshakeUI
HostHandshakeUI & getHostHandshakeUI()
get the host handshake UI
Definition: ApplicationInterfaceContainer.cpp:33
ApplicationInterface::setSystemHostHandshaked
void setSystemHostHandshaked(bool handshaked) override
set the system Host handshake and light the necessary LED
Definition: ApplicationInterface.cpp:13
DeviceStateUI.h
ConnectionStateUI.h
ConnectionState::Unconnected
@ Unconnected
ApplicationInterface::setSystemRemoteHandshaked
void setSystemRemoteHandshaked(bool handshaked) override
set the system Remote handshake and light the necessary LED
Definition: ApplicationInterface.cpp:7
Button
Button
Buttons present on the board.
Definition: IUserInterface.h:16
Button::BUTTON_1
@ BUTTON_1
ApplicationInterface::setSystemButtonCallback
void setSystemButtonCallback(Button button, buttonCallbackFunction_t callback, void *context) override
set the systems button to a callback
Definition: ApplicationInterface.cpp:51
ApplicationInterface::getSystemStates
SystemStates getSystemStates() const override
set the system states
Definition: ApplicationInterface.cpp:71
ApplicationStates::m_userStates
UserStates m_userStates
Definition: ApplicationStates.h:9
BittyBuzzBytecode::getBytecodeFetchFunction
bbzvm_bcode_fetch_fun getBytecodeFetchFunction() const override
Obtain the function that fetches the BittyBuzz byte code.
Definition: BittyBuzzBytecode.cpp:34
ApplicationInterface::setUserSegment
void setUserSegment(UserSegment segment) override
set the user seven segment
Definition: ApplicationInterface.cpp:63
RgbColor::RED
@ RED
RgbColor::VIOLET
@ VIOLET
ConnectionStateUI::ConnectionStateUI
ConnectionStateUI(IApplicationInterface &appInterface)
Definition: ConnectionStateUI.cpp:3
DeviceStateUI::m_appInterface
IApplicationInterface & m_appInterface
Definition: DeviceStateUI.h:14
ConnectionStateUI::m_appInterface
IApplicationInterface & m_appInterface
Definition: ConnectionStateUI.h:14
ApplicationInterface::m_userInterface
IUserInterface & m_userInterface
Definition: ApplicationInterface.h:41
ApplicationInterfaceContainer::getConnectionStateUI
ConnectionStateUI & getConnectionStateUI()
get the connection state UI
Definition: ApplicationInterfaceContainer.cpp:23
ButtonCallbackRegister
Definition: ButtonCallbackRegister.h:6
IBittyBuzzBytecode.h
ILogger
A logger class with basic logging capabilities.
Definition: ILogger.h:35
IUserInterface::setRGBLed
virtual void setRGBLed(RgbColor color)=0
Sets the RGB LED to a given color.
ApplicationInterface::s_userLed
static constexpr LED s_userLed
Definition: ApplicationInterface.h:38
UserUI.h
UserStates::m_userSegment
UserSegment m_userSegment
Definition: UserStates.h:25
ApplicationInterface::setUserLed
void setUserLed(bool state) override
set the user LED
Definition: ApplicationInterface.cpp:57
BittyBuzzBytecode
Definition: BittyBuzzBytecode.h:9
ConnectionState::Booting
@ Booting
ApplicationInterface::setSystemConnectionState
void setSystemConnectionState(ConnectionState state) override
set the system Connection state and light the necessary LED the right color
Definition: ApplicationInterface.cpp:19
IApplicationInterface::setSystemDeviceState
virtual void setSystemDeviceState(DeviceState state)=0
set the system Connection state and set the seven segment accordingly
DeviceStateUI::setDeviceState
void setDeviceState(DeviceState state) override
Sets the state of the device.
Definition: DeviceStateUI.cpp:5
UserUI::UserUI
UserUI(IApplicationInterface &appInterface)
Definition: UserUI.cpp:3
ConnectionState
ConnectionState
Definition: SystemStates.h:4
DeviceStateUI::DeviceStateUI
DeviceStateUI(IApplicationInterface &appInterface)
Definition: DeviceStateUI.cpp:3
ButtonCallbackRegister::setCallback
void setCallback(buttonCallbackFunction_t callback, void *context) override
sets the callback to the managed button
Definition: ButtonCallbackRegister.cpp:6
RgbColor::BLUE
@ BLUE
ApplicationInterfaceContainer::getButton0CallbackRegister
ButtonCallbackRegister & getButton0CallbackRegister()
get the button 0 callback register
Definition: ApplicationInterfaceContainer.cpp:11
ConnectionStateUI::setConnectionState
void setConnectionState(ConnectionState state) override
Sets the state of the connection.
Definition: ConnectionStateUI.cpp:6
DeviceStateUI
Definition: DeviceStateUI.h:6
ConnectionStateUI
Definition: ConnectionStateUI.h:6
IUserInterface::setLed
virtual void setLed(LED led, bool state)=0
Sets an LED on or off.
ApplicationInterface::m_mutex
IMutex & m_mutex
Definition: ApplicationInterface.h:42
ApplicationInterface::s_hostLed
static constexpr LED s_hostLed
Definition: ApplicationInterface.h:37
ConnectionState::Ethernet
@ Ethernet
IUserInterface
Manages the user interface The user interface can consist of buttons, LED, serial print ports,...
Definition: IUserInterface.h:36
UserSegment
UserSegment
Definition: UserStates.h:4
IBittyBuzzBytecode
Manages the BittyBuzz byte code.
Definition: IBittyBuzzBytecode.h:9
RgbColor::TEAL
@ TEAL
HostHandshakeUI::m_appInterface
IApplicationInterface & m_appInterface
Definition: HostHandshakeUI.h:15
ApplicationStates::m_systemStates
SystemStates m_systemStates
Definition: ApplicationStates.h:8
IApplicationInterface::setUserSegment
virtual void setUserSegment(UserSegment segment)=0
set the user seven segment
ButtonCallbackRegister::m_button
Button m_button
Definition: ButtonCallbackRegister.h:15
SystemStates::m_device
DeviceState m_device
the overall state of the device
Definition: SystemStates.h:36
ApplicationInterfaceContainer::getDeviceStateUI
DeviceStateUI & getDeviceStateUI()
get the device state UI
Definition: ApplicationInterfaceContainer.cpp:28
buttonCallbackFunction_t
void(* buttonCallbackFunction_t)(void *instance)
Prototype for a callback from a button press.
Definition: IUserInterface.h:28
DeviceState
DeviceState
Definition: SystemStates.h:6
SystemStates::m_hostHandshaked
bool m_hostHandshaked
if the handshake with the host is successfull
Definition: SystemStates.h:30
ApplicationInterface.h
ApplicationInterfaceContainer::getUserUI
UserUI & getUserUI()
get the UI available to the user
Definition: ApplicationInterfaceContainer.cpp:43
BittyBuzzBytecode::m_bytecodeLength
const uint16_t m_bytecodeLength
Definition: BittyBuzzBytecode.h:22
ApplicationInterfaceContainer::getRemoteHandshakeUI
RemoteHandshakeUI & getRemoteHandshakeUI()
get the remote handshake UI
Definition: ApplicationInterfaceContainer.cpp:38
RgbColor::WHITE
@ WHITE
SystemStates::m_remoteHandshaked
bool m_remoteHandshaked
if the handshake with the esp is successfull
Definition: SystemStates.h:27
ApplicationInterface::m_states
ApplicationStates m_states
Definition: ApplicationInterface.h:43
ApplicationInterface
Definition: ApplicationInterface.h:8
ILogger.h
RemoteHandshakeUI::m_appInterface
IApplicationInterface & m_appInterface
Definition: RemoteHandshakeUI.h:15
getApplicationInterface
ApplicationInterface & getApplicationInterface()
Definition: ApplicationInterfaceContainer.cpp:5