Skip to content

Commit 56372dd

Browse files
committed
use Input/Output traits explicitly to avoid inherent methods
1 parent a76342c commit 56372dd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/lib.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ where C: KeyColumns<CN>, R: KeyRows<RN> {
6868

6969
/// Return a 2-dimensional array of the last polled state of the matrix.
7070
pub fn current_state(&self) -> [[bool; RN]; CN] {
71-
let mut state = [[false; RN]; CN];// default_arr::<bool, CN, RN>();
71+
let mut state = [[false; RN]; CN];
7272
for (i, row) in self.state.iter().enumerate() {
7373
for (j, &elem) in row.iter().enumerate() {
7474
if elem > self.debounce_count {
@@ -126,18 +126,20 @@ impl KeyColumns<$size> for $Type {
126126
}
127127

128128
fn enable_column(&mut self, col: usize) -> Result<(), ()> {
129+
use embedded_hal::digital::v2::OutputPin;
129130
match col {
130131
$(
131-
$index => self.$col_name.set_low().map_err(drop),
132+
$index => OutputPin::set_low(&mut self.$col_name).map_err(drop),
132133
)+
133134
_ => unreachable!()
134135
}
135136
}
136137

137138
fn disable_column(&mut self, col: usize) -> Result<(), ()> {
139+
use embedded_hal::digital::v2::OutputPin;
138140
match col {
139141
$(
140-
$index => self.$col_name.set_high().map_err(drop),
142+
$index => OutputPin::set_high(&mut self.$col_name).map_err(drop),
141143
)+
142144
_ => unreachable!()
143145
}
@@ -184,9 +186,10 @@ impl KeyRows<$size> for $Type {
184186
}
185187

186188
fn read_row(&mut self, row: usize) -> Result<bool, ()> {
189+
use embedded_hal::digital::v2::InputPin;
187190
match row {
188191
$(
189-
$index => self.$row_name.is_low().map_err(drop),
192+
$index => InputPin::is_low(&self.$row_name).map_err(drop),
190193
)+
191194
_ => unreachable!()
192195
}

0 commit comments

Comments
 (0)