|
1 | 1 | # Components::LoadSwitch |
2 | 2 |
|
3 | | -A generic load switch for controlling power to components |
| 3 | + |
4 | 4 |
|
5 | | -## Usage Examples |
6 | | -Add usage examples here |
| 5 | +## Overview |
7 | 6 |
|
8 | | -### Diagrams |
9 | | -Add diagrams here |
| 7 | +The `LoadSwitch` component is an active F' component that controls a single load switch output |
| 8 | +through the `gpioSet` output port (connected to the platform's GPIO driver). It exposes two |
| 9 | +async commands to turn the switch on and off, telemetry reporting the current state, and an |
| 10 | +async `Reset` input which toggles the switch (off, short delay, on). |
10 | 11 |
|
11 | | -### Typical Usage |
12 | | -The load switch would be used whenever a sensor is to be turned on or off. |
| 12 | +## Responsibility |
13 | 13 |
|
14 | | -## Class Diagram |
15 | | -Add a class diagram here |
| 14 | +- Control the power rail for a connected peripheral by asserting/deasserting a GPIO. |
| 15 | +- Report state changes via an event and telemetry channel. |
16 | 16 |
|
17 | | -## Port Descriptions |
18 | | -| Name | Description | |
19 | | -|---|---| |
20 | | -| Status | Boolean value displaying whether the load switch is on or not. | |
| 17 | +## External interface |
21 | 18 |
|
22 | | -## Component States |
23 | | -| Name | Description | |
24 | | -|-------|--------------------------------------| |
25 | | -| Off | No power to the component | |
26 | | -| On | Power supplied to the component | |
27 | | -| Error | An error occurred in the load switch | |
| 19 | +### Commands |
28 | 20 |
|
29 | | -## Sequence Diagrams |
30 | | -Add sequence diagrams here |
| 21 | +| Name | Description | Implementation notes | |
| 22 | +|---|---|---| |
| 23 | +| TURN_ON | Turn on the associated power rail | `TURN_ON_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::HIGH)`, emits `StatusChanged` (ON), updates `IsOn` telemetry, replies OK. | |
| 24 | +| TURN_OFF | Turn off the associated power rail | `TURN_OFF_cmdHandler` sets the gpio via `gpioSet_out(0, Fw::Logic::LOW)`, emits `StatusChanged` (OFF), updates `IsOn` telemetry, replies OK. | |
31 | 25 |
|
32 | | -## Parameters |
33 | | -| Name | Description | |
34 | | -|---|---| |
35 | | -|---|---| |
| 26 | +### Telemetry |
36 | 27 |
|
37 | | -## Commands |
38 | | -| Name | Description | |
39 | | -|---|---| |
40 | | -| On | Turn on power to the component | |
41 | | -| Off | Turn off power to the component | |
| 28 | +| Name | Type | Description | |
| 29 | +|---|---:|---| |
| 30 | +| IsOn | Fw.On | Current power state; written after commands and on Reset handling. | |
42 | 31 |
|
43 | | -## Events |
44 | | -| Name | Description | |
45 | | -|---|---| |
46 | | -| StatusChanged | Emits event whenever the status of the load switch changes | |
| 32 | +### Events |
47 | 33 |
|
48 | | -## Telemetry |
49 | | -| Name | Description | |
50 | | -|---|---| |
51 | | -| IsOn | Returns whether the load switch is supplying power to the component or not | |
| 34 | +| Name | Severity | ID | Format | |
| 35 | +|---|---|---:|---| |
| 36 | +| StatusChanged | activity high | 1 | "Load switch state changed to {}" | |
52 | 37 |
|
53 | | -## Unit Tests |
54 | | -| Name | Description | Output | Coverage | |
55 | | -|---|---|---|---| |
| 38 | +The component logs the `StatusChanged` event whenever the switch transitions due to a command or a Reset. |
| 39 | + |
| 40 | +### Ports |
| 41 | + |
| 42 | +| Port name | Direction | Port type | Notes | |
56 | 43 | |---|---|---|---| |
| 44 | +| gpioSet | output | Drv.GpioWrite | Used to write the physical GPIO. Implementation always uses index 0 (`gpioSet_out(0, ...)`). | |
| 45 | +| Reset | input (async) | Fw.Signal | Causes the component to perform a hardware reset sequence: LOW -> wait 100ms -> HIGH. | |
57 | 46 |
|
58 | | -## Requirements |
59 | | -| Name | Description | Validation | |
60 | | -|---|---|---| |
61 | | -|---|---|---| |
62 | 47 |
|
63 | 48 | ## Change Log |
| 49 | + |
64 | 50 | | Date | Description | |
65 | 51 | |---|---| |
66 | 52 | | 10-22-2025 | Sarah, Kevin, and MoMata's first commit | |
| 53 | +| 11-07-2025 | Updated SDD to match implementation in `LoadSwitch.cpp/.hpp/.fpp` (commands, telemetry, event, ports, reset behavior). | |
0 commit comments