1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-27 16:54:15 +01:00

Merged in webbbn/librepilot/LP-537-update-f0-gps-to-be-more-similar (pull request #445)

LP-537 update f0 gps to be more similar

Approved-by: Philippe Renon <philippe_renon@yahoo.fr>
Approved-by: Alessio Morale <alessiomorale@gmail.com>
Approved-by: Lalanne Laurent <f5soh@free.fr>
Approved-by: Brian Webb <webbbn@gmail.com>
This commit is contained in:
Brian Webb 2017-07-05 19:32:00 +00:00 committed by Lalanne Laurent
commit 8f91f1b49b
6 changed files with 24 additions and 27 deletions

View File

@ -44,6 +44,7 @@
#include "inc/gps9flashhandler.h" #include "inc/gps9flashhandler.h"
#include "inc/gps9protocol.h" #include "inc/gps9protocol.h"
#include "pios_board_info.h" #include "pios_board_info.h"
#include "pios_board_init.h"
extern uint32_t pios_com_main_id; extern uint32_t pios_com_main_id;
@ -93,8 +94,7 @@ int32_t GPSPSystemModStart(void)
*/ */
int32_t GPSPSystemModInitialize(void) int32_t GPSPSystemModInitialize(void)
{ {
GPSPSystemModStart(); // Module started in main
return 0; return 0;
} }
@ -107,9 +107,17 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
#ifdef PIOS_INCLUDE_WDG #ifdef PIOS_INCLUDE_WDG
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM); PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
#endif #endif
/* board driver init */
PIOS_Board_Init();
/* Initialize all modules */
MODULE_INITIALISE_ALL;
while (!initTaskDone) { while (!initTaskDone) {
vTaskDelay(10); vTaskDelay(10);
} }
#ifndef PIOS_INCLUDE_WDG #ifndef PIOS_INCLUDE_WDG
// if no watchdog is enabled, don't reset watchdog in MODULE_TASKCREATE_ALL loop // if no watchdog is enabled, don't reset watchdog in MODULE_TASKCREATE_ALL loop
#define PIOS_WDG_Clear() #define PIOS_WDG_Clear()
@ -127,6 +135,7 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
#if defined(PIOS_INCLUDE_IAP) #if defined(PIOS_INCLUDE_IAP)
PIOS_IAP_WriteBootCount(0); PIOS_IAP_WriteBootCount(0);
#endif #endif
/* Right now there is no configuration and uart speed is fixed at 57600. /* Right now there is no configuration and uart speed is fixed at 57600.
* TODO: * TODO:
* 1) add a tiny ubx parser on gps side to intercept CFG-RINV and use that for config storage; * 1) add a tiny ubx parser on gps side to intercept CFG-RINV and use that for config storage;
@ -143,7 +152,7 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM); PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
#endif #endif
uint32_t ledPeriod = PIOS_DELAY_DiffuS(ledTimer) / 1000; uint32_t ledPeriod = PIOS_DELAY_DiffuS(ledTimer) / 1000;
if (ledPeriod < HB_LED_BLINK_ON_PERIOD_MS) { if (ledPeriod < HB_LED_BLINK_OFF_PERIOD_MS) {
PIOS_LED_Off(PIOS_LED_HEARTBEAT); PIOS_LED_Off(PIOS_LED_HEARTBEAT);
} else { } else {
PIOS_LED_On(PIOS_LED_HEARTBEAT); PIOS_LED_On(PIOS_LED_HEARTBEAT);

View File

@ -27,7 +27,7 @@
#include <stdint.h> #include <stdint.h>
#include <pios_i2c.h> #include <pios_i2c.h>
#include <pios_helpers.h> #include <pios_helpers.h>
#define GPS_I2C_ADDRESS (0x42 << 1) #define GPS_I2C_ADDRESS 0x42
#define GPS_I2C_STREAM_REG 0xFF #define GPS_I2C_STREAM_REG 0xFF
#define GPS_I2C_STREAM_SIZE_HIGH_REG 0xFD #define GPS_I2C_STREAM_SIZE_HIGH_REG 0xFD
#define GPS_I2C_STREAM_SIZE_LOW_REG 0xFE #define GPS_I2C_STREAM_SIZE_LOW_REG 0xFE

View File

@ -28,7 +28,7 @@
#ifdef PIOS_INCLUDE_FLASH_INTERNAL #ifdef PIOS_INCLUDE_FLASH_INTERNAL
#include "stm32f10x_flash.h" #include "stm32f0xx_flash.h"
#include "pios_flash_internal_priv.h" #include "pios_flash_internal_priv.h"
#include "pios_flash.h" #include "pios_flash.h"
#include <stdbool.h> #include <stdbool.h>

View File

@ -274,12 +274,12 @@ void go_txn_setup(struct pios_i2c_adapter *i2c_adapter)
I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE); I2C_ITConfig(i2c_adapter->cfg->regs, I2C_IT_EVT | I2C_IT_BUF | I2C_IT_ERR, ENABLE);
if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) { if (i2c_adapter->active_txn->rw == PIOS_I2C_TXN_READ) {
I2C_TransferHandling(i2c_adapter->cfg->regs, i2c_adapter->active_txn->addr, i2c_adapter->active_txn->len, I2C_TransferHandling(i2c_adapter->cfg->regs, (i2c_adapter->active_txn->addr << 1), i2c_adapter->active_txn->len,
/* Only last transaction generates Auto End */ /* Only last transaction generates Auto End */
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode, i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
I2C_Generate_Start_Read); I2C_Generate_Start_Read);
} else { } else {
I2C_TransferHandling(i2c_adapter->cfg->regs, i2c_adapter->active_txn->addr, i2c_adapter->active_txn->len, I2C_TransferHandling(i2c_adapter->cfg->regs, (i2c_adapter->active_txn->addr << 1), i2c_adapter->active_txn->len,
/* Only last transaction generates Auto End */ /* Only last transaction generates Auto End */
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode, i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
I2C_Generate_Start_Write); I2C_Generate_Start_Write);

View File

@ -62,7 +62,7 @@ static const struct pios_gpio pios_leds_gpsp[] = {
.GPIO_Speed = GPIO_Speed_Level_1, .GPIO_Speed = GPIO_Speed_Level_1,
}, },
}, },
.active_low = false .active_low = true
}, },
}; };

