Compare commits

..

4 Commits

Author SHA1 Message Date
1f734b1036 feat: rename crate dependency 2025-04-25 16:34:44 +04:00
3b6cc73b92 fix(???): crate name 2025-04-25 16:23:14 +04:00
733fc8e22f feat: add sparkfun-promicro feature 2025-04-25 16:19:18 +04:00
04b69b53f0 feat(pin): use set_low/high() method instead write() 2025-04-24 21:57:13 +04:00
2 changed files with 10 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "soft-serial" name = "neopixel-avr"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
@@ -9,10 +9,12 @@ smart-leds = "0.4.0"
[dependencies.arduino-hal] [dependencies.arduino-hal]
git = "https://github.com/rahix/avr-hal" git = "https://github.com/rahix/avr-hal"
rev = "3e362624547462928a219c40f9ea8e3a64f21e5f" rev = "3e362624547462928a219c40f9ea8e3a64f21e5f"
features = ["sparkfun-promicro"]
[dependencies.static_pins] [dependencies.static-pins]
git = "https://gitea.doryan04.ru/TheEmbeddedRust/static_pins" git = "https://gitea.doryan04.ru/TheEmbeddedRust/static-pins"
[features]
sparkfun-promicro = ["arduino-hal/sparkfun-promicro", "static-pins/sparkfun-promicro"]
[dependencies.avr-device] [dependencies.avr-device]
version = "0.5.4" version = "0.5.4"

View File

@@ -28,13 +28,13 @@ where
} }
fn write_color_channel(&self, data: u8) { fn write_color_channel(&self, data: u8) {
let (mut data, port_data) = (data, P::read()); let mut data = data;
unsafe { unsafe {
for _ in 0..8 { for _ in 0..8 {
P::write(port_data | P::PIN_POS); P::set_high();
asm!("rjmp +0"); asm!("rjmp +0");
if data & MSB == 0 { if data & MSB == 0 {
P::write(port_data & !P::PIN_POS); P::set_low();
} }
asm!( asm!(
" "
@@ -42,7 +42,7 @@ where
rjmp +0 rjmp +0
" "
); );
P::write(port_data & !P::PIN_POS); P::set_low();
asm!( asm!(
" "
rjmp +0 rjmp +0
@@ -78,4 +78,3 @@ where
Ok(()) Ok(())
} }
} }