modulino 0.3.0

A hardware-agnostic, no_std Rust driver for Arduino Modulino breakout boards
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use embedded_hal_mock::eh1::i2c::{Mock as I2cMock, Transaction as I2cTransaction};
use modulino::{Color, Pixels};

#[test]
fn test_pixels_formatting() {
    let addr = 0x36;
    let mut expected_data: Vec<u8> = Vec::new();
    expected_data.extend_from_slice(&[0xEF, 0x00, 0x00, 0xFF]); // Red
    for _ in 1..8 {
        expected_data.extend_from_slice(&[0xE0, 0x00, 0x00, 0x00]);
    }

    let expectations = [I2cTransaction::write(addr, expected_data)];
    let mut pixels = Pixels::new(I2cMock::new(&expectations)).unwrap();
    pixels.set_color(0, Color::RED, 50).unwrap();
    pixels.show().unwrap();
    pixels.release().done();
}