The reset requires a delay after the command is issued. This was solved by using a callback structure in the module
exports.connect = function(i2c,BusAddress,callback) { var W= new BNO055(i2c,BusAddress); W.RST_SYS(); setTimeout(function () { callback(); }, 1000); return W; };
Which changes the code in the test program.
//load the BMO055 module W=require("BNO055").connect(I2C3,BusAddress,function(){ ///lots of code here in the callback });//end require
The call to change the clock souce also requires a delay which is addressed using a callback function In the module:
BNO055.prototype.External_Clk=function(a,callback){ this.selectPage(0); if(a) this.WriteByte(this.Page0Regs.SYS_TRIGGER,0x80); else this.WriteByte(this.Page0Regs.SYS_TRIGGER,0x00); setTimeout(function () { callback(); }, 50); };
The code in the test program:
//load the BMO055 module W=require("BNO055").connect(I2C3,BusAddress,function(){ W.External_Clk(1,function(){ //1=external 0=internal clock //Lots of code //do a timed loop that acquires and displays data var i; setInterval(function () { console.log(" "); showAMG(); showIMU(); showTemp(); showCalibStatus(); showOffsets(); }, 500);//display rate });//end set external clock });//end require }//end start
2 Attachments
@ClearMemory041063 started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Solved the reset and external clock problem
Reset
The reset requires a delay after the command is issued.
This was solved by using a callback structure in the module
Which changes the code in the test program.
External Clock
The call to change the clock souce also requires a delay which is addressed using a callback function
In the module:
The code in the test program:
2 Attachments