mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
services/com: Implement From instead of Into
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
This commit is contained in:
parent
01bc25c55d
commit
d651ce51cc
1 changed files with 5 additions and 5 deletions
|
|
@ -36,12 +36,12 @@ impl From<[usize; 2]> for BattStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<[usize; 2]> for BattStats {
|
impl From<BattStats> for [usize; 2]{
|
||||||
fn into(self) -> [usize; 2] {
|
fn from(stats: BattStats) -> [usize; 2] {
|
||||||
[
|
[
|
||||||
(self.voltage as usize & 0xffff) | ((self.soc as usize) << 16) & 0xFF_0000,
|
(stats.voltage as usize & 0xffff) | ((stats.soc as usize) << 16) & 0xFF_0000,
|
||||||
(self.remaining_capacity as usize & 0xffff)
|
(stats.remaining_capacity as usize & 0xffff)
|
||||||
| ((self.current as usize) << 16) & 0xffff_0000,
|
| ((stats.current as usize) << 16) & 0xffff_0000,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue