Skip to content

Commit

Permalink
push work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
2bndy5 committed Jul 9, 2024
1 parent f8863cc commit 573bce7
Show file tree
Hide file tree
Showing 16 changed files with 1,609 additions and 13 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2021"

[dependencies]
embedded-hal = "1.0.0"
52 changes: 52 additions & 0 deletions src/enums.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/// Power Amplifier level. The units dBm (decibel-milliwatts or dB<sub>mW</sub>)
/// represents a logarithmic signal loss.
pub enum PaLevel {
/// | nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0 |
/// | :-------:|:-----------------------------:|:-----------------------------:|
/// | -18 dBm | -6 dBm | -12 dBm |
MIN,
/// | nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0 |
/// | :-------:|:-----------------------------:|:-----------------------------:|
/// | -12 dBm | 0 dBm | -4 dBm |
LOW,
/// | nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0 |
/// | :-------:|:-----------------------------:|:-----------------------------:|
/// | -6 dBm | 3 dBm | 1 dBm |
HIGH,
/// | nRF24L01 | Si24R1 with<br>lnaEnabled = 1 | Si24R1 with<br>lnaEnabled = 0 |
/// | :-------:|:-----------------------------:|:-----------------------------:|
/// | 0 dBm | 7 dBm | 4 dBm |
MAX,
}

/// How fast data moves through the air. Units are in bits per second (bps).
pub enum DataRate {
/// represents 1 Mbps
Mbps1,
/// represents 2 Mbps
Mbps2,
/// represents 250 Kbps
Kbps250,
}

/// The length of a CRC checksum that is used (if any).
///
/// Cyclical Redundancy Checking (CRC) is commonly used to ensure data integrity.
pub enum CrcLength {
/// represents no CRC checksum is used
DISABLED,
/// represents CRC 8 bit checksum is used
BIT8,
/// represents CRC 16 bit checksum is used
BIT16,
}

/// The possible states of a FIFO.
pub enum FifoState {
/// Represent the state of a FIFO when it is full.
Full,
/// Represent the state of a FIFO when it is empty.
Empty,
/// Represent the state of a FIFO when it is not full but not empty either.
Occupied,
}
28 changes: 15 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#![doc(
html_logo_url = "https://raw.githubusercontent.com/nRF24/RF24/master/docs/sphinx/_static/Logo%20large.png"
)]
#![doc(
html_favicon_url = "https://github.com/nRF24/RF24/raw/master/docs/sphinx/_static/new_favicon.ico"
)]

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
mod enums;
pub use enums::{CrcLength, DataRate, FifoState, PaLevel};
pub use radio::{
EsbAutoAck, EsbChannel, EsbCrcLength, EsbDataRate, EsbFifo, EsbPaLevel, EsbPayloadLength,
EsbPipe, EsbPower, EsbRadio, EsbStatus,
};
mod radio;
#[doc(inline)]
pub use radio::{Nrf24Error, RF24};
Loading

0 comments on commit 573bce7

Please sign in to comment.