fw-rust: Prepare to implement Si5351 commands
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Show settings of Si5351 channels on home screen. Initialize I2c and
Si5351.
This commit is contained in:
finga 2022-04-01 01:12:51 +02:00
parent 134db298f6
commit 52bf0e6eec
8 changed files with 188 additions and 13 deletions

View file

@ -28,6 +28,9 @@ mod screen;
use rotary::{Direction, Rotary};
use screen::{Screen, Screens};
pub type DefaultClock = MHz8;
pub type I2c = atmega_hal::i2c::I2c<DefaultClock>;
#[used]
#[link_section = ".eeprom"]
static BACKLIGHT: u8 = 0;
@ -54,7 +57,6 @@ struct ClockGenerator {
impl ClockGenerator {
fn new() -> Self {
// Get peripherals, pins and eeprom
let dp = Peripherals::take().unwrap();
let pins = pins!(dp);
@ -82,6 +84,12 @@ impl ClockGenerator {
pins.pd5.into_output(),
pins.pb0.into_output(),
pins.pb1.into_output(),
I2c::new(
dp.TWI,
pins.pc4.into_pull_up_input(),
pins.pc5.into_pull_up_input(),
50000,
),
),
tc1: dp.TC1,
exint: dp.EXINT,