<JamesMunns[m]>
It's not an official wg list, but you can also ping the owner if you'd like to be added so folks can find you
cinemaSundays has joined #rust-embedded
AdamHorden has quit [Ping timeout: 252 seconds]
AdamHorden has joined #rust-embedded
berkus[m] has quit [Quit: Idle timeout reached: 172800s]
sarath08071994[m has quit [Quit: Idle timeout reached: 172800s]
davidmpye[m] has quit [Quit: Idle timeout reached: 172800s]
alex[m]1 has quit [Quit: Idle timeout reached: 172800s]
diondokter[m] has quit [Quit: Idle timeout reached: 172800s]
thejpster[m] has quit [Quit: Idle timeout reached: 172800s]
AdamHorden has quit [Quit: Adam Horden | adam.horden.me]
cinemaSundays has quit [Quit: Connection closed for inactivity]
RockBoynton[m] has quit [Quit: Idle timeout reached: 172800s]
chrenderle[m] has joined #rust-embedded
<chrenderle[m]>
diondokter: I have a question regarding device-driver. I'm writing a driver for ST25DV. This device distinguishes between user memory and system memory. They are addressed over different I2c addresses. And both memory regions start at address 0 (not I2C address). So there are 2 registers which have the address 0 and are distinguished with the I2C address. What is the best way to handle this with your crate? My best guess would
<chrenderle[m]>
be to create two devices with seperate registers.
diondokter[m] has joined #rust-embedded
<diondokter[m]>
chrenderle[m]: Yeah I'm thinking the same thing. Only thing that would be annoying is that you'd need some I2C sharing...
<diondokter[m]>
Or make two blocks maybe?
<diondokter[m]>
One block can use the normal addresses and the other block has an adress offset of say 100. Then in your interface you can detect which register set it is, subtract the 100 and use the other I2C address
<diondokter[m]>
diondokter[m]: I think I like this one
<chrenderle[m]>
diondokter[m]: Yeah that was also an idea
<chrenderle[m]>
Another idea I had would be to enable touples as addresses. So I could use (u8, u16). Then i could distinguish in the u8 for which memory region I want
<chrenderle[m]>
But as far as I understand this is currently not possible in 1.0.0-rc.0
<diondokter[m]>
chrenderle[m]: Ah interesting. But also that'd be very impractical in the backend sadly
<diondokter[m]>
chrenderle[m]: No indeed, it isn't
<diondokter[m]>
But if you choose the first exponent of 2 larger than the highest address, you just get a bit that is on or off
<diondokter[m]>
Very cheap
<diondokter[m]>
And if you put it as an address offset on the block, then your register definitions don't have to be affected by it
<chrenderle[m]>
diondokter[m]: Ah yes. That's a nice solution which doesn't require much implicit knowledge in the code. Thank you. Awesome crate you created there
Makarov has joined #rust-embedded
<diondokter[m]>
chrenderle[m]: Thanks! If you've got a version out, feel free to let me know. I'll add it to the book so people can get inspiration sources. Especially an example like this would be nice 🙂
ivmarkov[m] has quit [Quit: Idle timeout reached: 172800s]
danielb[m] has quit [Quit: Idle timeout reached: 172800s]