Skip to content

Commit

Permalink
fix: Fix missing N const generic on write_reg() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BroderickCarlin committed Oct 31, 2023
1 parent cf7e48d commit 254a96d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ impl<SPI: embedded_hal::spi::SpiDevice> A7105<SPI> {
}

/// Writes a value to a regsiter, determined by the specified register type.
pub fn write_reg<R: WritableRegister>(&mut self, reg: R) -> Result<(), SPI::Error> {
pub fn write_reg<const N: usize, R: WritableRegister<N>>(
&mut self,
reg: R,
) -> Result<(), SPI::Error> {
self.spi.transaction(&mut [
embedded_hal::spi::Operation::Write(&[R::id()]),
embedded_hal::spi::Operation::Write(&reg.into_slice()),
Expand Down Expand Up @@ -108,7 +111,10 @@ impl<SPI: embedded_hal_async::spi::SpiDevice> A7105<SPI> {
}

/// Writes a value to a regsiter, determined by the specified register type.
pub async fn write_reg<R: WritableRegister>(&mut self, reg: R) -> Result<(), SPI::Error> {
pub async fn write_reg<const N: usize, R: WritableRegister>(
&mut self,
reg: R,
) -> Result<(), SPI::Error> {
self.spi
.transaction(&mut [
embedded_hal_async::spi::Operation::Write(&[R::id()]),
Expand Down

0 comments on commit 254a96d

Please sign in to comment.