Skip to content

Conversation

@haydenroche5
Copy link
Collaborator

CTX/RTX requires interacting with 2 GPIO pins, so I added a gpio.py file to
handle abstracting GPIO for 3 platforms: CircuitPython, MicroPython, and
Raspberry Pi (Raspbian). The core of the CTX/RTX code lives in
transaction_manager.py. This file uses the code in gpio.py to implement the
CTX/RTX protocol. This gets used in notecard.py when any Notecard transaction
occurs, so long as the transaction pins have been set. If they haven't been set,
everything behaves as before.

I tested this functionality on all 3 supported platforms by hooking up a
push button to the CTX pin and an LED to the RTX pin. I issued a hub.set request
and the LED lit up. The transaction only went through after I pushed the button,
simulating a CTX pulse from the Notecard.

Additionally, I refactored some other code:

  • platform.py is used to determine the platform we're on. We need to know this
    info throughout the code, so it makes sense to move it into a single file.
  • timeout.py is used for timeouts, which are also used throughout the code.

@haydenroche5 haydenroche5 requested a review from bsatrom June 27, 2023 17:57
chunk_offset:
chunk_offset + chunk_len
], 'utf-8')
write_data = bytes(json[chunk_offset:chunk_offset + chunk_len],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you not get errors from pylint with these formatting changes? I thought I had it set to 90 cols and this looks outside of that range to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I need to remove these changes. I had YAPF turned on while making this PR, and it automatically made some formatting changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sharp. I like this abstraction

CTX/RTX requires interacting with 2 GPIO pins, so I added a gpio.py file to
handle abstracting GPIO for 3 platforms: CircuitPython, MicroPython, and
Raspberry Pi (Raspbian). The core of the CTX/RTX code lives in
transaction_manager.py. This file uses the code in gpio.py to implement the
CTX/RTX protocol. This gets used in notecard.py when any Notecard transaction
occurs, so long as the transaction pins have been set. If they haven't been set,
everything behaves as before.

I tested this functionality on all 3 supported platforms by hooking up a
push button to the CTX pin and an LED to the RTX pin. I issued a hub.set request
and the LED lit up. The transaction only went through after I pushed the button,
simulating a CTX pulse from the Notecard.

Additionally, I refactored some other code:

- platform.py is used to determine the platform we're on. We need to know this
info throughout the code, so it makes sense to move it into a single file.
- timeout.py is used for timeouts, which are also used throughout the code.
@haydenroche5 haydenroche5 merged commit 35fb45e into blues:main Jul 11, 2023
@haydenroche5 haydenroche5 deleted the ctx_rtx branch July 11, 2023 21:12
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.

2 participants