[−][src]Crate si5351
A platform agnostic Rust driver for the Si5351, based on the
embedded-hal
traits.
The Device
The Silicon Labs Si5351 is an any-frequency CMOS clock generator.
The device has an I²C interface.
Usage
Import this crate and an embedded_hal
implementation:
extern crate stm32f103xx_hal as hal; extern crate si5351;
Initialize I²C bus (differs between embedded_hal
implementations):
use hal::i2c::I2c; type I2C = ...; let i2c: I2C = initialize_i2c();
Then instantiate the device:
use si5351; use si5351::{Si5351, Si5351Device}; let mut clock = Si5351Device<I2C>::new(i2c, false, 25_000_000); clock.init(si5351::CrystalLoad::_10)?;
Or, if you have an Adafruit module, you can use shortcut functions to initializate it:
use si5351; use si5351::{Si5351, Si5351Device}; let mut clock = Si5351Device<I2C>::new_adafruit_module(i2c); clock.init_adafruit_module()?;
And set frequency on one of the outputs:
use si5351; clock.set_frequency(si5351::PLL::A, si5351::ClockOutput::Clk0, 14_175_000)?;
Structs
DeviceStatusBits | |
Si5351Device | Si5351 driver |
Enums
ClockOutput | |
CrystalLoad | |
Error | |
FeedbackMultisynth | |
Multisynth | |
OutputDivider | |
PLL | |
SimpleMultisynth |
Traits
Si5351 |