受信割り込みバージョン

Dependents:   a_team_R1370 ashimawari_sample_test 2022NHK_A_ashimawari 2022A_NHK_kikou

Revision:
3:2f00371553c1
Parent:
1:b6f5a4994a84
Child:
4:ffc2a55269f9
--- a/R1370.h	Fri Aug 24 05:39:24 2018 +0000
+++ b/R1370.h	Wed Dec 19 07:44:20 2018 +0000
@@ -1,37 +1,18 @@
 #ifndef R1370_H
 #define R1370_H
 
-/**
- * Includes
- */
 #include "mbed.h"
 #include <vector>
 
-/**
- * Defines
- */
 #define R1370_BUFFER_SIZE 15
 #define R1370_HEADER0 0xAA
 #define R1370_HEADER1 0x00
 
-/**
- * R1370 sensor module
- * sample code is here https://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/R1370sample/
- */
 class R1370 : public RawSerial
 {
 public :
-    /**
-     * Constructor.
-     *
-     * set 2pins for UART
-     *
-     * @param tx - TXpin for UART
-     * @param rx - RXpin for UART
-     */
     R1370(PinName tx, PinName rx);
 
-    //Getters.
     float getAngle();
     float getRate();
     int16_t getAcc(char l);
@@ -40,20 +21,27 @@
     int16_t getAccY();
     int16_t getAccZ();
     
+    unsigned char upbit();
+    unsigned char downbit();
+    
     
 private :
     void receiveByte();
+    void checkData();
     void assembleLoop();
     void assemble();
     
-    Thread thread;
-    std::vector<unsigned char> buf;
-    
     uint8_t index;
     int16_t angle;
     int16_t rate;
     int16_t acc[3];
     uint8_t reserved;
+    uint8_t buffer[R1370_BUFFER_SIZE];
+    uint8_t data[R1370_BUFFER_SIZE-3];
+    uint8_t bufferPoint;
+    uint8_t receivedBytes;
+    
+    unsigned char upbit_, downbit_;
 };
 
 #endif
\ No newline at end of file