mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OP-782 OP-780 Cleanup of overosync module, fixing headers. Added(but not enabled) its boilerplate declarations on board_hw_defs.c/Makefile/pios_config.
This commit is contained in:
parent
b1360f8136
commit
376467bf57
@ -2,13 +2,13 @@
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotModules OpenPilot Modules
|
||||
* @{
|
||||
* @addtogroup TelemetryModule Telemetry Module
|
||||
* @brief Main telemetry module
|
||||
* Starts three tasks (RX, TX, and priority TX) that watch event queues
|
||||
* and handle all the telemetry of the UAVobjects
|
||||
* @addtogroup Overo Sync Module
|
||||
* @brief Overo sync module
|
||||
* Starts a sync tasks that watch event queues
|
||||
* and push to Overo spi port UAVobjects
|
||||
* @{
|
||||
*
|
||||
* @file telemetry.c
|
||||
* @file overosync.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Telemetry module, handles telemetry and UAVObject updates
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
@ -37,7 +37,6 @@
|
||||
#include "systemstats.h"
|
||||
|
||||
// Private constants
|
||||
#define OVEROSYNC_PACKET_SIZE 1024
|
||||
#define MAX_QUEUE_SIZE 200
|
||||
#define STACK_SIZE_BYTES 512
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 0)
|
||||
@ -48,8 +47,6 @@
|
||||
static xQueueHandle queue;
|
||||
static UAVTalkConnection uavTalkCon;
|
||||
static xTaskHandle overoSyncTaskHandle;
|
||||
volatile bool buffer_swap_failed;
|
||||
volatile uint32_t buffer_swap_timeval;
|
||||
static bool overoEnabled;
|
||||
|
||||
// Private functions
|
||||
@ -71,7 +68,7 @@ struct overosync {
|
||||
struct overosync *overosync;
|
||||
|
||||
/**
|
||||
* Initialise the telemetry module
|
||||
* Initialise the overosync module
|
||||
* \return -1 if initialisation failed
|
||||
* \return 0 on success
|
||||
*/
|
||||
@ -108,7 +105,7 @@ int32_t OveroSyncInitialize(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the telemetry module
|
||||
* Initialise the overosync module
|
||||
* \return -1 if initialisation failed
|
||||
* \return 0 on success
|
||||
*/
|
||||
@ -128,7 +125,7 @@ int32_t OveroSyncStart(void)
|
||||
// Process all registered objects and connect queue for updates
|
||||
UAVObjIterate(®isterObject);
|
||||
|
||||
// Start telemetry tasks
|
||||
// Start overosync tasks
|
||||
xTaskCreate(overoSyncTask, (signed char *)"OveroSync", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &overoSyncTaskHandle);
|
||||
|
||||
TaskMonitorAdd(TASKINFO_RUNNING_OVEROSYNC, overoSyncTaskHandle);
|
||||
|
@ -59,6 +59,7 @@ MODULES += Airspeed/revolution
|
||||
MODULES += AltitudeHold FixedWingPathFollower PathPlanner TxPID
|
||||
#MODULES += VtolPathFollower ## OP-700: VtolPathFollower disabled because its currently unsafe - remove this line once Sambas code has been merged
|
||||
MODULES += CameraStab
|
||||
#MODULES += OveroSync
|
||||
MODULES += Radio
|
||||
MODULES += Telemetry
|
||||
PYMODULES =
|
||||
|
@ -96,6 +96,8 @@
|
||||
/* Other Interfaces */
|
||||
//#define PIOS_INCLUDE_I2C_ESC
|
||||
|
||||
//#define PIOS_OVERO_SPI
|
||||
|
||||
/* Flags that alter behaviors - mostly to lower resources for CC */
|
||||
#define PIOS_INCLUDE_INITCALL /* Include init call structures */
|
||||
#define PIOS_TELEM_PRIORITY_QUEUE /* Enable a priority queue in telemetry */
|
||||
|
@ -104,6 +104,133 @@ const struct pios_led_cfg * PIOS_BOARD_HW_DEFS_GetLedCfg (uint32_t board_revisio
|
||||
#if defined(PIOS_INCLUDE_SPI)
|
||||
#include <pios_spi_priv.h>
|
||||
|
||||
#if defined(PIOS_OVERO_SPI)
|
||||
/* SPI2 Interface
|
||||
* - Used for Flexi/IO/Overo communications
|
||||
3: PB12 = SPI2 NSS, CAN2 RX
|
||||
4: PB13 = SPI2 SCK, CAN2 TX, USART3 CTS
|
||||
5: PB14 = SPI2 MISO, TIM12 CH1, USART3 RTS
|
||||
6: PB15 = SPI2 MOSI, TIM12 CH2
|
||||
*/
|
||||
#include <pios_overo_priv.h>
|
||||
void PIOS_OVERO_irq_handler(void);
|
||||
void DMA1_Stream7_IRQHandler(void) __attribute__((alias("PIOS_OVERO_irq_handler")));
|
||||
static const struct pios_overo_cfg pios_overo_cfg = {
|
||||
.regs = SPI2,
|
||||
.remap = GPIO_AF_SPI2,
|
||||
.init = {
|
||||
.SPI_Mode = SPI_Mode_Slave,
|
||||
.SPI_Direction = SPI_Direction_2Lines_FullDuplex,
|
||||
.SPI_DataSize = SPI_DataSize_8b,
|
||||
.SPI_NSS = SPI_NSS_Hard,
|
||||
.SPI_FirstBit = SPI_FirstBit_MSB,
|
||||
.SPI_CRCPolynomial = 7,
|
||||
.SPI_CPOL = SPI_CPOL_High,
|
||||
.SPI_CPHA = SPI_CPHA_2Edge,
|
||||
.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2,
|
||||
},
|
||||
.use_crc = false,
|
||||
.dma = {
|
||||
.irq = {
|
||||
// Note this is the stream ID that triggers interrupts (in this case TX)
|
||||
.flags = (DMA_IT_TCIF7),
|
||||
.init = {
|
||||
.NVIC_IRQChannel = DMA1_Stream7_IRQn,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||
.NVIC_IRQChannelSubPriority = 0,
|
||||
.NVIC_IRQChannelCmd = ENABLE,
|
||||
},
|
||||
},
|
||||
|
||||
.rx = {
|
||||
.channel = DMA1_Stream0,
|
||||
.init = {
|
||||
.DMA_Channel = DMA_Channel_0,
|
||||
.DMA_PeripheralBaseAddr = (uint32_t) & (SPI2->DR),
|
||||
.DMA_DIR = DMA_DIR_PeripheralToMemory,
|
||||
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
|
||||
.DMA_MemoryInc = DMA_MemoryInc_Enable,
|
||||
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
|
||||
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
|
||||
.DMA_Mode = DMA_Mode_Circular,
|
||||
.DMA_Priority = DMA_Priority_Medium,
|
||||
//TODO: Enable FIFO
|
||||
.DMA_FIFOMode = DMA_FIFOMode_Disable,
|
||||
.DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
|
||||
.DMA_MemoryBurst = DMA_MemoryBurst_Single,
|
||||
.DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
|
||||
},
|
||||
},
|
||||
.tx = {
|
||||
.channel = DMA1_Stream7,
|
||||
.init = {
|
||||
.DMA_Channel = DMA_Channel_0,
|
||||
.DMA_PeripheralBaseAddr = (uint32_t) & (SPI2->DR),
|
||||
.DMA_DIR = DMA_DIR_MemoryToPeripheral,
|
||||
.DMA_PeripheralInc = DMA_PeripheralInc_Disable,
|
||||
.DMA_MemoryInc = DMA_MemoryInc_Enable,
|
||||
.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte,
|
||||
.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte,
|
||||
.DMA_Mode = DMA_Mode_Circular,
|
||||
.DMA_Priority = DMA_Priority_Medium,
|
||||
.DMA_FIFOMode = DMA_FIFOMode_Disable,
|
||||
.DMA_FIFOThreshold = DMA_FIFOThreshold_Full,
|
||||
.DMA_MemoryBurst = DMA_MemoryBurst_Single,
|
||||
.DMA_PeripheralBurst = DMA_PeripheralBurst_Single,
|
||||
},
|
||||
},
|
||||
},
|
||||
.sclk = {
|
||||
.gpio = GPIOB,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_13,
|
||||
.GPIO_Speed = GPIO_Speed_100MHz,
|
||||
.GPIO_Mode = GPIO_Mode_AF,
|
||||
.GPIO_OType = GPIO_OType_PP,
|
||||
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||
},
|
||||
},
|
||||
.miso = {
|
||||
.gpio = GPIOB,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_14,
|
||||
.GPIO_Speed = GPIO_Speed_50MHz,
|
||||
.GPIO_Mode = GPIO_Mode_AF,
|
||||
.GPIO_OType = GPIO_OType_PP,
|
||||
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||
},
|
||||
},
|
||||
.mosi = {
|
||||
.gpio = GPIOB,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_15,
|
||||
.GPIO_Speed = GPIO_Speed_50MHz,
|
||||
.GPIO_Mode = GPIO_Mode_AF,
|
||||
.GPIO_OType = GPIO_OType_PP,
|
||||
.GPIO_PuPd = GPIO_PuPd_NOPULL
|
||||
},
|
||||
},
|
||||
.slave_count = 1,
|
||||
.ssel = { {
|
||||
.gpio = GPIOB,
|
||||
.init = {
|
||||
.GPIO_Pin = GPIO_Pin_12,
|
||||
.GPIO_Speed = GPIO_Speed_50MHz,
|
||||
.GPIO_Mode = GPIO_Mode_OUT,
|
||||
.GPIO_OType = GPIO_OType_PP,
|
||||
.GPIO_PuPd = GPIO_PuPd_UP
|
||||
},
|
||||
} },
|
||||
};
|
||||
uint32_t pios_overo_id = 0;
|
||||
void PIOS_OVERO_irq_handler(void)
|
||||
{
|
||||
/* Call into the generic code to handle the IRQ for this specific device */
|
||||
PIOS_OVERO_DMA_irq_handler(pios_overo_id);
|
||||
}
|
||||
|
||||
#endif /* PIOS_OVERO_SPI */
|
||||
|
||||
/*
|
||||
* SPI1 Interface
|
||||
* Used for MPU6000 gyro and accelerometer
|
||||
|
Loading…
x
Reference in New Issue
Block a user