2 releases
0.1.2 | Jan 5, 2025 |
---|---|
0.1.1 | Jan 5, 2025 |
#179 in Hardware support
239 downloads per month
56KB
958 lines
embedded-lora-rfm95
A no-std
-compatible, opinionated driver for the RFM95 LoRa modem. It only supports the LoRa mode, and has only been
tested with the EU 868 MHz ISM bands for now.
Features
The crate supports the following optional cargo
features:
fugit
(disabled by default)
The fugit
-feature implements simple From
/Into
-conversions between the built-in frequency type and
fugit
's HertzU32
type.
This is a comfort-feature only, and does not enable additional functionality.
debug
(disabled by default)
The debug
feature enables some debug functionality, namely an SPI debug callback which can be used to log all SPI
transactions with the RFM95 modem, and provides some helper functions to dump the register state and FIFO contents. The
debug
feature also disables the modem silicon revision check.
To use this feature, you MUST implement this extern callback function in your crate (otherwise you'll get a cryptic linker error):
extern "Rust" {
/// A debug callback that is called for every SPI transaction
///
/// # About
/// This function is called for every SPI transaction, where `operation` is the operation type (`0x00` for read,
/// `0x80` for replace), `address` is the register address, and `input` and `output` are the values written and read
/// respectively.
fn embeddedrfm95_spidebug_AwiUzTRu(operation: u8, address: u8, input: u8, output: u8);
}
Example implementation:
/// The debug callback implementation for `embedded-rfm95`
#[no_mangle]
pub extern "Rust" fn embeddedrfm95_spidebug_AwiUzTRu(operation: u8, address: u8, input: u8, output: u8) {
// Print the transaction to stdout
println!("[SPI 0x{operation:02X} @[0x{address:02X}] tx:0x{input:02X} rx:0x{output:02X}");
}
Dependencies
~95KB