diff --git a/src/vendor/command/hal.rs b/src/vendor/command/hal.rs index 1b55eec..5cb5186 100644 --- a/src/vendor/command/hal.rs +++ b/src/vendor/command/hal.rs @@ -164,7 +164,8 @@ pub trait HalCommands { /// This command returns the value of the RSSI. async fn read_rssi(&mut self); - // TODO: read_radio_reg + /// This command reads a register value from the RF module + async fn read_radio_reg(&mut self, address: u8); // TODO: read_raw_rssi @@ -268,6 +269,11 @@ impl HalCommands for T { self.controller_write(crate::vendor::opcode::HAL_READ_RSSI, &[]) .await; } + + async fn read_radio_reg(&mut self, address: u8) { + self.controller_write(crate::vendor::opcode::HAL_READ_RADIO_REG, &[address]) + .await; + } } /// Potential errors from parameter validation. diff --git a/src/vendor/event/command.rs b/src/vendor/event/command.rs index 271ccc0..9b71be2 100644 --- a/src/vendor/event/command.rs +++ b/src/vendor/event/command.rs @@ -64,6 +64,10 @@ pub enum VendorReturnParameters { /// command. HalReadRssi(u8), + /// Parameters returned by the [HAL Read Radio Register](crate::vendor::command::hal::HalCommands::read_radio_reg) + /// command. + HalReadRadioReg(u8), + /// Status returned by the /// [GAP Set Non-Discoverable](crate::vendor::command::gap::GapCommands::gap_set_nondiscoverable) /// command. @@ -297,6 +301,12 @@ impl VendorReturnParameters { require_len!(&bytes[3..], 1); bytes[3] })), + crate::vendor::opcode::HAL_READ_RADIO_REG => { + Ok(VendorReturnParameters::HalReadRadioReg({ + require_len!(&bytes[3..], 1); + bytes[3] + })) + } crate::vendor::opcode::GAP_SET_NONDISCOVERABLE => Ok( VendorReturnParameters::GapSetNonDiscoverable(to_status(&bytes[3..])?), ), diff --git a/src/vendor/opcode.rs b/src/vendor/opcode.rs index 72b4e33..5eeb44a 100644 --- a/src/vendor/opcode.rs +++ b/src/vendor/opcode.rs @@ -41,6 +41,7 @@ vendor_opcodes! { pub const HAL_GET_PM_DEBUG_INFO = 0x1C; pub const HAL_SET_PERIPHERAL_LATENCY = 0x20; pub const HAL_READ_RSSI = 0x22; + pub const HAL_READ_RADIO_REG = 0x30; } Gap = 0x1; {