-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #828 from brentru/add-generic-board
Add "generic os-agnostic" board and remove "fake_mcp2221" board
- Loading branch information
Showing
19 changed files
with
583 additions
and
207 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,38 @@ | ||
# SPDX-FileCopyrightText: 2024 Brent Rubell for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: MIT | ||
"""Pin definitions for a generic, os-agnostic, board.""" | ||
from adafruit_blinka.microcontroller.generic_agnostic_board import pin | ||
|
||
# Digital pins | ||
Dx_INPUT_TRUE = pin.D0 | ||
Dx_INPUT_FALSE = pin.D1 | ||
Dx_INPUT_TRUE_PULL_UP = pin.D2 | ||
Dx_INPUT_TRUE_PULL_DOWN = pin.D3 | ||
Dx_OUTPUT = pin.D4 | ||
Dx_INPUT_TOGGLE = pin.D7 | ||
# Special "digital" pins | ||
NEOPIXEL = pin.D6 | ||
|
||
|
||
# Analog pins | ||
Ax_INPUT_RAND_INT = pin.A0 | ||
Ax_INPUT_FIXED_INT_PI = pin.A1 | ||
Ax_INPUT_WAVE_SINE = pin.A2 | ||
Ax_INPUT_WAVE_SAW = pin.A3 | ||
Ax_OUTPUT = pin.A4 | ||
|
||
# I2C pins | ||
SDA = pin.SDA | ||
SCL = pin.SCL | ||
|
||
# SPI pins | ||
SCLK = pin.SCLK | ||
SCK = pin.SCK | ||
MOSI = pin.MOSI | ||
MISO = pin.MISO | ||
CS = pin.D6 | ||
|
||
# UART pins | ||
UART_TX = pin.UART_TX | ||
UART_RX = pin.UART_RX |
20 changes: 0 additions & 20 deletions
20
src/adafruit_blinka/microcontroller/fake_mcp2221/fake_mcp2221.py
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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
20 changes: 20 additions & 0 deletions
20
src/adafruit_blinka/microcontroller/generic_agnostic_board/generic_agnostic_board.py
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,20 @@ | ||
# SPDX-FileCopyrightText: 2024 Brent Rubell for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: MIT | ||
"""Chip Definition for a generic, os-agnostic, board.""" | ||
|
||
|
||
class GENERIC_AGNOSTIC_BOARD: | ||
"""Generic Agnostic Board Device Class Definition""" | ||
|
||
def __init__(self): | ||
pass # This implementation is for a generic board, no initialization is required | ||
|
||
def __del__(self): | ||
# try to close the device before destroying the instance | ||
return | ||
|
||
# pylint: enable=unused-argument | ||
|
||
|
||
generic_agnostic_board = GENERIC_AGNOSTIC_BOARD() |
26 changes: 26 additions & 0 deletions
26
src/adafruit_blinka/microcontroller/generic_agnostic_board/i2c.py
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,26 @@ | ||
# SPDX-FileCopyrightText: 2024 Brent Rubell for Adafruit Industries | ||
# | ||
# SPDX-License-Identifier: MIT | ||
"""I2C Class for Generic Agnostic Board""" | ||
from random import randint | ||
|
||
# from .generic_agnostic_board.pin import generic_agnostic_board | ||
|
||
|
||
class I2C: | ||
"""Custom I2C Class for a Generic Agnostic Board""" | ||
|
||
def __init__(self, *, frequency=100000): | ||
# self._generic_agnostic_board = generic_agnostic_board | ||
self.freq = frequency | ||
|
||
@staticmethod | ||
def scan(): | ||
"""Mocks an I2C scan and returns a list of 3 randomly generated | ||
I2C addresses from 0x0 to 0x79. | ||
""" | ||
# Generate a list of 3 randomly generated addresses from 0x0 to 0x79 | ||
address_list = [] | ||
for _ in range(3): | ||
address_list.append(randint(0x0, 0x79)) | ||
return address_list |
Oops, something went wrong.