Simplify I2C and SPI code (#237)
This commit is contained in:
committed by
GitHub
parent
b85ef7a2e7
commit
83a82be901
@@ -24,10 +24,11 @@ struct Configuration {
|
||||
i2c_port_t port;
|
||||
/** Whether this bus should be initialized when device starts up */
|
||||
InitMode initMode;
|
||||
/** Whether this bus can stopped and re-started. */
|
||||
bool canReinit;
|
||||
/** Whether configuration can be changed. */
|
||||
bool hasMutableConfiguration;
|
||||
/**
|
||||
* Whether this bus can be changed after booting.
|
||||
* If the bus is internal and/or used for core features like touch screen, then it can be declared static.
|
||||
*/
|
||||
bool isMutable;
|
||||
/** Configuration that must be valid when initAtBoot is set to true. */
|
||||
i2c_config_t config;
|
||||
};
|
||||
@@ -40,8 +41,7 @@ enum class Status {
|
||||
|
||||
/**
|
||||
* Reconfigure a port with the provided settings.
|
||||
* @warning This fails when the HAL Configuration does not allow for reinit.
|
||||
* @warning This fails when the HAL Configuration does not allow for mutation of the device.
|
||||
* @warning This fails when the HAL Configuration is not mutable.
|
||||
* @param[in] port the port to reconfigure
|
||||
* @param[in] configuration the new configuration
|
||||
* @return true on success
|
||||
|
||||
@@ -21,10 +21,8 @@ struct Configuration {
|
||||
spi_bus_config_t config;
|
||||
/** Whether this bus should be initialized when device starts up */
|
||||
InitMode initMode;
|
||||
/** Whether this bus can stopped and re-started. */
|
||||
bool canReinit;
|
||||
/** Whether configuration can be changed. */
|
||||
bool hasMutableConfiguration;
|
||||
bool isMutable;
|
||||
/** Optional custom lock */
|
||||
std::shared_ptr<Lock> _Nullable lock;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user