@@ -7,8 +7,8 @@ This library provides a set of reusable components for the Arduino Uno.
7
7
### Register and bit definitions
8
8
9
9
``` 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
12
12
```
13
13
14
14
### Prelude
@@ -26,11 +26,10 @@ without_interrupts(|| {
26
26
Configure a timer.
27
27
28
28
``` rust
29
- const CPU_FREQUENCY_HZ : u64 = 16_000_000 ;
30
29
const DESIRED_HZ_TIM1 : f64 = 2.0 ;
31
30
const TIM1_PRESCALER : u64 = 1024 ;
32
31
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 ;
34
33
35
34
timer1 :: Timer :: new ()
36
35
. waveform_generation_mode (timer1 :: WaveformGenerationMode :: ClearOnTimerMatchOutputCompare )
@@ -54,9 +53,8 @@ pub unsafe extern "avr-interrupt" fn _ivr_timer1_compare_a() {
54
53
Configure the serial port.
55
54
56
55
``` rust
57
- const CPU_FREQUENCY_HZ : u64 = 16_000_000 ;
58
56
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 ;
60
58
61
59
serial :: Serial :: new (UBRR )
62
60
. character_size (serial :: CharacterSize :: EightBits )
@@ -82,3 +80,4 @@ if let Some(b) = serial::try_receive() {
82
80
serial :: transmit (b );
83
81
}
84
82
```
83
+
0 commit comments