NagaokaRoboticsClub_mbedTeam / FEP_TX22

Dependents:   2022_FEPTX-PS4 2022_FEPTX-TokiPS4

Files at this revision

API Documentation at this revision

Comitter:
piroro4560
Date:
Thu Oct 06 08:06:20 2022 +0000
Parent:
0:729795414ebd
Commit message:
add datalen

Changed in this revision

FEP_TX22.cpp Show annotated file Show diff for this revision Revisions of this file
FEP_TX22.h Show annotated file Show diff for this revision Revisions of this file
--- a/FEP_TX22.cpp	Wed Oct 05 01:05:52 2022 +0000
+++ b/FEP_TX22.cpp	Thu Oct 06 08:06:20 2022 +0000
@@ -2,7 +2,7 @@
  *  @file   FEP_TX22.cpp
  *  @brief  送信用FEPライブラリ
  *  @author 安澤瑠
- *  @date   22/10/4
+ *  @date   22/10/6
  */
 #include "FEP_TX22.h"
 
@@ -12,16 +12,17 @@
     addr     = addr_;
 }
 
-int8_t FEP_TX22::SendData(uint8_t *data)
+int8_t FEP_TX22::SendData(uint8_t *data, uint8_t datalen)
 {
     uint8_t sendindex; // index of 'data'
-    printf("@TBN%03d%03d", addr, DATANUM); // send comand
-    for (sendindex=0; sendindex<DATANUM; sendindex++) { 
+    printf("@TBN%03d%03d", addr, datalen); // send comand
+    for (sendindex=0; sendindex<datalen; sendindex++) { 
         putc(data[sendindex]); // 
     }
     printf("\r\n"); // <cr><lf>
     return 0;
 //    return GetResponse();
+//    他にgetc()をループさせている場合に不具合確認
 }
 
 int8_t FEP_TX22::GetResponse()
--- a/FEP_TX22.h	Wed Oct 05 01:05:52 2022 +0000
+++ b/FEP_TX22.h	Thu Oct 06 08:06:20 2022 +0000
@@ -2,18 +2,16 @@
  *  @file   FEP_TX22.h
  *  @brief  送信用FEPライブラリ
  *  @author 安澤瑠
- *  @date   22/10/4
+ *  @date   22/10/6
  */
 #ifndef FEP_TX22_H
 #define FEP_TX22_H
 
 #include "mbed.h"
 
-#define DATANUM 9 // ボタン(BusIn)が1 + スティックが4 2021FEP_TX22のcontroller.hと連携していないとダメ
-
 /**
- *  @class  class for 2021FEP_TX22 using FEP-01, FEP-02
- *  @note  mbed-os 6 では使えません。  Not compatible with mbed-os 6
+ *  @class class for FEP using FEP-01, FEP-02
+ *  @note  RawSerialクラスを使用しているため mbed-os 6 では使えません。  Not compatible with mbed-os 6
  */
 class FEP_TX22 : public RawSerial {
 public :
@@ -36,20 +34,21 @@
      *  @return 4  通信相手が受け取りに失敗
      *  @return -1 可否不明
      */
-    int8_t SendData(uint8_t *data);
+    int8_t SendData(uint8_t *data, uint8_t datalen);
 
-    /** Response acquisition function
+    /** Get response
      *  @return 0  通信成功
      *  @return 2  コマンドエラー
      *  @return 3  通信相手からのレスポンス無し
      *  @return 4  通信相手が受け取りに失敗
      *  @return -1 可否不明
+     *  @note getc()を他のループで回している場合に不具合確認 SerialArduinoと共存不可
      */
     int8_t GetResponse();
 
 private :
 
-    uint8_t addr;         //! 通信相手のアドレス
+    uint8_t addr;  //! 通信相手のアドレス
 };
 
 #endif
\ No newline at end of file