|
1 | 1 | # Drv::Ina219Manager |
2 | 2 |
|
3 | | -Manager for Ina219 device |
| 3 | +The INA219 Manager component interfaces with the INA219 current/power monitor to provide voltage, current, and power measurements. |
4 | 4 |
|
5 | 5 | ## Usage Examples |
6 | | -Add usage examples here |
7 | 6 |
|
8 | | -### Diagrams |
9 | | -Add diagrams here |
| 7 | +The INA219 Manager component is designed to be called periodically to collect and return sensor data. It operates as a passive component that responds to manager calls. |
10 | 8 |
|
11 | 9 | ### Typical Usage |
12 | | -And the typical usage of the component here |
| 10 | + |
| 11 | +1. The component is instantiated and initialized during system startup |
| 12 | +2. A manager calls any of the input ports: `VoltageGet`, `CurrentGet`, or `PowerGet` |
| 13 | +3. On each call, the component: |
| 14 | + - Fetches fresh sensor samples from the sensor |
| 15 | + - Converts sensor data to double precision floating point |
| 16 | + - Writes telemetry data |
| 17 | + - Returns data in SI units |
13 | 18 |
|
14 | 19 | ## Class Diagram |
15 | | -Add a class diagram here |
16 | 20 |
|
17 | | -## Port Descriptions |
18 | | -| Name | Description | |
19 | | -|---|---| |
20 | | -|---|---| |
| 21 | +```mermaid |
| 22 | +classDiagram |
| 23 | + namespace Drv { |
| 24 | + class Ina219ManagerComponentBase { |
| 25 | + <<Auto-generated>> |
| 26 | + } |
| 27 | + class Ina219Manager { |
| 28 | + - m_dev: const struct device* |
| 29 | + + Ina219Manager(const char* compName) |
| 30 | + + ~Ina219Manager() |
| 31 | + + configure(const struct device* dev) |
| 32 | + - voltageGet_handler(const FwIndexType portNum): F64 |
| 33 | + - currentGet_handler(const FwIndexType portNum): F64 |
| 34 | + - powerGet_handler(const FwIndexType portNum): F64 |
| 35 | + } |
| 36 | + } |
| 37 | + Ina219ManagerComponentBase <|-- Ina219Manager : inherits |
| 38 | +``` |
21 | 39 |
|
22 | | -## Component States |
23 | | -Add component states in the chart below |
24 | | -| Name | Description | |
25 | | -|---|---| |
26 | | -|---|---| |
| 40 | +## Port Descriptions |
| 41 | +| Name | Type | Description | |
| 42 | +|---|---|---| |
| 43 | +| VoltageGet | sync input | Triggers voltage data collection and returns voltage in volts | |
| 44 | +| CurrentGet | sync input | Triggers current data collection and returns current in amps | |
| 45 | +| PowerGet | sync input | Triggers power data collection and returns power in watts | |
27 | 46 |
|
28 | 47 | ## Sequence Diagrams |
29 | | -Add sequence diagrams here |
30 | 48 |
|
31 | | -## Parameters |
32 | | -| Name | Description | |
33 | | -|---|---| |
34 | | -|---|---| |
| 49 | +### VoltageGet |
| 50 | +```mermaid |
| 51 | +sequenceDiagram |
| 52 | + participant Manager |
| 53 | + participant INA219 Manager |
| 54 | + participant Zephyr Sensor API |
| 55 | + participant INA219 Sensor |
35 | 56 |
|
36 | | -## Commands |
37 | | -| Name | Description | |
38 | | -|---|---| |
39 | | -|---|---| |
| 57 | + Manager-->>INA219 Manager: Call VoltageGet synchronous input port |
| 58 | + INA219 Manager->>Zephyr Sensor API: Fetch sensor data |
| 59 | + Zephyr Sensor API->>INA219 Sensor: Read sensor |
| 60 | + INA219 Sensor->>Zephyr Sensor API: Return sensor data |
| 61 | + Zephyr Sensor API->>INA219 Manager: Return voltage sensor_value struct |
| 62 | + INA219 Manager->>INA219 Manager: Write telemetry |
| 63 | + INA219 Manager-->>Manager: Return F64 voltage in volts |
| 64 | +``` |
40 | 65 |
|
41 | | -## Events |
42 | | -| Name | Description | |
43 | | -|---|---| |
44 | | -|---|---| |
| 66 | +### CurrentGet |
| 67 | +```mermaid |
| 68 | +sequenceDiagram |
| 69 | + participant Manager |
| 70 | + participant INA219 Manager |
| 71 | + participant Zephyr Sensor API |
| 72 | + participant INA219 Sensor |
45 | 73 |
|
46 | | -## Telemetry |
47 | | -| Name | Description | |
48 | | -|---|---| |
49 | | -|---|---| |
| 74 | + Manager-->>INA219 Manager: Call CurrentGet synchronous input port |
| 75 | + INA219 Manager->>Zephyr Sensor API: Fetch sensor data |
| 76 | + Zephyr Sensor API->>INA219 Sensor: Read sensor |
| 77 | + INA219 Sensor->>Zephyr Sensor API: Return sensor data |
| 78 | + Zephyr Sensor API->>INA219 Manager: Return current sensor_value struct |
| 79 | + INA219 Manager->>INA219 Manager: Write telemetry |
| 80 | + INA219 Manager-->>Manager: Return F64 current in amps |
| 81 | +``` |
50 | 82 |
|
51 | | -## Unit Tests |
52 | | -Add unit test descriptions in the chart below |
53 | | -| Name | Description | Output | Coverage | |
54 | | -|---|---|---|---| |
55 | | -|---|---|---|---| |
| 83 | +### PowerGet |
| 84 | +```mermaid |
| 85 | +sequenceDiagram |
| 86 | + participant Manager |
| 87 | + participant INA219 Manager |
| 88 | + participant Zephyr Sensor API |
| 89 | + participant INA219 Sensor |
| 90 | +
|
| 91 | + Manager-->>INA219 Manager: Call PowerGet synchronous input port |
| 92 | + INA219 Manager->>Zephyr Sensor API: Fetch sensor data |
| 93 | + Zephyr Sensor API->>INA219 Sensor: Read sensor |
| 94 | + INA219 Sensor->>Zephyr Sensor API: Return sensor data |
| 95 | + Zephyr Sensor API->>INA219 Manager: Return power sensor_value struct |
| 96 | + INA219 Manager->>INA219 Manager: Write telemetry |
| 97 | + INA219 Manager-->>Manager: Return F64 power in watts |
| 98 | +``` |
56 | 99 |
|
57 | 100 | ## Requirements |
58 | | -Add requirements in the chart below |
59 | 101 | | Name | Description | Validation | |
60 | 102 | |---|---|---| |
61 | | -|---|---|---| |
| 103 | +| VoltageGet Port | The component shall provide access to voltage sensor data and return in volts | Integration test | |
| 104 | +| CurrentGet Port | The component shall provide access to current sensor data and return in amps | Integration test | |
| 105 | +| PowerGet Port | The component shall provide access to power sensor data and return in watts | Integration test | |
| 106 | +| DeviceNotReady Event | The component shall emit a throttled warning event when the device is not ready | Verify event is emitted and throttled to 5 occurrences | |
62 | 107 |
|
63 | 108 | ## Change Log |
64 | 109 | | Date | Description | |
65 | 110 | |---|---| |
66 | | -|---| Initial Draft | |
| 111 | +| 2025-11-03 | Initial INA219 Manager component | |
0 commit comments