fw-rust: Make Si5351 useable
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
In order to make the Si5351 configurable add some needed assets, create the ability to print the frequency with selected digits and add a channel screen.
This commit is contained in:
parent
7f14974146
commit
c36581e703
5 changed files with 430 additions and 119 deletions
|
@ -268,6 +268,79 @@ impl Lcd {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn print_freq_digit(&mut self, segment: u8, page: u8, data: u32, digit: u8) {
|
||||
let mut delay = Delay::<MHz8>::new();
|
||||
|
||||
let mut array = [0usize; 9];
|
||||
for (i, item) in array.iter_mut().enumerate() {
|
||||
*item = (((data / 10_u32.pow(i.try_into().unwrap())) % 10) + 2)
|
||||
.try_into()
|
||||
.unwrap();
|
||||
}
|
||||
array.reverse();
|
||||
let digit = 8 - digit;
|
||||
|
||||
for i in 0..2 {
|
||||
self.move_cursor(segment, page + i);
|
||||
|
||||
// TODO: This delay fixes issues, try find a better solution
|
||||
delay.delay_ms(1_u8);
|
||||
self.cd.set_high();
|
||||
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
for j in 0..3 {
|
||||
if j == digit {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(!*segment)).unwrap();
|
||||
}
|
||||
} else {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(*segment)).unwrap();
|
||||
}
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
}
|
||||
for segment in SYMBOL_TABLE[0][i as usize] {
|
||||
block!(self.spi.send(*segment)).unwrap();
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
for j in 3..6 {
|
||||
if j == digit {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(!*segment)).unwrap();
|
||||
}
|
||||
} else {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(*segment)).unwrap();
|
||||
}
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
}
|
||||
for segment in SYMBOL_TABLE[0][i as usize] {
|
||||
block!(self.spi.send(*segment)).unwrap();
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
for j in 6..9 {
|
||||
if j == digit {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(!*segment)).unwrap();
|
||||
}
|
||||
} else {
|
||||
for segment in SYMBOL_TABLE[array[j as usize]][i as usize] {
|
||||
block!(self.spi.send(*segment)).unwrap();
|
||||
}
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
}
|
||||
block!(self.spi.send(0x00)).unwrap();
|
||||
|
||||
// TODO: This delay fixes issues, try find a better solution
|
||||
delay.delay_ms(1_u8);
|
||||
self.cd.set_low();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print_icon(&mut self, segment: u8, page: u8, symbol: &[u8]) {
|
||||
let mut delay = Delay::<MHz8>::new();
|
||||
self.move_cursor(segment, page);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue