Skip to content

Commit

Permalink
refactor: move components to vendor directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfischer committed Jun 11, 2024
1 parent f3d1892 commit 1a94ebe
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/connectors.ato" import JstGhHorizontalCan
from "lib/leds.ato" import LEDIndicatorUser
from "lib/mechanical-switches.ato" import CkJs102011jcqn
from "lib/microchip/MCP2517FDT.ato" import MCP2517FDT
from "lib/microchip/MCP2562FD.ato" import MCP2562FD
from "lib/oscillators.ato" import ABM8_20MHzOscillator
from "lib/resistors.ato" import Resistor1608
from "MCP2517FDT.ato" import MCP2517FDT
from "MCP2562FD.ato" import MCP2562FD


module CanControllerTrx:
Expand Down
32 changes: 32 additions & 0 deletions src/osr_elec/elec/src/lib/maxlinear/SP3485.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""MaxLinear RS-485 Transceiver."""

from "generics/interfaces.ato" import Power


component Sp3485:
"""
SP3485 RS-485 Transceiver.

3.3V Low Power Half-Duplex RS-485 Transceivers with 10Mbps Data Rate.

# Reference

* [SP3485 Datasheet](https://maxlinear-assets.azureedge.net/web/documents/sp3485.pdf)
* [SP3485 Product page](https://www.maxlinear.com/product/interface/serial-transceivers/rs485-422/sp3485)
"""
footprint = "SOIC-8_3.9x4.9mm_P1.27mm"
lcsc_id = "C916153"
mpn = "C916153" # SP3485CN-L

# power
power = new Power
signal gnd ~ power.gnd
power.vcc ~ pin 8 # Vcc
gnd ~ pin 5 # GND

signal ro ~ pin 1 # RO; receiver output
signal re ~ pin 2 # RE (active LOW); receiver output enable
signal de ~ pin 3 # DE (active HIGH); driver output enable
signal di ~ pin 4 # DI; driver input
signal a ~ pin 6 # A; non-inverting driver output / receiver input
signal b ~ pin 7 # B: inverting driver output / receiver input
41 changes: 0 additions & 41 deletions src/osr_elec/elec/src/lib/nxp/SC16IS752.ato
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
"""NXP SPI to UART protocol converters."""

from "generics/capacitors.ato" import Capacitor
from "generics/interfaces.ato" import GPIO, I2C, Power, SPI, UART
from "generics/oscillators.ato" import Oscillator

from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/leds.ato" import LEDIndicatorUser
from "lib/oscillators.ato" import ABM8_14MHz7456Oscillator


module SpiToUart:
"""SPI to UART converter."""
power = new Power
spi = new SPI
uart_a = new UART
uart_b = new UART

converter = new SC16IS752
converter.spi ~ spi
converter.power ~ power
converter.interface_select ~ power.gnd

# power decoupling capacitor
power_cap = new PowerDecouplingCap100nf
power_cap.power ~ power

# configure interface as SPI
converter.interface_select ~ power.gnd

# oscillator
converter_osc = new ABM8_14MHz7456Oscillator
converter.xin ~ converter_osc.xin.io
converter.xout ~ converter_osc.xout.io

# UARTs
uart_a ~ converter.uart_a
uart_b ~ converter.uart_b

# user LED indicator
user_led_indicator = new LEDIndicatorUser
user_led_indicator.v_in = 3.1V to 3.3V
user_led_indicator.input ~ converter.gpio0.io
user_led_indicator.gnd ~ power.gnd


component SC16IS752:
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/osr_elec/elec/src/lib/rpi-hat/id-eeprom.ato
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ from "generics/interfaces.ato" import I2C, Power
from "generics/resistors.ato" import I2CPullup

from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/eeproms.ato" import CAT24C32WI_GT3
from "lib/headers.ato" import PinHeader1x2PinDipStraightTHT
from "lib/onsemi/eeproms.ato" import CAT24C32WI_GT3
from "lib/resistors.ato" import Resistor1608


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from "generics/interfaces.ato" import Power, UART
from "lib/bourns/tvs-diodes.ato" import Cdsot23Sm712
from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/interfaces.ato" import RS485
from "lib/maxlinear/SP3485.ato" import Sp3485
from "lib/resistors.ato" import Resistor1608


Expand Down Expand Up @@ -70,32 +71,3 @@ module Rs485Transceiver:
rs485.gnd ~ gnd

trx.de ~ trx.re


component Sp3485:
"""
SP3485 RS-485 Transceiver.

3.3V Low Power Half-Duplex RS-485 Transceivers with 10Mbps Data Rate.

# Reference

* [SP3485 Datasheet](https://maxlinear-assets.azureedge.net/web/documents/sp3485.pdf)
* [SP3485 Product page](https://www.maxlinear.com/product/interface/serial-transceivers/rs485-422/sp3485)
"""
footprint = "SOIC-8_3.9x4.9mm_P1.27mm"
lcsc_id = "C916153"
mpn = "C916153" # SP3485CN-L

# power
power = new Power
signal gnd ~ power.gnd
power.vcc ~ pin 8 # Vcc
gnd ~ pin 5 # GND

signal ro ~ pin 1 # RO; receiver output
signal re ~ pin 2 # RE (active LOW); receiver output enable
signal de ~ pin 3 # DE (active HIGH); driver output enable
signal di ~ pin 4 # DI; driver input
signal a ~ pin 6 # A; non-inverting driver output / receiver input
signal b ~ pin 7 # B: inverting driver output / receiver input
44 changes: 44 additions & 0 deletions src/osr_elec/elec/src/lib/spi-uart-converter.ato
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""NXP SPI to UART protocol converters."""


from "generics/interfaces.ato" import Power, SPI, UART

from "lib/capacitors.ato" import PowerDecouplingCap100nf
from "lib/leds.ato" import LEDIndicatorUser
from "lib/nxp/SC16IS752.ato" import SC16IS752
from "lib/oscillators.ato" import ABM8_14MHz7456Oscillator


module SpiToUart:
"""SPI to UART converter."""
power = new Power
spi = new SPI
uart_a = new UART
uart_b = new UART

converter = new SC16IS752
converter.spi ~ spi
converter.power ~ power
converter.interface_select ~ power.gnd

# power decoupling capacitor
power_cap = new PowerDecouplingCap100nf
power_cap.power ~ power

# configure interface as SPI
converter.interface_select ~ power.gnd

# oscillator
converter_osc = new ABM8_14MHz7456Oscillator
converter.xin ~ converter_osc.xin.io
converter.xout ~ converter_osc.xout.io

# UARTs
uart_a ~ converter.uart_a
uart_b ~ converter.uart_b

# user LED indicator
user_led_indicator = new LEDIndicatorUser
user_led_indicator.v_in = 3.1V to 3.3V
user_led_indicator.input ~ converter.gpio0.io
user_led_indicator.gnd ~ power.gnd
7 changes: 4 additions & 3 deletions src/osr_elec/elec/src/rpi-hat.ato
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ from "generics/interfaces.ato" import I2C, Power
from "rpi-header/elec/src/rpi.ato" import ConnectorRaspberryPi
from "xt-connectors/xt-connectors.ato" import XT30_Male_Right_Angle

from "lib/can-controller-trx.ato" import CanControllerTrx
from "lib/connectors.ato" import Rs485Connector
from "lib/headers.ato" import PinHeaderUartTHT
from "lib/leds.ato" import LEDIndicatorPowerRail
from "lib/maxlinear/serial-transceivers.ato" import Rs485Transceiver
from "lib/microchip/can-controller-trx.ato" import CanControllerTrx
from "lib/nxp/SC16IS752.ato" import SpiToUart
from "lib/rpi-hat/id-eeprom.ato" import RpiHatIdEeprom
from "lib/rpi-hat/ideal-diode.ato" import IdealDiode
from "lib/rpi-hat/robot-signal-light.ato" import RobotSignalLight
from "lib/serial-transceivers.ato" import Rs485Transceiver
from "lib/spi-uart-converter.ato" import SpiToUart
from "lib/test-points.ato" import RcwcteTestPoint


module RpiHat:
"""
Raspberry Pi HAT
Expand Down

0 comments on commit 1a94ebe

Please sign in to comment.