1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-26 15: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/gps9protocol.h"
#include "pios_board_info.h"
#include "pios_board_init.h"
extern uint32_t pios_com_main_id;
@ -93,8 +94,7 @@ int32_t GPSPSystemModStart(void)
*/
int32_t GPSPSystemModInitialize(void)
{
GPSPSystemModStart();
// Module started in main
return 0;
}
@ -107,9 +107,17 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
#ifdef PIOS_INCLUDE_WDG
PIOS_WDG_UpdateFlag(PIOS_WDG_SYSTEM);
#endif
/* board driver init */
PIOS_Board_Init();
/* Initialize all modules */
MODULE_INITIALISE_ALL;
while (!initTaskDone) {
vTaskDelay(10);
}
#ifndef PIOS_INCLUDE_WDG
// if no watchdog is enabled, don't reset watchdog in MODULE_TASKCREATE_ALL loop
#define PIOS_WDG_Clear()
@ -127,6 +135,7 @@ static void gpspSystemTask(__attribute__((unused)) void *parameters)
#if defined(PIOS_INCLUDE_IAP)
PIOS_IAP_WriteBootCount(0);
#endif
/* Right now there is no configuration and uart speed is fixed at 57600.
* TODO:
* 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);
#endif
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);
} else {
PIOS_LED_On(PIOS_LED_HEARTBEAT);

View File

@ -27,7 +27,7 @@
#include <stdint.h>
#include <pios_i2c.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_SIZE_HIGH_REG 0xFD
#define GPS_I2C_STREAM_SIZE_LOW_REG 0xFE

View File

@ -28,7 +28,7 @@
#ifdef PIOS_INCLUDE_FLASH_INTERNAL
#include "stm32f10x_flash.h"
#include "stm32f0xx_flash.h"
#include "pios_flash_internal_priv.h"
#include "pios_flash.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);
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 */
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
I2C_Generate_Start_Read);
} 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 */
i2c_adapter->active_txn == i2c_adapter->last_txn ? I2C_AutoEnd_Mode : I2C_SoftEnd_Mode,
I2C_Generate_Start_Write);

View File

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

View File

@ -42,6 +42,7 @@
/* Global Variables */
extern void Stack_Change(void);
extern void GPSPSystemModStart(void);
/**
* OpenPilot Main function:
@ -54,32 +55,19 @@ extern void Stack_Change(void);
*/
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. */
PIOS_SYS_Init();
/* Architecture dependant Hardware and
* core subsystem initialisation
* (see pios_board.c for your arch)
* */
PIOS_Board_Init();
/*
* Initialize the system module, which configures the board and
* starts the other modules.
*/
GPSPSystemModStart();
/* Initialize modules */
MODULE_INITIALISE_ALL
/* swap the stack to use the IRQ stack */
Stack_Change();
/* Start the FreeRTOS scheduler, which should never return.
*
* 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.
*
*/
/* Start the FreeRTOS scheduler */
vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be running. */