Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tangara-fw/src/drivers/include/touchwheel.hpp

52 lines
924 B

2 years ago
#pragma once
#include <stdint.h>
#include <functional>
2 years ago
#include "esp_err.h"
#include "result.hpp"
#include "gpio_expander.hpp"
namespace drivers {
struct TouchWheelData {
bool is_touched = false;
uint8_t wheel_position = -1;
};
class TouchWheel {
public:
TouchWheel();
2 years ago
~TouchWheel();
// Not copyable or movable.
TouchWheel(const TouchWheel&) = delete;
TouchWheel& operator=(const TouchWheel&) = delete;
auto Update() -> void;
auto GetTouchWheelData() const -> TouchWheelData;
private:
TouchWheelData data_;
2 years ago
enum Register {
FIRMWARE_VERSION = 1,
DETECTION_STATUS = 2,
KEY_STATUS_A = 3,
KEY_STATUS_B = 4,
SLIDER_POSITION = 5,
CALIBRATE = 6,
RESET = 7,
LOW_POWER = 8,
SLIDER_OPTIONS = 14,
CHARGE_TIME = 15,
KEY_CONTROL_BASE = 28,
2 years ago
};
void WriteRegister(uint8_t reg, uint8_t val);
uint8_t ReadRegister(uint8_t reg);
2 years ago
};
} // namespace drivers