GPS module (GYSFDMAXB) 57600 bps
Dependents: HAPS_GPS_Test_0002
Revision 5:0983cd1d7183, committed 2021-04-23
- Comitter:
- cocorlow
- Date:
- Fri Apr 23 11:43:26 2021 +0000
- Parent:
- 4:8d315f7977b3
- Commit message:
- 16 -> 64
Changed in this revision
GYSFDMAXB.cpp | Show annotated file Show diff for this revision Revisions of this file |
GYSFDMAXB.hpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8d315f7977b3 -r 0983cd1d7183 GYSFDMAXB.cpp --- a/GYSFDMAXB.cpp Thu Apr 22 12:20:43 2021 +0000 +++ b/GYSFDMAXB.cpp Fri Apr 23 11:43:26 2021 +0000 @@ -7,7 +7,7 @@ #define M_PI 3.14159265358979f GYSFDMAXB::GYSFDMAXB(PinName tx, PinName rx) - :serial(tx, rx), receive_flag(false), start_index(0), uart_index(0) + :serial(tx, rx, 57600), receive_flag(false), start_index(0), uart_index(0) { for (int i = 0; i < uart_size; i++) { @@ -17,9 +17,8 @@ { uart_start[i] = NULL; } - serial.baud(57600); - serial.attach(this, &GYSFDMAXB::Receive, Serial::RxIrq); - timer.attach(this, &GYSFDMAXB::Punctuate, 0.01); +// serial.attach(this, &GYSFDMAXB::Receive, Serial::RxIrq); + timer.attach(this, &GYSFDMAXB::Update, 0.01); } void GYSFDMAXB::Receive() @@ -70,15 +69,16 @@ void GYSFDMAXB::Update() { -// if (receive_flag){ + Receive(); + if (receive_flag){ for (int i = 0; i < start_size; i++) { if (uart_start[i] != NULL) { char str[256]; - char* p[16]; + char* p[64]; int p_index = 0; - for (int j = 0; j < 16; j++) + for (int j = 0; j < 64; j++) { p[j] = NULL; } @@ -200,8 +200,8 @@ uart_start[i] = NULL; } } -// receive_flag = false; -// } + receive_flag = false; + } } void GYSFDMAXB::Initialize()
diff -r 8d315f7977b3 -r 0983cd1d7183 GYSFDMAXB.hpp --- a/GYSFDMAXB.hpp Thu Apr 22 12:20:43 2021 +0000 +++ b/GYSFDMAXB.hpp Fri Apr 23 11:43:26 2021 +0000 @@ -29,7 +29,8 @@ class GYSFDMAXB { private: - Serial serial; +// Serial serial; + BufferedSerial serial; volatile bool receive_flag; char* uart_start[start_size]; volatile int start_index; @@ -87,6 +88,4 @@ Vector3 Calcurate(Vector3 position); }; -extern Serial pc; - #endif \ No newline at end of file