You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I'm trying to use this crate and encountered problem: delay is TOO short when library is added as dependency. I use this code for blink LED:
#![feature(llvm_asm)]#![no_std]#![no_main]use avrd::current as c;mod delay;// your source code, copied into file inside project #[no_mangle]pubextern"C"fnmain(){unsafe{*c::DDRB = 0xFF;*c::PORTB = 0x00;};loop{unsafe{*c::PORTB = 0xFF;// here is used local copy of `delay_ms`// it works OK, LED is on for about second
delay::delay_ms(1000);*c::PORTB = 0x00;// here is used `delay_ms` from dependency `avr_delay`// it is TOO short, blink (off) is barely visible (few milliseconds maybe);
avr_delay::delay_ms(1000);// h};}}#[panic_handler]fnpanic(_info:&core::panic::PanicInfo) -> ! {loop{}}
Also interesting thing: when I upload program with avrdude, version with avr_delay dependency is much bigger than version with only local copy:
Thank you, bu unfortunately I am unable to test it now. I am gonna close this issue, if somehow I will be able to try it and something doesn't work, I wil open a new issue
Hi! I'm trying to use this crate and encountered problem: delay is TOO short when library is added as dependency. I use this code for blink LED:
Also interesting thing: when I upload program with
avrdude
, version withavr_delay
dependency is much bigger than version with only local copy:I also tested:
avr_dude
on my machine and import withavr_delay = { path = ... }
;avr_config
);but all the same, if I use
avr_delay
from external dependency, it works way too fast.I'm using Arduino Mega 2560 (or maybe it is Chinese clone, I'm not sure). My target:
Let me know if I could provide anything else.
P.S. Local copy only works properly when
opt-level
set to 2 or 3, maybe this is somehow helpful.P.P.S. Code is still super useful, it is very easy and intuitive for beginner like me, thanks!
The text was updated successfully, but these errors were encountered: