File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ rtic-monotonic = { version = "1.0", optional = true }
48
48
systick-monotonic = { version = " 1.0" , optional = true }
49
49
bitflags = " 2.2"
50
50
embedded-storage = " 0.2"
51
+ vcell = " 0.1.3"
51
52
52
53
[dependencies .time ]
53
54
version = " 0.3.14"
Original file line number Diff line number Diff line change 1
1
use core:: marker:: PhantomData ;
2
2
use core:: ops:: { Deref , DerefMut } ;
3
- use core:: ptr;
4
3
5
4
use crate :: dma:: traits:: { DMASet , PeriAddress } ;
6
5
use crate :: dma:: { MemoryToPeripheral , PeripheralToMemory } ;
@@ -739,12 +738,14 @@ impl<SPI: Instance> Inner<SPI> {
739
738
fn read_data_reg < W : FrameSize > ( & mut self ) -> W {
740
739
// NOTE(read_volatile) read only 1 byte (the svd2rust API only allows
741
740
// reading a half-word)
742
- unsafe { ptr :: read_volatile ( & self . spi . dr as * const _ as * const W ) }
741
+ unsafe { ( * ( & self . spi . dr as * const pac :: spi1 :: DR ) . cast :: < vcell :: VolatileCell < W > > ( ) ) . get ( ) }
743
742
}
744
743
745
744
fn write_data_reg < W : FrameSize > ( & mut self , data : W ) {
746
745
// NOTE(write_volatile) see note above
747
- unsafe { ptr:: write_volatile ( & self . spi . dr as * const _ as * mut W , data) }
746
+ unsafe {
747
+ ( * ( & self . spi . dr as * const pac:: spi1:: DR ) . cast :: < vcell:: VolatileCell < W > > ( ) ) . set ( data)
748
+ }
748
749
}
749
750
750
751
#[ inline( always) ]
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ impl IndependentWatchdog {
46
46
fn setup ( & self , timeout_ms : MilliSeconds ) {
47
47
assert ! ( timeout_ms. ticks( ) < ( 1 << 15 ) , "Watchdog timeout to high" ) ;
48
48
let pr = match timeout_ms. ticks ( ) {
49
- t if t == 0 => 0b000 , // <= (MAX_PR + 1) * 4 / LSI_KHZ => 0b000,
49
+ 0 => 0b000 , // <= (MAX_PR + 1) * 4 / LSI_KHZ => 0b000,
50
50
t if t <= ( MAX_PR + 1 ) * 8 / LSI_KHZ => 0b001 ,
51
51
t if t <= ( MAX_PR + 1 ) * 16 / LSI_KHZ => 0b010 ,
52
52
t if t <= ( MAX_PR + 1 ) * 32 / LSI_KHZ => 0b011 ,
You can’t perform that action at this time.
0 commit comments