Untitled
unknown
plain_text
5 months ago
498 B
2
Indexable
typedef struct { uint16_t C1; uint16_t C2; uint16_t C3; uint16_t C4; uint16_t C5; uint16_t C6; }coefficients; void MS5837_ReadCoeffisients(MS5837 *ms5837, coefficients *coeff){ uint8_t cmd = MS5837_PROM_READ; uint8_t coeff_buff[2]; memset(coeff_buff, 0, 2); if (coeff->C1 == 0){ HAL_I2C_Master_Transmit(ms5837->msi2c, ms5837->address, &cmd, 1, 5); HAL_I2C_Master_Receive(ms5837->msi2c, ms5837->address, coeff_buff, 2, 10); coeff->C1 = (coeff_buff[0] << 8) | coeff_buff[1]; } }
Editor is loading...
Leave a Comment