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

Feature: nice!view support #7

Open
1 of 4 tasks
svmnotn opened this issue Mar 20, 2024 · 12 comments
Open
1 of 4 tasks

Feature: nice!view support #7

svmnotn opened this issue Mar 20, 2024 · 12 comments
Labels
enhancement New feature or request

Comments

@svmnotn
Copy link

svmnotn commented Mar 20, 2024

Type of Feature Request

  • Enhancement to an existing rumcake feature
  • New feature unrelated to existing rumcake features
  • New driver for existing rumcake features
  • Support for a new MCU

Description

Just found this while trying to figure out why my nice!nano wouldn't work with USB/BLE (I did get it to blink the LED and respond to a short to ground on a pin). While looking at the docs I noticed that the only display listed was the SSD1306.

I'm fairly new to building keyboards (just got sucked into it 2 weeks ago), so I haven't dived into all the specs. Feel free to close this issue if the SSD1306 driver is compatible with the nice!view.

I do have a pair of nice!view's that I can test with, but I believe I saw that I can't use the uf2 flashing method with rumcake (I did manage it with my LED example, but not anything more complex). So I'll have to wait to test it until I get some jumper cables (should be arriving in the mail tomorrow EST) :)

Thanks for making this! ❤️

I was also planning to add joystick support to my board. Specifically for this guy, so I might look into adding that here if there's interest (I'll make a new issue once I figure out the details involved).

@svmnotn svmnotn added the enhancement New feature or request label Mar 20, 2024
@Univa
Copy link
Owner

Univa commented Mar 20, 2024

The nice!view uses a LS011B7DH03 display which isn't compatible with the SSD1306 driver. That display does have an existing driver crate here: https://crates.io/crates/sharp-memory-display, but rumcake doesn't implement the DisplayDriver trait for it yet. I dont have a nice!view myself, so I can't really test if it works. Feel free to submit a PR for it. I would take a look at rumcake/drivers/ssd1306.rs, rumcake-macros/drivers/ssd1306.rs, and the setup_display_driver function in rumcake-macros/keyboard.rs to get an idea of what you need to do to add support for it.

... I believe I saw that I can't use the uf2 flashing method with rumcake (I did manage it with my LED example, but not anything more complex).

Do you mind elaborating on what you did to flash via UF2? I did write in the readme for the rumcake-split-template that I couldn't get UF2 working and I haven't yet come back to it, so any information on that would be helpful as well.

@svmnotn
Copy link
Author

svmnotn commented Mar 20, 2024

The nice!view uses a LS011B7DH03 display which isn't compatible with the SSD1306 driver. That display does have an existing driver crate here: https://crates.io/crates/sharp-memory-display, but rumcake doesn't implement the DisplayDriver trait for it yet. I dont have a nice!view myself, so I can't really test if it works. Feel free to submit a PR for it. I would take a look at rumcake/drivers/ssd1306.rs, rumcake-macros/drivers/ssd1306.rs, and the setup_display_driver function in rumcake-macros/keyboard.rs to get an idea of what you need to do to add support for it.

Will do, once I get some jumper cables so I can test it out, I'll be making a PR :D

Do you mind elaborating on what you did to flash via UF2?

Yeah, so first I changed the address in memory.x to 0x27000 due to this example, then noticing the line here that mentioned that the s140 softdevice required version v7.x.x, I tried to fork and update the bootloader that the nice!nano uses, but I messed up and ended up PRing the main repo 😅, but I still got the build output I needed here then used the instructions here to DFU flash the nice!nano v2.

After that I had to run:

rustup component add llvm-tools-preview

and

cargo install cargo-binutils uf2conv

so that I could run the following command

cargo objcopy --bin right -- -O binary right.bin

followed by

uf2conv right.bin --base 0x27000 --family 0xADA52840 --output right.uf2

For context my project has 2 bins (right and left).

The steps are a bit complicated, and as I said, the code just refused to work with anything more complex than the embassy blinky example, but I did get that to uf2 flash. I'm going to try at some point this week to grab the driver code from here to see if it works before switching over to using this crate. Mostly just to prove out if that was the fix or not.

I was also thinking of making a bootloader similar to the one already in the nice!nano in rust, in case I couldn't get the uf2 working. I do see that someone alright kind of started on some of the support for it here, but I would probably need to use the embassy-boot-nrf crate, but I haven't dug too deeply 😅.

@svmnotn
Copy link
Author

svmnotn commented Mar 21, 2024

