* Added beginning of webconfig-side I2C bus scanning. Added experimental wrapper class for ADS1219 to handle device auto-detection. * Added scanner to webconfig. * Case sensitivity fix * All current I2C addons except Display updated to do auto device detection rather than rely on I2C block options. Added address range to ADS1219 addon to allow scanning across full range. * Fixed I2C/USB peripheral configuration check to reject negative pin values. * Added autodetection of I2C displays. This currently does not disable the usage of other devices on the same block. * Deprecating I2C addon block and address fields. * Remove deprecated Block and Address fields from Display and several Addons. * Added exclusive mode for I2C peripherals to allow data-hungry devices like Display to take full control of the bus. * Revert deprecatedi2cBlock to i2cBlock * Reinstated deprecatedI2cBlock * Reinstated usage of deprecatedI2cBlock
51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
#ifndef _PERIPHERALMANAGER_H_
|
|
#define _PERIPHERALMANAGER_H_
|
|
|
|
#include "peripheral_i2c.h"
|
|
#include "peripheral_spi.h"
|
|
#include "peripheral_usb.h"
|
|
#include "i2cdevicebase.h"
|
|
|
|
#define PMGR PeripheralManager::getInstance()
|
|
|
|
typedef struct {
|
|
int8_t address;
|
|
uint8_t block;
|
|
} PeripheralI2CScanResult;
|
|
|
|
class PeripheralManager {
|
|
public:
|
|
PeripheralManager(PeripheralManager const&) = delete;
|
|
void operator=(PeripheralManager const&) = delete;
|
|
static PeripheralManager& getInstance() // Thread-safe storage ensures cross-thread talk
|
|
{
|
|
static PeripheralManager instance;
|
|
return instance;
|
|
}
|
|
|
|
PeripheralI2C* getI2C(uint8_t block);
|
|
PeripheralSPI* getSPI(uint8_t block);
|
|
PeripheralUSB* getUSB(uint8_t block);
|
|
|
|
void initUSB();
|
|
void initI2C();
|
|
void initSPI();
|
|
|
|
bool isI2CEnabled(uint8_t block);
|
|
bool isSPIEnabled(uint8_t block);
|
|
bool isUSBEnabled(uint8_t block);
|
|
|
|
PeripheralI2CScanResult scanForI2CDevice(std::vector<uint8_t> addressList);
|
|
private:
|
|
PeripheralManager(){}
|
|
|
|
PeripheralI2C blockI2C0;
|
|
PeripheralI2C blockI2C1;
|
|
|
|
PeripheralSPI blockSPI0;
|
|
PeripheralSPI blockSPI1;
|
|
|
|
PeripheralUSB blockUSB0;
|
|
};
|
|
|
|
#endif |