kopia lustrzana https://github.com/DL7AD/pecanpico10
Fix error introduced when reworking GPS I2C/UART configuration
rodzic
11cd5a4849
commit
732f8afc01
|
@ -1,57 +1,59 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "pktconf.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "threads.h"
|
||||
|
||||
/**
|
||||
* Main routine is starting up system, runs the software watchdog (module monitoring), controls LEDs
|
||||
*/
|
||||
int main(void) {
|
||||
halInit(); // Startup HAL
|
||||
chSysInit(); // Startup RTOS
|
||||
|
||||
/* Setup core IO peripherals. */
|
||||
sysConfigureCoreIO();
|
||||
|
||||
// Init debugging (Serial debug port, LEDs)
|
||||
DEBUG_INIT();
|
||||
|
||||
/*
|
||||
* Setup buffers in CCM if available.
|
||||
* Setup packet primary data.
|
||||
*/
|
||||
bool pkt = pktSystemInit();
|
||||
|
||||
chDbgAssert(pkt == true, "failed to init packet system");
|
||||
|
||||
/* Start Serial Over USB. */
|
||||
startSDU();
|
||||
|
||||
/* Start serial channels if selected. */
|
||||
pktSerialStart();
|
||||
|
||||
/* Create packet radio service. */
|
||||
if(!pktServiceCreate(PKT_RADIO_1)) {
|
||||
TRACE_ERROR("PKT > Unable to create packet services");
|
||||
} else {
|
||||
pktEnableEventTrace();
|
||||
}
|
||||
|
||||
TRACE_INFO("MAIN > Startup");
|
||||
|
||||
// Startup threads
|
||||
start_essential_threads(); // Startup required modules (tracking manager, watchdog)
|
||||
start_user_threads(); // Startup optional modules (eg. POSITION, LOG, ...)
|
||||
|
||||
while(true) {
|
||||
#if ACTIVATE_USB
|
||||
manageTraceAndShell();
|
||||
pktTraceEvents();
|
||||
#endif /* ACTIVATE_USB */
|
||||
/* Wait in a loop if nothing to do. */
|
||||
chThdSleep(TIME_MS2I(200));
|
||||
}
|
||||
}
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
#include "pktconf.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "threads.h"
|
||||
|
||||
/**
|
||||
* Main routine is starting up system, runs the software watchdog (module monitoring), controls LEDs
|
||||
*/
|
||||
int main(void) {
|
||||
halInit(); // Startup HAL
|
||||
chSysInit(); // Startup RTOS
|
||||
|
||||
/* Setup core IO peripherals. */
|
||||
sysConfigureCoreIO();
|
||||
|
||||
// Init debugging (Serial debug port, LEDs)
|
||||
DEBUG_INIT();
|
||||
|
||||
/*
|
||||
* Setup buffers in CCM if available.
|
||||
* Setup packet primary data.
|
||||
*/
|
||||
bool pkt = pktSystemInit();
|
||||
|
||||
chDbgAssert(pkt == true, "failed to init packet system");
|
||||
|
||||
#if ACTIVATE_USB
|
||||
/* Start Serial Over USB. */
|
||||
startSDU();
|
||||
#endif
|
||||
|
||||
/* Start serial channels if selected. */
|
||||
pktSerialStart();
|
||||
|
||||
/* Create packet radio service. */
|
||||
if(!pktServiceCreate(PKT_RADIO_1)) {
|
||||
TRACE_ERROR("PKT > Unable to create packet services");
|
||||
} else {
|
||||
pktEnableEventTrace();
|
||||
}
|
||||
|
||||
TRACE_INFO("MAIN > Startup");
|
||||
|
||||
// Startup threads
|
||||
start_essential_threads(); // Startup required modules (tracking manager, watchdog)
|
||||
start_user_threads(); // Startup optional modules (eg. POSITION, LOG, ...)
|
||||
|
||||
while(true) {
|
||||
#if ACTIVATE_USB
|
||||
manageTraceAndShell();
|
||||
pktTraceEvents();
|
||||
#endif /* ACTIVATE_USB */
|
||||
/* Wait in a loop if nothing to do. */
|
||||
chThdSleep(TIME_MS2I(200));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ const conf_t conf_flash_default = {
|
|||
},
|
||||
// APRS identity used in message responses if digipeat is not enabled
|
||||
.call = "VK2GJ-4",
|
||||
.symbol = SYM_ANTENNA,
|
||||
.symbol = SYM_ANTENNA
|
||||
},
|
||||
.aprs_msg = false, // Set true to enable messages to be accepted on RX call sign
|
||||
.digi = true,
|
||||
|
|
|
@ -32,7 +32,7 @@ void gps_transmit_string(uint8_t *cmd, uint8_t length) {
|
|||
gps_calc_ubx_csum(cmd, length);
|
||||
#if UBLOX_USE_I2C == TRUE
|
||||
I2C_writeN(UBLOX_MAX_ADDRESS, cmd, length);
|
||||
#elif defined(UBLOX_USE_UART)
|
||||
#elif defined(UBLOX_UART_CONNECTED)
|
||||
sdWrite(&SD5, cmd, length);
|
||||
#endif
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ bool gps_receive_byte(uint8_t *data) {
|
|||
I2C_read8(UBLOX_MAX_ADDRESS, 0xFF, data);
|
||||
return true;
|
||||
}
|
||||
#elif defined(UBLOX_USE_UART)
|
||||
#elif defined(UBLOX_UART_CONNECTED)
|
||||
return sdReadTimeout(&SD5, data, 1, TIME_IMMEDIATE);
|
||||
#else
|
||||
(void) data;
|
||||
|
@ -581,13 +581,15 @@ bool GPS_Init() {
|
|||
palSetLineMode(LINE_GPS_RESET, PAL_MODE_OUTPUT_PUSHPULL); // GPS reset
|
||||
palSetLineMode(LINE_GPS_EN, PAL_MODE_OUTPUT_PUSHPULL); // GPS off
|
||||
|
||||
// Init UART
|
||||
#if defined(UBLOX_UART_CONNECTED)
|
||||
|
||||
#if defined(UBLOX_UART_CONNECTED) && UBLOX_USE_I2C == FALSE
|
||||
// Init and start UART
|
||||
TRACE_INFO("GPS > Init GPS UART");
|
||||
palSetLineMode(LINE_GPS_RXD, PAL_MODE_ALTERNATE(11)); // UART RXD
|
||||
palSetLineMode(LINE_GPS_TXD, PAL_MODE_ALTERNATE(11)); // UART TXD
|
||||
TRACE_INFO("GPS > Init GPS UART");
|
||||
|
||||
sdStart(&SD5, &gps_config);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Switch MOSFET
|
||||
TRACE_INFO("GPS > Power up GPS");
|
||||
|
@ -622,6 +624,14 @@ void GPS_Deinit(void)
|
|||
// Switch MOSFET
|
||||
TRACE_INFO("GPS > Power down GPS");
|
||||
palClearLine(LINE_GPS_EN);
|
||||
|
||||
#if defined(UBLOX_UART_CONNECTED) && UBLOX_USE_I2C == FALSE
|
||||
// Stop and deinit UART
|
||||
TRACE_INFO("GPS > Stop GPS UART");
|
||||
sdStop(&SD5);
|
||||
palSetLineMode(LINE_GPS_RXD, PAL_MODE_INPUT); // UART RXD
|
||||
palSetLineMode(LINE_GPS_TXD, PAL_MODE_INPUT); // UART TXD
|
||||
#endif
|
||||
gps_model = GPS_MODEL_UNSET;
|
||||
gps_enabled = false;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue