DonCon2040/include/peripherals/Display.h

56 lines
966 B
C
Raw Normal View History

2023-05-22 00:08:23 +02:00
#ifndef _PERIPHERALS_DISPLAY_H_
#define _PERIPHERALS_DISPLAY_H_
#include "usb/usb_driver.h"
#include "utils/InputState.h"
2023-05-22 00:08:23 +02:00
#include <ssd1306/ssd1306.h>
#include "hardware/i2c.h"
#include <memory>
#include <stdint.h>
namespace Doncon::Peripherals {
class Display {
public:
struct Config {
i2c_inst_t *i2c_block;
uint8_t i2c_address;
};
private:
enum class State {
Idle,
Menu,
};
Config m_config;
State m_state;
Utils::InputState m_input_state;
usb_mode_t m_usb_mode;
uint8_t m_player_id;
2023-05-22 00:08:23 +02:00
ssd1306_t m_display;
void drawIdleScreen();
void drawMenuScreen();
public:
Display(const Config &config);
void setInputState(const Utils::InputState &state);
void setUsbMode(usb_mode_t mode);
void setPlayerId(uint8_t player_id);
2023-05-22 00:08:23 +02:00
void showIdle();
void showMenu();
void update();
};
} // namespace Doncon::Peripherals
#endif // _PERIPHERALS_DISPLAY_H_