Giter VIP home page Giter VIP logo

apa102-spi-rs's People

Contributors

blakesmith avatar david-sawatzke avatar sajattack avatar therealprof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

apa102-spi-rs's Issues

Can't get working with adafruit itsybitsy nrf52840

I'm trying to use the built-in DotStar led on the Adafruit ItsyBitsy nrf52840. I've confirmed on the pinout that it is an Apa102.

I initialize like so.

let port0 = hal::gpio::p0::Parts::new(cx.device.P0);
let port1 = hal::gpio::p1::Parts::new(cx.device.P1);

// Setup builtin dotstar led
let dotstar_pins = spi::Pins {
    // Pin numbers from <https://blog.adafruit.com/2021/05/26/pin-reference-adafruit-itsybitsy-nrf52840-prettypins/>
    sck: port1.p1_09.into_push_pull_output(Level::High).degrade(),
    mosi: Some(port0.p0_08.into_push_pull_output(Level::High).degrade()),
    miso: None,
};

let dotstar_spi = Spi::new(
    cx.device.SPI0,
    dotstar_pins,
    spi0::frequency::FREQUENCY_A::K125,
    apa102_spi::MODE,
);
// Not inverting end frame b/c adafruit does something similar in their bsp for other boards
// See <https://github.com/atsamd-rs/atsamd/blob/9495af975d6a35ae8bb455fae29ad0356fe20e09/boards/trinket_m0/src/lib.rs#L155>
let dotstar = Apa102::new_with_custom_postamble(dotstar_spi, 4, false);

I've tried varying the frequency and invert_end_frame. I'm running in release mode.

Here's how I try to actually set the led

cx.shared.dotstar.lock(|dotstar| {
    dotstar.write([RGB8::new(0, 0, 64)].into_iter()).unwrap();
});

This results in no visible change.

Inverted clock polarity does not seem to work?

cc @therealprof, not sure whats going on here

I tested version v3 out on real hardware (ItsyBitsy M4). I was not able to get it working with the end frame polarity inverted - it would twitch blue and pink.

I could only get it working if I reset clock polarity back to all ones (0xff), which is no longer the default configuration.

This doesnt match my expectations.

Any chance you can try out the behaviour in v3 @therealprof ? would be interested to know how it behaves for your setup + if we can track down what its doing.

Brightness support

It was a shame to see that this library doesn't support setting the brightness of the LEDs; for my application I would appreciate it but I gather from the comments that this is an intentional omission because it didn't fit in with your application :).

I'd be happy to PR support for this, but I'm not sure how brightness fits in to the smart_leds_trait crate either.
It seems to have an RGBA colour type but I don't know if alpha truly corresponds to brightness...?
What would you accept?

Ultimately I can just run a fork with brightness support shoved in, but it would be nice to not fragment the system too much so that the next person who is happy to see an APA102 crate already exists won't find this feature missing :).

Off-by-one error

Hi,

I have a led strip with 72 apa102, and I have to initialize an array with 73 colors to have the last one light up.
Either there's an off-by-one error somewhere, or the trailing frames are wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.