* Cardputer Kit BMI270 WIP * BMI270 support * verify that the number of bytes read matches the requested length Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * trunk'd * remove excessive logging * Kick the screen when unsleeping * Update the st7789 library, and enable displayon and displayoff * Battery detection * Default to arrow keys and enter, while in menus. * Enable Backlight control * Update src/detect/ScanI2CTwoWire.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * updateState method now accepts shouldRequestFocus parameter for better maintainability --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
37 lines
918 B
C++
37 lines
918 B
C++
#pragma once
|
|
#ifndef _BMI270_SENSOR_H_
|
|
#define _BMI270_SENSOR_H_
|
|
|
|
#include "MotionSensor.h"
|
|
|
|
#if !defined(ARCH_STM32WL) && !MESHTASTIC_EXCLUDE_I2C && defined(HAS_BMI270)
|
|
|
|
class BMI270Sensor : public MotionSensor
|
|
{
|
|
private:
|
|
bool initialized = false;
|
|
TwoWire *wire = nullptr;
|
|
|
|
// Previous readings for motion detection
|
|
int16_t prevX = 0, prevY = 0, prevZ = 0;
|
|
bool hasBaseline = false;
|
|
|
|
// BMI270 register access
|
|
bool writeRegister(uint8_t reg, uint8_t value);
|
|
bool writeRegisters(uint8_t reg, const uint8_t *data, size_t len);
|
|
uint8_t readRegister(uint8_t reg);
|
|
bool readRegisters(uint8_t reg, uint8_t *data, size_t len);
|
|
|
|
// Config file upload (BMI270 requires 8KB config blob)
|
|
bool uploadConfigFile();
|
|
|
|
public:
|
|
explicit BMI270Sensor(ScanI2C::FoundDevice foundDevice);
|
|
virtual bool init() override;
|
|
virtual int32_t runOnce() override;
|
|
};
|
|
|
|
#endif
|
|
|
|
#endif
|