//============================================================= // Synchronous READ (internal) //------------------------------------------------------------- uint _MPURead( byte Register, byte* Buffer, uint BufLen ) { if (!_MPU_Init) return MPU_NOTINIT; // Not initialized... //----------------------- if (_MPU_Async) return MPU_ABSY; // Asynchronous operation in progress... //********************************************************* uint RC = MPU_OK; uint Count = 0; //--------------------------------------------------------- RetryNACK: RC = I2CSyncRead(_MPU_Addr, Register, Buffer, BufLen); switch (RC) { case I2CRC_OK: return MPU_OK; case I2CRC_NACK: Count++; if (Count < I2C_NACKRetry) goto RetryNACK; default: return RC; } }
//============================================================= // Synchronous READ (internal) //------------------------------------------------------------- // <editor-fold defaultstate="collapsed" desc="_MPLRead(...)"> uint _MPLRead( byte Register, byte* Buffer, uint BufLen ) { if (!_MPL_Init) return MPL_NOTINIT; // Not initialized... //----------------------- if (_MPL_Async) return MPL_ABSY; // Asynchronous operation in progress... //********************************************************* return I2CSyncRead (_MPL_Addr, Register, Buffer, BufLen); }