- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on. - WiFi service now turns on WiFi when calling connect() and WiFi is not on. - Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex. - Various apps: Moved private headers into Private/ folder. - Various apps: created start() function for easy starting. - Added documentation to all TactilityC APIs - Refactored various `enum` into `class enum` - Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
26 lines
692 B
C++
26 lines
692 B
C++
#pragma once
|
|
|
|
#include "hal/i2c/I2c.h"
|
|
|
|
class I2cDevice {
|
|
|
|
protected:
|
|
|
|
i2c_port_t port;
|
|
uint8_t address;
|
|
|
|
static constexpr TickType_t DEFAULT_TIMEOUT = 1000 / portTICK_PERIOD_MS;
|
|
|
|
bool readRegister8(uint8_t reg, uint8_t& result) const;
|
|
bool writeRegister8(uint8_t reg, uint8_t value) const;
|
|
bool readRegister12(uint8_t reg, float& out) const;
|
|
bool readRegister14(uint8_t reg, float& out) const;
|
|
bool readRegister16(uint8_t reg, uint16_t& out) const;
|
|
bool bitOn(uint8_t reg, uint8_t bitmask) const;
|
|
bool bitOff(uint8_t reg, uint8_t bitmask) const;
|
|
|
|
public:
|
|
|
|
explicit I2cDevice(i2c_port_t port, uint32_t address) : port(port), address(address) {}
|
|
};
|