Skip to content

Commit 2fe4c95

Browse files
committed
Feedback
1 parent cad87d7 commit 2fe4c95

File tree

6 files changed

+98
-49
lines changed

6 files changed

+98
-49
lines changed

FprimeZephyrReference/Components/Drv/Ina219Manager/Ina219Manager.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ======================================================================
22
// \title Ina219Manager.cpp
3-
// \author nate
43
// \brief cpp file for Ina219Manager component implementation class
54
// ======================================================================
65

@@ -17,6 +16,10 @@ Ina219Manager ::Ina219Manager(const char* const compName) : Ina219ManagerCompone
1716

1817
Ina219Manager ::~Ina219Manager() {}
1918

19+
// ----------------------------------------------------------------------
20+
// Helper methods
21+
// ----------------------------------------------------------------------
22+
2023
void Ina219Manager::configure(const struct device* dev) {
2124
this->m_dev = dev;
2225
}

FprimeZephyrReference/Components/Drv/Ina219Manager/Ina219Manager.fpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ module Drv {
44
port PowerGet -> F64
55
}
66

7-
module Drv {
7+
module Drv {
88
@ Manager for Ina219 device
99
passive component Ina219Manager {
10-
11-
#Ports
10+
# Ports
1211
@ Port to read the voltage in volts
1312
sync input port voltageGet: VoltageGet
1413

@@ -32,7 +31,6 @@ module Drv {
3231
@ Event for reporting INA219 not ready error
3332
event DeviceNotReady() severity warning high format "INA219 device not ready" throttle 5
3433

35-
3634
###############################################################################
3735
# Standard AC Ports: Required for Channels, Events, Commands, and Parameters #
3836
###############################################################################

FprimeZephyrReference/Components/Drv/Ina219Manager/Ina219Manager.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ======================================================================
22
// \title Ina219Manager.hpp
3-
// \author nate
43
// \brief hpp file for Ina219Manager component implementation class
54
// ======================================================================
65

@@ -27,7 +26,13 @@ class Ina219Manager final : public Ina219ManagerComponentBase {
2726
//! Destroy Ina219Manager object
2827
~Ina219Manager();
2928

30-
void configure(const struct device* dev); // helper function to configure device for the class
29+
public:
30+
// ----------------------------------------------------------------------
31+
// Helper methods
32+
// ----------------------------------------------------------------------
33+
34+
//! Configure the INA219 device
35+
void configure(const struct device* dev);
3136

3237
private:
3338
// ----------------------------------------------------------------------
Lines changed: 85 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,111 @@
11
# Drv::Ina219Manager
22

3-
Manager for Ina219 device
3+
The INA219 Manager component interfaces with the INA219 current/power monitor to provide voltage, current, and power measurements.
44

55
## Usage Examples
6-
Add usage examples here
76

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.
108

119
### 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
1318

1419
## Class Diagram
15-
Add a class diagram here
1620

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+
```
2139

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 |
2746

2847
## Sequence Diagrams
29-
Add sequence diagrams here
3048

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
3556
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+
```
4065

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
4573
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+
```
5082

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+
```
5699

57100
## Requirements
58-
Add requirements in the chart below
59101
| Name | Description | Validation |
60102
|---|---|---|
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 |
62107

63108
## Change Log
64109
| Date | Description |
65110
|---|---|
66-
|---| Initial Draft |
111+
| 2025-11-03 | Initial INA219 Manager component |

FprimeZephyrReference/Components/PowerMonitor/PowerMonitor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ======================================================================
22
// \title PowerMonitor.cpp
3-
// \author nate
43
// \brief cpp file for PowerMonitor component implementation class
54
// ======================================================================
65

FprimeZephyrReference/Components/PowerMonitor/PowerMonitor.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// ======================================================================
22
// \title PowerMonitor.hpp
3-
// \author nate
43
// \brief hpp file for PowerMonitor component implementation class
54
// ======================================================================
65

0 commit comments

Comments
 (0)