1# rule
2
3## Description
4A rule is a sequence of actions that can be shared by multiple regulators in
5the config file.  Rules define a standard way to perform an operation.  Rules
6are used to minimize duplication in the config file.
7
8For example, the following action sequences might be sharable using a rule:
9* Actions that set the output voltage of a regulator rail
10* Actions that read all the sensors of a regulator rail
11* Actions that detect down-level hardware using version registers
12* Actions that detect phase faults
13
14## Properties
15| Name | Required | Type | Description |
16| :--- | :------: | :--- | :---------- |
17| comments | no | array of strings | One or more comment lines describing this rule. |
18| id | yes | string | Unique ID for this rule.  Can only contain letters (A-Z, a-z), numbers (0-9), and underscore (\_). |
19| actions | yes | array of [actions](action.md) | One or more actions to execute. |
20
21## Return Value
22Return value of the last action in the "actions" property.
23
24## Example
25```
26{
27  "comments": [ "Sets output voltage of PAGE 0 of a PMBus regulator" ],
28  "id": "set_page0_voltage_rule",
29  "actions": [
30    { "i2c_write_byte": { "register": "0x00", "value": "0x00" } },
31    { "pmbus_write_vout_command": { "format": "linear" } }
32  ]
33}
34
35... later in the config file ...
36
37"configuration": {
38  "volts": 1.03,
39  "rule_id": "set_page0_voltage_rule"
40}
41```
42