mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
l3gd20: add l3gd20h chipid to ctor check as well
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
06ecae7212
commit
e689dc175c
@ -134,11 +134,13 @@ L3GD20::L3GD20(int bus, int addr)
|
|||||||
// check ChipID
|
// check ChipID
|
||||||
|
|
||||||
uint8_t cid = getChipID();
|
uint8_t cid = getChipID();
|
||||||
if (cid != L3GD20_DEFAULT_CHIP_ID)
|
if (!(cid == L3GD20_DEFAULT_CHIP_ID || cid == L3GD20H_DEFAULT_CHIP_ID))
|
||||||
{
|
{
|
||||||
throw std::runtime_error(std::string(__FUNCTION__) +
|
throw std::runtime_error(std::string(__FUNCTION__) +
|
||||||
": invalid Chip ID: expected "
|
": Invalid Chip ID: expected "
|
||||||
+ std::to_string(L3GD20_DEFAULT_CHIP_ID)
|
+ std::to_string(L3GD20_DEFAULT_CHIP_ID)
|
||||||
|
+ " or "
|
||||||
|
+ std::to_string(L3GD20H_DEFAULT_CHIP_ID)
|
||||||
+ ", got "
|
+ ", got "
|
||||||
+ std::to_string(int(cid)));
|
+ std::to_string(int(cid)));
|
||||||
return;
|
return;
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
// if SDO tied to GND
|
// if SDO tied to GND
|
||||||
#define L3GD20_DEFAULT_I2C_ADDR 0x6a
|
#define L3GD20_DEFAULT_I2C_ADDR 0x6a
|
||||||
#define L3GD20_DEFAULT_CHIP_ID 0xd4
|
#define L3GD20_DEFAULT_CHIP_ID 0xd4
|
||||||
|
// the 'H' variant uses a different chip id
|
||||||
|
#define L3GD20H_DEFAULT_CHIP_ID 0xd7
|
||||||
|
|
||||||
namespace upm
|
namespace upm
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user