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

Forward button presses to FPGA in FPGA download mode #43

Closed
renzenicolai opened this issue May 24, 2022 · 2 comments
Closed

Forward button presses to FPGA in FPGA download mode #43

renzenicolai opened this issue May 24, 2022 · 2 comments
Assignees

Comments

@renzenicolai
Copy link
Member

When the FPGA bitstream has been downloaded and the ESP32 is waiting for a new start command from the PC to load a new bitstream the ESP32 should forward button presses to the FPGA as simple SPI transfers.

The button presses are sent to a queue (that can be added to the FPGA downloader function as an argument from main, have a look at the other functions of the firmware that use buttons) and the ice40 driver has a function to send data to the ICE40 via SPI: esp_err_t ice40_send(ICE40* device, const uint8_t* data, uint32_t length);

The FPGA people specified the following:

Packet would be f4 xx xx yy yy with the xx xx being current state and yy yy the change mask.
(the F4 byte at the start is a command byte / constant)

FransFaase added a commit that referenced this issue May 26, 2022
This no longer has the delay as with the previous commit.
Bits are mapped to the following keys:
 0 - joystick down
 1 - joystick up
 2 - joystick left
 3 - joystick right
 4 - joystick press
 5 - home
 6 - menu
 7 - select
 8 - start
 9 - accept
10 - back
@FransFaase
Copy link
Contributor

The above commits seem to implement the required function. I tested this with Buttons.bin.

Bits are mapped to the following keys:
0 - joystick down
1 - joystick up
2 - joystick left
3 - joystick right
4 - joystick press
5 - home
6 - menu
7 - select
8 - start
9 - accept
10 - back

FransFaase added a commit that referenced this issue May 26, 2022
Did some code clean-up. Also updated fpga.py. Will now show
messages send through serial USB. Might aid debugging.
@FransFaase
Copy link
Contributor

Did some code clean-up. Button processing has now be moved to fpga_process_events. I decided on this generic name, because maybe also other events will be send to the FPGA in the future using this function.

The commit also includes a version of the fpga.py which keeps the port open and echos messages from USB serial port about the progress of the download or possible error messages. This could aid debugging.

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

No branches or pull requests

2 participants