3 releases (breaking)
new 0.3.0 | Mar 21, 2025 |
---|---|
0.2.0 | Mar 18, 2025 |
0.1.3 | Feb 8, 2025 |
0.1.2 |
|
0.1.1 |
|
#205 in Embedded development
215 downloads per month
64KB
1K
SLoC
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.
backtrace
(disabled by default)
The backtrace
-feature can be used to get more verbose errors. If this feature is enabled, errors will contain a human
readable description as well as file and line information about where the error occurred. This is useful for debugging
or better logging, but can be disabled if library size matters.
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
~185KB