mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
mag sensor: put some bounds on the parameters
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1012 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
a3a2dbd634
commit
29a8f05ac9
@ -64,7 +64,7 @@ int main()
|
||||
HMC5843_InitStructure.M_ODR = PIOS_HMC5843_ODR_10;
|
||||
HMC5843_InitStructure.Meas_Conf = PIOS_HMC5843_MEASCONF_NORMAL;
|
||||
HMC5843_InitStructure.Gain = PIOS_HMC5843_GAIN_2;
|
||||
HMC5843_InitStructure.Mode = PIOS_HMC5843_MODE_CONTINUOS;
|
||||
HMC5843_InitStructure.Mode = PIOS_HMC5843_MODE_CONTINUOUS;
|
||||
PIOS_HMC5843_Config(&HMC5843_InitStructure);
|
||||
|
||||
uint8_t id[4] = {0};
|
||||
|
@ -124,7 +124,7 @@ void PIOS_HMC5843_Config(PIOS_HMC5843_ConfigTypeDef *HMC5843_Config_Struct)
|
||||
/**
|
||||
* Read the magnetic readings from the sensor
|
||||
*/
|
||||
void PIOS_HMC5843_ReadMag(int16_t *out)
|
||||
void PIOS_HMC5843_ReadMag(int16_t out[3])
|
||||
{
|
||||
uint8_t buffer[6];
|
||||
uint8_t crtlB;
|
||||
@ -187,9 +187,10 @@ void PIOS_HMC5843_ReadMag(int16_t *out)
|
||||
/**
|
||||
* Read the identification bytes from the sensor
|
||||
*/
|
||||
void PIOS_HMC5843_ReadID(uint8_t *out)
|
||||
void PIOS_HMC5843_ReadID(uint8_t out[4])
|
||||
{
|
||||
PIOS_HMC5843_Read(PIOS_HMC5843_DATAOUT_IDA_REG, out, 3);
|
||||
out[3] = '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@
|
||||
#define PIOS_HMC5843_GAIN_6_5 0xE0
|
||||
|
||||
/* Modes */
|
||||
#define PIOS_HMC5843_MODE_CONTINUOS 0x00
|
||||
#define PIOS_HMC5843_MODE_CONTINUOUS 0x00
|
||||
#define PIOS_HMC5843_MODE_SINGLE 0x01
|
||||
#define PIOS_HMC5843_MODE_IDLE 0x02
|
||||
#define PIOS_HMC5843_MODE_SLEEP 0x02
|
||||
@ -96,8 +96,8 @@ typedef struct {
|
||||
/* Public Functions */
|
||||
extern void PIOS_HMC5843_Init(void);
|
||||
extern void PIOS_HMC5843_Config(PIOS_HMC5843_ConfigTypeDef *HMC5843_Config_Struct);
|
||||
extern void PIOS_HMC5843_ReadMag(int16_t *out);
|
||||
extern void PIOS_HMC5843_ReadID(uint8_t *out);
|
||||
extern void PIOS_HMC5843_ReadMag(int16_t out[3]);
|
||||
extern void PIOS_HMC5843_ReadID(uint8_t out[4]);
|
||||
extern int32_t PIOS_HMC5843_Read(uint8_t address, uint8_t *buffer, uint8_t len);
|
||||
extern int32_t PIOS_HMC5843_Write(uint8_t address, uint8_t buffer);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user