From ba342e602ac366447edfa539f9904ffa4b8af534 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Tue, 25 Nov 2014 23:20:58 +0100 Subject: [PATCH] gps: add position pinning configuration --- imuboard/gps_venus.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/imuboard/gps_venus.c b/imuboard/gps_venus.c index 3c089fa..0580fa7 100644 --- a/imuboard/gps_venus.c +++ b/imuboard/gps_venus.c @@ -152,6 +152,24 @@ typedef struct { uint8_t attributes; } m_waas_t; +/* 0x39 - configure position pinning */ +#define M_PINNING 0x39 +typedef struct { + uint8_t enable; /* 0 = default, 1 = enable, 2 = disable */ + uint8_t attributes; /* 0 = ram, 1 = ram+flash */ +} m_pinning_t; + +/* 0x3B - configure position pinning */ +#define M_PINNING_PARAMS 0x3B +typedef struct { + uint16_t pin_speed; + uint16_t pin_cnt; + uint16_t unpin_speed; + uint16_t unpin_cnt; + uint16_t unpin_dist; + uint8_t attributes; /* 0 = ram, 1 = ram+flash */ +} m_pinning_params_t; + /* 0x3C - nav mode */ #define M_NAVMODE 0x3c typedef struct { @@ -265,6 +283,33 @@ void venus634_waas(void) return; } +/* Configure position pinning – Enable or disable position pinning of GNSS + * receiver */ +void venus634_pinning(void) +{ + m_pinning_t pinning; + + memset(&pinning, 0, sizeof(m_pinning_t)); + pinning.enable = 2; + pinning.attributes = 0; /* ram */ + + venus634_send(M_PINNING, &pinning, sizeof(m_pinning_t)); +} + +/* Configure position pinning parameters */ +void venus634_pinning_params(void) +{ + m_pinning_params_t pinning_params; + + /* just set everything to 0 */ + memset(&pinning_params, 0, sizeof(m_pinning_params_t)); + pinning_params.attributes = 0; /* ram */ + + venus634_send(M_PINNING_PARAMS, &pinning_params, + sizeof(m_pinning_params_t)); +} + + /* Tell we are a car instead of a pedestrian */ void venus634_navmode(void) { @@ -591,6 +636,14 @@ static void venus634_configure(void) venus634_waas(); wait_ack(M_WAAS); + printf_P(PSTR("pinning...")); + venus634_pinning(); + wait_ack(M_PINNING); + + printf_P(PSTR("pinning parameters...")); + venus634_pinning_params(); + wait_ack(M_PINNING_PARAMS); + printf_P(PSTR("rate...")); venus634_rate(); wait_ack(M_RATE); -- 2.39.5