Re: Help with Hi Technic Sensor Multiplexer - Status word
I keep track of the current state of the command sequence in the struct, this is not based on the status byte from register 0x21
It just allows me to make sure that specific commands have been issued before other ones. For example, in order for me to be able to read from the sensor, it needs to be in running mode, not busy or halted. Rather than issuing time consuming I2C commands all the time to request this info, I keep track of this info in a struct, one for each possible SMUX.
In the readStatus() function I don't update the struct at all. The only reason I have this function in here is for future enhancements
I have some plans for the SMUX driver to handle additional error conditions.
You could just use the HTSMUXreadAnalogue() and HTSMUXreadPort() calls, without all the other drivers. You should be careful when using asynchronous calls, btw, these functions are not thread safe.
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page