gnss.h
89 lines
| 1.6 KiB
| text/x-c
|
CLexer
|
r132 | /* | ||
* gnss.h | ||||
* | ||||
|
r175 | * Created on: Dec 29, 2014 | ||
* Author: aras | ||||
|
r132 | */ | ||
|
r209 | #pragma once | ||
|
r175 | #ifndef LIBTE_GNSS_H_ | ||
#define LIBTE_GNSS_H_ | ||||
|
r132 | |||
|
r209 | |||
|
r175 | #include "te_structs.h" | ||
|
r209 | #include "../libnmea++/libnmea++.h" | ||
|
r132 | |||
|
r196 | |||
|
r209 | namespace te_gnss{ | ||
|
r132 | |||
|
r209 | //pin ports to GNSS | ||
#define PPS 2 /*!< PE4 AVR <> 2 Arduino */ | ||||
#define ENB 5 /*!< PE3 AVR <> 5 Arduino */ | ||||
#define RX0_GNSS RX0 | ||||
#define TX0_GNSS TX0 PE1 | ||||
|
r132 | |||
|
r209 | uint16_t bauds[]{4800,9600}; | ||
|
r196 | |||
|
r209 | #define BAUDRATE(x) bauds[x] | ||
#define BAUD_IDX_MAX 5 | ||||
#define LOCK_IDX_MAX 100 | ||||
|
r196 | |||
|
r209 | #define GNSS_PORT 0x01 | ||
#define RBP_PORT 0x02 | ||||
void scan_baud_func(); | ||||
void scan_lock_func(); | ||||
void get_pps_data_func(); | ||||
|
r203 | bool configure(gnss_config_struct &gcs); | ||
bool activate(); | ||||
bool deactivate(); | ||||
bool set_baudrate(uint16_t baud); | ||||
bool wait_to_be_locked(); | ||||
bool get_pps_data(bool raw); | ||||
bool set_position(fix32 lat,fix32 lon); | ||||
bool activate_nmea_frames(uint16_t mask); | ||||
|
r196 | |||
|
r203 | inline void ISR_pps(); | ||
|
r196 | |||
|
r203 | void process_frame(const char* fr); | ||
|
r196 | |||
|
r203 | void scan_baudrate(); | ||
|
r209 | void push(void (*pfunc)()); | ||
|
r203 | |||
|
r209 | void pop(void (*pfunc)()); | ||
|
r203 | |||
|
r209 | |||
|
r203 | void write_baud(uint8_t port, uint16_t baud); | ||
void open(uint8_t port); | ||||
void writeline(uint8_t port, char* frame);// abre y cierra puerto | ||||
char* readline(uint8_t port); | ||||
void close(uint8_t port); | ||||
bool is_gnss_frame_valid(); | ||||
bool is_locked(); | ||||
volatile bool scan_baud_success; | ||||
volatile bool scan_baud_finish; | ||||
volatile bool scan_lock_success; | ||||
volatile bool scan_lock_finish; | ||||
volatile uint8_t baud_idx; | ||||
volatile uint8_t lock_idx; | ||||
void (*pfunc_pps)(); | ||||
uint8_t stk_ptr; | ||||
|
r209 | void (*stack[5])(); | ||
|
r203 | |||
bool is_raw; | ||||
|
r209 | } | ||
|
r203 | |||
|
r175 | #endif /* LIBTE_GNSS_H_ */ | ||