https://github.com/dajamante/asyncrab
Embassy tests
https://github.com/dajamante/asyncrab
Last synced: about 1 month ago
JSON representation
Embassy tests
- Host: GitHub
- URL: https://github.com/dajamante/asyncrab
- Owner: Dajamante
- License: mit
- Created: 2022-06-17T13:54:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-13T13:35:54.000Z (almost 3 years ago)
- Last Synced: 2025-04-08T15:44:51.058Z (2 months ago)
- Language: Rust
- Size: 14 MB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Embassy examples
**TL;DR**: Plug the stuff as per the figures and run:
```console
cargo rb
```
With demo = buttons, gyro, qdec## Demo 1: `buttons`; board buttons and screen
The first example uses the nRF52840-DK and a [TFT LCD Display](https://www.amazon.com/Display-Module-ST7735-128x160-STM32/dp/B07BFV69DZ) (specs: 1.8 inch Color TFT LCD Display Module 128*160 Interface SPI Drive ST7735, can be bought at Amazon but really from anywhere.
You can move Ferris around with the buttons. It will appear on the other side of the screen if you scroll too long :)
### Connections
![]()
![]()
![]()
### Run the demo
`$ cargo rb buttons`
### First video
https://vimeo.com/705697973
## Demo 2: `gyro`; Accelerometer
The second example uses the same screen and board, and adds a [MPU6050 accelerometer](https://www.electrokit.com/en/product/mpu-6050-accelerometer-3-axel-monterad-pa-kort-2/).
It has I2C and we use only the pins `SDA`, `SCK`, `GND` and `VCC`.
Ferris can be moved on the screen by tilting the accelerometer, and stops at the border of the screen.
![]()
![]()
That seems like a lot of cables but the important thing is that the accelerometer and the screen must share `5V` and `GND` pins.
![]()
### Run the demo
`$ cargo rb gyro`
### Async driver
Check the [async driver](https://github.com/kalkyl/mpu6050-async.git) for this program!
### Second video
https://vimeo.com/705697951
## Demo 3: `qdec`; Rotary encoder
The third example uses the same screen and board, with a rotary encoder [EC11](https://www.digikey.se/sv/products/detail/bourns-inc./PEC11R-4220F-S0024/4499660?utm_adgroup=Encoders&utm_source=google&utm_medium=cpc&utm_campaign=Shopping_Product_Sensors%2C%20Transducers&utm_term=&productid=4499660).
It does not have a `VDD` pin because of how the rotary encoder works (it works as switches that shorts to GND, the other pulls to VDD).
In this demo, Ferris does not move but you can dim the screen with the encoder.
![]()
The rotary encoder and the screen must share the `GND` pin.
![]()
### Run the demo
`$ cargo rb qdec`
### Third video
https://vimeo.com/725265205
## Make your own image
If you want to insert your own image, find a `.png` and convert with ImageMagick:
`$ convert .png -type truecolor -define bmp:subtype=RGB565 -depth 16 -strip -resize 86x64 .bmp`
Then replace your image in the code:
```rust
let raw_image: Bmp =
Bmp::from_slice(include_bytes!("../../assets/.bmp")).unwrap();
```