typo fix
This commit is contained in:
parent
1934c2abc8
commit
05b8818de0
1 changed files with 5 additions and 4 deletions
|
@ -5,7 +5,7 @@
|
|||
// Thus we can adjust SPI to send each *round* of data at 800 kHz, and in each *round*, we can adjust each *bit* to mimic 2 different PWM waveform.
|
||||
// such that the output waveform meet the bit representation of ws2812.
|
||||
//
|
||||
// If you want to save SPI for other purpose, you may want to take a look at `ws2812_tim_dma.rs` file, which make use of TIM and DMA.
|
||||
// If you want to save SPI for other purpose, you may want to take a look at `ws2812_pwm_dma.rs` file, which make use of TIM and DMA.
|
||||
//
|
||||
// Warning:
|
||||
// DO NOT stare at ws2812 directy (especially after each MCU Reset), its (max) brightness could easily make your eyes feel burn.
|
||||
|
@ -20,11 +20,12 @@ use embassy_time::{Duration, Ticker, Timer};
|
|||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// we use 16 bit data frame format of SPI, to let timing as accurate as possible.
|
||||
// thanks to loose tolerance of ws2812 timing, you can also use 8 bit data frame format, thus you need want to adjust the bit representation.
|
||||
// thanks to loose tolerance of ws2812 timing, you can also use 8 bit data frame format, thus you will need to adjust the bit representation.
|
||||
const N0: u16 = 0b1111100000000000u16; // ws2812 Bit 0 high level timing
|
||||
const N1: u16 = 0b1111111111000000u16; // ws2812 Bit 1 high level timing
|
||||
|
||||
// ws2812 only need 24 bits for each LED, but we add one bit more to keep SPI output low
|
||||
// ws2812 only need 24 bits for each LED,
|
||||
// but we add one bit more to keep SPI output low at the end
|
||||
|
||||
static TURN_OFF: [u16; 25] = [
|
||||
N0, N0, N0, N0, N0, N0, N0, N0, // Green
|
||||
|
@ -77,7 +78,7 @@ async fn main(_spawner: embassy_executor::Spawner) {
|
|||
let mut spi_config = spi::Config::default();
|
||||
spi_config.frequency = khz(12_800);
|
||||
|
||||
// Since we only output waveform, then the Rx and Sck it is not considered
|
||||
// Since we only output waveform, then the Rx and Sck and RxDma it is not considered
|
||||
let mut ws2812_spi = spi::Spi::new_txonly_nosck(dp.SPI1, dp.PB5, dp.DMA2_CH3, dma::NoDma, spi_config);
|
||||
|
||||
// flip color at 2 Hz
|
||||
|
|
Loading…
Reference in a new issue