GPS handling library
Dependents: LoRaWAN-NAMote72-Application-Demo-good LoRaWAN-gps-cayenne LoRaWAN-NAMote72-Application-Demo
Fork of lib_gps by
Diff: gps.cpp
- Revision:
- 2:b531881123bf
- Parent:
- 1:2f5fbb33ae8b
- Child:
- 3:03d7275dc4fd
--- a/gps.cpp Fri Mar 27 00:41:33 2015 +0000 +++ b/gps.cpp Fri May 08 01:39:02 2015 +0000 @@ -15,11 +15,10 @@ const int32_t MaxEastPosition = 8388607; // 2^23 - 1 const int32_t MaxWestPosition = 8388608; // -2^23 -Serial gps_uart(PB_6, PB_7); -DigitalOut gps_en(PB_11); -InterruptIn pps_pin(PC_5); +//InterruptIn pps_pin(PC_5); -GPS::GPS() + +GPS::GPS(PinName uart_tx, PinName uart_rx, PinName en) : m_uart(uart_tx, uart_rx), m_en_pin(en) { have_fix = false; } @@ -28,10 +27,10 @@ { } -void GPS::pps() +/*void GPS::pps() { pps_occurred = true; -} +}*/ void GPS::on_uart_rx() { @@ -40,7 +39,7 @@ char ch; do { - ch = gps_uart.getc(); + ch = m_uart.getc(); if (ch != '$') { if (len < RX_BUF_SIZE) { @@ -60,7 +59,7 @@ printf("gps overflow\r\n");*/ rx_buf_lens[rx_bufs_in_idx] = 0; } - } while (gps_uart.readable()); + } while (m_uart.readable()); } void GPS::init() @@ -70,9 +69,9 @@ rx_bufs_out_idx = 0; //gps_uart.baud(57600); - gps_uart.attach(this, &GPS::on_uart_rx); + m_uart.attach(this, &GPS::on_uart_rx); - pps_pin.rise(this, &GPS::pps); + //pps_pin.rise(this, &GPS::pps); } #define DELAY_MAX 20 @@ -111,9 +110,9 @@ } } #endif /* SOFT_START */ - gps_en = 0; + m_en_pin = 0; } else { - gps_en = 1; + m_en_pin = 1; } // reset current string index @@ -122,7 +121,7 @@ bool GPS::enabled() { - return !gps_en.read(); + return !m_en_pin.read(); } /*char GPS::Nibble2HexChar( char a ); @@ -634,11 +633,11 @@ rx_bufs_out_idx = 0; } - if (pps_occurred) { + /*if (pps_occurred) { pps_occurred = false; if (verbose) printf("gps:pps\r\n"); - } + }*/ }