Skip to content

Add missing turbofix to examples #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ cargo build -Z build-std=core --target avr-atmega328p.json --release
## API

```rust
delay_cycles<const CYCLES: u64>()
delay_us<const US: u64>()
delay_ms<const MS: u64>()
delay_sec<const SEC: u64>()
delay_cycles::<const CYCLES: u64>()
delay_us::<const US: u64>()
delay_ms::<const MS: u64>()
delay_sec::<const SEC: u64>()
```

`delay_cycles` accepts 0 to 25_769_803_784 cycles (almost 18 minutes at 24Mhz).

The other functions convert time to cycles by using CPU_FREQUENCY_HZ.

```rust
delay_ms<42>(); // delay by 42ms (exactly 1_008_000 cycles at 24Mhz).
delay_ms::<42>(); // delay by 42ms (exactly 1_008_000 cycles at 24Mhz).
```

## Example
Expand Down Expand Up @@ -72,7 +72,7 @@ pub extern fn main() {
loop {
out = out ^ 0xff;
unsafe { write_volatile(PORTB, out) }
delay_ms<1000000>();
delay_ms::<1000000>();
}
}

Expand Down