Find workable signal timings

This commit is contained in:
Tangent 128 2019-10-27 01:20:30 -04:00
parent 59ff9aa7fd
commit a29ec85a6c

View file

@ -42,10 +42,17 @@ pub fn boot() -> NeopixelLights<impl OutputPin<Error = ()>, impl OutputPin<Error
// WS2815 lighting times // WS2815 lighting times
// approx. 20ns per clock cycle; // approx. 20ns per clock cycle;
const ZERO_HIGH_CYCLES: u32 = 11; // about 220ns // const ZERO_HIGH_CYCLES: u32 = 11; // about 220ns
const ONE_HIGH_CYCLES: u32 = 29; // about 580ns // const ONE_HIGH_CYCLES: u32 = 29; // about 580ns
const ZERO_LOW_CYCLES: u32 = 29; // about 580ns // const ZERO_LOW_CYCLES: u32 = 29; // about 580ns
const ONE_LOW_CYCLES: u32 = 11; // about 220ns // const ONE_LOW_CYCLES: u32 = 11; // about 220ns
// experimentally, there is some unknown overhead
// but these timings appear to work for me:
const ZERO_HIGH_CYCLES: u32 = 11-8;
const ONE_HIGH_CYCLES: u32 = 29-8;
const ZERO_LOW_CYCLES: u32 = 29-8;
const ONE_LOW_CYCLES: u32 = 11-8;
const LATCH_CYCLES: u32 = 15000; // about 300us const LATCH_CYCLES: u32 = 15000; // about 300us
pub struct NeopixelLights<T: OutputPin, U: OutputPin, V: OutputPin> { pub struct NeopixelLights<T: OutputPin, U: OutputPin, V: OutputPin> {