Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fake Microchip MCP2221 #347

Closed
wants to merge 3 commits into from
Closed

Add Fake Microchip MCP2221 #347

wants to merge 3 commits into from

Conversation

brentru
Copy link
Member

@brentru brentru commented Mar 27, 2024

Adding a fake Microchip MCP2221A board and chip for use with stubbing the blinka API for usage with no hardware attached.

Test result after setting environment variable to BLINKA_FAKE_MCP2221 and running python3 bin/detect.py

Board Detection Test

Check that the Chip and Board IDs match your board and that this it is
correctly detecting whether or not it is a Linux board.

Chip id:  FAKE_MCP2221
Board id:  FAKE_MICROCHIP_MCP2221

Linux Detection
---------------
Is this an embedded Linux system? False

Raspberry Pi Boards
-------------------
Is this a Pi 3B+? False
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? False
Is this a Raspberry Pi Compute Module? False

Other Boards
-------------------
Is this a Siemens Simatic IOT2000 Gateway? False
Is this a 96boards board? False
Is this a BeagleBone board? False
Is this a Giant board? False
Is this a Coral Dev board? False
Is this a MaaXBoard? False
Is this a SiFive board?  False
Is this a PYNQ board? False
Is this a Rock Pi board? False
Is this a NanoPi board? False
Is this a Khadas VIM3 board? False
Is this a Clockwork Pi board? False
Is this a Seeed Board? False
Is this a UDOO board? False
Is this an ASUS Tinker board? False
Is this an STM32MP1 board? False
Is this a MilkV board? False
Is this a generic Linux PC? False
Is this an OS environment variable special case? False

@makermelissa
Copy link
Contributor

Is there a reason you are making it MCP2221 specific instead of a more generic board that we can use to CI test all of the functions?

@makermelissa
Copy link
Contributor

I was thinking more about this and thought it might be better to adding a way to force a board and then remembered, I had added a feature like this a while back and completely forgotten about it. There are a couple of environment variables BLINKA_FORCEBOARD and BLINKA_FORCECHIP that can be set with the constant of the board/chip you are trying to set.

@brentru
Copy link
Member Author

brentru commented Mar 28, 2024

Is there a reason you are making it MCP2221 specific instead of a more generic board that we can use to CI test all of the functions?

I was using the MCP2221 to test WipperSnapper Python. Open to suggestions for using a generic target.

I was thinking more about this and thought it might be better to adding a way to force a board and then remembered, I had added a feature like this a while back and completely forgotten about it. There are a couple of environment variables BLINKA_FORCEBOARD and BLINKA_FORCECHIP that can be set with the constant of the board/chip you are trying to set.

I don't really understand how the FORCEBOARD/FORCECHIP env. variables come into play for the purpose of this PR, could you explain more about them?

@makermelissa
Copy link
Contributor

Sure. Since the MCP2221a is already a board, to force Platform detect to return the correct board IDs, you could use something like those environment variables.
For instance, in the detect script, it you added:

os.environ["BLINKA_FORCEBOARD"] = "MICROCHIP_MCP2221"
os.environ["BLINKA_ FORCECHIP"] = "MCP2221"

Then it should return that it detected those. Likewise, in your Python Wipper script, you could set those before calling Blinka. Now in the Blinka code, you would probably want to check if those variables are set in order to know that it's actually a fake board rather than a real one. This way, you wouldn't need to modify PlatformDetect at all.

@brentru
Copy link
Member Author

brentru commented Mar 28, 2024

Closing this conditionally in favor of the forcechip approach

@brentru brentru closed this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants