-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add wireless mixins, clean up mixins across all mcus
- Loading branch information
Showing
14 changed files
with
104 additions
and
1,746 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from electronics_model import * | ||
from .IoController import BaseIoController, IoController | ||
|
||
|
||
class IoControllerI2s(BlockInterfaceMixin[BaseIoController]): | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
|
||
self.i2s = self.Port(Vector(I2sController.empty()), optional=True) | ||
self.implementation(lambda base: base._io_ports.insert(0, self.i2s)) | ||
|
||
|
||
class IoControllerWifi(BlockInterfaceMixin[BaseIoController]): | ||
"""Mixin indicating this IoController has programmable WiFi. Does not expose any ports.""" | ||
|
||
|
||
class IoControllerBluetooth(BlockInterfaceMixin[BaseIoController]): | ||
"""Mixin indicating this IoController has programmable Bluetooth Classic. Does not expose any ports.""" | ||
|
||
|
||
class IoControllerBle(BlockInterfaceMixin[BaseIoController]): | ||
"""Mixin indicating this IoController has programmable Bluetooth LE. Does not expose any ports.""" | ||
|
||
|
||
class IoControllerGroundOut(BlockInterfaceMixin[IoController]): | ||
"""Base class for an IO controller that can act as a power output (e.g. dev boards), | ||
this only provides the ground source pin. Subclasses can define output power pins. | ||
Multiple power pin mixins can be used on the same class, but only one gnd_out can be connected.""" | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
self.gnd_out = self.Port(GroundSource.empty(), optional=True) | ||
|
||
|
||
class IoControllerPowerOut(IoControllerGroundOut): | ||
"""IO controller mixin that provides an output of the IO controller's VddIO rail, commonly 3.3v.""" | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
self.pwr_out = self.Port(VoltageSource.empty(), optional=True) | ||
|
||
|
||
class IoControllerUsbOut(IoControllerGroundOut): | ||
"""IO controller mixin that provides an output of the IO controller's USB Vbus. | ||
For devices without PD support, this should be 5v. For devices with PD support, this is whatever | ||
Vbus can be.""" | ||
def __init__(self, *args, **kwargs) -> None: | ||
super().__init__(*args, **kwargs) | ||
self.vusb_out = self.Port(VoltageSource.empty(), optional=True) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.