View File

@ -42,6 +42,7 @@
/* Global Variables */ /* Global Variables */
extern void Stack_Change(void); extern void Stack_Change(void);
extern void GPSPSystemModStart(void);
/** /**
* OpenPilot Main function: * OpenPilot Main function:
@ -54,32 +55,19 @@ extern void Stack_Change(void);
*/ */
int main() int main()
{ {
/* NOTE: Do NOT modify the following start-up sequence */
/* Any new initialization functions should be added in OpenPilotInit() */
/* Brings up System using CMSIS functions, enables the LEDs. */ /* Brings up System using CMSIS functions, enables the LEDs. */
PIOS_SYS_Init(); PIOS_SYS_Init();
/* Architecture dependant Hardware and /*
* core subsystem initialisation * Initialize the system module, which configures the board and
* (see pios_board.c for your arch) * starts the other modules.
* */ */
PIOS_Board_Init(); GPSPSystemModStart();
/* Initialize modules */
MODULE_INITIALISE_ALL
/* swap the stack to use the IRQ stack */ /* swap the stack to use the IRQ stack */
Stack_Change(); Stack_Change();
/* Start the FreeRTOS scheduler, which should never return. /* Start the FreeRTOS scheduler */
*
* NOTE: OpenPilot runs an operating system (FreeRTOS), which constantly calls
* (schedules) function files (modules). These functions never return from their
* while loops, which explains why each module has a while(1){} segment. Thus,
* the OpenPilot software actually starts at the vTaskStartScheduler() function,
* even though this is somewhat obscure.
*
*/
vTaskStartScheduler(); vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be running. */ /* If all is well we will never reach here as the scheduler will now be running. */