I have ported the Arduino Library for the BNO055, a very nice accelerometer board that I got today.
I was able to port the library so that it now works perfectly on a Photon. I have also condensed the library a bit so that it is now just two files, particle-BNO055.cpp and particle-BNO055.h.
Nathan, thank you for the port. There are several examples… but they use a couple different pins to connect SDA/SCL. I can’t see where it is actually called out in the .h. Does the code determine which photon pins are actually connected?
Nope, the pins are "hard wired" to the Wire object.
And for that reason it would always be good to also have a ::begin() function that can take an alternative I2C interface (e.g. Wire1) as input parameter.
Thanks much for porting the library. In the use of it, what is the best way to put the BNO055 to sleep / or how the manual states, 'suspend'? I did not notice such a function in the library so I figure using something such as the following would work?
3.2.1 Normal Mode
In normal mode all sensors required for the selected operating mode (see section 3.3) are always switched ON. The register map and the internal peripherals of the MCU are always operative in this mode.
3.2.2 Low Power Mode
If no activity (i.e. no motion) is detected for a configurable duration (default 5 seconds), the BNO055 enters the low power mode. In this mode only the accelerometer is active. Once motion is detected (i.e. the accelerometer signals an any-motion interrupt), the system is woken up and normal mode is entered. The following settings are possible.
3.2.3 Suspend Mode
In suspend mode the system is paused and all the sensors and the microcontroller are put into sleep mode. No values in the register map will be updated in this mode. To exit from suspend mode the mode should be changed by writing to the PWR_MODE register (see Table 3-1).
So to save battery power, use something like this before a sleep cycle? (0x02)
No worries on modifying your port - all works well as is. I just wanted to be sure I didn’t miss a possible already existing function for that, and to additionally get some advice of my proposed method to make it sleep would work.