Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: receives_robot_wheel
Revision 1:e808dd01f134, committed 2014-10-05
- Comitter:
- bousiya03
- Date:
- Sun Oct 05 01:00:00 2014 +0000
- Parent:
- 0:fbf5705f90cc
- Commit message:
- test
Changed in this revision
| serial_extend.cpp | Show annotated file Show diff for this revision Revisions of this file |
| serial_extend.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r fbf5705f90cc -r e808dd01f134 serial_extend.cpp
--- a/serial_extend.cpp Sat Oct 04 12:19:26 2014 +0000
+++ b/serial_extend.cpp Sun Oct 05 01:00:00 2014 +0000
@@ -83,7 +83,7 @@
}
- void serial_extend::TX(void){//送信バッファ空き割り込み用関数
+ void serial_extend::TX(void){
if(__stop_write==1){return;}
@@ -97,16 +97,16 @@
txData[k] = __writeData[k-1];
}
- //送るデータ = センサ等のデータ
+
for(i=KEY+1, tx_checkcode=0; i<__writeSize+1; i++){
tx_checkcode ^= txData[i];
- }//CHECKCODE作成
+ } //CHECKCODE
txData[__writeSize+1] = tx_checkcode;
tx=0;
}
__serial__.putc(txData[tx]);
tx++;
- }//受信割り込み用関数
+ }
void serial_extend::RX(void){
@@ -125,7 +125,7 @@
if(rx==__readSize+1){
for(i=KEY+1, rx_checkcode=0; i<__readSize+1; i++){
rx_checkcode ^= rxData[i];
- }//CHECKCODE作成
+ } //CHECKCODE
}
if(rx >= __readSize+2){
@@ -135,7 +135,7 @@
__readData[m-1] = rxData[m];
}
- //使うデータ = 受け取ったデータ
+
}
rx=0;
}
diff -r fbf5705f90cc -r e808dd01f134 serial_extend.h
--- a/serial_extend.h Sat Oct 04 12:19:26 2014 +0000
+++ b/serial_extend.h Sun Oct 05 01:00:00 2014 +0000
@@ -1,11 +1,9 @@
/*
- *mbed array data serial Library
- *This comment is available in Japanese only
- */
-
+ * array data transmission and reception library
+ */
-#ifndef serial_extend_H
-#define serial_extend_H
+#ifndef SERIAL_EXTEND_H
+#define SERIAL_EXTE_H
#include "mbed.h"
@@ -15,23 +13,26 @@
#define MAX_DATA_NUM 10
#define KEY 0//number of first data
-/** 多バイト通信用クラス
+/** array data transmission and reception class
*
* Example:
* @code
* #include"mbed.h"
- * #include"serial_extend.h"
- * BusOut check(LED3,LED4);
-
+ * #include"serial_extend.h"
+ * #define KEYCODE 0x0A
+ *
+ * BusOut check(LED3,LED4);
+ *
* uint8_t send_data[2]={0,0xF};
* uint8_t get_data[2];
+ *
* serial_extend send(p9,p10);
* serial_extend get(p28,p27);
*
* int main(){
*
- * send.write(send_data,0x0A);
- * get.read(get_data,0x0A);
+ * send.write(send_data,KEYCODE);
+ * get.read(get_data,KEYCODE);
* for(int i=1;;i++){
*
* check = get_data[i];
@@ -56,42 +57,43 @@
public:
- /** 多バイト通信用オブジェクト作成 Serialにそのままつなげるよ
+ /** Create a serial_extend object onnected to the specified serial pin
*
* @param tx Serial tx pin
* @param rx Serial rx pin
- * @param state 通信方向 read,write,both
*/
serial_extend(PinName tx,PinName rx);
- /**データ読み込みするよ
+ /**reception data
*
- * @param readData 読み込み先の配列アドレス
- * @param readKey 多バイト通信のキーコード
+ * @param readData array address
+ * @param readKey KEYCODE
*/
void read_data(uint8_t* readData,uint8_t readKey);
- /**データカキコするよ
+ /**send data
*
- * @param writeData 送るデーターの配列アドレス
- * @param writeKey 多バイト通信のキーコード
+ * @param writeData array address
+ * @param writeKey KEYCODE
*/
void write_data(uint8_t* writeData,uint8_t writeKey);
- /**送信割り込み用関数
+ /**transmit interrupt
*
*@param none
*/
void TX(void);
- /**受信割り込み用関数
+
+ /**receive interrupt
*
*@param none
*/
void RX(void);
+
void start_read();
void stop_read();