Skip to content

Commit e6ebb19

Browse files
committed
Update the examples in the README to newer APIs
1 parent 9dcdab8 commit e6ebb19

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ This library provides a set of reusable components for the Arduino Uno.
77
### Register and bit definitions
88

99
```rust
10-
use ruduino::PORTB; // Register
11-
use ruduino::PORTB7; // Pin
10+
use ruduino::cores::current::PORTB; // Register
11+
use ruduino::cores::current::PORTB7; // Pin
1212
```
1313

1414
### Prelude
@@ -26,11 +26,10 @@ without_interrupts(|| {
2626
Configure a timer.
2727

2828
```rust
29-
const CPU_FREQUENCY_HZ: u64 = 16_000_000;
3029
const DESIRED_HZ_TIM1: f64 = 2.0;
3130
const TIM1_PRESCALER: u64 = 1024;
3231
const INTERRUPT_EVERY_1_HZ_1024_PRESCALER: u16 =
33-
((CPU_FREQUENCY_HZ as f64 / (DESIRED_HZ_TIM1 * TIM1_PRESCALER as f64)) as u64 - 1) as u16;
32+
((ruduino::config::CPU_FREQUENCY_HZ as f64 / (DESIRED_HZ_TIM1 * TIM1_PRESCALER as f64)) as u64 - 1) as u16;
3433

3534
timer1::Timer::new()
3635
.waveform_generation_mode(timer1::WaveformGenerationMode::ClearOnTimerMatchOutputCompare)
@@ -54,9 +53,8 @@ pub unsafe extern "avr-interrupt" fn _ivr_timer1_compare_a() {
5453
Configure the serial port.
5554

5655
```rust
57-
const CPU_FREQUENCY_HZ: u64 = 16_000_000;
5856
const BAUD: u64 = 9600;
59-
const UBRR: u16 = (CPU_FREQUENCY_HZ / 16 / BAUD - 1) as u16;
57+
const UBRR: u16 = (ruduino::config::CPU_FREQUENCY_HZ / 16 / BAUD - 1) as u16;
6058

6159
serial::Serial::new(UBRR)
6260
.character_size(serial::CharacterSize::EightBits)
@@ -82,3 +80,4 @@ if let Some(b) = serial::try_receive() {
8280
serial::transmit(b);
8381
}
8482
```
83+

0 commit comments

Comments
 (0)