kopia lustrzana https://github.com/bristol-seds/pico-tracker
Added GPS reset code
rodzic
f10d6861ff
commit
c2822a5d8f
|
@ -48,6 +48,7 @@ uint8_t gps_is_locked(void);
|
|||
void gps_set_powersave_auto(void);
|
||||
|
||||
void gps_usart_init_enable(uint32_t baud_rate);
|
||||
void gps_reset(void);
|
||||
void gps_init(void);
|
||||
void usart_loopback_test(void);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "hw_config.h"
|
||||
#include "system/system.h"
|
||||
#include "system/port.h"
|
||||
#include "system/interrupt.h"
|
||||
#include "sercom/sercom.h"
|
||||
#include "sercom/usart.h"
|
||||
|
@ -503,11 +504,42 @@ void gps_usart_init_enable(uint32_t baud_rate)
|
|||
usart_enable(GPS_SERCOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* GPS reset pin
|
||||
*/
|
||||
void gps_reset_on(void)
|
||||
{
|
||||
#ifdef GPS_RESET_PIN
|
||||
port_pin_set_output_level(GPS_RESET_PIN, 0); /* active low */
|
||||
#endif
|
||||
}
|
||||
void gps_reset_off(void)
|
||||
{
|
||||
#ifdef GPS_RESET_PIN
|
||||
port_pin_set_output_level(GPS_RESET_PIN, 1); /* active low */
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Reset. Places the GPS in a RESET state
|
||||
*/
|
||||
void gps_reset(void)
|
||||
{
|
||||
#ifdef GPS_RESET_PIN
|
||||
port_pin_set_config(GPS_RESET_PIN,
|
||||
PORT_PIN_DIR_OUTPUT, /* Direction */
|
||||
PORT_PIN_PULL_NONE, /* Pull */
|
||||
false); /* Powersave */
|
||||
port_pin_set_output_level(GPS_RESET_PIN, 0); /* active low */
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
void gps_init(void)
|
||||
{
|
||||
/* Bring GPS out of reset */
|
||||
gps_reset_on();
|
||||
|
||||
/* Enable usart */
|
||||
gps_usart_init_enable(GPS_BAUD_RATE);
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ void init(timepulse_callback_t callback, enum init_type init_t)
|
|||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
led_reset();
|
||||
gps_reset();
|
||||
si_trx_shutdown();
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue