29 lines
559 B
C++
29 lines
559 B
C++
#pragma once
|
|
|
|
#include <fmt/ostream.h>
|
|
|
|
#include <optional>
|
|
#include <ostream>
|
|
#include <string>
|
|
|
|
constexpr int I2C_SLAVE_ADDR = 0x20;
|
|
constexpr int I2C_POLL_COMMAND = 0x00;
|
|
|
|
enum class AppView { MISSION_SELECT, AMI, DRIVER, TESTING };
|
|
std::ostream& operator<<(std::ostream& os, AppView view);
|
|
|
|
class AppState {
|
|
public:
|
|
AppState(const std::string& i2c_dev_path);
|
|
~AppState();
|
|
|
|
void poll();
|
|
|
|
AppView get_view();
|
|
|
|
private:
|
|
// This is optional so that we can still run the code on a PC without I2C
|
|
std::optional<int> i2c_dev_file;
|
|
|
|
AppView view;
|
|
}; |