@@ -39,7 +39,7 @@ macro_rules! rf233_component_static {
39
39
capsules_core:: virtualizers:: virtual_spi:: VirtualSpiMasterDevice <' static , $S>,
40
40
>
41
41
) ;
42
- // The RF233 radio stack requires our buffers for its SPI operations:
42
+ // The RF233 radio stack requires four buffers for its SPI operations:
43
43
//
44
44
// 1. buf: a packet-sized buffer for SPI operations, which is
45
45
// used as the read buffer when it writes a packet passed to it and the write
@@ -48,8 +48,10 @@ macro_rules! rf233_component_static {
48
48
// 3 + 4: two small buffers for performing registers
49
49
// operations (one read, one write).
50
50
let rf233_buf = kernel:: static_buf!( [ u8 ; kernel:: hil:: radio:: MAX_BUF_SIZE ] ) ;
51
- let rf233_reg_write = kernel:: static_buf!( [ u8 ; 2 ] ) ;
52
- let rf233_reg_read = kernel:: static_buf!( [ u8 ; 2 ] ) ;
51
+ let rf233_reg_write =
52
+ kernel:: static_buf!( [ u8 ; capsules_extra:: rf233:: SPI_REGISTER_TRANSACTION_LENGTH ] ) ;
53
+ let rf233_reg_read =
54
+ kernel:: static_buf!( [ u8 ; capsules_extra:: rf233:: SPI_REGISTER_TRANSACTION_LENGTH ] ) ;
53
55
54
56
( spi_device, rf233_buf, rf233_reg_write, rf233_reg_read)
55
57
} ; } ;
@@ -88,15 +90,17 @@ impl<S: SpiMaster<'static> + 'static> Component for RF233Component<S> {
88
90
type StaticInput = (
89
91
& ' static mut MaybeUninit < RF233 < ' static , VirtualSpiMasterDevice < ' static , S > > > ,
90
92
& ' static mut MaybeUninit < [ u8 ; hil:: radio:: MAX_BUF_SIZE ] > ,
91
- & ' static mut MaybeUninit < [ u8 ; 2 ] > ,
92
- & ' static mut MaybeUninit < [ u8 ; 2 ] > ,
93
+ & ' static mut MaybeUninit < [ u8 ; capsules_extra :: rf233 :: SPI_REGISTER_TRANSACTION_LENGTH ] > ,
94
+ & ' static mut MaybeUninit < [ u8 ; capsules_extra :: rf233 :: SPI_REGISTER_TRANSACTION_LENGTH ] > ,
93
95
) ;
94
96
type Output = & ' static RF233 < ' static , VirtualSpiMasterDevice < ' static , S > > ;
95
97
96
98
fn finalize ( self , s : Self :: StaticInput ) -> Self :: Output {
97
99
let rf233_buf = s. 1 . write ( [ 0 ; hil:: radio:: MAX_BUF_SIZE ] ) ;
98
- let rf233_reg_write = s. 2 . write ( [ 0 ; 2 ] ) ;
99
- let rf233_reg_read = s. 3 . write ( [ 0 ; 2 ] ) ;
100
+ let rf233_reg_write =
101
+ s. 2 . write ( [ 0 ; capsules_extra:: rf233:: SPI_REGISTER_TRANSACTION_LENGTH ] ) ;
102
+ let rf233_reg_read =
103
+ s. 3 . write ( [ 0 ; capsules_extra:: rf233:: SPI_REGISTER_TRANSACTION_LENGTH ] ) ;
100
104
let rf233 = s. 0 . write ( RF233 :: new (
101
105
self . spi ,
102
106
rf233_buf,
0 commit comments