• R/O
  • HTTP
  • SSH
  • HTTPS

MiMicSDK: Commit

MiMicSDK


Commit MetaInfo

Revisionae90363045b102dc308a48fb9ae99e3522592170 (tree)
Zeit2014-07-04 20:27:13
Autornyatla <nyatla@4719...>
Commiternyatla

Log Message

ドキュメントの修正

git-svn-id: http://svn.osdn.jp/svnroot/mimic/trunk@383 47198e57-cb75-475f-84c4-a814cd6f29e0

Ändern Zusammenfassung

Diff

--- a/misc/mbedJS/mbddJS.API/mbedJS.jsdoc.xml
+++ b/misc/mbedJS/mbddJS.API/mbedJS.jsdoc.xml
@@ -26,6 +26,10 @@
2626 <source file="${SRC_ROOT}\mbed.SPISlave.js" />
2727 <source file="${SRC_ROOT}\mbed.types.js" />
2828 <source file="${SRC_ROOT}\MiMicCore.js" />
29+ <source file="${SRC_ROOT}\mbed.Memory.js" />
30+ <source file="${SRC_ROOT}\mbed.Serial.js" />
31+ <source file="${SRC_ROOT}\mbed.I2C.js" />
32+ <source file="${SRC_ROOT}\mbed.I2CSlave.js" />
2933 </jsdoctoolkit>
3034 </target>
3135 </project>
--- a/misc/mbedJS/mbddJS.API/mbedJS/MiMicCore.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/MiMicCore.js
@@ -18,7 +18,7 @@ var MiMicJS={};
1818 * 配列要素、又は値がすべてInt値でない場合に例外を起こします。
1919 * @name MiMicJS.assertInt
2020 * @function
21- * @params {[array]} v
21+ * @param {[array]} v
2222 * テストする配列
2323 */
2424 NS.assertInt=function assertInt(v){
@@ -36,7 +36,7 @@ var MiMicJS={};
3636 * 配列要素、、又は値がすべて数値でない場合に例外を起こします。
3737 * @name MiMicJS.assertNumber
3838 * @function
39- * @params {[array]} v
39+ * @param {[array]} v
4040 * テストする配列
4141 */
4242 NS.assertNumber=function assertNumber(v){
@@ -197,6 +197,8 @@ var MiMicJS={};
197197 };
198198 /**
199199 * ByteArrayをBinarayStringに変換します。
200+ * @name MiMicJS.byteArray2bstr
201+ * @function
200202 * @param v
201203 * @return {String}
202204 */
@@ -212,6 +214,8 @@ var MiMicJS={};
212214 /**
213215 * UInt32ArrayをBinarayStringに変換します。
214216 * 出力はLittleEndianの配列です。
217+ * @name MiMicJS.uintArray2bstr
218+ * @function
215219 * @param v
216220 * UInt32の配列
217221 * @return {String}
--- a/misc/mbedJS/mbddJS.API/mbedJS/mbed.I2C.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/mbed.I2C.js
@@ -52,37 +52,72 @@ var MI=MiMicJS;
5252 * <p>
5353 * @return {mbedJS.I2C}
5454 * @example //Callback
55+ * var st=0;
5556 * var mcu=new mbedJS.Mcu("192.168.128.39",
5657 * {
5758 * onNew:function(){
58- * var pin=new mbedJS.I2C(mcu,mbedJS.PinName.A0,{
59+ * var i2c=new mbedJS.I2C(mcu,[mbedJS.PinName.p28,mbedJS.PinName.p27],{
5960 * onNew:function(){
60- * pin.read();
61+ * i2c.frequency(100000);
6162 * },
62- * onRead:function(v)
63+ * onFrequency:function()
6364 * {
64- * pin.read_u16();
65+ * i2c.start();
6566 * },
66- * onRead_u16:function(v){
67+ * onStart:function(){
68+ * st=0;
69+ * i2c.write(1);
70+ * },
71+ * onWrite:function(v){
72+ * if(st==0){
73+ * i2c.write(0,[1,2,3],false);
74+ * st++;
75+ * }else{
76+ * i2c.read(1);
77+ * st=0;
78+ * }
79+ * },
80+ * onRead:function(v){
81+ * if(st==0){
82+ * i2c.read(1,2,false);
83+ * st++;
84+ * }else{
85+ * i2c.stop();
86+ * }
87+ * },
88+ * onStop:function(){
6789 * mcu.close();
68- * }});
90+ * }
91+ * });
92+ * },
93+ * onClose:function(){
6994 * },
70- * onClose:function(){},
71- * onError:function(){}
95+ * onError:function(){
96+ * alert("Error");
97+ * }
7298 * });
7399 * @example //Generator
74100 * var g=function*(){
75101 * try{
102+ * var v;
76103 * var mcu=new mbedJS.Mcu("192.168.128.39",g);
77104 * yield mcu.waitForNew();
78- * var pin=new mbedJS.I2C(mcu,mbedJS.PinName.A0,g);
79- * yield pin.waitForNew();
80- * var v=yield pin.read();
81- * v=yield pin.read_u16();
105+ * var i2c=new mbedJS.I2C(mcu,[mbedJS.PinName.p28,mbedJS.PinName.p27],g);
106+ * yield i2c.waitForNew();
107+ * yield i2c.frequency(100000);
108+ * yield i2c.start();
109+ * yield i2c.write(1);
110+ * yield i2c.write(0,[1,2,3],false);
111+ * yield i2c.read(1);
112+ * yield i2c.read(1,2,false);
113+ * yield i2c.stop();
82114 * yield mcu.close();
83115 * }catch(e){
84116 * mcu.shutdown();
85- * }}();
117+ * alert(e);
118+ * throw e;
119+ * }
120+ * }();
86121 * g.next();
87122 */
88123 var CLASS=function I2C(i_mcu,i_params,i_handler)
--- a/misc/mbedJS/mbddJS.API/mbedJS/mbed.I2CSlave.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/mbed.I2CSlave.js
@@ -60,35 +60,77 @@ var MI=MiMicJS;
6060 * var mcu=new mbedJS.Mcu("192.168.128.39",
6161 * {
6262 * onNew:function(){
63- * var pin=new mbedJS.I2CSlave(mcu,mbedJS.PinName.A0,{
63+ * var i2c=new mbedJS.I2CSlave(mcu,[mbedJS.PinName.p28,mbedJS.PinName.p27],{
6464 * onNew:function(){
65- * pin.read();
65+ * i2c.frequency(100000);
6666 * },
67- * onRead:function(v)
67+ * onFrequency:function()
6868 * {
69- * pin.read_u16();
69+ * i2c.address(1);
7070 * },
71- * onRead_u16:function(v){
71+ * onAddress:function()
72+ * {
73+ * i2c.receive();
74+ * },
75+ * onReceive:function(){
76+ * st=0;
77+ * i2c.write(1);
78+ * },
79+ * onWrite:function(v){
80+ * if(st==0){
81+ * i2c.write([1,2,3]);
82+ * st++;
83+ * }else{
84+ * i2c.read();
85+ * st=0;
86+ * }
87+ * },
88+ * onRead:function(v){
89+ * if(st==0){
90+ * i2c.read(2,false);
91+ * st++;
92+ * }else{
93+ * log("[PASS]onRead:"+v.ret+":"+v.data);
94+ * i2c.stop();
95+ * }
96+ * },
97+ * onStop:function(){
7298 * mcu.close();
73- * }});
99+ * }
100+ * });
74101 * },
75- * onClose:function(){},
76- * onError:function(){}
102+ * onClose:function(){
103+ * },
104+ * onError:function(){
105+ * alert("Error");
106+ * }
77107 * });
78108 * @example //Generator
79109 * var g=function*(){
80110 * try{
81- * var mcu=new mbedJS.Mcu("192.168.128.39",g);
82- * yield mcu.waitForNew();
83- * var pin=new mbedJS.I2CSlave(mcu,mbedJS.PinName.A0,g);
84- * yield pin.waitForNew();
85- * var v=yield pin.read();
86- * v=yield pin.read_u16();
87- * yield mcu.close();
111+ * var v;
112+ * var mcu=new mbedJS.Mcu("192.168.128.39",g);
113+ * yield mcu.waitForNew();
114+ * var i2c=new mbedJS.I2CSlave(mcu,[mbedJS.PinName.p28,mbedJS.PinName.p27],g);
115+ * yield i2c.waitForNew();
116+ * yield i2c.frequency(100000);
117+ * yield i2c.address(1);
118+ * v=yield i2c.receive();
119+ * v=yield i2c.write(1);
120+ * v=yield i2c.write([1,2,3]);
121+ * v=yield i2c.read();
122+ * v=yield i2c.read(2,false);
123+ * log("[PASS]onRead:"+v.ret+":"+v.data);
124+ * yield i2c.stop();
125+ * yield mcu.close();
88126 * }catch(e){
89- * mcu.shutdown();
90- * }}();
127+ * mcu.shutdown();
128+ * alert(e);
129+ * throw e;
130+ * }
131+ * }();
91132 * g.next();
133+ * return;
92134 */
93135 var CLASS=function I2CSlave(i_mcu,i_params,i_handler)
94136 {
@@ -115,6 +157,11 @@ CLASS.prototype=
115157 {
116158 /** @private */
117159 RPC_NS:"mbedJS:I2CSlave",
160+ /**
161+ * mbedJS.Serial#receiveの戻り値の種類です。
162+ * NoData,ReadAddressed,WriteGeneral,WriteAddressedがあります。
163+ * @name mbedJS.I2CSlave#RxStatus
164+ */
118165 RxStatus:{
119166 NoData:0,ReadAddressed:1,WriteGeneral:2,WriteAddressed:3},
120167 /** @private 最後にコールしたAPIです。*/
--- a/misc/mbedJS/mbddJS.API/mbedJS/mbed.Mcu.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/mbed.Mcu.js
@@ -45,10 +45,22 @@ var MI=MiMicJS;
4545 * var mcu=new mbedJS.Mcu("192.168.128.39",
4646 * {
4747 * onNew:function(){
48+ * mcu.getInfo();
49+ * },
50+ * onGetInfo:function(v){
51+ * log("[PASS]onGetInfo:"+v.version+","+v.platform+","+v.mcu.name+","+v.mcu.eth+","+v.memory.free);
52+ * var pin=new mbedJS.DigitalIn(mcu,mbedJS.PinName.P0_22,{
53+ * onNew:function(){
54+ * mcu.disposeObject(pin._oid);
55+ * }});
56+ * },
57+ * onDisposeObject:function(v){
58+ * mcu.close();
4859 * },
4960 * onClose:function(){
5061 * },
5162 * onError:function(){
63+ * alert("Error");
5264 * }
5365 * });
5466 * @example //Generator
@@ -180,7 +192,7 @@ CLASS.prototype=
180192 },
181193 /**
182194 * Mcuの情報を返します。
183- * @name mbedJS.Mcu#rpc
195+ * @name mbedJS.Mcu#getInfo
184196 * @function
185197 * @return {HashMap}
186198 * 情報を格納した連想配列です。
--- a/misc/mbedJS/mbddJS.API/mbedJS/mbed.Memory.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/mbed.Memory.js
@@ -44,7 +44,121 @@ var MI=MiMicJS;
4444 * <p>
4545 * @return {mbedJS.Memory}
4646 * @example //Callback
47+ * var s=0;
48+ * var mcu=new mbedJS.Mcu("192.168.128.39",
49+ * {
50+ * onNew:function(){
51+ * var mem=new mbedJS.Memory(mcu,{
52+ * onNew:function(){
53+ * s=0;
54+ * mem.write(0x20080000,1);
55+ * },
56+ * onWrite:function(){
57+ * log("[PASS]onWrite:"+s);
58+ * switch(s){
59+ * case 0:
60+ * mem.read(0x20080000,1);
61+ * break;
62+ * case 1:
63+ * mem.read(0x20080001,1);
64+ * break;
65+ * case 2:
66+ * mem.read(0x20080000,8);
67+ * break;
68+ * }
69+ * },
70+ * onRead:function(v){
71+ * log("[PASS]onRead:"+s);
72+ * switch(s){
73+ * case 0:
74+ * mem.write(0x20080001,[2]);
75+ * break;
76+ * case 1:
77+ * mem.write(0x20080004,[10,20,30]);
78+ * break;
79+ * case 2:
80+ * mem.write32(0x20080000,0xff);
81+ * s=-1;
82+ * }
83+ * s++;
84+ * },
85+ * onWrite32:function(){
86+ * log("[PASS]onWrite32:"+s);
87+ * switch(s){
88+ * case 0:
89+ * mem.read32(0x20080000);
90+ * break;
91+ * case 1:
92+ * mem.read32(0x20080004,4);
93+ * break;
94+ * case 2:
95+ * mem.read32(0x20080000,16);
96+ * break;
97+ * }
98+ * },
99+ * onRead32:function(v){
100+ * log("[PASS]onRead32:"+s);
101+ * switch(s){
102+ * case 0:
103+ * mem.write32(0x20080004,[2]);
104+ * break;
105+ * case 1:
106+ * mem.write32(0x20080004,[10,20,30]);
107+ * break;
108+ * case 2:
109+ * mcu.close();
110+ * }
111+ * s++;
112+ * }
113+ * });
114+ * },
115+ * onClose:function(){
116+ * log("[PASS]onClose");
117+ * },
118+ * onError:function(){
119+ * alert("Error");
120+ * }
121+ * });
47122 * @example //Generator
123+ * var g=function*(){
124+ * try{
125+ * var v;
126+ * var mcu=new mbedJS.Mcu("192.168.128.39",g);
127+ * yield mcu.waitForNew();
128+ * var mem=new mbedJS.Memory(mcu,g);
129+ * yield mem.waitForNew();
130+ * yield mem.write(0x20080000,1);
131+ * log("[PASS]onWrite:");
132+ * v=yield mem.read(0x20080000,1);
133+ * log("[PASS]onRead:"+v);
134+ * v=yield mem.read(0x20080001,1);
135+ * log("[PASS]onRead:"+v);
136+ * v=yield mem.read(0x20080000,8);
137+ * log("[PASS]onRead:"+v);
138+ * yield mem.write(0x20080001,[2]);
139+ * log("[PASS]onWrite:");
140+ * yield mem.write(0x20080004,[10,20,30]);
141+ * log("[PASS]onWrite:");
142+ * yield mem.write32(0x20080000,0xff);
143+ * log("[PASS]onWrite32:");
144+ * v=yield mem.read32(0x20080000);
145+ * log("[PASS]onRead32:"+v);
146+ * v=yield mem.read32(0x20080004,4);
147+ * log("[PASS]onRead32:"+v);
148+ * v=yield mem.read32(0x20080000,16);
149+ * log("[PASS]onRead32:"+v);
150+ * yield mem.write32(0x20080004,[2]);
151+ * log("[PASS]onWrite32:");
152+ * yield mem.write32(0x20080004,[10,20,30]);
153+ * log("[PASS]onWrite32:");
154+ * mcu.close();
155+ * }catch(e){
156+ * mcu.shutdown();
157+ * alert(e);
158+ * throw e;
159+ * }
160+ * }();
161+ * g.next();
48162 */
49163 var CLASS=function Memory(i_mcu,i_handler)
50164 {
--- a/misc/mbedJS/mbddJS.API/mbedJS/mbed.Serial.js
+++ b/misc/mbedJS/mbddJS.API/mbedJS/mbed.Serial.js
@@ -73,7 +73,74 @@ var MI=MiMicJS;
7373 * <p>
7474 * @return {mbedJS.Serial}
7575 * @example //Callback
76+ * var mcu=new mbedJS.Mcu("192.168.128.39",
77+ * {
78+ * onNew:function(){
79+ * var uart=new mbedJS.Serial(mcu,[mbedJS.PinName.p9,mbedJS.PinName.p10],{
80+ * onNew:function(){
81+ * uart.baud(115200);
82+ * },
83+ * onBaud:function()
84+ * {
85+ * uart.send_break();
86+ * },
87+ * onSend_break:function(){
88+ * uart.format(8,uart.Parity.None,1);
89+ * },
90+ * onFormat:function(){
91+ * uart.readable();
92+ * },
93+ * onReadable:function(v){
94+ * uart.writeable();
95+ * },
96+ * onWriteable:function(v){
97+ * uart.putc(32);
98+ * },
99+ * onPutc:function(v){
100+ * uart.getc();
101+ * },
102+ * onGetc:function(v){
103+ * uart.puts("1234");
104+ * },
105+ * onPuts:function(v){
106+ * uart.gets(5);
107+ * },
108+ * onGets:function(v){
109+ * mcu.close();
110+ * }
111+ * });
112+ * },
113+ * onClose:function(){
114+ * },
115+ * onError:function(){
116+ * alert("Error");
117+ * }
118+ * });
76119 * @example //Generator
120+ * var g=function*(){
121+ * try{
122+ * var v;
123+ * var mcu=new mbedJS.Mcu("192.168.128.39",g);
124+ * yield mcu.waitForNew();
125+ * var uart=new mbedJS.Serial(mcu,[mbedJS.PinName.p9,mbedJS.PinName.p10],g);
126+ * yield uart.waitForNew();
127+ * yield uart.baud(115200);
128+ * yield uart.send_break();
129+ * yield uart.format(8,uart.Parity.None,1);
130+ * v=yield uart.readable();
131+ * v=yield uart.writeable();
132+ * v=yield uart.putc(32);
133+ * v=yield uart.getc();
134+ * v=yield uart.puts("1234");
135+ * v=yield uart.gets(5);
136+ * yield mcu.close();
137+ * }catch(e){
138+ * mcu.shutdown();
139+ * alert(e);
140+ * throw e;
141+ * }
142+ * }();
143+ * g.next();
77144 */
78145 var CLASS=function Serial(i_mcu,i_params,i_handler)
79146 {
@@ -101,10 +168,10 @@ CLASS.prototype=
101168 /** @private */
102169 RPC_NS:"mbedJS:Serial",
103170 /**
104- * @namespace
105- * @name mbedJS.Serial#Parity
106171 * mbedJS.Serial#format関数に指定する値の種類です。
107172 * None,Odd,Even,Forced1,Forced0があります。
173+ * @name mbedJS.Serial#Parity
174+ * @field
108175 */
109176 Parity:{
110177 None:0,Odd:1,Even:2,Forced1:3,Forced0:4
--- a/misc/mbedJS/mbddJS.API/test.MCU.html
+++ b/misc/mbedJS/mbddJS.API/test.MCU.html
@@ -57,10 +57,15 @@ function sync()
5757 {
5858 var g=function*(){
5959 try{
60-log(1);
60+log();
6161 var mcu=new mbedJS.Mcu("192.168.128.39",g);
6262 log(2);
63+var v;
6364 yield mcu.waitForNew();
65+ v=yield mcu.disposeObject(0);
66+ log(v);
67+ v=yield mcu.getInfo();
68+ log("[PASS]onGetInfo:"+v.version+","+v.platform+","+v.mcu.name+","+v.mcu.eth+","+v.memory.free);
6469 yield mcu.close();
6570 log(3);
6671 }catch(e){
Show on old repository browser