Skip to content

Commit

Permalink
refactor: define voltage on power interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Jun 14, 2024
1 parent 2fe39a8 commit 5f806cc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/osr_elec/elec/src/lib/can-controller-trx.ato
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module CanControllerTrx:

# power
power = new Power
power.voltage = 3.1V to 3.3V
signal gnd ~ power.gnd

spi = new SPI
Expand All @@ -37,7 +38,7 @@ module CanControllerTrx:

# user LED on controller GPIO 0
user_led_indicator = new LEDIndicatorUser
user_led_indicator.v_in = 3.1V to 3.3V
user_led_indicator.v_in = power.voltage
user_led_indicator.input ~ controller.gpio0.io
user_led_indicator.gnd ~ gnd

Expand All @@ -48,12 +49,12 @@ module CanControllerTrx:

# indicator LEDs
led_rx = new LEDIndicatorRx
led_rx.v_in = 3.1V to 3.3V
led_rx.v_in = power.voltage
led_rx.input ~ power.vcc
led_rx.gnd ~ controller.can_ttl.rx

led_tx = new LEDIndicatorTx
led_tx.v_in = 3.1V to 3.3V
led_tx.v_in = power.voltage
led_tx.input ~ power.vcc
led_tx.gnd ~ controller.can_ttl.tx

Expand Down
1 change: 0 additions & 1 deletion src/osr_elec/elec/src/lib/connectors.ato
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ from "generics/interfaces.ato" import CAN, Power
from "lib/interfaces.ato" import RS485



component Connector:
"""Connector."""
designator_prefix = "J"
Expand Down
3 changes: 2 additions & 1 deletion src/osr_elec/elec/src/lib/rpi-hat/robot-signal-light.ato
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module RobotSignalLight:
"""
# power
power_5v = new Power
power_5v.voltage = 4.9V to 5.1V
signal gnd ~ power_5v.gnd

input = new Pair
Expand All @@ -33,7 +34,7 @@ module RobotSignalLight:
# on-board signal LED
status_indicator = new LEDIndicatorAmber
status_indicator.current = 5mA to 10mA
status_indicator.v_in = 4.9V to 5.1V
status_indicator.v_in = power_5v.voltage
status_indicator.input ~ switch.load.p
status_indicator.gnd ~ switch.load.n

Expand Down
3 changes: 2 additions & 1 deletion src/osr_elec/elec/src/lib/spi-uart-converter.ato
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ from "lib/oscillators.ato" import ABM8_14MHz7456Oscillator
module SpiToUart:
"""SPI to UART converter."""
power = new Power
power.voltage = 3.1V to 3.3V
spi = new SPI
uart_a = new UART
uart_b = new UART
Expand Down Expand Up @@ -39,6 +40,6 @@ module SpiToUart:

# user LED indicator
user_led_indicator = new LEDIndicatorUser
user_led_indicator.v_in = 3.1V to 3.3V
user_led_indicator.v_in = power.voltage
user_led_indicator.input ~ converter.gpio0.io
user_led_indicator.gnd ~ power.gnd
6 changes: 4 additions & 2 deletions src/osr_elec/elec/src/rpi-hat.ato
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ module RpiHat:
"""
# power
power_3v3 = new Power # peripheral power supply
power_3v3.voltage = 3.1V to 3.3V
power_5v = new Power
power_5v.voltage = 4.9V to 5.1V
# common ground for both power rails
signal gnd ~ power_3v3.gnd
gnd ~ power_5v.gnd
Expand Down Expand Up @@ -83,12 +85,12 @@ module RpiHat:

# 3.3V power rail LED indicator
power_indicator_3v3 = new LEDIndicatorPowerRail
power_indicator_3v3.v_in = 3.1V to 3.3V
power_indicator_3v3.v_in = power_3v3.voltage
power_indicator_3v3.power ~ power_3v3

# 5V power rail LED indicator
power_indicator_5v = new LEDIndicatorPowerRail
power_indicator_5v.v_in = 4.9V to 5.1V
power_indicator_5v.v_in = power_5v.voltage
power_indicator_5v.power ~ power_5v

# robot signal light
Expand Down

0 comments on commit 5f806cc

Please sign in to comment.