Skip to content

Commit

Permalink
Merge pull request #83 from sparkfun/release_candidate
Browse files Browse the repository at this point in the history
v1.2.8
  • Loading branch information
PaulZC committed Nov 15, 2021
2 parents 486fdbf + 5ee49bc commit 74d9c1e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void setup()
WIRE_PORT.setClock(400000);
#endif

// Initialize myICM
ICM_20948_init_struct(&myICM);

// Link the serif
ICM_20948_link_serif(&myICM, &mySerif);

Expand Down Expand Up @@ -202,7 +205,6 @@ ICM_20948_Status_e my_read_i2c(uint8_t reg, uint8_t *buff, uint32_t len, void *u
buff[i] = WIRE_PORT.read();
}
}
WIRE_PORT.endTransmission();

return ICM_20948_Stat_Ok;
}
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
version=1.2.7
version=1.2.8
author=SparkFun Electronics <techsupport@sparkfun.com>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Use the low-power high-resolution ICM 20948 9 DoF IMU from Invensense with I2C or SPI. Version 1.2 of the library includes support for the InvenSense Digital Motion Processor (DMP™).
Expand Down
1 change: 1 addition & 0 deletions src/ICM_20948.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ICM_20948_Status_e ICM_20948_read_SPI(uint8_t reg, uint8_t *buff, uint32_t len,
// Base
ICM_20948::ICM_20948()
{
status = ICM_20948_init_struct(&_device);
}

void ICM_20948::enableDebugging(Stream &debugPort)
Expand Down
14 changes: 13 additions & 1 deletion src/util/ICM_20948_C.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
*/
#if defined(ICM_20948_USE_DMP) // Only include the 14301 Bytes of DMP if ICM_20948_USE_DMP is defined

#if defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__) // Store the DMP firmware in PROGMEM on older AVR (ATmega) platforms
#if defined(ARDUINO_ARCH_MBED) // ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
const uint8_t dmp3_image[] = {
#elif (defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)) && !defined(__linux__) // Store the DMP firmware in PROGMEM on older AVR (ATmega) platforms
#define ICM_20948_USE_PROGMEM_FOR_DMP
#include <avr/pgmspace.h>
const uint8_t dmp3_image[] PROGMEM = {
Expand Down Expand Up @@ -120,6 +122,16 @@ const ICM_20948_Serif_t NullSerif = {
// Private function prototypes

// Function definitions
ICM_20948_Status_e ICM_20948_init_struct(ICM_20948_Device_t *pdev)
{
// Initialize all elements by 0 except for _last_bank
// Initialize _last_bank to 4 (invalid bank number)
// so ICM_20948_set_bank function does not skip issuing bank change operation
static const ICM_20948_Device_t init_device = { ._last_bank = 4 };
*pdev = init_device;
return ICM_20948_Stat_Ok;
}

ICM_20948_Status_e ICM_20948_link_serif(ICM_20948_Device_t *pdev, const ICM_20948_Serif_t *s)
{
if (s == NULL)
Expand Down
2 changes: 2 additions & 0 deletions src/util/ICM_20948_C.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ extern int memcmp(const void *, const void *, size_t); // Avoid compiler warning
uint16_t _dataIntrCtl; // Diagnostics: record the setting of DATA_INTR_CTL
} ICM_20948_Device_t; // Definition of device struct type

ICM_20948_Status_e ICM_20948_init_struct(ICM_20948_Device_t *pdev); // Initialize ICM_20948_Device_t

// ICM_20948_Status_e ICM_20948_Startup( ICM_20948_Device_t* pdev ); // For the time being this performs a standardized startup routine

ICM_20948_Status_e ICM_20948_link_serif(ICM_20948_Device_t *pdev, const ICM_20948_Serif_t *s); // Links a SERIF structure to the device
Expand Down

0 comments on commit 74d9c1e

Please sign in to comment.