Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the electronics-interface modeling to include bus/peripheral frequency (and bitrate/baud) limits across many parts, and introduces I2C bus frequency derivation as the intersection of controller/target limits. It also updates API surfaces with deprecation shims (notably SPI) and removes the untested Mcp47f part.
Changes:
- Add
frequency_limit/bitrate_limit/baud_limitparameters to multiple comms ports and populate limits across many parts. - Compute
I2cLink.frequencyfrom controller/targetfrequency_limitintersections. - Improve deprecation shims (
deprecated_param_remap), adjust SPI/UART/I2C APIs accordingly, and removeMcp47f.
Reviewed changes
Copilot reviewed 56 out of 56 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| edg/util/init.py | Enhances deprecation shim to remap deprecated positional args and kwargs. |
| edg/electronics_interfaces/I2cPort.py | Adds I2C bus frequency modeling and updates controller/target limit parameters. |
| edg/electronics_interfaces/SpiPort.py | Renames SPI controller frequency API to frequency_limit with shims. |
| edg/electronics_interfaces/UartPort.py | Unifies UART modeling around baud_limit. |
| edg/electronics_interfaces/I2sPort.py | Adds bitrate_limit parameter to I2S controller. |
| edg/electronics_interfaces/CanPort.py | Adds bitrate_limit parameter to CAN controller port. |
| edg/electronics_interfaces/test_i2c_link.py | Updates I2C target construction to kwarg-only addresses. |
| edg/parts/sensor/Temp_TexasInstruments.py | Adds I2C target address + frequency limits for TI temp sensors. |
| edg/parts/sensor/Temp_Shtc3.py | Adds I2C frequency limits for SHTC3. |
| edg/parts/sensor/Rtc_Pcf2129.py | Adds SPI peripheral frequency limit for PCF2129. |
| edg/parts/sensor/Mag_Qmc5883.py | Adds I2C address + frequency limits for QMC5883 variants. |
| edg/parts/sensor/LightSensor_Bh1750.py | Adds I2C frequency limit for BH1750. |
| edg/parts/sensor/LightSensor_As7341.py | Adds I2C frequency limit for AS7341. |
| edg/parts/sensor/Imu_Lsm6dsv16x.py | Adds I2C address + frequency limit for LSM6DSV16X. |
| edg/parts/sensor/Imu_Lsm6ds3trc.py | Adds I2C address + frequency limits for LSM6DS3TR-C. |
| edg/parts/sensor/FlirLepton.py | Updates SPI + I2C (CCI) modeling with explicit frequency limits. |
| edg/parts/sensor/EnvironmentalSensor_Bme680.py | Adds I2C frequency limit (voltage-dependent note). |
| edg/parts/sensor/DistanceArray_Vl53l5cx.py | Adds I2C frequency limit for VL53L5CX. |
| edg/parts/sensor/Distance_Vl53l0x.py | Adds I2C frequency limit for VL53L0X. |
| edg/parts/sensor/Camera_Ov2640_Fpc24.py | Adds I2C frequency limit for SCCB/I2C control bus. |
| edg/parts/power/FuelGauge_Max17048.py | Adds I2C frequency limit for MAX17048. |
| edg/parts/power/converter/Mp2722.py | Adds I2C address + frequency limit for MP2722. |
| edg/parts/interface/UsbPd_Fusb302b.py | Adds I2C frequency limit for FUSB302B. |
| edg/parts/interface/UsbInterface_Ft232h.py | Adds SPI/UART/MPSSE frequency/baud limits for FT232H interfaces. |
| edg/parts/interface/Rf_Pn7160.py | Adds I2C frequency limit for PN7160. |
| edg/parts/interface/IoExpander_Pcf8574.py | Adds I2C frequency limit for PCF8574. |
| edg/parts/interface/IoExpander_Pca9554.py | Adds I2C frequency limit for PCA9554. |
| edg/parts/interface/Ethernet_W5500.py | Adds SPI peripheral frequency limit for W5500. |
| edg/parts/logic/SpiMemory_W25q.py | Adds SPI peripheral frequency limit for W25Q memories. |
| edg/parts/logic/SpiMemory_93Lc.py | Adds SPI peripheral frequency limit for 93LC EEPROMs. |
| edg/parts/display/oled/Er_Oled_096_1_1.py | Adds SPI frequency limits and makes I2C address explicit in-port. |
| edg/parts/display/oled/Er_Oled_091_3.py | Adds SPI peripheral frequency limit. |
| edg/parts/display/oled/Er_Oled_028.py | Adds SPI peripheral frequency limit. |
| edg/parts/display/oled/Er_Oled_022.py | Adds SPI frequency limits and makes I2C address explicit in-port. |
| edg/parts/display/lcd/Qt096t_if09.py | Adds SPI frequency limit and updates module docstring. |
| edg/parts/display/lcd/Er_Tft1_28_3.py | Adds SPI + CTP I2C frequency limits and related notes. |
| edg/parts/display/lcd/Ch280qv10_Ct.py | Adds CTP I2C frequency limit and SPI frequency limit notes. |
| edg/parts/display/EInk_Er_Epd027_2.py | Adds SPI peripheral frequency limit. |
| edg/parts/analog/opamp/Ina219.py | Adds I2C frequency limit for INA219. |
| edg/parts/analog/dac/Mcp4728.py | Adds I2C frequency limit for MCP4728. |
| edg/parts/analog/dac/init.py | Removes Mcp47f export. |
| edg/parts/analog/dac/Mcp47f.py | Removes the untested Mcp47f implementation. |
| edg/parts/microcontroller/Stm32l432.py | Adds baud/frequency/bitrate limits to MCU peripheral models; splits LPUART. |
| edg/parts/microcontroller/Stm32g431.py | Adds peripheral frequency/bitrate limits; splits LPUART. |
| edg/parts/microcontroller/Stm32g031.py | Adds UART/SPI/I2C limit modeling. |
| edg/parts/microcontroller/Stm32f303.py | Adds UART/SPI/I2C/CAN limit modeling. |
| edg/parts/microcontroller/Stm32f103.py | Adds per-UART-domain baud limits plus SPI/I2C/CAN limits. |
| edg/parts/microcontroller/Rp2040.py | Adds UART/SPI/I2C limit modeling. |
| edg/parts/microcontroller/nRF52840.py | Adds UART/SPI/I2C/I2S limits and updates SPI peripheral model. |
| edg/parts/microcontroller/Lpc1549.py | Adds UART/SPI/I2C/CAN limit modeling. |
| edg/parts/microcontroller/Ice40up.py | Updates SPI controller to use frequency_limit. |
| edg/parts/microcontroller/Esp32s3.py | Adds UART/SPI/I2C/CAN/I2S limits and updates models to new APIs. |
| edg/parts/microcontroller/Esp32c3.py | Adds UART/SPI/I2C/CAN/I2S limits and updates resource declarations. |
| edg/parts/microcontroller/Esp32.py | Adds UART/SPI/I2C/CAN limits and updates SPI/I2C models to new APIs. |
| edg/parts/microcontroller/Ch32v203.py | Adds SPI/I2C limits. |
| edg/parts/microcontroller/Ch32v003.py | Adds SPI/I2C limits. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for old_param, new_param in sorted_params: | ||
| if isinstance(old_param, int) and old_param < len(args): | ||
| warnings.warn( | ||
| f"Positional argument {old_param} is deprecated and replaced with {new_param}", |
Comment on lines
11
to
12
| Args: | ||
| *params: A list of tuples where each tuple contains the old parameter name and the new parameter name. |
| self.eedata = self.Port(DigitalBidir.empty()) | ||
| self.spi = self.Port(SpiController.empty()) | ||
| # datasheet: 93LC56B or equivalent capable of 1 Mbit/s clock rate | ||
| self.spi = self.Port(SpiController(DigitalBidir.empty(), frequency_limit=(1, 1) * MHertz)) |
|
|
||
| # Control pins | ||
| self.spi = self.Port(SpiPeripheral(dio_model)) | ||
| # SPI up to 100 MHz in write mode |
| self.cs = self.Port(din_model) | ||
|
|
||
| self.spi = self.Port(SpiPeripheral(dio_model)) | ||
| # up to 15 MHz in write mode |
| self.gnd = self.Export(self.device.gnd, [Common]) | ||
| self.pwr = self.Export(self.device.iovcc, [Power]) | ||
| self.spi = self.Port(SpiPeripheral.empty()) | ||
| # SPI capable of 10 MHz in write mode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add frequency limit modelling for these comms busses to all devices, based either off the datasheet peripheral (informal) description or the AC electrical characteristics, whichever one is available or more straightforward.
Adds bus frequency calculation to I2C. A future change will add bus frequency calculation to the other protocols. A future change will add unit tests for protocol frequency calculations.
Improves deprecation shims util.
Makes these breaking API changes with deprecation shims:
addressesin I2cTarget is kwarg-onlyfrequency_limitin SpiPeripheral is kwarg-onlyfrequencyin SpiController tofrequency_limitbaudandbaud_limitin UartPart, with no deprecation since those did not take valuesMakes these changes without deprecation:
Contributor License Agreement
By submitting this pull request, I agree to dual-license this contribution under both BSD 3-clause and Apache License, Version 2.0.