[peripherals] hmc58xx: fix typo in comment and make explict separate defines for Y,Z data regs for HMC5843/HMC5883

This commit is contained in:
Felix Ruess
2013-02-21 13:46:52 +01:00
parent a69420d469
commit eb6bce26b5
2 changed files with 19 additions and 5 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ void hmc58xx_event(struct Hmc58xx *hmc)
hmc->data.vect.y = Int16FromBuf(hmc->i2c_trans.buf,2);
hmc->data.vect.z = Int16FromBuf(hmc->i2c_trans.buf,4);
}
/* HMC5843 has xzy order of axes in returned data */
/* HMC5883 has xzy order of axes in returned data */
else {
hmc->data.vect.x = Int16FromBuf(hmc->i2c_trans.buf,0);
hmc->data.vect.y = Int16FromBuf(hmc->i2c_trans.buf,4);
+18 -4
View File
@@ -36,10 +36,24 @@
#define HMC58XX_REG_MODE 0x02
#define HMC58XX_REG_DATXM 0x03
#define HMC58XX_REG_DATXL 0x04
#define HMC58XX_REG_DATYM 0x05
#define HMC58XX_REG_DATYL 0x06
#define HMC58XX_REG_DATZM 0x07
#define HMC58XX_REG_DATZL 0x08
/* Warning!
* The HMC5843 and HMC5883 differ here.
* - HMC5843 order: Y,Z
* - HMC5883 order: Z,Y
* So we make defines for each version explicitly.
*/
#define HMC5843_REG_DATYM 0x05
#define HMC5843_REG_DATYL 0x06
#define HMC5843_REG_DATZM 0x07
#define HMC5843_REG_DATZL 0x08
#define HMC5883_REG_DATZM 0x05
#define HMC5883_REG_DATZL 0x06
#define HMC5883_REG_DATYM 0x07
#define HMC5883_REG_DATYL 0x08
#define HMC58XX_REG_STATUS 0x09
#define HMC58XX_REG_IDA 0x0A
#define HMC58XX_REG_IDB 0x0B