Skip to content

Commit

Permalink
Improve categorizations (again), add XIAO RP2040 (#345)
Browse files Browse the repository at this point in the history
Improve categorization
- Better classification of DiscreteComponents instead of
InternalSubcircuit
- Remove InternalBlock from super-superclasses of some microcontrollers
- anything inheriting InternalBlock (even transitively) is internal

Add XIAO RP2040 and a basic keyboard example that uses the dev board.
  • Loading branch information
ducky64 authored Apr 24, 2024
1 parent 0788698 commit 5066c59
Show file tree
Hide file tree
Showing 15 changed files with 715 additions and 144 deletions.
2 changes: 1 addition & 1 deletion electronics_abstract_parts/AbstractFuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@abstract_block
class Fuse(InternalSubcircuit, Block):
class Fuse(DiscreteComponent, Block):
@init_in_parent
def __init__(self, trip_current: RangeLike, *, hold_current: RangeLike = RangeExpr.ALL,
voltage: RangeLike = RangeExpr.ZERO) -> None:
Expand Down
4 changes: 2 additions & 2 deletions electronics_abstract_parts/AbstractJumper.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from electronics_model import *
from .Categories import InternalSubcircuit, TypedJumper
from .Categories import DiscreteComponent, TypedJumper


@abstract_block
class Jumper(InternalSubcircuit, Block):
class Jumper(DiscreteComponent, Block):
"""A two-ported passive-typed jumper (a disconnect-able connection), though is treated
as always connected for model purposes.
Expand Down
2 changes: 1 addition & 1 deletion electronics_abstract_parts/Categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class InternalSubcircuit(InternalBlock):


@abstract_block
class DiscreteComponent(InternalSubcircuit, Block):
class DiscreteComponent(InternalBlock):
"""Discrete component that typically provides untyped ports (not to be be used directly), as a component to be used in an application circuit."""
pass

Expand Down
2 changes: 1 addition & 1 deletion electronics_abstract_parts/IoController.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


@abstract_block
class BaseIoController(PinMappable, InternalBlock, Block):
class BaseIoController(PinMappable, Block):
"""An abstract IO controller block, that takes power input and provides a grab-bag of common IOs.
A base interface for microcontrollers and microcontroller-like devices (eg, FPGAs).
Pin assignments are handled via refinements and can be assigned to pins' allocated names.
Expand Down
2 changes: 1 addition & 1 deletion electronics_abstract_parts/PassiveConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


@abstract_block
class PassiveConnector(InternalSubcircuit, Block):
class PassiveConnector(DiscreteComponent, Block):
"""A base Block that is an elastic n-ported connector with passive type.
Interface only, no implementation.
Expand Down
4 changes: 2 additions & 2 deletions electronics_lib/Microcontroller_Esp32.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _io_pinmap(self) -> PinMapUtil:


@abstract_block
class Esp32_Base(Esp32_Ios, InternalSubcircuit, GeneratorBlock):
class Esp32_Base(Esp32_Ios, GeneratorBlock):
"""Base class for ESP32 series microcontrollers with WiFi and Bluetooth (classic and LE)
Chip datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
Expand Down Expand Up @@ -179,7 +179,7 @@ def _system_pinmap(self) -> Dict[str, CircuitPort]:
}).remap(self.SYSTEM_PIN_REMAP)


class Esp32_Wroom_32_Device(Esp32_Base, FootprintBlock, JlcPart):
class Esp32_Wroom_32_Device(Esp32_Base, InternalSubcircuit, FootprintBlock, JlcPart):
"""ESP32-WROOM-32 module
Module datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32e_esp32-wroom-32ue_datasheet_en.pdf
Expand Down
6 changes: 3 additions & 3 deletions electronics_lib/Microcontroller_Esp32c3.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _io_pinmap(self) -> PinMapUtil:


@abstract_block
class Esp32c3_Base(Esp32c3_Ios, InternalSubcircuit, BaseIoControllerPinmapGenerator):
class Esp32c3_Base(Esp32c3_Ios, BaseIoControllerPinmapGenerator):
"""Base class for ESP32-C3 series devices, with RISC-V core, 2.4GHz WiF,i, BLE5.
PlatformIO: use board ID esp32-c3-devkitm-1
Expand Down Expand Up @@ -127,7 +127,7 @@ def __init__(self, **kwargs) -> None:
self.uart0 = self.Port(UartPort(dio_model), optional=True)


class Esp32c3_Wroom02_Device(Esp32c3_Base, FootprintBlock, JlcPart):
class Esp32c3_Wroom02_Device(Esp32c3_Base, InternalSubcircuit, FootprintBlock, JlcPart):
"""ESP32C module
Module datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3-wroom-02_datasheet_en.pdf
Expand Down Expand Up @@ -211,7 +211,7 @@ def generate(self) -> None:
gnd=self.gnd, pwr=self.pwr, io=self.ic.en)


class Esp32c3_Device(Esp32c3_Base, FootprintBlock, JlcPart):
class Esp32c3_Device(Esp32c3_Base, InternalSubcircuit, FootprintBlock, JlcPart):
"""ESP32C3 with 4MB integrated flash
TODO: support other part numbers, including without integrated flash
"""
Expand Down
4 changes: 2 additions & 2 deletions electronics_lib/Microcontroller_Esp32s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _io_pinmap(self) -> PinMapUtil:


@abstract_block
class Esp32s3_Base(Esp32s3_Ios, InternalSubcircuit, GeneratorBlock):
class Esp32s3_Base(Esp32s3_Ios, GeneratorBlock):
"""Base class for ESP32-S3 series microcontrollers with WiFi and Bluetooth (classic and LE)
and AI acceleration
Expand Down Expand Up @@ -180,7 +180,7 @@ def __init__(self, **kwargs) -> None:
self.uart0 = self.Port(UartPort(dio_model), optional=True) # programming


class Esp32s3_Wroom_1_Device(Esp32s3_Base, FootprintBlock, JlcPart):
class Esp32s3_Wroom_1_Device(Esp32s3_Base, InternalSubcircuit, FootprintBlock, JlcPart):
SYSTEM_PIN_REMAP: Dict[str, Union[str, List[str]]] = {
'VDD': '2',
'GND': ['1', '40', '41'], # 41 is EP
Expand Down
Loading

0 comments on commit 5066c59

Please sign in to comment.