Drv::Tmp112Manager
The TMP112 Manager component interfaces with the TMP112 sensor to provide ambient temperature measurements.
Usage Examples
The TMP112 Manager component is designed to be called periodically or on demand to collect and return sensor data. It operates as a passive component that responds to manager calls.
Typical Usage
- The component is instantiated and initialized during system startup.
- A manager calls the input port:
temperatureGet.
- On each call, the component:
- Checks if the device is initialized and ready (including TCA, MUX, and Load Switch status).
- Fetches fresh sensor samples.
- Writes telemetry data.
- Returns the temperature value in degrees Celsius.
Class Diagram
classDiagram
namespace Drv {
class Tmp112ManagerComponentBase {
<<Auto-generated>>
}
class Tmp112Manager {
- m_dev: const struct device*
- m_tca: const struct device*
- m_mux: const struct device*
- m_load_switch_state: Fw::On
- m_load_switch_on_timeout: Fw::Time
- m_load_switch_check: bool
+ Tmp112Manager(const char* compName)
+ ~Tmp112Manager()
+ configure(const struct device* tca, const struct device* mux, const struct device* dev, bool loadSwitchCheck)
- temperatureGet_handler(FwIndexType portNum, Fw::Success& condition): F64
- loadSwitchStateChanged_handler(FwIndexType portNum, const Fw::On& state): Fw::Success
}
}
Tmp112ManagerComponentBase <|-- Tmp112Manager : inherits
Port Descriptions
| Name |
Type |
Description |
| temperatureGet |
sync input |
Reads the temperature in degrees Celsius. |
| loadSwitchStateChanged |
sync input |
Initializes and deinitializes the TMP112 device on load switch state change. |
Sequence Diagrams
temperatureGet
sequenceDiagram
participant Manager
participant Tmp112Manager
participant Zephyr Sensor API
participant TMP112 Sensor
Manager-->>Tmp112Manager: Call temperatureGet
Tmp112Manager->>Tmp112Manager: Check/Init Device (TCA, MUX, LoadSwitch)
Tmp112Manager->>Zephyr Sensor API: Fetch sensor sample (SENSOR_CHAN_AMBIENT_TEMP)
Zephyr Sensor API->>TMP112 Sensor: Read registers
TMP112 Sensor->>Zephyr Sensor API: Return data
Zephyr Sensor API->>Tmp112Manager: Return sample
Tmp112Manager->>Zephyr Sensor API: Get channel value
Zephyr Sensor API->>Tmp112Manager: Return value
Tmp112Manager->>Tmp112Manager: Write Telemetry (Temperature)
Tmp112Manager-->>Manager: Return temperature (F64)
Commands
| Name |
Description |
| GetTemperature |
Command to get the temperature in degrees Celsius |
Events
| Name |
Description |
| DeviceNotReady |
TMP112 device not ready |
| DeviceInitFailed |
TMP112 initialization failed |
| DeviceNil |
TMP112 device is nil |
| DeviceStateNil |
TMP112 device state is nil |
| TcaUnhealthy |
TMP112 TCA device is unhealthy |
| MuxUnhealthy |
TMP112 MUX device is unhealthy |
| SensorSampleFetchFailed |
TMP112 sensor fetch failed |
| SensorChannelGetFailed |
TMP112 sensor channel get failed |
| Temperature |
Temperature reading in celsius |
Telemetry
| Name |
Description |
| Temperature |
Temperature in degrees Celsius |
Requirements
| Name |
Description |
Validation |
| TemperatureGet Port |
The component shall provide access to temperature sensor data and return in degrees Celsius |
Verify output matches expected values from sensor datasheet |
| LoadSwitchStateChanged Port |
The component shall manage device initialization based on load switch state |
Verify device initializes when switch is ON and deinitializes when OFF |
Change Log
| Date |
Description |
| 2025-12-04 |
Initial TMP112 Manager component SDD |