-var LPCXpresso1769;(function(){var g=MiMicLib.isUndef;var a={_EE:function(n){return{NG:[n|0,"Unknown exception in LPCXpresso1769"],INVALID_ARG:[n|1,"Invalid argument"],INVALID_PIN:[n|2,"Invalid pin"],INVALID_CFG:[n|3,"Invalid configulation"],VM_RUNTIME:[n|4,"MVM runtime error"],}}(MiMicError.NG[0]|MiMicError.MID_MiMic|MiMicError.CAID_LPCXPresso1769),_BCF:{setBit:function m(p,r,o,q,n){try{n.push(p);n.push(~(r<<q));n.push((r&o)<<q);return"EA00EA01EA02DB0700AA0701AE0702DF0700"}catch(s){throw new MiMicException(s)}},setMem:function b(p,o,n){try{n.push(p);n.push(o);return"EA00EA01DF0100"}catch(q){throw new MiMicException(q)}},getMem:function i(o,n){try{n.push(o);return"EA00DB0000EE00"}catch(p){throw new MiMicException(p)}},READMEM:"EA00DB0000EE00",END:"ZZ.E"},FUNC_NAME:["GPIO","AD","DA","PWM"],PHL_NAME:["GPIO","ADC","DAC","PWM"],PHL:{WDT:[0,0,null],TIMER0:[0,2,1],TIMER1:[0,4,2],UART0:[0,6,3],UART1:[0,8,4],PWM1:[0,12,6],I2C0:[0,14,7],SPI:[0,16,8],RTC:[null,null,9],SSPI1:[0,20,10],DAC:[0,22,null],ADC:[0,24,12],CAN1:[0,26,13],CAN2:[0,28,14],ACF:[0,30,null],QEI:[1,0,18],GPIOINT:[1,2,15],PCB:[1,4,null],I2C1:[1,6,19],SSP0:[1,10,21],TIMER2:[1,12,22],TIMER3:[1,14,23],UART2:[1,16,24],UART3:[1,18,25],I2C2:[1,20,26],I2S:[1,22,27],RIT:[1,26,16],SYSCON:[1,28,null],PWM_MC:[1,30,17],GPDMA:[null,null,29],ENET:[null,null,30],USB:[null,null,31]},P0:[[0,0,0,0,["GPIO0.0","RD1","TXD3","SDA1"]],[0,0,0,1,["GPIO0.1","TD1","RXD3","SCL1"]],[0,0,0,2,["GPIO0.2","TXD0","AD0.7",null]],[0,0,0,3,["GPIO0.3","RXD0","AD0.6",null]],[0,0,0,4,["GPIO0.4","I2SRX_CLK","RD2","CAP2.0"]],[0,0,0,5,["GPIO0.5","I2SRX_WS","TD2","CAP2.1"]],[0,0,0,6,["GPIO0.6","I2SRX_SDA","SSEL1","MAT2.0"]],[0,0,0,7,["GPIO0.7","I2STX_CLK","SCK1","MAT2.1"]],[0,0,0,8,["GPIO0.8","I2STX_WS","MISO1","MAT2.2"]],[0,0,0,9,["GPIO0.9","I2STX_SDA","MOSI1","MAT2.3"]],[0,0,0,10,["GPIO0.10","TXD2","SDA2","MAT3.0"]],[0,0,0,11,["GPIO0.11","RXD2","SCL2","MAT3.1"]],null,null,null,[0,0,0,15,["GPIO0.15","TXD1","SCK0","SCK"]],[1,1,0,16,["GPIO0.16","RXD1","SSEL0","SSEL"]],[1,1,0,17,["GPIO0.17","CTS1","MISO0","MISO"]],[1,1,0,18,["GPIO0.18","DCD1","MOSI0","MOSI"]],[1,1,0,19,["GPIO0.19","DSR1",null,"SDA1"]],[1,1,0,20,["GPIO0.20","DTR1",null,"SCL1"]],[1,1,0,21,["GPIO0.21","RI1",null,"RD1"]],[1,1,0,22,["GPIO0.22","RTS1",null,"TD1"]],[1,1,0,23,["GPIO0.23","AD0.0","I2SRX_CLK","CAP3.0"]],[1,1,0,24,["GPIO0.24","AD0.1","I2SRX_WS","CAP3.1"]],[1,1,0,25,["GPIO0.25","AD0.2","I2SRX_SDA","TXD3"]],[1,1,0,26,["GPIO0.26","AD0.3","AOUT","RXD3"]],[1,null,null,22,["GPIO0.27","SDA0","USB_SDA",null]],[1,null,null,24,["GPIO0.28","SCL0","USB_SCL",null]],[1,null,0,29,["GPIO0.29","USB_D+",null,null]],[1,null,0,30,["GPIO0.30","USB_D-",null,null]],],P1:[[2,2,1,0,["GPIO1.0","ENET_TXD0",null,null]],[2,2,1,1,["GPIO1.1","ENET_TXD1",null,null]],null,null,[2,2,1,4,["GPIO1.4","ENET_TX_EN",null,null]],null,null,null,[2,2,1,8,["GPIO1.8","ENET_CRS",null,null]],[2,2,1,9,["GPIO1.9","ENET_RXD0",null,null]],[2,2,1,10,["GPIO1.10","ENET_RXD1",null,null]],null,null,null,[2,2,1,14,["GPIO1.14","ENET_RX_ER",null,null]],[2,2,1,15,["GPIO1.15","ENET_REF_CLK",null,null]],[3,3,1,16,["GPIO1.16","ENET_MDC",null,null]],[3,3,1,17,["GPIO1.17","ENET_MDIO",null,null]],[3,3,1,18,["GPIO1.18","USB_UP_LED","PWM1.1","CAP1.0"]],[3,3,1,19,["GPIO1.19","MCOA0","USB_PPWR","CAP1.1"]],[3,3,1,20,["GPIO1.20","MCI0","PWM1.2","SCK0"]],[3,3,1,21,["GPIO1.21","MCABORT","PWM1.3","SSEL0"]],[3,3,1,22,["GPIO1.22","MCOB0","USB_PWRD","MAT1.0"]],[3,3,1,23,["GPIO1.23","MCI1","PWM1.4","MISO0"]],[3,3,1,24,["GPIO1.24","MCI2","PWM1.5","MOSI0"]],[3,3,1,25,["GPIO1.25","MCOA1",null,"MAT1.1"]],[3,3,1,26,["GPIO1.26","MCOB1","PWM1.6","CAP0.0"]],[3,3,1,27,["GPIO1.27","CLKOUT","USB_OVRCR","CAP0.1"]],[3,3,1,28,["GPIO1.28","MCOA2","PCAP1.0","MAT0.0"]],[3,3,1,29,["GPIO1.29","MCOB2","PCAP1.1","MAT0.1"]],[3,3,1,30,["GPIO1.30",null,"VBUS","AD0.4"]],[3,3,1,31,["GPIO1.31",null,"SCK1","AD0.5"]],],P2:[[4,4,2,0,["GPIO2.0","PWM1.1","TXD1",null]],[4,4,2,1,["GPIO2.1","PWM1.2","RXD1",null]],[4,4,2,2,["GPIO2.2","PWM1.3","CTS1",null]],[4,4,2,3,["GPIO2.3","PWM1.4","DCD1",null]],[4,4,2,4,["GPIO2.4","PWM1.5","DSR1",null]],[4,4,2,5,["GPIO2.5","PWM1.6","DTR1",null]],[4,4,2,6,["GPIO2.6","PCAP1.0","RI1",null]],[4,4,2,7,["GPIO2.7","RD2","RTS1",null]],[4,4,2,8,["GPIO2.8","TD2","TXD2","ENET_MDC"]],[4,4,2,9,["GPIO2.9","USB_CONNECT","RXD2","ENET_MDIO"]],[4,4,2,10,["GPIO2.10","EINT0","NMI",null]],[4,4,2,11,["GPIO2.11","EINT1",null,"I2STX_CLK"]],[4,4,2,12,["GPIO2.12","EINT2",null,"I2STX_WS"]],[4,4,2,13,["GPIO2.13","EINT3",null,"I2STX_SDA"]],],P3:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[7,7,3,25,["GPIO3.25",null,"MAT0.0","PWM1.2"]],[7,7,3,26,["GPIO3.26","STCLK","MAT0.1","PWM1.3"]],],P4:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[9,9,4,28,["GPIO4.28","RX_MCLK","MAT2.0","TXD3"]],[9,9,4,29,["GPIO4.29","TX_MCLK","MAT2.1","RXD3"]]],completePinFunctionName:function j(p,o){try{for(var n=0;n<p[4].length;n++){if(p[4][n].indexOf(o)==0){return p[4][n]}}throw new MiMicException("The function name '"+o+"' is not unknown.")}catch(q){throw new MiMicException(q)}},getPinRegInfo:function d(n){try{return{s:n[0],m:n[1],o:n[2],smb:(n[3]%16)*2,ob:n[3]}}catch(o){throw new MiMicException(o)}},getPinSelByFunctionName:function h(o,q){try{for(var n=0;n<o[4].length;n++){if(o[4][n]==q){return n}}throw new MiMicException("The function name '"+q+"' has not function.")}catch(p){throw new MiMicException(p)}},hasPinFunctionName:function l(n,o){return n[4].indexOf(o)>=0}};a.I2c=function c(){throw new MiMicException("Not imprement.")};a.Dma=function k(){throw new MiMicException("Not imprement.")};a.Uart=function f(){throw new MiMicException("Not imprement.")};a.Usb=function e(){throw new MiMicException("Not imprement.")};LPCXpresso1769=a}());(function(){var f=LPCXpresso1769;var p=f._BCF;var a=f._EE;var e=MiMicLib.isUndef;function b(w){try{var y=["0000000","000000","00000","0000","000","00","0",""];var A="";for(var u=0;u<w.length;u++){var t=(w[u]>>>0);var x=t.toString(16).toLowerCase();if(x.length<1||x.length>8){throw new MiMicException(a.NG)}A+=y[x.length-1]+x}return A}catch(z){throw new MiMicException(z)}}function h(w){try{function x(A,z){for(var y=0;y<A.length;y++){if(A[y]==null){continue}if(f.hasPinFunctionName(A[y],z)){return A[y]}}return null}var v=[f.P0,f.P1,f.P2,f.P3,f.P4];for(var t=0;t<v.length;t++){var s=x(v[t],w);if(s!=null){return s}}throw new MiMicException("pin function '"+w+"' not found")}catch(u){throw new MiMicException(u)}}function n(v){try{var t={GPIO:"GPIO",AD:"ADC",DA:"DAC"};for(var s in t){if(v.indexOf(s)==0){return t[s]}}throw new MiMicException("Peripheral for "+i_pinfunction+" not found.")}catch(u){throw new MiMicException(u)}}f.Mcu=function o(v,t){try{this.events={onActivateChanged:null};this._phl_holder=[];this._mif=new MiMicRemoteMcuInterface(v);var s=e(t)?true:t;if(s){this.activate()}}catch(u){throw new MiMicException(u)}};f.Mcu.prototype={_mif:null,isActive:function m(){try{return this._mif.isConnected()}catch(s){throw new MiMicException(s)}},events:null,_phl_holder:null,getClockInfo:function g(){return{cclk:100*1000*1000}},activate:function d(){try{var s=this;if(this.isActive()){throw new MiMicException("Already activated!")}this._mif.connect(function(u){if(!u){if(s.events.onActivateChanged!=null){s.events.onActivateChanged(false)}}});if(this.events.onActivateChanged!=null){this.events.onActivateChanged(true)}}catch(t){throw new MiMicException(t)}},deactivate:function c(){try{if(!this.isActive()){throw new MiMicException("Already activated!")}this._mif.disconnect();if(this.events.onActivateChanged!=null){this.events.onActivateChanged(false)}}catch(s){throw new MiMicException(s)}},callMiMic:function l(){try{var t;switch(arguments.length){case 1:t=arguments[0];break;case 2:t=arguments[0]+b(arguments[1]);break;default:throw new MiMicException(s)}return this._mif.execBc(t)}catch(s){throw new MiMicException(s)}},callMiMicWithCheck:function k(){try{var s=this.callMiMic.apply(this,arguments);if(s.result!=0){throw new MiMicException(a.VM_RUNTIME,"Result="+s.toString())}return s}catch(t){throw new MiMicException(t)}},getPin:function q(){switch(arguments.length){case 1:var s=h(arguments[0]);var t=n(arguments[0]);return this.getPeripheral(t).getPin(s);case 2:var t=n(arguments[1]);return this.getPeripheral(t).getPin(arguments[0]);default:throw new MiMicException()}},getPort:function r(s){throw new MiMicException("Not implemented.")},getPeripheral:function i(s,t){if(e(this._phl_holder[s])){switch(s){case"GPIO":new f.Gpio(this,t);break;case"ADC":new f.Adc(this,t);break;case"PWM":new f.Pwm(this,t);break;default:throw new MiMicException("Unknown peripheral symbol "+s)}}else{if(!e(t)){throw new MiMicException()}}return this._phl_holder[s]},registerPhl:function j(t,s){try{if(!e(this._phl_holder[s])){throw new MiMicException("Peripheral symbol "+s+" is already exist on mcu.")}this._phl_holder[s]=t}catch(u){throw new MiMicException(u)}}}}());(function(){var f=LPCXpresso1769;var d=f._BCF;var a=f._EE;var b=MiMicLib.isUndef;f.Memory=function e(g,h){if(!b(h)){this._base=h}this._mcu=g};f.Memory.prototype={_base:0,_mcu:null,read32:function c(){try{function o(i){if(i%4!=0){throw new MiMicException(a.INVALID_ARG,"An alignment is not 32bit unit.")}}var n="";var h=new Array();var p=arguments[0];switch(arguments.length){case 1:if(!isNaN(p)){o(p);n=d.READMEM;h.push(this._base+p)}else{for(var k=0;k<p.length;k++){o(p[k]);n+=d.getMem(this._base+p[k],h)}}break;case 2:o(p);o(arguments[1]);var g=arguments[1]/4;for(var k=0;k<g;k++){n+=d.READMEM;h.push(this._base+p+k*4)}break;default:break}var j=this._mcu.callMiMicWithCheck(n+d.END,h).stream;return j.length==1?j[0]:j}catch(m){throw new MiMicException(m)}}}}());(function(){var g=LPCXpresso1769;var f=g._BCF;var c=g._EE;var e=MiMicLib.isUndef;g.Peripheral=function(h,i,k){try{if(e(i)){throw new MiMicException(c.INVALID_PHL)}this._mcu=h;this._phl=i;if(!e(k)){this.setOpt(k)}}catch(j){throw new MiMicException(j)}};g.Peripheral.prototype={_PCLKSEL:[1074774440,1074774444],_PCONP:1074774212,_phl:null,_mcu:null,_cache:{pclk:0},BCF_setOpt:function a(k,h){try{var j="";if(!e(k.power)){if(this._phl[2]==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PCONP.")}j+=f.setBit(this._PCONP,1,k.power,this._phl[2],h)}if(!e(k.clock)){if(this._phl[0]==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PCLKSEL.")}this._cache.pclk=k.clock;j+=f.setBit(this._PCLKSEL[this._phl[0]],3,k.clock,this._phl[1],h)}return j}catch(i){throw new MiMicException(i)}},setOpt:function b(k){try{var h=new Array();var j=this.BCF_setOpt(k,h);if(j.length==0){throw new MiMicException("i_opt is empty or invalid.")}this._mcu.callMiMicWithCheck(j+f.END,h)}catch(i){throw new MiMicException(i)}return},getPCLK:function d(){try{var h=[4,1,2,0];var i=h[this._cache.pclk];var j;if(i==0){if(this._phl===g.PHL.CAN1||this._phl===g.PHL.CAN2){j=this._mcu.getClockInfo().cclk/6}else{j=this._mcu.getClockInfo().cclk/8}}else{j=this._mcu.getClockInfo().cclk/i}return Math.round(j)}catch(k){throw new MiMicException(k)}}}}());(function(){var g=LPCXpresso1769;var e=g._BCF;var c=g._EE;var d=MiMicLib.isUndef;g.Pin=function f(h,i,k){try{if(d(i)){throw new MiMicException(c.INVALID_PIN)}this._mcu=h;this._pininfo=g.getPinRegInfo(i);if(!d(k)){this.setOpt(k)}}catch(j){throw new MiMicException(j)}};g.Pin.prototype={_PINSEL:[1073922048,1073922052,1073922056,1073922060,1073922064,null,null,1073922240,null,1073922084,1073922088],_PINMODE:[1073922112,1073922116,1073922120,1073922124,1073922128,1073922132,1073922136,1073922140,null,1073922148],_PINMODE_OD:[1073922152,1073922156,1073922160,1073922164,1073922168],_pininfo:null,_mcu:null,BCF_setOpt:function a(k,h){try{var j="";if(!d(k.sel)){j+=e.setBit(this._PINSEL[this._pininfo.s],3,k.sel,this._pininfo.smb,h)}if(!d(k.mode)){if(this._pininfo.m==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PINMODE. pininfo.")}j+=e.setBit(this._PINMODE[this._pininfo.m],3,k.mode,this._pininfo.smb,h)}if(!d(k.od)){if(this._pininfo.o==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PINMODE_OD. pininfo.")}j+=e.setBit(this._PINMODE_OD[this._pininfo.o],1,k.od,this._pininfo.ob,h)}return j}catch(i){throw new MiMicException(i)}},setOpt:function b(k){try{var h=new Array();var j=this.BCF_setOpt(k,h);if(j.length==0){throw new MiMicException("i_opt is empty or invalid.")}this._mcu.callMiMicWithCheck(j+e.END,h)}catch(i){throw new MiMicException(i)}return}}}());(function(){var a=LPCXpresso1769;var k=a._BCF;var l=a._EE;var c=MiMicLib.isUndef;a.Adc=function b(m,r){try{this._mcu=m;this._phl=new a.Peripheral(m,a.PHL.ADC);var o=c(r)?{phl:{}}:{phl:c(r.phl)?{}:cloneAssoc(r.phl),};if(c(o.phl.power)){o.phl.power=1}var q="";var n=new Array();q+=this.BCF_setOpt(o,n);q+=k.setMem(this._AD0CR,2098176,n);q+=k.setMem(this._AD0CR,2163712,n);this._mcu.callMiMicWithCheck(q+k.END,n);this._mcu.registerPhl(this,"ADC")}catch(p){throw new MiMicException(p)}};a.Adc.prototype={_PHL_DEF:{power:1},_AD0CR:1073954816,_AD0DR:[1073954832,1073954836,1073954840,1073954844,1073954848,1073954852,1073954856,1073954860],_phl:null,_mcu:null,BCF_setOpt:function h(p,m){try{var o="";if(!c(p.phl)){o+=this._phl.BCF_setOpt(p.phl,m)}return o}catch(n){throw new MiMicException(n)}},BCF_setSel:function i(o,n,m){try{return k.setBit(this._AD0CR,1,n,o,m)}catch(p){throw new MiMicException(p)}},BCF_getAD0DR:function g(n,m){try{return k.getMem(this._AD0DR[n],m)}catch(o){throw new MiMicException(o)}},setOpt:function f(p){try{var m=new Array();var o=this.BCF_setOpt(p,m);this._mcu.callMiMicWithCheck(o+k.END,m)}catch(n){throw new MiMicException(n)}},getPin:function j(m,o){try{return new a.AdcPin(this,m,o)}catch(n){throw new MiMicException(n)}}};a.AdcPin=function d(m,o,q){try{this._adc=m;this._pin=new a.Pin(m._mcu,o);this._adinfo=function(v){var t=a.completePinFunctionName(v,"AD");var s=t.substring(2).split(".");var u={port:0,ch:parseInt(s[1]),pin_sel:a.getPinSelByFunctionName(v,t)};if(!isNaN(u.ch)){return u}throw new MiMicException(l.INVALID_CFG,"The pin has not AD fuction.")}(o);var n=c(q)?{pin:{}}:{pin:c(q.pin)?{}:cloneAssoc(q.pin)};n.sel=1;if(c(n.pin.sel)){n.pin.sel=this._adinfo.pin_sel}this.setOpt(n)}catch(p){throw new MiMicException(p)}};a.AdcPin.prototype={_adc:null,_pin:null,_adinfo:null,getValue:function e(){try{var m=new Array();var p=this._adc.BCF_getAD0DR(this._adinfo.ch,m);var n=this._adc._mcu.callMiMicWithCheck(p+k.END,m);return(n.stream[0]>>4)&4095}catch(o){throw new MiMicException(o)}},setOpt:function f(p){try{var o="";var m=new Array();if(!c(p.pin)){o+=this._pin.BCF_setOpt(p.pin,m)}if(!c(p.sel)){o+=this._adc.BCF_setSel(this._adinfo.ch,p.sel,m)}this._adc._mcu.callMiMicWithCheck(o+k.END,m);return}catch(n){throw new MiMicException(n)}}}}());(function(){var a=LPCXpresso1769;var n=a._BCF;var o=a._EE;var c=MiMicLib.isUndef;var h=MiMicLib.cloneAssoc;a.Gpio=function i(p,r){try{this._mcu=p;p.registerPhl(this,"GPIO")}catch(q){throw new MiMicException(q)}};a.Gpio.prototype={_FIO_DIR:[537509888,537509920,537509952,537509984,537510016],_FIO_PIN:[537509908,537509940,537509972,537510004,537510036],_FIO_SET:[537509912,537509944,537509976,537510008,537510040],_FIO_CLR:[537509916,537509948,537509980,537510012,537510044],_FIO_MASK:[537509904,537509936,537509968,537510000,537510032],_mcu:null,BCF_setDir:function k(r,q,s,p){try{return n.setBit(this._FIO_DIR[r],1,s,q,p)}catch(t){throw new MiMicException(t)}},BCF_setValue:function b(s,r,q,p){try{if(q){p.push(this._FIO_SET[s],this._FIO_MASK[s],~(1<<r))}else{p.push(this._FIO_CLR[s],this._FIO_MASK[s],~(1<<r))}return"EA00EA01EA02DF0201FB02ffffffffDF0200"}catch(t){throw new MiMicException(t)}},BCF_getValue:function d(r,q,p){try{p.push(this._FIO_PIN[r],this._FIO_MASK[r],~(1<<q));return"EA00EA01EA02DF0201DB0300EE03"}catch(s){throw new MiMicException(s)}},getPin:function j(p,r){try{return new a.GpioPin(this,p,r)}catch(q){throw new MiMicException(q)}}};a.GpioPin=function l(q,r,t){try{this._gpio=q;this._pin=new a.Pin(q._mcu,r);this._gpioinfo=function(x){var v=a.completePinFunctionName(x,"GPIO");var u=v.substring(4).split(".");var w={port:parseInt(u[0]),bit:parseInt(u[1]),pin_sel:a.getPinSelByFunctionName(x,v)};if(!isNaN(w.port)&&!isNaN(w.bit)){return w}throw new MiMicException(o.INVALID_CFG,"The pin has not GPIO fuction.")}(r);var p=c(t)?{pin:{}}:{dir:t.dir,pin:c(t.pin)?{}:h(t.pin)};if(c(p.pin.sel)){p.pin.sel=this._gpioinfo.pin_sel}this.setOpt(p)}catch(s){throw new MiMicException(s)}};a.GpioPin.prototype={_gpio:null,_pin:null,_gpioinfo:null,setOpt:function g(s){try{var r="";var p=new Array();if(!c(s.dir)){r+=this._gpio.BCF_setDir(this._gpioinfo.port,this._gpioinfo.bit,s.dir,p)}if(!c(s.pin)){r+=this._pin.BCF_setOpt(s.pin,p)}this._gpio._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},setValue:function e(q){try{var s="";var p=new Array();s+=this._gpio.BCF_setValue(this._gpioinfo.port,this._gpioinfo.bit,q,p);this._gpio._mcu.callMiMicWithCheck(s+n.END,p)}catch(r){throw new MiMicException(r)}},getValue:function f(){try{var s="";var p=new Array();s+=this._gpio.BCF_getValue(this._gpioinfo.port,this._gpioinfo.bit,p);var q=this._gpio._mcu.callMiMicWithCheck(s+n.END,p);return(q.stream[0]>>this._gpioinfo.bit)&1}catch(r){throw new MiMicException(r)}},outPatt:function m(q){try{var t="";var p=new Array();for(var r=0;r<q.length;r++){t+=this._gpio.BCF_setValue(this._gpioinfo.port,this._gpioinfo.bit,q[r],p)}this._gpio._mcu.callMiMicWithCheck(t+n.END,p)}catch(s){throw new MiMicException(s)}},}}());(function(){var a=LPCXpresso1769;var n=a._BCF;var o=a._EE;var b=MiMicLib.isUndef;var g=MiMicLib.cloneAssoc;a.Pwm=function d(p,u){try{this._mcu=p;this._phl=new a.Peripheral(p,a.PHL.PWM1);var r=b(u)?{phl:{}}:{phl:b(u.phl)?{}:g(u.phl),freq:u.freq};if(b(r.phl.power)){r.phl.power=1}if(b(r.phl.clock)){r.phl.clock=0}if(b(r.freq)){r.freq=100}var t="";var q=new Array();t+=this.BCF_setOpt(r,q);t+=n.setMem(this._PC,0,q);t+=n.setMem(this._PCR,0,q);t+=n.setMem(this._CTCR,0,q);t+=n.setMem(this._TCR,0,q);t+=n.setMem(this._TC,0,q);t+=n.setMem(this._TCR,9,q);this._mcu.callMiMicWithCheck(t+n.END,q);this._mcu.registerPhl(this,"PWM")}catch(s){throw new MiMicException(s)}};a.Pwm.prototype={_cache:{mr0:0},_TCR:1073840132,_TC:1073840136,_PR:1073840140,_PC:1073840144,_MCR:1073840152,_PCR:1073840204,_LER:1073840208,_CTCR:1073840240,_MRn:[1073840152,1073840156,1073840160,1073840164,1073840192,1073840196,1073840200],_phl:null,_mcu:null,BCF_setOpt:function h(u,p){try{var t="";var r;var q;if(!b(u.phl)){t+=this._phl.BCF_setOpt(u.phl,p)}if(!b(u.freq)){q=Math.round(this._phl.getPCLK()/u.freq);if(q<=0){throw new MiMicException("The peripheral clock too small.")}t+=this.BCF_setMRn(0,q,p);t+=this.BCF_setLER(0,p);this._cache.mr0=q}return t}catch(s){throw new MiMicException(s)}},BCF_setLER:function e(q,p){return n.setBit(this._LER,1,1,q,p)},BCF_setMRn:function j(r,q,p){try{return n.setMem(this._MRn[r],q,p)}catch(s){throw new MiMicException(s)}},BCF_setMRnByDuty:function m(q,r,p){try{return this.BCF_setMRn(q,Math.round(r*this._cache.mr0),p)}catch(s){throw new MiMicException(s)}},BCF_setPCRbit:function l(u,r,s,q){try{var p,t;p=t=0;if(!b(r)){t|=r;p|=1}if(!b(s)){t|=(s<<8);p|=256}return n.setBit(this._PCR,p,t,u,q)}catch(w){throw new MiMicException(w)}},setOpt:function f(s){try{var p=new Array();var r=this.BCF_setOpt(s,p);this._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},getPin:function i(p,r){try{return new a.PwmPin(this,p,r)}catch(q){throw new MiMicException(q)}}};a.PwmPin=function k(p,r,t){try{this._pwm=p;this._pin=new a.Pin(p._mcu,r);this._pwminfo=function(x){var v=a.completePinFunctionName(x,"PWM");var u=v.substring(2).split(".");var w={port:0,ch:parseInt(u[1]),pin_sel:a.getPinSelByFunctionName(x,v)};if(!isNaN(w.ch)){return w}throw new MiMicException(o.INVALID_CFG,"The pin has not PWM fuction.")}(r);var q=b(t)?{pin:{}}:{pin:b(t.pin)?{}:g(t.pin),duty:t.duty,enable:t.enable};if(b(q.pin.sel)){q.pin.sel=this._pwminfo.pin_sel}if(b(q.duty)){q.duty=0}if(b(q.enable)){q.enable=1}this.setOpt(q)}catch(s){throw new MiMicException(s)}};a.PwmPin.prototype={_pwm:null,_pin:null,_pwminfo:null,BCF_setOpt:function h(s,p){try{var r="";if(!b(s.pin)){r+=this._pin.BCF_setOpt(s.pin,p)}if(!b(s.enable)){r+=this._pwm.BCF_setPCRbit(this._pwminfo.ch,0,s.enable,p)}if(!b(s.duty)){r+=this._pwm.BCF_setMRnByDuty(this._pwminfo.ch,s.duty,p);r+=this._pwm.BCF_setLER(this._pwminfo.ch,p)}return r}catch(q){throw new MiMicException(q)}},setOpt:function f(s){try{var p=new Array();var r=this.BCF_setOpt(s,p);this._pwm._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},setDuty:function c(p){try{this.setOpt({duty:p})}catch(q){throw new MiMicException(q)}}}}());
\ No newline at end of file
+var LPCXpresso1769;(function(){var g=MiMicLib.isUndef;var a={_EE:function(n){return{NG:[n|0,"Unknown exception in LPCXpresso1769"],INVALID_ARG:[n|1,"Invalid argument"],INVALID_PIN:[n|2,"Invalid pin"],INVALID_CFG:[n|3,"Invalid configulation"],VM_RUNTIME:[n|4,"MVM runtime error"],}}(MiMicError.NG[0]|MiMicError.MID_MiMic|MiMicError.CAID_LPCXPresso1769),_BCF:{setBit:function m(p,r,o,q,n){try{n.push(p);n.push(~(r<<q));n.push((r&o)<<q);return"EA00EA01EA02DB0700AA0701AE0702DF0700"}catch(s){throw new MiMicException(s)}},setMem:function b(p,o,n){try{n.push(p);n.push(o);return"EA00EA01DF0100"}catch(q){throw new MiMicException(q)}},getMem:function i(o,n){try{n.push(o);return"EA00DB0000EE00"}catch(p){throw new MiMicException(p)}},READMEM:"EA00DB0000EE00",END:"ZZ.E"},FUNC_NAME:["GPIO","AD","DA","PWM"],PHL_NAME:["GPIO","ADC","DAC","PWM"],PHL:{WDT:[0,0,null],TIMER0:[0,2,1],TIMER1:[0,4,2],UART0:[0,6,3],UART1:[0,8,4],PWM1:[0,12,6],I2C0:[0,14,7],SPI:[0,16,8],RTC:[null,null,9],SSPI1:[0,20,10],DAC:[0,22,null],ADC:[0,24,12],CAN1:[0,26,13],CAN2:[0,28,14],ACF:[0,30,null],QEI:[1,0,18],GPIOINT:[1,2,15],PCB:[1,4,null],I2C1:[1,6,19],SSP0:[1,10,21],TIMER2:[1,12,22],TIMER3:[1,14,23],UART2:[1,16,24],UART3:[1,18,25],I2C2:[1,20,26],I2S:[1,22,27],RIT:[1,26,16],SYSCON:[1,28,null],PWM_MC:[1,30,17],GPDMA:[null,null,29],ENET:[null,null,30],USB:[null,null,31]},P0:[[0,0,0,0,["GPIO0.0","RD1","TXD3","SDA1"]],[0,0,0,1,["GPIO0.1","TD1","RXD3","SCL1"]],[0,0,0,2,["GPIO0.2","TXD0","AD0.7",null]],[0,0,0,3,["GPIO0.3","RXD0","AD0.6",null]],[0,0,0,4,["GPIO0.4","I2SRX_CLK","RD2","CAP2.0"]],[0,0,0,5,["GPIO0.5","I2SRX_WS","TD2","CAP2.1"]],[0,0,0,6,["GPIO0.6","I2SRX_SDA","SSEL1","MAT2.0"]],[0,0,0,7,["GPIO0.7","I2STX_CLK","SCK1","MAT2.1"]],[0,0,0,8,["GPIO0.8","I2STX_WS","MISO1","MAT2.2"]],[0,0,0,9,["GPIO0.9","I2STX_SDA","MOSI1","MAT2.3"]],[0,0,0,10,["GPIO0.10","TXD2","SDA2","MAT3.0"]],[0,0,0,11,["GPIO0.11","RXD2","SCL2","MAT3.1"]],null,null,null,[0,0,0,15,["GPIO0.15","TXD1","SCK0","SCK"]],[1,1,0,16,["GPIO0.16","RXD1","SSEL0","SSEL"]],[1,1,0,17,["GPIO0.17","CTS1","MISO0","MISO"]],[1,1,0,18,["GPIO0.18","DCD1","MOSI0","MOSI"]],[1,1,0,19,["GPIO0.19","DSR1",null,"SDA1"]],[1,1,0,20,["GPIO0.20","DTR1",null,"SCL1"]],[1,1,0,21,["GPIO0.21","RI1",null,"RD1"]],[1,1,0,22,["GPIO0.22","RTS1",null,"TD1"]],[1,1,0,23,["GPIO0.23","AD0.0","I2SRX_CLK","CAP3.0"]],[1,1,0,24,["GPIO0.24","AD0.1","I2SRX_WS","CAP3.1"]],[1,1,0,25,["GPIO0.25","AD0.2","I2SRX_SDA","TXD3"]],[1,1,0,26,["GPIO0.26","AD0.3","AOUT","RXD3"]],[1,null,null,22,["GPIO0.27","SDA0","USB_SDA",null]],[1,null,null,24,["GPIO0.28","SCL0","USB_SCL",null]],[1,null,0,29,["GPIO0.29","USB_D+",null,null]],[1,null,0,30,["GPIO0.30","USB_D-",null,null]],],P1:[[2,2,1,0,["GPIO1.0","ENET_TXD0",null,null]],[2,2,1,1,["GPIO1.1","ENET_TXD1",null,null]],null,null,[2,2,1,4,["GPIO1.4","ENET_TX_EN",null,null]],null,null,null,[2,2,1,8,["GPIO1.8","ENET_CRS",null,null]],[2,2,1,9,["GPIO1.9","ENET_RXD0",null,null]],[2,2,1,10,["GPIO1.10","ENET_RXD1",null,null]],null,null,null,[2,2,1,14,["GPIO1.14","ENET_RX_ER",null,null]],[2,2,1,15,["GPIO1.15","ENET_REF_CLK",null,null]],[3,3,1,16,["GPIO1.16","ENET_MDC",null,null]],[3,3,1,17,["GPIO1.17","ENET_MDIO",null,null]],[3,3,1,18,["GPIO1.18","USB_UP_LED","PWM1.1","CAP1.0"]],[3,3,1,19,["GPIO1.19","MCOA0","USB_PPWR","CAP1.1"]],[3,3,1,20,["GPIO1.20","MCI0","PWM1.2","SCK0"]],[3,3,1,21,["GPIO1.21","MCABORT","PWM1.3","SSEL0"]],[3,3,1,22,["GPIO1.22","MCOB0","USB_PWRD","MAT1.0"]],[3,3,1,23,["GPIO1.23","MCI1","PWM1.4","MISO0"]],[3,3,1,24,["GPIO1.24","MCI2","PWM1.5","MOSI0"]],[3,3,1,25,["GPIO1.25","MCOA1",null,"MAT1.1"]],[3,3,1,26,["GPIO1.26","MCOB1","PWM1.6","CAP0.0"]],[3,3,1,27,["GPIO1.27","CLKOUT","USB_OVRCR","CAP0.1"]],[3,3,1,28,["GPIO1.28","MCOA2","PCAP1.0","MAT0.0"]],[3,3,1,29,["GPIO1.29","MCOB2","PCAP1.1","MAT0.1"]],[3,3,1,30,["GPIO1.30",null,"VBUS","AD0.4"]],[3,3,1,31,["GPIO1.31",null,"SCK1","AD0.5"]],],P2:[[4,4,2,0,["GPIO2.0","PWM1.1","TXD1",null]],[4,4,2,1,["GPIO2.1","PWM1.2","RXD1",null]],[4,4,2,2,["GPIO2.2","PWM1.3","CTS1",null]],[4,4,2,3,["GPIO2.3","PWM1.4","DCD1",null]],[4,4,2,4,["GPIO2.4","PWM1.5","DSR1",null]],[4,4,2,5,["GPIO2.5","PWM1.6","DTR1",null]],[4,4,2,6,["GPIO2.6","PCAP1.0","RI1",null]],[4,4,2,7,["GPIO2.7","RD2","RTS1",null]],[4,4,2,8,["GPIO2.8","TD2","TXD2","ENET_MDC"]],[4,4,2,9,["GPIO2.9","USB_CONNECT","RXD2","ENET_MDIO"]],[4,4,2,10,["GPIO2.10","EINT0","NMI",null]],[4,4,2,11,["GPIO2.11","EINT1",null,"I2STX_CLK"]],[4,4,2,12,["GPIO2.12","EINT2",null,"I2STX_WS"]],[4,4,2,13,["GPIO2.13","EINT3",null,"I2STX_SDA"]],],P3:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[7,7,3,25,["GPIO3.25",null,"MAT0.0","PWM1.2"]],[7,7,3,26,["GPIO3.26","STCLK","MAT0.1","PWM1.3"]],],P4:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,[9,9,4,28,["GPIO4.28","RX_MCLK","MAT2.0","TXD3"]],[9,9,4,29,["GPIO4.29","TX_MCLK","MAT2.1","RXD3"]]],completePinFunctionName:function j(p,o){try{for(var n=0;n<p[4].length;n++){if(p[4][n].indexOf(o)==0){return p[4][n]}}throw new MiMicException("The function name '"+o+"' is not unknown.")}catch(q){throw new MiMicException(q)}},getPinRegInfo:function d(n){try{return{s:n[0],m:n[1],o:n[2],smb:(n[3]%16)*2,ob:n[3]}}catch(o){throw new MiMicException(o)}},getPinSelByFunctionName:function h(o,q){try{for(var n=0;n<o[4].length;n++){if(o[4][n]==q){return n}}throw new MiMicException("The function name '"+q+"' has not function.")}catch(p){throw new MiMicException(p)}},hasPinFunctionName:function l(n,o){return n[4].indexOf(o)>=0}};a.I2c=function c(){throw new MiMicException("Not imprement.")};a.Dma=function k(){throw new MiMicException("Not imprement.")};a.Uart=function f(){throw new MiMicException("Not imprement.")};a.Usb=function e(){throw new MiMicException("Not imprement.")};LPCXpresso1769=a}());(function(){var f=LPCXpresso1769;var p=f._BCF;var a=f._EE;var e=MiMicLib.isUndef;function b(t){try{var v="";for(var s=0;s<t.length;s++){v+=MiMicLib.hexout(t[s],8)}return v}catch(u){throw new MiMicException(u)}}function h(w){try{function x(A,z){for(var y=0;y<A.length;y++){if(A[y]==null){continue}if(f.hasPinFunctionName(A[y],z)){return A[y]}}return null}var v=[f.P0,f.P1,f.P2,f.P3,f.P4];for(var t=0;t<v.length;t++){var s=x(v[t],w);if(s!=null){return s}}throw new MiMicException("pin function '"+w+"' not found")}catch(u){throw new MiMicException(u)}}function n(v){try{var t={GPIO:"GPIO",AD:"ADC",DA:"DAC"};for(var s in t){if(v.indexOf(s)==0){return t[s]}}throw new MiMicException("Peripheral for "+i_pinfunction+" not found.")}catch(u){throw new MiMicException(u)}}f.Mcu=function o(v,t){try{this.events={onActivateChanged:null};this._phl_holder=[];this._mif=new MiMicRemoteMcuInterface(v);var s=e(t)?true:t;if(s){this.activate()}}catch(u){throw new MiMicException(u)}};f.Mcu.prototype={_mif:null,isActive:function m(){try{return this._mif.isConnected()}catch(s){throw new MiMicException(s)}},events:null,_phl_holder:null,getClockInfo:function g(){return{cclk:100*1000*1000}},activate:function d(){try{var s=this;if(this.isActive()){throw new MiMicException("Already activated!")}this._mif.connect(function(u){if(!u){if(s.events.onActivateChanged!=null){s.events.onActivateChanged(false)}}});if(this.events.onActivateChanged!=null){this.events.onActivateChanged(true)}}catch(t){throw new MiMicException(t)}},deactivate:function c(){try{if(!this.isActive()){throw new MiMicException("Already activated!")}this._mif.disconnect();if(this.events.onActivateChanged!=null){this.events.onActivateChanged(false)}}catch(s){throw new MiMicException(s)}},callMiMic:function l(){try{var t;switch(arguments.length){case 1:t=arguments[0];break;case 2:t=arguments[0]+b(arguments[1]);break;default:throw new MiMicException(s)}return this._mif.execBc(t)}catch(s){throw new MiMicException(s)}},callMiMicWithCheck:function k(){try{var s=this.callMiMic.apply(this,arguments);if(s.result!=0){throw new MiMicException(a.VM_RUNTIME,"Result="+s.toString())}return s}catch(t){throw new MiMicException(t)}},getPin:function q(){switch(arguments.length){case 1:var s=h(arguments[0]);var t=n(arguments[0]);return this.getPeripheral(t).getPin(s);case 2:var t=n(arguments[1]);return this.getPeripheral(t).getPin(arguments[0]);default:throw new MiMicException()}},getPort:function r(s){throw new MiMicException("Not implemented.")},getPeripheral:function i(s,t){if(e(this._phl_holder[s])){switch(s){case"GPIO":new f.Gpio(this,t);break;case"ADC":new f.Adc(this,t);break;case"PWM":new f.Pwm(this,t);break;default:throw new MiMicException("Unknown peripheral symbol "+s)}}else{if(!e(t)){throw new MiMicException()}}return this._phl_holder[s]},registerPhl:function j(t,s){try{if(!e(this._phl_holder[s])){throw new MiMicException("Peripheral symbol "+s+" is already exist on mcu.")}this._phl_holder[s]=t}catch(u){throw new MiMicException(u)}}}}());(function(){var f=LPCXpresso1769;var d=f._BCF;var a=f._EE;var b=MiMicLib.isUndef;f.Memory=function e(g,h){if(!b(h)){this._base=h}this._mcu=g};f.Memory.prototype={_base:0,_mcu:null,read32:function c(){try{function o(i){if(i%4!=0){throw new MiMicException(a.INVALID_ARG,"An alignment is not 32bit unit.")}}var n="";var h=new Array();var p=arguments[0];switch(arguments.length){case 1:if(!isNaN(p)){o(p);n=d.READMEM;h.push(this._base+p)}else{for(var k=0;k<p.length;k++){o(p[k]);n+=d.getMem(this._base+p[k],h)}}break;case 2:o(p);o(arguments[1]);var g=arguments[1]/4;for(var k=0;k<g;k++){n+=d.READMEM;h.push(this._base+p+k*4)}break;default:break}var j=this._mcu.callMiMicWithCheck(n+d.END,h).stream;return j.length==1?j[0]:j}catch(m){throw new MiMicException(m)}}}}());(function(){var g=LPCXpresso1769;var f=g._BCF;var c=g._EE;var e=MiMicLib.isUndef;g.Peripheral=function(h,i,k){try{if(e(i)){throw new MiMicException(c.INVALID_PHL)}this._mcu=h;this._phl=i;if(!e(k)){this.setOpt(k)}}catch(j){throw new MiMicException(j)}};g.Peripheral.prototype={_PCLKSEL:[1074774440,1074774444],_PCONP:1074774212,_phl:null,_mcu:null,_cache:{pclk:0},BCF_setOpt:function a(k,h){try{var j="";if(!e(k.power)){if(this._phl[2]==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PCONP.")}j+=f.setBit(this._PCONP,1,k.power,this._phl[2],h)}if(!e(k.clock)){if(this._phl[0]==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PCLKSEL.")}this._cache.pclk=k.clock;j+=f.setBit(this._PCLKSEL[this._phl[0]],3,k.clock,this._phl[1],h)}return j}catch(i){throw new MiMicException(i)}},setOpt:function b(k){try{var h=new Array();var j=this.BCF_setOpt(k,h);if(j.length==0){throw new MiMicException("i_opt is empty or invalid.")}this._mcu.callMiMicWithCheck(j+f.END,h)}catch(i){throw new MiMicException(i)}return},getPCLK:function d(){try{var h=[4,1,2,0];var i=h[this._cache.pclk];var j;if(i==0){if(this._phl===g.PHL.CAN1||this._phl===g.PHL.CAN2){j=this._mcu.getClockInfo().cclk/6}else{j=this._mcu.getClockInfo().cclk/8}}else{j=this._mcu.getClockInfo().cclk/i}return Math.round(j)}catch(k){throw new MiMicException(k)}}}}());(function(){var g=LPCXpresso1769;var e=g._BCF;var c=g._EE;var d=MiMicLib.isUndef;g.Pin=function f(h,i,k){try{if(d(i)){throw new MiMicException(c.INVALID_PIN)}this._mcu=h;this._pininfo=g.getPinRegInfo(i);if(!d(k)){this.setOpt(k)}}catch(j){throw new MiMicException(j)}};g.Pin.prototype={_PINSEL:[1073922048,1073922052,1073922056,1073922060,1073922064,null,null,1073922240,null,1073922084,1073922088],_PINMODE:[1073922112,1073922116,1073922120,1073922124,1073922128,1073922132,1073922136,1073922140,null,1073922148],_PINMODE_OD:[1073922152,1073922156,1073922160,1073922164,1073922168],_pininfo:null,_mcu:null,BCF_setOpt:function a(k,h){try{var j="";if(!d(k.sel)){j+=e.setBit(this._PINSEL[this._pininfo.s],3,k.sel,this._pininfo.smb,h)}if(!d(k.mode)){if(this._pininfo.m==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PINMODE. pininfo.")}j+=e.setBit(this._PINMODE[this._pininfo.m],3,k.mode,this._pininfo.smb,h)}if(!d(k.od)){if(this._pininfo.o==null){throw new MiMicException(c.INVALID_CFG,"The pin does not support PINMODE_OD. pininfo.")}j+=e.setBit(this._PINMODE_OD[this._pininfo.o],1,k.od,this._pininfo.ob,h)}return j}catch(i){throw new MiMicException(i)}},setOpt:function b(k){try{var h=new Array();var j=this.BCF_setOpt(k,h);if(j.length==0){throw new MiMicException("i_opt is empty or invalid.")}this._mcu.callMiMicWithCheck(j+e.END,h)}catch(i){throw new MiMicException(i)}return}}}());(function(){var a=LPCXpresso1769;var k=a._BCF;var l=a._EE;var c=MiMicLib.isUndef;a.Adc=function b(m,r){try{this._mcu=m;this._phl=new a.Peripheral(m,a.PHL.ADC);var o=c(r)?{phl:{}}:{phl:c(r.phl)?{}:cloneAssoc(r.phl),};if(c(o.phl.power)){o.phl.power=1}var q="";var n=new Array();q+=this.BCF_setOpt(o,n);q+=k.setMem(this._AD0CR,2098176,n);q+=k.setMem(this._AD0CR,2163712,n);this._mcu.callMiMicWithCheck(q+k.END,n);this._mcu.registerPhl(this,"ADC")}catch(p){throw new MiMicException(p)}};a.Adc.prototype={_PHL_DEF:{power:1},_AD0CR:1073954816,_AD0DR:[1073954832,1073954836,1073954840,1073954844,1073954848,1073954852,1073954856,1073954860],_phl:null,_mcu:null,BCF_setOpt:function h(p,m){try{var o="";if(!c(p.phl)){o+=this._phl.BCF_setOpt(p.phl,m)}return o}catch(n){throw new MiMicException(n)}},BCF_setSel:function i(o,n,m){try{return k.setBit(this._AD0CR,1,n,o,m)}catch(p){throw new MiMicException(p)}},BCF_getAD0DR:function g(n,m){try{return k.getMem(this._AD0DR[n],m)}catch(o){throw new MiMicException(o)}},setOpt:function f(p){try{var m=new Array();var o=this.BCF_setOpt(p,m);this._mcu.callMiMicWithCheck(o+k.END,m)}catch(n){throw new MiMicException(n)}},getPin:function j(m,o){try{return new a.AdcPin(this,m,o)}catch(n){throw new MiMicException(n)}}};a.AdcPin=function d(m,o,q){try{this._adc=m;this._pin=new a.Pin(m._mcu,o);this._adinfo=function(v){var t=a.completePinFunctionName(v,"AD");var s=t.substring(2).split(".");var u={port:0,ch:parseInt(s[1]),pin_sel:a.getPinSelByFunctionName(v,t)};if(!isNaN(u.ch)){return u}throw new MiMicException(l.INVALID_CFG,"The pin has not AD fuction.")}(o);var n=c(q)?{pin:{}}:{pin:c(q.pin)?{}:cloneAssoc(q.pin)};n.sel=1;if(c(n.pin.sel)){n.pin.sel=this._adinfo.pin_sel}this.setOpt(n)}catch(p){throw new MiMicException(p)}};a.AdcPin.prototype={_adc:null,_pin:null,_adinfo:null,getValue:function e(){try{var m=new Array();var p=this._adc.BCF_getAD0DR(this._adinfo.ch,m);var n=this._adc._mcu.callMiMicWithCheck(p+k.END,m);return(n.stream[0]>>4)&4095}catch(o){throw new MiMicException(o)}},setOpt:function f(p){try{var o="";var m=new Array();if(!c(p.pin)){o+=this._pin.BCF_setOpt(p.pin,m)}if(!c(p.sel)){o+=this._adc.BCF_setSel(this._adinfo.ch,p.sel,m)}this._adc._mcu.callMiMicWithCheck(o+k.END,m);return}catch(n){throw new MiMicException(n)}}}}());(function(){var a=LPCXpresso1769;var n=a._BCF;var o=a._EE;var c=MiMicLib.isUndef;var h=MiMicLib.cloneAssoc;a.Gpio=function i(p,r){try{this._mcu=p;p.registerPhl(this,"GPIO")}catch(q){throw new MiMicException(q)}};a.Gpio.prototype={_FIO_DIR:[537509888,537509920,537509952,537509984,537510016],_FIO_PIN:[537509908,537509940,537509972,537510004,537510036],_FIO_SET:[537509912,537509944,537509976,537510008,537510040],_FIO_CLR:[537509916,537509948,537509980,537510012,537510044],_FIO_MASK:[537509904,537509936,537509968,537510000,537510032],_mcu:null,BCF_setDir:function k(r,q,s,p){try{return n.setBit(this._FIO_DIR[r],1,s,q,p)}catch(t){throw new MiMicException(t)}},BCF_setValue:function b(s,r,q,p){try{if(q){p.push(this._FIO_SET[s],this._FIO_MASK[s],~(1<<r))}else{p.push(this._FIO_CLR[s],this._FIO_MASK[s],~(1<<r))}return"EA00EA01EA02DF0201FB02ffffffffDF0200"}catch(t){throw new MiMicException(t)}},BCF_getValue:function d(r,q,p){try{p.push(this._FIO_PIN[r],this._FIO_MASK[r],~(1<<q));return"EA00EA01EA02DF0201DB0300EE03"}catch(s){throw new MiMicException(s)}},getPin:function j(p,r){try{return new a.GpioPin(this,p,r)}catch(q){throw new MiMicException(q)}}};a.GpioPin=function l(q,r,t){try{this._gpio=q;this._pin=new a.Pin(q._mcu,r);this._gpioinfo=function(x){var v=a.completePinFunctionName(x,"GPIO");var u=v.substring(4).split(".");var w={port:parseInt(u[0]),bit:parseInt(u[1]),pin_sel:a.getPinSelByFunctionName(x,v)};if(!isNaN(w.port)&&!isNaN(w.bit)){return w}throw new MiMicException(o.INVALID_CFG,"The pin has not GPIO fuction.")}(r);var p=c(t)?{pin:{}}:{dir:t.dir,pin:c(t.pin)?{}:h(t.pin)};if(c(p.pin.sel)){p.pin.sel=this._gpioinfo.pin_sel}this.setOpt(p)}catch(s){throw new MiMicException(s)}};a.GpioPin.prototype={_gpio:null,_pin:null,_gpioinfo:null,setOpt:function g(s){try{var r="";var p=new Array();if(!c(s.dir)){r+=this._gpio.BCF_setDir(this._gpioinfo.port,this._gpioinfo.bit,s.dir,p)}if(!c(s.pin)){r+=this._pin.BCF_setOpt(s.pin,p)}this._gpio._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},setValue:function e(q){try{var s="";var p=new Array();s+=this._gpio.BCF_setValue(this._gpioinfo.port,this._gpioinfo.bit,q,p);this._gpio._mcu.callMiMicWithCheck(s+n.END,p)}catch(r){throw new MiMicException(r)}},getValue:function f(){try{var s="";var p=new Array();s+=this._gpio.BCF_getValue(this._gpioinfo.port,this._gpioinfo.bit,p);var q=this._gpio._mcu.callMiMicWithCheck(s+n.END,p);return(q.stream[0]>>this._gpioinfo.bit)&1}catch(r){throw new MiMicException(r)}},outPatt:function m(q){try{var t="";var p=new Array();for(var r=0;r<q.length;r++){t+=this._gpio.BCF_setValue(this._gpioinfo.port,this._gpioinfo.bit,q[r],p)}this._gpio._mcu.callMiMicWithCheck(t+n.END,p)}catch(s){throw new MiMicException(s)}},}}());(function(){var a=LPCXpresso1769;var n=a._BCF;var o=a._EE;var b=MiMicLib.isUndef;var g=MiMicLib.cloneAssoc;a.Pwm=function d(p,u){try{this._mcu=p;this._phl=new a.Peripheral(p,a.PHL.PWM1);var r=b(u)?{phl:{}}:{phl:b(u.phl)?{}:g(u.phl),freq:u.freq};if(b(r.phl.power)){r.phl.power=1}if(b(r.phl.clock)){r.phl.clock=0}if(b(r.freq)){r.freq=100}var t="";var q=new Array();t+=this.BCF_setOpt(r,q);t+=n.setMem(this._PC,0,q);t+=n.setMem(this._PCR,0,q);t+=n.setMem(this._CTCR,0,q);t+=n.setMem(this._TCR,0,q);t+=n.setMem(this._TC,0,q);t+=n.setMem(this._TCR,9,q);this._mcu.callMiMicWithCheck(t+n.END,q);this._mcu.registerPhl(this,"PWM")}catch(s){throw new MiMicException(s)}};a.Pwm.prototype={_cache:{mr0:0},_TCR:1073840132,_TC:1073840136,_PR:1073840140,_PC:1073840144,_MCR:1073840152,_PCR:1073840204,_LER:1073840208,_CTCR:1073840240,_MRn:[1073840152,1073840156,1073840160,1073840164,1073840192,1073840196,1073840200],_phl:null,_mcu:null,BCF_setOpt:function h(u,p){try{var t="";var r;var q;if(!b(u.phl)){t+=this._phl.BCF_setOpt(u.phl,p)}if(!b(u.freq)){q=Math.round(this._phl.getPCLK()/u.freq);if(q<=0){throw new MiMicException("The peripheral clock too small.")}t+=this.BCF_setMRn(0,q,p);t+=this.BCF_setLER(0,p);this._cache.mr0=q}return t}catch(s){throw new MiMicException(s)}},BCF_setLER:function e(q,p){return n.setBit(this._LER,1,1,q,p)},BCF_setMRn:function j(r,q,p){try{return n.setMem(this._MRn[r],q,p)}catch(s){throw new MiMicException(s)}},BCF_setMRnByDuty:function m(q,r,p){try{return this.BCF_setMRn(q,Math.round(r*this._cache.mr0),p)}catch(s){throw new MiMicException(s)}},BCF_setPCRbit:function l(u,r,s,q){try{var p,t;p=t=0;if(!b(r)){t|=r;p|=1}if(!b(s)){t|=(s<<8);p|=256}return n.setBit(this._PCR,p,t,u,q)}catch(w){throw new MiMicException(w)}},setOpt:function f(s){try{var p=new Array();var r=this.BCF_setOpt(s,p);this._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},getPin:function i(p,r){try{return new a.PwmPin(this,p,r)}catch(q){throw new MiMicException(q)}}};a.PwmPin=function k(p,r,t){try{this._pwm=p;this._pin=new a.Pin(p._mcu,r);this._pwminfo=function(x){var v=a.completePinFunctionName(x,"PWM");var u=v.substring(2).split(".");var w={port:0,ch:parseInt(u[1]),pin_sel:a.getPinSelByFunctionName(x,v)};if(!isNaN(w.ch)){return w}throw new MiMicException(o.INVALID_CFG,"The pin has not PWM fuction.")}(r);var q=b(t)?{pin:{}}:{pin:b(t.pin)?{}:g(t.pin),duty:t.duty,enable:t.enable};if(b(q.pin.sel)){q.pin.sel=this._pwminfo.pin_sel}if(b(q.duty)){q.duty=0}if(b(q.enable)){q.enable=1}this.setOpt(q)}catch(s){throw new MiMicException(s)}};a.PwmPin.prototype={_pwm:null,_pin:null,_pwminfo:null,BCF_setOpt:function h(s,p){try{var r="";if(!b(s.pin)){r+=this._pin.BCF_setOpt(s.pin,p)}if(!b(s.enable)){r+=this._pwm.BCF_setPCRbit(this._pwminfo.ch,0,s.enable,p)}if(!b(s.duty)){r+=this._pwm.BCF_setMRnByDuty(this._pwminfo.ch,s.duty,p);r+=this._pwm.BCF_setLER(this._pwminfo.ch,p)}return r}catch(q){throw new MiMicException(q)}},setOpt:function f(s){try{var p=new Array();var r=this.BCF_setOpt(s,p);this._pwm._mcu.callMiMicWithCheck(r+n.END,p)}catch(q){throw new MiMicException(q)}},setDuty:function c(p){try{this.setOpt({duty:p})}catch(q){throw new MiMicException(q)}}}}());(function(){var f=LPCXpresso1769;var e=f._BCF;var a=f._EE;var d=MiMicLib.isUndef;f.Ni=function c(g){try{this._mcu=g}catch(h){throw new MiMicException(h)}};f.Ni.prototype={call:function b(j,q,p){var n="";var r=new Array();if(!d(q)){for(var l=0;l<8;l++){var k="wm"+l;if(!d(q[k])){n+="FB"+MiMicLib.hexout(l,2)+MiMicLib.hexout(q[k],8)}}if(!d(q.stream)){for(var l=0;l<q.stream.length;l++){r.push(q.stream[l])}}}n+="ZF"+MiMicLib.hexout(j,8);var g=0;if(!d(p)){for(var l=0;l<8;l++){if(!d(p["wm"+l])){n+="EE"+MiMicLib.hexout(l,2);g++}}}var m=this._mcu.callMiMic(n+e.END,r);if(m.result!=0){return false}var o=0;if(!d(p)){var h=m.stream.length-g;for(var l=0;l<8;l++){var k="wm"+l;if(!d(p[k])){p[k]=m.stream[h];h++}}if(!d(p.stream)){p.stream=m.stream.slice(0,m.stream.length-g)}}return false}}}());
\ No newline at end of file