Bosch BNO055 Library Port

I guess that is important to know.

So I went to the Web IDE and created a new project. I then pasted the code from the files I downloaded from

Here is a link to the shared project. Funny it compiles just fine.

https://go.particle.io/shared_apps/58efd4b2ca6ff11ddb00068d

BTW is there a way to move a file from my local machine to the Web IDE rather than pasting it?

Thanks

Kurt

Not yet, but it's planned (without ETA)

BTW, that link leads me to an empty project.

The more I do this the less I understand.

How about this link.

https://go.particle.io/shared_apps/58efd9b2ca6ff11ddb000750

Here I added the files NAxisMotion.h and .cpp which is the complete library. Now it doesn’t compile and gives me the same errors as the desktop IDE

I see.
I guess using common terms like SUCCESS is not that clever, since other libraries or even the framework might use the same for something else and I think this is what causes the errors.

/*  BNO055 API error codes */
#define E_NULL_PTR                  ((s_8)-127)
#define E_BNO055_OUT_OF_RANGE       ((s_8)-2)
#define	SUCCESS						((u_8)0)  // <-- line 759
#define	ERROR_BOSCH					((s_8)-1)

/* Selection for bit enable and disable */
#define ENABLED		0x01
#define DISABLED	0x00

If this is already defined otherwise that will cause troubles.

You could try to rename SUCCESS to something more unique like BNO055_SUCCESS in the project

And I’d apply the same to other common terms like ENABLED, DISABLED, …

After doing that your project builds without errors for me.

Thanks ScruffR!

I actually figured that out before I saw your post. I got a successful compile and then I added the code from the Arduino example to make a complete workable program.

https://go.particle.io/shared_apps/58efe8fdca6ff11ddb000912

I am getting 3 errors

/workspace/NAxisMotion.cpp:105: undefined reference to 'bno055_init'
/workspace/NAxisMotion.cpp:111: undefined reference to 'bno055_set_data_output_format'
/workspace/NAxisMotion.cpp:150: undefined reference to 'bno055_set_operation_mode'

These functions are defined in BNO055.h and I included that explicitly in the .ino before including the NAxisMotion.h. Why is it not finding these?

Rats I need to wait 6 hours to post this.

Ok so I put
#include "BNO055.h"
in NAxisMotion.cpp at line 54 and that fixed it. I don’t know why I needed to do that.
Thanks for all the help guys. Now I need to see it it works. Can’t do that until I get back to Albuquerque :slight_smile:

That's because seperate .cpp files get built as individual modules that will be linked at the end. So each module needs to know the definitions isolated from any other module.