Let me know if you have any questions about any of the steps :D (still not done cooking but I'll try to respond as soon as I see it)

@svmnotn
Copy link
Author

svmnotn commented Mar 25, 2024

Amazon finally delivered :D, I should be able to actually look into a driver for the nice!view this week

@svmnotn
Copy link
Author

svmnotn commented Apr 3, 2024

Took longer than I wanted to, but I finally have it displaying something! :D

I currently have a bug where not all pixels are filled in. The image above is meant to be fully filled in 😅

@svmnotn
Copy link
Author

svmnotn commented Apr 4, 2024

Quick update, sharp-memory-display has a default feature for the wrong module, so one has to go default-features = false before it can work for the nice!view 😅

@svmnotn
Copy link
Author

svmnotn commented Apr 4, 2024

Got started trying to add the code to support nice!view to rumcake, but... it doesn't build 😅 (got latest from main), I tried cargo check -F nrf52840,usb,display inside the rumcake folder, but I get issues like:

no function or associated item named `get_via_hid_send_channel` found for type parameter `K` in the current scope
   --> src/usb.rs:140:22
    |
132 | pub async fn usb_hid_kb_write_task<K: HIDDevice>(
    |                                    - function or associated item `get_via_hid_send_channel` not found for this type parameter
...
140 |     let channel = K::get_via_hid_send_channel();
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `K`

Might be helpful to add some amount of how to setup to contribute to rumcake in the Readme 😅

@Univa
Copy link
Owner

Univa commented Apr 4, 2024

Got started trying to add the code to support nice!view to rumcake, but... it doesn't build 😅 (got latest from main), I tried cargo check -F nrf52840,usb,display inside the rumcake folder, but I get issues like:

no function or associated item named `get_via_hid_send_channel` found for type parameter `K` in the current scope
   --> src/usb.rs:140:22
    |
132 | pub async fn usb_hid_kb_write_task<K: HIDDevice>(
    |                                    - function or associated item `get_via_hid_send_channel` not found for this type parameter
...
140 |     let channel = K::get_via_hid_send_channel();
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `K`

Might be helpful to add some amount of how to setup to contribute to rumcake in the Readme 😅

Woops, I think I goofed up here, will push a fix.

Edit: the wrong channels were being used for those tasks (should be get_keyboard_report_send_channel for that task), so those should be fixed now.

@svmnotn
Copy link
Author

svmnotn commented Apr 5, 2024

Pretty sure I'm missing something in the command I'm running since I still can't build 😅

error[E0432]: unresolved import `embassy_sync::blocking_mutex::raw::ThreadModeRawMutex`
  --> src/hw/mcu/nrf.rs:22:5
   |
22 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ThreadModeRawMutex` in `blocking_mutex::raw`

error[E0432]: unresolved import `embassy_sync::blocking_mutex::ThreadModeMutex`
  --> src/hw/mcu/nrf.rs:23:5
   |
23 | use embassy_sync::blocking_mutex::ThreadModeMutex;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ThreadModeMutex` in `blocking_mutex`

I updated my fork to the latest, then cd rumcake and ran cargo check -F nrf52840,usb,display. Am I missing a step?

@Univa
Copy link
Owner

Univa commented Apr 5, 2024

Pretty sure I'm missing something in the command I'm running since I still can't build 😅

error[E0432]: unresolved import `embassy_sync::blocking_mutex::raw::ThreadModeRawMutex`
  --> src/hw/mcu/nrf.rs:22:5
   |
22 | use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ThreadModeRawMutex` in `blocking_mutex::raw`

error[E0432]: unresolved import `embassy_sync::blocking_mutex::ThreadModeMutex`
  --> src/hw/mcu/nrf.rs:23:5
   |
23 | use embassy_sync::blocking_mutex::ThreadModeMutex;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `ThreadModeMutex` in `blocking_mutex`

I updated my fork to the latest, then cd rumcake and ran cargo check -F nrf52840,usb,display. Am I missing a step?

You'll need to build the crate with the appropriate target triple. Try adding --target thumbv7em-none-eabihf (for nrf52840).

@svmnotn
Copy link
Author

svmnotn commented Apr 5, 2024

I knew I was forgetting something, got too used to having a .cargo/config.toml specifying that for me 😅

And that gave a different error 😅

error[E0432]: unresolved import `embassy_sync::blocking_mutex::thread_mode`
  --> src/hw/mcu/nrf.rs:23:35
   |
23 | use embassy_sync::blocking_mutex::thread_mode::ThreadModeMutex;
   |                                   ^^^^^^^^^^^ could not find `thread_mode` in `blocking_mutex`

error[E0603]: module `thread_mode` is private
  --> src/hw/mcu/nrf.rs:22:40
   |
22 | use embassy_sync::blocking_mutex::raw::thread_mode::ThreadModeRawMutex;
   |                                        ^^^^^^^^^^^ private module
   |
note: the module `thread_mode` is defined here
  --> /home/victor/.cargo/git/checkouts/embassy-9312dcb0ed774b29/b8be126/embassy-sync/src/blocking_mutex/raw.rs:91:1
   |
91 | mod thread_mode {
   | ^^^^^^^^^^^^^^^

I haven't changed the Cargo.tomol other than to add the sharp-memory-display optional dependency, I've also gone ahead and deleted my local cargo cache to ensure that it isn't a version thing on my end... I'm sorry for all the issues 😅

Quick update, doing a git reset got it building... so I think it's something in the sharp-memory-display that is causing the issue?

Quick update again, added it again and it works? I have no idea what's going on, I think my PC is slightly cursed. Assuming this keeps working when I get back from work, I might actually make some progress today!

@svmnotn
Copy link
Author

svmnotn commented Apr 7, 2024

Update, got it all working where I can build rumcake and add things, also have a working progress bar to ensure that I'm using the display code correctly (had a small diversion into making the joysitck adc work, so other than the capacitance sensing, I get the inputs! :D).

Turns out sharp-memory-display is using an older version of embedded-graphics so I'm working on updating it, will probably just use my fork for the PR until I figure out how to merge it into the official one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants