Skip to content

Commit

Permalink
Add gate voltage to config (#331)
Browse files Browse the repository at this point in the history
* add gate_voltage to config

* black formatting

* add changes to CONFIGURATION.md

* fix indent
  • Loading branch information
roryjamesallen authored Feb 8, 2024
1 parent d3bcc59 commit aed66f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion software/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ default configuration:
"display_height": 32,
"volts_per_octave": 1.0,
"max_output_voltage": 10,
"max_input_voltage": 12
"max_input_voltage": 12,
"gate_voltage": 5
}
```

Expand All @@ -29,3 +30,4 @@ default configuration:
The hardware is capable of 10V maximum
- `max_input_voltage` is an integer in the range `[0, 12]` indicating the maximum allowed voltage into the `ain` jack.
The hardware is capable of 12V maximum
- `gate_voltage` is an integer in the range `[0, 12]` indicating the voltage that an output will produce when `cvx.on()` is called
3 changes: 2 additions & 1 deletion software/firmware/europi.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ def __init__(self, pin, min_voltage=MIN_OUTPUT_VOLTAGE, max_voltage=MAX_OUTPUT_V
self._duty = 0
self.MIN_VOLTAGE = min_voltage
self.MAX_VOLTAGE = max_voltage
self.gate_voltage = clamp(europi_config["gate_voltage"], self.MIN_VOLTAGE, self.MAX_VOLTAGE)

self._gradients = []
for index, value in enumerate(OUTPUT_CALIBRATION_VALUES[:-1]):
Expand All @@ -597,7 +598,7 @@ def voltage(self, voltage=None):

def on(self):
"""Set the voltage HIGH at 5 volts."""
self.voltage(5)
self.voltage(self.gate_voltage)

def off(self):
"""Set the voltage LOW at 0 volts."""
Expand Down
5 changes: 5 additions & 0 deletions software/firmware/europi_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ def config_points(cls):
range=range(1, 13),
default=12
),
configuration.integer(
name="gate_voltage",
range=range(1, 13),
default=5
),
]
# fmt: on

Expand Down

0 comments on commit aed66f3

Please sign in to comment.