Skip to content

Commit 74d9c1e

Browse files
authored
Merge pull request #83 from sparkfun/release_candidate
v1.2.8
2 parents 486fdbf + 5ee49bc commit 74d9c1e

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed

examples/PortableC/Example999_Portable/Example999_Portable.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ void setup()
7272
WIRE_PORT.setClock(400000);
7373
#endif
7474

75+
// Initialize myICM
76+
ICM_20948_init_struct(&myICM);
77+
7578
// Link the serif
7679
ICM_20948_link_serif(&myICM, &mySerif);
7780

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

207209
return ICM_20948_Stat_Ok;
208210
}

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library
2-
version=1.2.7
2+
version=1.2.8
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
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™).

src/ICM_20948.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ICM_20948_Status_e ICM_20948_read_SPI(uint8_t reg, uint8_t *buff, uint32_t len,
1212
// Base
1313
ICM_20948::ICM_20948()
1414
{
15+
status = ICM_20948_init_struct(&_device);
1516
}
1617

1718
void ICM_20948::enableDebugging(Stream &debugPort)

src/util/ICM_20948_C.c

+13-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
*/
99
#if defined(ICM_20948_USE_DMP) // Only include the 14301 Bytes of DMP if ICM_20948_USE_DMP is defined
1010

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

122124
// Function definitions
125+
ICM_20948_Status_e ICM_20948_init_struct(ICM_20948_Device_t *pdev)
126+
{
127+
// Initialize all elements by 0 except for _last_bank
128+
// Initialize _last_bank to 4 (invalid bank number)
129+
// so ICM_20948_set_bank function does not skip issuing bank change operation
130+
static const ICM_20948_Device_t init_device = { ._last_bank = 4 };
131+
*pdev = init_device;
132+
return ICM_20948_Stat_Ok;
133+
}
134+
123135
ICM_20948_Status_e ICM_20948_link_serif(ICM_20948_Device_t *pdev, const ICM_20948_Serif_t *s)
124136
{
125137
if (s == NULL)

src/util/ICM_20948_C.h

+2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ extern int memcmp(const void *, const void *, size_t); // Avoid compiler warning
184184
uint16_t _dataIntrCtl; // Diagnostics: record the setting of DATA_INTR_CTL
185185
} ICM_20948_Device_t; // Definition of device struct type
186186

187+
ICM_20948_Status_e ICM_20948_init_struct(ICM_20948_Device_t *pdev); // Initialize ICM_20948_Device_t
188+
187189
// ICM_20948_Status_e ICM_20948_Startup( ICM_20948_Device_t* pdev ); // For the time being this performs a standardized startup routine
188190

189191
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

0 commit comments

Comments
 (0)