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
13## Properties
14| Name | Required | Type | Description |
15| :--- | :------: | :--- | :---------- |
16| comments | no | array of strings | One or more comment lines describing this rule. |
17| id | yes | string | Unique ID for this rule.  Can only contain letters (A-Z, a-z), numbers (0-9), and underscore (\_). |
18| actions | yes | array of [actions](action.md) | One or more actions to execute. |
19
20## Return Value
21Return value of the last action in the "actions" property.
22
23## Example
24```
25{
26  "comments": [ "Sets output voltage of PAGE 0 of a PMBus regulator" ],
27  "id": "set_page0_voltage_rule",
28  "actions": [
29    { "i2c_write_byte": { "register": "0x00", "value": "0x00" } },
30    { "pmbus_write_vout_command": { "format": "linear" } }
31  ]
32}
33
34... later in the config file ...
35
36"configuration": {
37  "volts": 1.03,
38  "rule_id": "set_page0_voltage_rule"
39}
40```
41