OSDN Git Service

add mbed.html
[mimic/MiMicSDK.git] / misc / mbedJS / mbed.html / m / mbedJS.all-min.js
diff --git a/misc/mbedJS/mbed.html/m/mbedJS.all-min.js b/misc/mbedJS/mbed.html/m/mbedJS.all-min.js
new file mode 100644 (file)
index 0000000..fd8ab9c
--- /dev/null
@@ -0,0 +1 @@
+var MiMicJS={};(function(){var d=MiMicJS;d.VERSION="MiMicJsAPI/2.0.0";d.assertInt=function a(o){if(!d.isArray(o)){if(!d.isInt(o)){throw new d.MiMicException()}}for(var p=0;p<o.length;p++){if(d.isInt(o[p])){continue}throw new d.MiMicException('"'+o[p]+'" is not integer.')}};d.assertNumber=function i(o){if(!d.isArray(o)){if(!d.isNumber(o)){throw new d.MiMicException()}}else{for(var p=0;p<o.length;p++){if(d.isNumber(o[p])){continue}throw new d.MiMicException('"'+o[p]+'" is not number.')}}};d.isNumber=function n(p){return(typeof p=="number")};d.isInt=function g(p){return(typeof p=="number")&&(p-Math.round(p)==0)};d.isGenerator=function e(p){if(!p){return false}return p.toString().indexOf("Generator")!=-1};d.getNow=function j(){return(new Date()).getTime()};d.isArray=function h(o){return o instanceof Array};d.isHashArray=function b(o){return(!(o instanceof Array))&&(typeof o=="object")};d.cloneAssoc=function f(o){var q={};for(var p in o){q[p]=o[p]}return q};d.hexout=function c(p,q){try{var t=["","0","00","000","0000","00000","000000","0000000"];var r=(p>>>0).toString(16).toLowerCase();if(r.length>q){throw new MiMicException(EE.NG)}var o=q-r.length;return t[o]+r}catch(u){throw new MiMicException(u)}};d.assocToStr=function m(o){var p="";for(k in o){p+=k+":"+o[k]+","}return p};d.using=function l(o){for(var p in o){window[p]=o[p]}}}());(function(){var a=MiMicJS;a.Error={OK:[0,"OK"],NG:[1073741824,"NG"],NG_YIELD_NOT_COMPLETED:[1073745921,"The previous function has not been completed."],NG_ILLEGAL_CALL:[1073745922,"Illegal procedure call."],NG_INVALID_ARG:[1073745923,"Invalid arguments."],isOK:function(b){return(1073741824&b)==0}}}());(function(){var b=MiMicJS;b.MiMicException=function a(){var f;if(typeof arguments.callee.caller=="function"){if(arguments.callee.caller.name.toString().length>0){f="function '"+arguments.callee.caller.name+"."}else{var d=arguments.callee.caller.toString();f="closure '"+d.substring(0,d.indexOf("{"))+"...'"}}else{f="root document"}var e="";switch(arguments.length){case 0:this.code=b.Error.NG[0];this.message=f+" code(0x"+this.code.toString(16)+")"+b.Error.NG[1];return;case 1:var c=arguments[0];if(c instanceof b.MiMicException){this.code=c.code;e="  \nfrom "+c.message}else{if(typeof c=="object"&&c.length==2){this.code=c[0];e=c[1]}else{this.code=b.Error.NG[0];e=b.Error.NG[1]+" "+(((typeof c)!="undefined")?c.toString():"v==undefined")}}this.message=f+" code(0x"+this.code.toString(16)+")"+e;return;default:break}throw new b.MiMicException("Invalid MiMicException argument.")};b.MiMicException.prototype={code:null,message:"",alert:function(){alert(this.message)},toString:function(){return"MiMicException:"+this.message}}}());(function(){var NS=MiMicJS;NS.Rpc=function Rpc(i_event){this._event=(i_event)?i_event:null};NS.Rpc.prototype={_event:null,_ws:null,rtt:0,_method_id:0,open:function open(i_url){var _t=this;if(this._ws){throw new MiMicException()}var q=new Array();var ev=this._event;var ws=new WebSocket(i_url);ws.onopen=function(){if(ev.onOpen){ev.onOpen()}};ws.onclose=function(){if(ev.onClose){ev.onClose()}};ws.error=function(){_t.shutdown();if(ev.onClose){ev.onError()}};var rx="";var rxst=0;var _t=this;ws.onmessage=function(e){for(var i=0;i<e.data.length;i++){var t=e.data[i];switch(rxst){case 2:if(t!='"'){rxst=1}break;case 0:if(t!="{"){continue}rx="({";rxst=1;continue;case 1:switch(t){case'"':rxst=2;break;case"}":rx+="})";rxst=0;var j=eval(rx);for(var i2=q.length-1;i2>=0;i2--){if(q[i2][0]==j.id){var qi=q[i2];q.splice(i2,1);if(qi[1]){qi[1](j)}break}}continue}}rx+=t}};this._method_id=0;this._q=q;this._ws=ws},close:function close(){if(this._ws&&this._ws.readyState==1){this._ws.close();this._ws=null}},shutdown:function shutdown(){var _t=this;if(_t._ws){_t._ws.onopen=function(){_t._ws.close()};_t._ws.onmessage=function(){_t._ws.close()};_t._ws.onclose=function(){_t._ws=null};_t._ws.onerror=function(){_t._ws=null}}},sendMethod:function callJsonRpc(i_method,i_params,i_callback){this._ws.send('{"verdion":"2.0","method":"'+i_method+'","params":['+i_params+'],"id":'+this._method_id+"}");this._q.push([this._method_id,i_callback]);this._method_id=(this._method_id+1)&268435455;return this._method_id}}}());var mbedJS={};(function(){var a=mbedJS;a.PinName=function(){var e;var d={};e=65536;for(var b=0;b<=5;b++){for(var c=0;c<=31;c++){d["P"+b+"_"+c]=e+b*32+c}}e=131072;for(var b=5;b<=40;b++){d["p"+b]=e+b}e=196608|0;d.LED1=e+0;d.LED2=e+1;d.LED3=e+2;d.LED4=e+3;e=196608|256;d.USBTX=e+0;d.USBRX=e+1;e=262144;for(var b=0;b<=15;b++){d["D"+b]=e+b}for(var b=0;b<=5;b++){d["A"+b]=e+b+256}d.I2C_SCL=e+512+0;d.I2C_SDA=e+512+1;d.NC=2147483647;return d}();a.PinMode={PullUp:65536,PullDown:65537,PullNone:65538,OpenDrain:65539,PullDefault:65540};a.PortName={Port0:65536,Port1:65537,Port2:65538,Port3:65539,Port4:65540}}());(function(){var d=mbedJS;var b=MiMicJS;var e=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=e;if(b.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(o){j._oid=o.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}b.assertInt(n);return j._mcu.rpc(j.RPC_NS+":_new1",n,h)}catch(l){throw new b.MiMicException(l)}};e.prototype={RPC_NS:"mbedJS:AnalogIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function c(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(h){throw new b.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read;return h._mcu.rpc(h.RPC_NS+":read_fx",h._oid,function(m){var l=m.result[0]/10000;if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}},read_u16:function f(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read_u16;return h._mcu.rpc(h.RPC_NS+":read_u16",h._oid,function(m){var l=m.result[0];if(h._event.onRead_u16){h._event.onRead_u16(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}}};d.AnalogIn=e}());(function(){var b=mbedJS;var a=MiMicJS;var e=function h(j,o,n){try{var l=this;l._mcu=j;l._lc=e;if(a.isGenerator(n)){l._gen=n}else{if(n){l._event=n}}function i(p){l._oid=p.result[0];if(l._event.onNew){l._event.onNew()}if(l._gen){l._gen.next(l)}l._lc=null}a.assertInt(o);return l._mcu.rpc(l.RPC_NS+":_new1",o,i)}catch(m){throw new a.MiMicException(m)}};e.prototype={RPC_NS:"mbedJS:AnalogOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function d(){try{if(this._lc!=e){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(i){throw new a.MiMicException(i)}},write:function g(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertNumber(i);return j._mcu.rpc(j.RPC_NS+":write_fx",j._oid+","+Math.round(i*10000),function(m){if(j._event.onWrite){j._event.onWrite()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},write_u16:function c(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":write_fx",j._oid+","+i,function(m){if(j._event.onWrite_u16){j._event.onWrite_u16()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},read:function f(){try{var i=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}i._lc=e.read;return i._mcu.rpc(i.RPC_NS+":read_fx",i._oid,function(m){var l=m.result[0]/10000;if(i._event.onRead){i._event.onRead(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new a.MiMicException(j)}}};b.AnalogOut=e}());(function(){var e=mbedJS;var c=MiMicJS;var f=function d(j,h,n){try{var r=this;r._mcu=j;r._lc=f;if(c.isGenerator(n)){r._gen=n}else{if(n){r._event=n}}function l(i){r._oid=i.result[0];if(r._event.onNew){r._event.onNew()}if(r._gen){r._gen.next(r)}r._lc=null}var o=h;if(o.length<1||o.length>16){throw new c.MiMicException(c.NG_INVALID_ARG)}c.assertInt(o);var m=o[0];var p=1;for(;p<h.length;p++){m+=","+o[p]}for(;p<16;p++){m+=","+e.PinName.NC}return r._mcu.rpc(r.RPC_NS+":_new1",m,l)}catch(q){throw new c.MiMicException(q)}};f.prototype={RPC_NS:"mbedJS:BusIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function g(){try{if(this._lc!=f){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new c.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}},mode:function b(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.mode;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":mode",i._oid+","+h,function(m){var l=m.result[0];if(i._event.onMode){i._event.onMode(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new c.MiMicException(j)}}};e.BusIn=f}());(function(){var c=mbedJS;var a=MiMicJS;var i=function e(m,l,p){try{var t=this;t._mcu=m;t._lc=i;if(a.isGenerator(p)){t._gen=p}else{if(p){t._event=p}}function n(u){t._oid=u.result[0];if(t._event.onNew){t._event.onNew()}if(t._gen){t._gen.next(t)}t._lc=null}var q=l;a.assertInt(q);if(q.length<1||q.length>16){throw new a.MiMicException(a.NG_INVALID_ARG)}var o=q[0];var r=1;for(;r<l.length;r++){o+=","+q[r]}for(;r<16;r++){o+=","+c.PinName.NC}return t._mcu.rpc(t.RPC_NS+":_new1",o,n)}catch(s){throw new a.MiMicException(s)}};i.prototype={RPC_NS:"mbedJS:BusInOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function d(){try{if(this._lc!=i){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=i.waitForNew}catch(l){throw new a.MiMicException(l)}},write:function f(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=i.write;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":write",m._oid+","+l,function(o){if(m._event.onWrite){m._event.onWrite()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}},read:function j(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.read;return l._mcu.rpc(l.RPC_NS+":read",l._oid,function(o){var n=o.result[0];if(l._event.onRead){l._event.onRead(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},mode:function g(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=i.mode;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":mode",m._oid+","+l,function(p){var o=p.result[0];if(m._event.onMode){m._event.onMode(o)}if(m._gen){m._gen.next(o)}m._lc=null})}catch(n){throw new a.MiMicException(n)}},input:function b(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.input;return l._mcu.rpc(l.RPC_NS+":input",l._oid,function(n){if(l._event.onInput){l._event.onInput()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}},output:function h(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=i.mode;return l._mcu.rpc(l.RPC_NS+":output",l._oid,function(n){if(l._event.onOutput){l._event.onOutput()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}}};c.BusInOut=i}());(function(){var f=mbedJS;var c=MiMicJS;var g=function d(j,h,n){try{var r=this;r._mcu=j;r._lc=g;if(c.isGenerator(n)){r._gen=n}else{if(n){r._event=n}}function l(i){r._oid=i.result[0];if(r._event.onNew){r._event.onNew()}if(r._gen){r._gen.next(r)}r._lc=null}var o=h;if(o.length<1||o.length>16){throw new c.MiMicException(c.NG_INVALID_ARG)}c.assertInt(o);var m=o[0];var p=1;for(;p<h.length;p++){m+=","+o[p]}for(;p<16;p++){m+=","+f.PinName.NC}return r._mcu.rpc(r.RPC_NS+":_new1",m,l)}catch(q){throw new c.MiMicException(q)}};g.prototype={RPC_NS:"mbedJS:BusOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=g){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=g.waitForNew}catch(h){throw new c.MiMicException(h)}},write:function e(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=g.write;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new c.MiMicException(j)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=g.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}}};f.BusOut=g}());(function(){var e=mbedJS;var d=MiMicJS;var f=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=f;if(d.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(o){j._oid=o.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}d.assertInt(n);return j._mcu.rpc(j.RPC_NS+":_new1",n,h)}catch(l){throw new d.MiMicException(l)}};f.prototype={RPC_NS:"mbedJS:DigitalIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function c(){try{if(this._lc!=f){throw new d.MiMicException(d.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new d.MiMicException(h)}},read:function a(){try{var h=this;if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new d.MiMicException(i)}},mode:function b(h){try{var i=this;if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.mode;d.assertInt(h);return i._mcu.rpc(i.RPC_NS+":mode",i._oid+","+h,function(m){var l=m.result[0];if(i._event.onMode){i._event.onMode(l)}if(i._gen){i._gen.next(l)}i._lc=null})}catch(j){throw new d.MiMicException(j)}}};e.DigitalIn=f}());(function(){var c=mbedJS;var b=MiMicJS;var e=function g(i,n,m){try{var j=this;j._mcu=i;j._lc=e;if(b.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(p){j._oid=p.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}var o;if(b.isHashArray(n)){o=[n.pin,n.value]}else{if(b.isArray(n)){o=[n[0],null]}else{o=[n,null]}}b.assertInt(o[0]);if(o[1]){b.assertInt(o[1]);return j._mcu.rpc(j.RPC_NS+":_new2",o[0]+","+o[1],h)}else{return j._mcu.rpc(j.RPC_NS+":_new1",o[0],h)}}catch(l){throw new b.MiMicException(l)}};e.prototype={RPC_NS:"mbedJS:DigitalOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function f(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(h){throw new b.MiMicException(h)}},write:function a(h){try{var i=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}i._lc=e.write;b.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new b.MiMicException(j)}},read:function d(){try{var h=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}h._lc=e.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new b.MiMicException(i)}}};c.DigitalOut=e}());(function(){var f=mbedJS;var d=MiMicJS;var g=function c(l,n){var j=this;j._lc=g;j._has_error=false;if(d.isGenerator(n)){j._gen=n}else{if(n){j._event=n}}j._rpc=new d.Rpc({onOpen:function m(){if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j.lc=null},onClose:function o(){if(j._lc==g.close){if(j._event.onClose){j._event.onClose()}}else{if(j._event.onError){j._event.onError()}}if(j._gen){j._gen.next(j)}j.lc=null},onError:function i(){j._has_error=true;if(j._event.onError){j._event.onError()}if(j._gen&&j._lc){j._gen.throw(new d.MiMicException())}}});this._rpc.open("ws://"+l+"/rpc/")};g.prototype={_lc:null,_rpc:null,_gen:null,_event:{},_has_error:false,hasError:function(){return _t._has_error},waitForNew:function e(){if(this._lc!=g){throw new d.MiMicException(d.Error.NG_ILLEGAL_CALL)}this._lc=g.waitForNew},close:function b(){if(this._gen&&this._lc){throw new d.MiMicException(d.Error.NG_YIELD_NOT_COMPLETED)}this._lc=g.close;this._rpc.close()},shutdown:function a(){this._rpc.shutdown()},rpc:function h(i,j,l){if(this._has_error){throw new d.MiMicException()}return this._rpc.sendMethod(i,j,l)},addItem:function(i){this._items.push(i)}};f.Mcu=g}());(function(){var d=mbedJS;var b=MiMicJS;var e=function c(h,m,l){try{var i=this;i._mcu=h;i._lc=e;if(b.isGenerator(l)){i._gen=l}else{if(l){i._event=l}}function g(o){i._oid=o.result[0];if(i._event.onNew){i._event.onNew()}if(i._gen){i._gen.next(i)}i._lc=null}var n;if(b.isHashArray(m)){n=[m.port,m.mask]}else{if(b.isArray(m)){n=m}}b.assertInt(n);return i._mcu.rpc(i.RPC_NS+":_new1",n[0]+","+n[1],g)}catch(j){throw new b.MiMicException(j)}};e.prototype={RPC_NS:"mbedJS:PortIn",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function a(){try{if(this._lc!=e){throw new b.MiMicException(b.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(g){throw new b.MiMicException(g)}},read:function f(){try{var g=this;if(this._gen&&this._lc){throw new b.MiMicException(b.Error.NG_YIELD_NOT_COMPLETED)}g._lc=e.read;return g._mcu.rpc(g.RPC_NS+":read",g._oid,function(l){var i=l.result[0];if(g._event.onRead){g._event.onRead(i)}if(g._gen){g._gen.next(i)}g._lc=null})}catch(h){throw new b.MiMicException(h)}}};d.PortIn=e}());(function(){var e=mbedJS;var c=MiMicJS;var f=function a(i,n,m){try{var j=this;j._mcu=i;j._lc=f;if(c.isGenerator(m)){j._gen=m}else{if(m){j._event=m}}function h(p){j._oid=p.result[0];if(j._event.onNew){j._event.onNew()}if(j._gen){j._gen.next(j)}j._lc=null}var o;if(c.isHashArray(n)){o=[n.port,n.mask]}else{if(c.isArray(n)){o=n}}c.assertInt(o);return j._mcu.rpc(j.RPC_NS+":_new1",o[0]+","+o[1],h)}catch(l){throw new c.MiMicException(l)}};f.prototype={RPC_NS:"mbedJS:PortOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function g(){try{if(this._lc!=f){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=f.waitForNew}catch(h){throw new c.MiMicException(h)}},write:function d(h){try{var i=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}i._lc=f.write;c.assertInt(h);return i._mcu.rpc(i.RPC_NS+":write",i._oid+","+h,function(l){if(i._event.onWrite){i._event.onWrite()}if(i._gen){i._gen.next()}i._lc=null})}catch(j){throw new c.MiMicException(j)}},read:function b(){try{var h=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}h._lc=f.read;return h._mcu.rpc(h.RPC_NS+":read",h._oid,function(m){var l=m.result[0];if(h._event.onRead){h._event.onRead(l)}if(h._gen){h._gen.next(l)}h._lc=null})}catch(i){throw new c.MiMicException(i)}}};e.PortOut=f}());(function(){var g=mbedJS;var c=MiMicJS;var n=function h(p,t,s){try{var q=this;q._mcu=p;q._lc=n;if(c.isGenerator(s)){q._gen=s}else{if(s){q._event=s}}function o(u){q._oid=u.result[0];if(q._event.onNew){q._event.onNew()}if(q._gen){q._gen.next(q)}q._lc=null}c.assertInt(t);return q._mcu.rpc(q.RPC_NS+":_new1",t,o)}catch(r){throw new c.MiMicException(r)}};n.prototype={RPC_NS:"mbedJS:PwmOut",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=n){throw new c.MiMicException(c.Error.NG_ILLEGAL_CALL)}this._lc=n.waitForNew}catch(o){throw new c.MiMicException(o)}},write:function j(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.write;c.assertNumber(o);return p._mcu.rpc(p.RPC_NS+":write_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onWrite){p._event.onWrite()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},read:function m(){try{var o=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}o._lc=n.read;return o._mcu.rpc(o.RPC_NS+":read_fx",o._oid,function(r){var q=r.result[0]/10000;if(o._event.onRead){o._event.onRead(q)}if(o._gen){o._gen.next(q)}o._lc=null})}catch(p){throw new c.MiMicException(p)}},period:function l(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onPeriod){p._event.onPeriod()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},period_ms:function e(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period_ms;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_ms",p._oid+","+Math.round(o),function(r){if(p._event.onPeriod_ms){p._event.onPeriod_ms()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},period_us:function i(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.period_us;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":period_us",p._oid+","+Math.round(o),function(r){if(p._event.onPeriod_us){p._event.onPeriod_us()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth:function d(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_fx",p._oid+","+Math.round(o*10000),function(r){if(p._event.onPulsewidth){p._event.onPulsewidth()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth_ms:function a(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth_ms;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_ms",p._oid+","+Math.round(o),function(r){if(p._event.onPulsewidth_ms){p._event.onPulsewidth_ms()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}},pulsewidth_us:function f(o){try{var p=this;if(this._gen&&this._lc){throw new c.MiMicException(c.Error.NG_YIELD_NOT_COMPLETED)}p._lc=n.pulsewidth_us;c.assertInt(o);return p._mcu.rpc(p.RPC_NS+":pulsewidth_us",p._oid+","+Math.round(o),function(r){if(p._event.onPulsewidth_us){p._event.onPulsewidth_us()}if(p._gen){p._gen.next()}p._lc=null})}catch(q){throw new c.MiMicException(q)}}};g.PwmOut=n}());(function(){var b=mbedJS;var a=MiMicJS;var e=function d(j,o,n){try{var l=this;l._mcu=j;l._lc=e;if(a.isGenerator(n)){l._gen=n}else{if(n){l._event=n}}function i(p){l._oid=p.result[0];if(l._event.onNew){l._event.onNew()}if(l._gen){l._gen.next(l)}l._lc=null}a.assertInt(o);return l._mcu.rpc(l.RPC_NS+":_new1",o[0]+","+o[1]+","+o[2]+","+b.PinName.NC,i)}catch(m){throw new a.MiMicException(m)}};e.prototype={RPC_NS:"mbedJS:SPI",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function h(){try{if(this._lc!=e){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=e.waitForNew}catch(i){throw new a.MiMicException(i)}},write:function g(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.write;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":write",j._oid+","+i,function(n){var m=n.result[0];if(j._event.onWrite){j._event.onWrite(m)}if(j._gen){j._gen.next(m)}j._lc=null})}catch(l){throw new a.MiMicException(l)}},frequency:function c(i){try{var j=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}j._lc=e.frequency;a.assertInt(i);return j._mcu.rpc(j.RPC_NS+":frequency",j._oid+","+i,function(m){if(j._event.onFrequency){j._event.onFrequency()}if(j._gen){j._gen.next()}j._lc=null})}catch(l){throw new a.MiMicException(l)}},format:function f(i,j){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=e.format;var n=j?j:0;a.assertInt([i,n]);return l._mcu.rpc(l.RPC_NS+":format",l._oid+","+i+","+n,function(o){if(l._event.onFormat){l._event.onFormat()}if(l._gen){l._gen.next()}l._lc=null})}catch(m){throw new a.MiMicException(m)}}};b.SPI=e}());(function(){var d=mbedJS;var a=MiMicJS;var j=function c(m,q,p){try{var n=this;n._mcu=m;n._lc=j;if(a.isGenerator(p)){n._gen=p}else{if(p){n._event=p}}function l(r){n._oid=r.result[0];if(n._event.onNew){n._event.onNew()}if(n._gen){n._gen.next(n)}n._lc=null}a.assertInt(q);return n._mcu.rpc(n.RPC_NS+":_new1",q[0]+","+q[1]+","+q[2]+","+q[3],l)}catch(o){throw new a.MiMicException(o)}};j.prototype={RPC_NS:"mbedJS:SPISlave",_lc:null,_gen:null,_event:{},_oid:null,waitForNew:function b(){try{if(this._lc!=j){throw new a.MiMicException(a.Error.NG_ILLEGAL_CALL)}this._lc=j.waitForNew}catch(l){throw new a.MiMicException(l)}},frequency:function i(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=j.frequency;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":frequency",m._oid+","+l,function(o){if(m._event.onFrequency){m._event.onFrequency()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}},format:function h(l,m){try{var n=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}n._lc=j.format;var p=m?m:0;a.assertInt([l,p]);return n._mcu.rpc(n.RPC_NS+":format",n._oid+","+l+","+p,function(q){if(n._event.onFormat){n._event.onFormat()}if(n._gen){n._gen.next()}n._lc=null})}catch(o){throw new a.MiMicException(o)}},read:function g(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=j.read;return l._mcu.rpc(l.RPC_NS+":read",l._oid,function(o){var n=o.result[0];if(l._event.onRead){l._event.onRead(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},receive:function e(){try{var l=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}l._lc=j.receive;return l._mcu.rpc(l.RPC_NS+":receive",l._oid,function(o){var n=o.result[0];if(l._event.onReceive){l._event.onReceive(n)}if(l._gen){l._gen.next(n)}l._lc=null})}catch(m){throw new a.MiMicException(m)}},reply:function f(l){try{var m=this;if(this._gen&&this._lc){throw new a.MiMicException(a.Error.NG_YIELD_NOT_COMPLETED)}m._lc=j.reply;a.assertInt(l);return m._mcu.rpc(m.RPC_NS+":reply",m._oid+","+l,function(o){if(m._event.onReply){m._event.onReply()}if(m._gen){m._gen.next()}m._lc=null})}catch(n){throw new a.MiMicException(n)}}};d.SPISlave=j}());
\ No newline at end of file