mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-02 19:29:15 +01:00
Graphic features and cleanup
osdinput module back to irq based usart
This commit is contained in:
parent
2fcbb4ee8e
commit
d6216cf02b
@ -1897,6 +1897,91 @@ void setGpsOsd(uint8_t status, int32_t lat, int32_t lon, float alt, float spd)
|
|||||||
m_gpsSpd=spd;
|
m_gpsSpd=spd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void draw_artificial_horizon(float angle, float pitch, int16_t l_x, int16_t l_y, int16_t size )
|
||||||
|
{
|
||||||
|
float alpha;
|
||||||
|
|
||||||
|
int16_t x1,x2,x3,x4;
|
||||||
|
int16_t y1,y2,y3,y4;
|
||||||
|
int16_t y_pitch;
|
||||||
|
// rotated corners
|
||||||
|
int16_t ax1,ax2,ax3,ax4,ay1,ay2,ay3,ay4;
|
||||||
|
int16_t refx,refy;
|
||||||
|
alpha=DEG2RAD(angle);
|
||||||
|
|
||||||
|
// move up or down Size
|
||||||
|
y_pitch=(pitch/90.0f*(size/2))+size/2;
|
||||||
|
|
||||||
|
// center rotate point
|
||||||
|
refx=l_x + size/2;
|
||||||
|
refy=l_y + size/2;
|
||||||
|
|
||||||
|
x1=l_x - size/2;
|
||||||
|
y1=l_y + y_pitch;
|
||||||
|
x2=l_x + size + size/2;
|
||||||
|
y2=l_y + y_pitch;
|
||||||
|
x3=l_x + size + size/2;
|
||||||
|
y3=l_y + size + y_pitch;
|
||||||
|
x4=l_x - size/2;
|
||||||
|
y4=l_y + size + y_pitch;
|
||||||
|
|
||||||
|
ax1=refy+(x1-refx)*cosf(alpha)-(y1-refy)*sinf(alpha);
|
||||||
|
ay1=refy+(x1-refx)*sinf(alpha)+(y1-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
ax2=refy+(x2-refx)*cosf(alpha)-(y2-refy)*sinf(alpha);
|
||||||
|
ay2=refy+(x2-refx)*sinf(alpha)+(y2-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
ax3=refy+(x3-refx)*cosf(alpha)-(y3-refy)*sinf(alpha);
|
||||||
|
ay3=refy+(x3-refx)*sinf(alpha)+(y3-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
ax4=refy+(x4-refx)*cosf(alpha)-(y4-refy)*sinf(alpha);
|
||||||
|
ay4=refy+(x4-refx)*sinf(alpha)+(y4-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
write_line_outlined(ax1,ay1,ax2,ay2,0,0,0,1);
|
||||||
|
//fill
|
||||||
|
for(int i=0;i<(size);i++)
|
||||||
|
{
|
||||||
|
x1=l_x - size/2;
|
||||||
|
y1=l_y + y_pitch + i;
|
||||||
|
x2=l_x + size + size/2;
|
||||||
|
y2=l_y + y_pitch + i;
|
||||||
|
ax1=refy+(x1-refx)*cosf(alpha)-(y1-refy)*sinf(alpha);
|
||||||
|
ay1=refy+(x1-refx)*sinf(alpha)+(y1-refy)*cosf(alpha);
|
||||||
|
ax2=refy+(x2-refx)*cosf(alpha)-(y2-refy)*sinf(alpha);
|
||||||
|
ay2=refy+(x2-refx)*sinf(alpha)+(y2-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
write_line_lm(ax1,ay1,ax2,ay2,1,1);
|
||||||
|
}
|
||||||
|
//fill2
|
||||||
|
for(int i=0;i<(size*2);i++)
|
||||||
|
{
|
||||||
|
x1=l_x - size/2 + i;
|
||||||
|
y1=l_y + y_pitch;
|
||||||
|
x4=l_x - size/2 + i;
|
||||||
|
y4=l_y + size + y_pitch;
|
||||||
|
ax1=refy+(x1-refx)*cosf(alpha)-(y1-refy)*sinf(alpha);
|
||||||
|
ay1=refy+(x1-refx)*sinf(alpha)+(y1-refy)*cosf(alpha);
|
||||||
|
ax4=refy+(x4-refx)*cosf(alpha)-(y4-refy)*sinf(alpha);
|
||||||
|
ay4=refy+(x4-refx)*sinf(alpha)+(y4-refy)*cosf(alpha);
|
||||||
|
|
||||||
|
write_line_lm(ax1,ay1,ax4,ay4,1,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//sides
|
||||||
|
write_line_outlined(l_x,l_y,l_x,l_y+size,0,0,0,1);
|
||||||
|
write_line_outlined(l_x+size,l_y,l_x+size,l_y+size,0,0,0,1);
|
||||||
|
//plane
|
||||||
|
write_line_outlined(refx-5,refy,refx+6,refy,0,0,0,1);
|
||||||
|
write_line_outlined(refx,refy,refx,refy-3,0,0,0,1);
|
||||||
|
//needs better way to limit drawing outside the box
|
||||||
|
write_filled_rectangle_lm(l_x - size - size/2-1, l_y - size - size/2-1, size + size/2, size*4+2, 0,0); //left
|
||||||
|
write_filled_rectangle_lm(l_x + size + 1, l_y - size - size/2-1, size + size/2, size*4+2, 0,0); //right
|
||||||
|
write_filled_rectangle_lm(l_x-1, l_y + size + 1, size+2, size + size/2, 0,0); //bot
|
||||||
|
write_filled_rectangle_lm(l_x-1, l_y - size - size/2-1, size+1, size + size/2+1, 0,0); //top
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void introText(){
|
void introText(){
|
||||||
write_string("ver 0.2", APPLY_HDEADBAND((GRAPHICS_RIGHT/2)),APPLY_VDEADBAND(GRAPHICS_BOTTOM-10), 0, 0, TEXT_VA_BOTTOM, TEXT_HA_CENTER, 0, 3);
|
write_string("ver 0.2", APPLY_HDEADBAND((GRAPHICS_RIGHT/2)),APPLY_VDEADBAND(GRAPHICS_BOTTOM-10), 0, 0, TEXT_VA_BOTTOM, TEXT_HA_CENTER, 0, 3);
|
||||||
}
|
}
|
||||||
@ -2196,6 +2281,11 @@ void updateGraphics() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
draw_artificial_horizon(-attitude.Roll,attitude.Pitch,100,100,30);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
lamas();
|
lamas();
|
||||||
@ -2273,7 +2363,7 @@ static void osdgenTask(void *parameters)
|
|||||||
lastSysTime = xTaskGetTickCount();
|
lastSysTime = xTaskGetTickCount();
|
||||||
|
|
||||||
// intro
|
// intro
|
||||||
for(int i=0; i<125; i++)
|
for(int i=0; i<63; i++)
|
||||||
{
|
{
|
||||||
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
||||||
{
|
{
|
||||||
@ -2281,7 +2371,7 @@ static void osdgenTask(void *parameters)
|
|||||||
introGraphics();
|
introGraphics();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=0; i<125; i++)
|
for(int i=0; i<63; i++)
|
||||||
{
|
{
|
||||||
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ static void OpOsdTask(void *parameters);
|
|||||||
// ****************
|
// ****************
|
||||||
// Private variables
|
// Private variables
|
||||||
|
|
||||||
//static uint32_t oposdPort;
|
static uint32_t oposdPort;
|
||||||
|
|
||||||
static xTaskHandle OpOsdTaskHandle;
|
static xTaskHandle OpOsdTaskHandle;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ int32_t OpOsdInitialize(void)
|
|||||||
|
|
||||||
|
|
||||||
// TODO: Get gps settings object
|
// TODO: Get gps settings object
|
||||||
/* oposdPort = PIOS_COM_OSD;*/
|
oposdPort = PIOS_COM_OSD;
|
||||||
|
|
||||||
oposd_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH);
|
oposd_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH);
|
||||||
PIOS_Assert(oposd_rx_buffer);
|
PIOS_Assert(oposd_rx_buffer);
|
||||||
@ -127,6 +127,7 @@ MODULE_INITCALL(OpOsdInitialize, OpOsdStart)
|
|||||||
|
|
||||||
static void OpOsdTask(void *parameters)
|
static void OpOsdTask(void *parameters)
|
||||||
{
|
{
|
||||||
|
portTickType xDelay = 100 / portTICK_RATE_MS;
|
||||||
portTickType lastSysTime;
|
portTickType lastSysTime;
|
||||||
// Loop forever
|
// Loop forever
|
||||||
lastSysTime = xTaskGetTickCount(); //portTickType xDelay = 100 / portTICK_RATE_MS;
|
lastSysTime = xTaskGetTickCount(); //portTickType xDelay = 100 / portTICK_RATE_MS;
|
||||||
@ -152,7 +153,7 @@ static void OpOsdTask(void *parameters)
|
|||||||
// Loop forever
|
// Loop forever
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
//DMA_Cmd(DMA1_Stream2, DISABLE); //prohibit channel3 for a little time
|
/*//DMA_Cmd(DMA1_Stream2, DISABLE); //prohibit channel3 for a little time
|
||||||
uint16_t cnt = DMA_GetCurrDataCounter(DMA1_Stream2);
|
uint16_t cnt = DMA_GetCurrDataCounter(DMA1_Stream2);
|
||||||
rx.wr = rx.buf_size-cnt;
|
rx.wr = rx.buf_size-cnt;
|
||||||
if(rx.wr)
|
if(rx.wr)
|
||||||
@ -199,9 +200,9 @@ static void OpOsdTask(void *parameters)
|
|||||||
attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8);
|
attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8);
|
||||||
attitude.Yaw = (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8);
|
attitude.Yaw = (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8);
|
||||||
AttitudeActualSet(&attitude);
|
AttitudeActualSet(&attitude);
|
||||||
/*setAttitudeOsd((int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8), //pitch
|
//setAttitudeOsd((int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8), //pitch
|
||||||
(int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8), //roll
|
// (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8), //roll
|
||||||
(int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8)); //yaw*/
|
// (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8)); //yaw
|
||||||
|
|
||||||
}
|
}
|
||||||
//frame completed
|
//frame completed
|
||||||
@ -212,9 +213,8 @@ static void OpOsdTask(void *parameters)
|
|||||||
}
|
}
|
||||||
//DMA_Cmd(DMA1_Stream2, ENABLE);
|
//DMA_Cmd(DMA1_Stream2, ENABLE);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*uint8_t c=0xAA;
|
|
||||||
//PIOS_COM_SendBufferNonBlocking(oposdPort, &c, 1);
|
//PIOS_COM_SendBufferNonBlocking(oposdPort, &c, 1);
|
||||||
|
|
||||||
// This blocks the task until there is something on the buffer
|
// This blocks the task until there is something on the buffer
|
||||||
@ -245,6 +245,8 @@ static void OpOsdTask(void *parameters)
|
|||||||
rx_count++;
|
rx_count++;
|
||||||
}
|
}
|
||||||
if (rx_count == 11)
|
if (rx_count == 11)
|
||||||
|
{
|
||||||
|
if(oposd_rx_buffer[1]==3)
|
||||||
{
|
{
|
||||||
AttitudeActualData attitude;
|
AttitudeActualData attitude;
|
||||||
AttitudeActualGet(&attitude);
|
AttitudeActualGet(&attitude);
|
||||||
@ -254,10 +256,15 @@ static void OpOsdTask(void *parameters)
|
|||||||
attitude.q4 = 0;
|
attitude.q4 = 0;
|
||||||
attitude.Roll = (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8);
|
attitude.Roll = (int16_t)(oposd_rx_buffer[3] | oposd_rx_buffer[4]<<8);
|
||||||
attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8);
|
attitude.Pitch = (int16_t)(oposd_rx_buffer[5] | oposd_rx_buffer[6]<<8);
|
||||||
attitude.Yaw = 0;
|
attitude.Yaw = (int16_t)(oposd_rx_buffer[7] | oposd_rx_buffer[8]<<8);
|
||||||
AttitudeActualSet(&attitude);
|
AttitudeActualSet(&attitude);
|
||||||
}
|
}
|
||||||
}*/
|
//frame completed
|
||||||
|
start_flag = false;
|
||||||
|
rx_count = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
vTaskDelayUntil(&lastSysTime, 50 / portTICK_RATE_MS);
|
vTaskDelayUntil(&lastSysTime, 50 / portTICK_RATE_MS);
|
||||||
// Check for GPS timeout
|
// Check for GPS timeout
|
||||||
timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
|
timeNowMs = xTaskGetTickCount() * portTICK_RATE_MS;
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
/* Com systems to include */
|
/* Com systems to include */
|
||||||
#define PIOS_INCLUDE_COM
|
#define PIOS_INCLUDE_COM
|
||||||
#define PIOS_INCLUDE_COM_TELEM
|
#define PIOS_INCLUDE_COM_TELEM
|
||||||
//#define PIOS_INCLUDE_COM_AUX
|
#define PIOS_INCLUDE_COM_AUX
|
||||||
#define PIOS_INCLUDE_GPS
|
#define PIOS_INCLUDE_GPS
|
||||||
//#define PIOS_OVERO_SPI
|
//#define PIOS_OVERO_SPI
|
||||||
|
|
||||||
|
@ -41,20 +41,10 @@
|
|||||||
#include <gcsreceiver.h>
|
#include <gcsreceiver.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TxBufferSize3 33
|
|
||||||
|
|
||||||
|
|
||||||
/* Private macro -------------------------------------------------------------*/
|
/* Private macro -------------------------------------------------------------*/
|
||||||
#define countof(a) (sizeof(a) / sizeof(*(a)))
|
#define countof(a) (sizeof(a) / sizeof(*(a)))
|
||||||
|
|
||||||
/* Private variables ---------------------------------------------------------*/
|
/* Private variables ---------------------------------------------------------*/
|
||||||
//uint8_t TxBuffer2[TxBufferSize2];
|
|
||||||
uint8_t TxBuffer3[TxBufferSize3];
|
|
||||||
//uint8_t RxBuffer2[TxBufferSize2];
|
|
||||||
uint8_t RxBuffer3[TxBufferSize3];
|
|
||||||
//uint8_t UART1_REVDATA[380];
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_ADC)
|
#if defined(PIOS_INCLUDE_ADC)
|
||||||
#include "pios_adc_priv.h"
|
#include "pios_adc_priv.h"
|
||||||
@ -222,115 +212,15 @@ void DAC_Ch1_SineWaveConfig(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void Clock(uint32_t spektrum_id);
|
static void Clock(uint32_t spektrum_id);
|
||||||
|
|
||||||
void initUSARTs(void)
|
|
||||||
{
|
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
|
||||||
USART_InitTypeDef USART_InitStructure;
|
|
||||||
|
|
||||||
//RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
|
|
||||||
//RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
|
|
||||||
//RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
|
|
||||||
|
|
||||||
/* Configure USART Tx as alternate function push-pull */
|
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
|
||||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
|
||||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
|
|
||||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
|
||||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource0,GPIO_AF_UART4);
|
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|
||||||
|
|
||||||
|
|
||||||
/* Configure USART Rx as input floating */
|
|
||||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
|
||||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
|
||||||
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
|
|
||||||
GPIO_PinAFConfig(GPIOA,GPIO_PinSource1,GPIO_AF_UART4);
|
|
||||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
|
||||||
|
|
||||||
|
|
||||||
USART_InitStructure.USART_BaudRate = 57600;
|
|
||||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
|
||||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
|
||||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
|
||||||
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
|
||||||
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
|
||||||
|
|
||||||
USART_Init(UART4, &USART_InitStructure);
|
|
||||||
USART_DMACmd(UART4, USART_DMAReq_Rx, ENABLE);
|
|
||||||
DMA_Cmd(DMA1_Stream2, ENABLE);
|
|
||||||
USART_Cmd(UART4, ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DMA_Channel_USART4_RX DMA1_Stream2
|
|
||||||
#define DMA_Channel_USART4_TX DMA1_Stream4
|
|
||||||
#define DMA_FLAG_USART3_TC_RX DMA1_FLAG_TC3
|
|
||||||
#define DMA_FLAG_USART3_TC_TX DMA1_FLAG_TC2
|
|
||||||
#define USART3_DR_Base 0x40004804
|
|
||||||
|
|
||||||
void init_USART_dma()
|
|
||||||
{
|
|
||||||
DMA_InitTypeDef DMA_InitStructure;
|
|
||||||
|
|
||||||
/*RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
|
|
||||||
|
|
||||||
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(USART3->DR);
|
|
||||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
|
||||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
|
||||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
|
||||||
DMA_InitStructure.DMA_BufferSize = size;
|
|
||||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
|
|
||||||
DMA_InitStructure.DMA_Priority = DMA_Priority_Low;
|
|
||||||
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
|
|
||||||
DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)buff[0];
|
|
||||||
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
|
|
||||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
|
||||||
|
|
||||||
DMA_DeInit(DMA_Channel_USART3_RX);
|
|
||||||
DMA_Init(DMA_Channel_USART3_RX, &DMA_InitStructure);
|
|
||||||
//DMA_ITConfig(DMA1_Channel3, DMA_IT_TC, ENABLE);
|
|
||||||
|
|
||||||
DMA_Cmd(DMA_Channel_USART3_RX, ENABLE);
|
|
||||||
USART_DMACmd(USART3, USART_DMAReq_Rx, ENABLE);*/
|
|
||||||
|
|
||||||
/*DMA Channel2 USART3 TX*/
|
|
||||||
DMA_DeInit(DMA1_Stream4);
|
|
||||||
DMA_InitStructure.DMA_Channel = DMA_Channel_4;
|
|
||||||
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&UART4->DR;
|
|
||||||
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)TxBuffer3;
|
|
||||||
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral; /*read from ram*/
|
|
||||||
DMA_InitStructure.DMA_BufferSize = TxBufferSize3; /*if content is 0,stop TX*/
|
|
||||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
|
||||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
|
||||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
|
||||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
|
||||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
|
|
||||||
//DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
|
|
||||||
DMA_InitStructure.DMA_Priority = DMA_Priority_Low;
|
|
||||||
//DMA_Init(DMA1_Channel2, &DMA_InitStructure);
|
|
||||||
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
|
|
||||||
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
|
|
||||||
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
|
|
||||||
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
|
|
||||||
|
|
||||||
/*DMA Channel3 USART3 RX*/
|
|
||||||
DMA_DeInit(DMA1_Stream2);
|
|
||||||
DMA_InitStructure.DMA_Channel = DMA_Channel_4;
|
|
||||||
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&UART4->DR;
|
|
||||||
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)RxBuffer3;
|
|
||||||
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralToMemory;
|
|
||||||
DMA_InitStructure.DMA_BufferSize = sizeof(RxBuffer3);
|
|
||||||
DMA_Init(DMA1_Stream2, &DMA_InitStructure);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 512
|
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 512
|
||||||
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 512
|
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 512
|
||||||
|
|
||||||
|
#define PIOS_COM_AUX_RX_BUF_LEN 512
|
||||||
|
#define PIOS_COM_AUX_TX_BUF_LEN 512
|
||||||
|
|
||||||
#define PIOS_COM_GPS_RX_BUF_LEN 32
|
#define PIOS_COM_GPS_RX_BUF_LEN 32
|
||||||
|
|
||||||
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 65
|
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 65
|
||||||
@ -343,7 +233,7 @@ uint32_t pios_com_aux_id;
|
|||||||
uint32_t pios_com_gps_id;
|
uint32_t pios_com_gps_id;
|
||||||
uint32_t pios_com_telem_usb_id;
|
uint32_t pios_com_telem_usb_id;
|
||||||
uint32_t pios_com_telem_rf_id;
|
uint32_t pios_com_telem_rf_id;
|
||||||
uint32_t pios_com_cotelem_id;
|
|
||||||
|
|
||||||
|
|
||||||
void PIOS_Board_Init(void) {
|
void PIOS_Board_Init(void) {
|
||||||
@ -530,15 +420,14 @@ void PIOS_Board_Init(void) {
|
|||||||
PIOS_DEBUG_Assert(0);
|
PIOS_DEBUG_Assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint32_t BUF_SIZE = 512;
|
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_AUX_RX_BUF_LEN);
|
||||||
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(BUF_SIZE);
|
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_AUX_TX_BUF_LEN);
|
||||||
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(BUF_SIZE);
|
|
||||||
PIOS_Assert(rx_buffer);
|
PIOS_Assert(rx_buffer);
|
||||||
PIOS_Assert(tx_buffer);
|
PIOS_Assert(tx_buffer);
|
||||||
|
|
||||||
if (PIOS_COM_Init(&pios_com_aux_id, &pios_usart_com_driver, pios_usart_aux_id,
|
if (PIOS_COM_Init(&pios_com_aux_id, &pios_usart_com_driver, pios_usart_aux_id,
|
||||||
rx_buffer, BUF_SIZE,
|
rx_buffer, PIOS_COM_AUX_RX_BUF_LEN,
|
||||||
tx_buffer, BUF_SIZE)) {
|
tx_buffer, PIOS_COM_AUX_TX_BUF_LEN)) {
|
||||||
PIOS_DEBUG_Assert(0);
|
PIOS_DEBUG_Assert(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,65 +456,14 @@ void PIOS_Board_Init(void) {
|
|||||||
pios_com_telem_rf_id = 0;
|
pios_com_telem_rf_id = 0;
|
||||||
#endif /* PIOS_INCLUDE_COM_TELEM */
|
#endif /* PIOS_INCLUDE_COM_TELEM */
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_COM_COTELEM)
|
|
||||||
{ /* Eventually add switch for this port function */
|
|
||||||
uint32_t pios_usart_cotelem_id;
|
|
||||||
if (PIOS_USART_Init(&pios_usart_cotelem_id, &pios_usart_cotelem_main_cfg)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_RX_BUF_LEN);
|
|
||||||
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_TX_BUF_LEN);
|
|
||||||
PIOS_Assert(rx_buffer);
|
|
||||||
PIOS_Assert(tx_buffer);
|
|
||||||
if (PIOS_COM_Init(&pios_com_cotelem_id, &pios_usart_com_driver, pios_usart_cotelem_id,
|
|
||||||
rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN,
|
|
||||||
tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
pios_com_cotelem_id = 0;
|
|
||||||
#endif /* PIOS_INCLUDE_COM_TELEM */
|
|
||||||
#endif /* PIOS_INCLUDE_COM */
|
#endif /* PIOS_INCLUDE_COM */
|
||||||
|
|
||||||
/*
|
|
||||||
uint32_t pios_usart_hkosd_id;
|
|
||||||
if (PIOS_USART_Init(&pios_usart_hkosd_id, &pios_usart_serial_cfg)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}
|
|
||||||
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_RX_BUF_LEN);
|
|
||||||
PIOS_Assert(rx_buffer);
|
|
||||||
|
|
||||||
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_TX_BUF_LEN);
|
|
||||||
PIOS_Assert(tx_buffer);
|
|
||||||
if (PIOS_COM_Init(&pios_com_hkosd_id, &pios_usart_com_driver, pios_usart_hkosd_id,
|
|
||||||
rx_buffer, PIOS_COM_HKOSD_RX_BUF_LEN,
|
|
||||||
tx_buffer, PIOS_COM_HKOSD_TX_BUF_LEN)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
uint32_t pios_usart_serial_id;
|
|
||||||
if (PIOS_USART_Init(&pios_usart_serial_id, &pios_usart_serial_cfg)) {
|
|
||||||
PIOS_DEBUG_Assert(0);
|
|
||||||
}
|
|
||||||
uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_RX_BUF_LEN);
|
|
||||||
uint8_t * tx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_TELEM_RF_TX_BUF_LEN);
|
|
||||||
PIOS_Assert(rx_buffer);
|
|
||||||
PIOS_Assert(tx_buffer);
|
|
||||||
|
|
||||||
if (PIOS_COM_Init(&pios_com_serial_id, &pios_usart_com_driver, pios_usart_serial_id,
|
|
||||||
rx_buffer, PIOS_COM_TELEM_RF_RX_BUF_LEN,
|
|
||||||
tx_buffer, PIOS_COM_TELEM_RF_TX_BUF_LEN)) {
|
|
||||||
PIOS_Assert(0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
/* Preconfiguration before using DAC----------------------------------------*/
|
/* Preconfiguration before using DAC----------------------------------------*/
|
||||||
GPIO_InitTypeDef GPIO_InitStructure;
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
|
||||||
/* DAC Periph clock enable */
|
/* DAC Periph clock enable */
|
||||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
|
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
|
||||||
|
|
||||||
/* DAC channel 1 & 2 (DAC_OUT1 = PA.4)(DAC_OUT2 = PA.5) configuration */
|
/* DAC channel 1 & 2 (DAC_OUT1 = PA.4)(DAC_OUT2 = PA.5) configuration */
|
||||||
@ -641,28 +479,15 @@ GPIO_InitTypeDef GPIO_InitStructure;
|
|||||||
DAC_Ch1_SineWaveConfig();
|
DAC_Ch1_SineWaveConfig();
|
||||||
//DAC_Ch2_SineWaveConfig();
|
//DAC_Ch2_SineWaveConfig();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ADC system
|
// ADC system
|
||||||
#if defined(PIOS_INCLUDE_ADC)
|
#if defined(PIOS_INCLUDE_ADC)
|
||||||
PIOS_ADC_Init(&pios_adc_cfg);
|
PIOS_ADC_Init(&pios_adc_cfg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// SPI link to master
|
#if defined(PIOS_INCLUDE_VIDEO)
|
||||||
/*if (PIOS_SPI_Init(&pios_spi_port_id, &pios_spi_port_cfg)) {
|
|
||||||
PIOS_DEBUG_Assert(0);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*init_USART_dma();
|
|
||||||
initUSARTs();
|
|
||||||
extern t_fifo_buffer rx;
|
|
||||||
fifoBuf_init(&rx,RxBuffer3,sizeof(RxBuffer3));*/
|
|
||||||
|
|
||||||
PIOS_Video_Init(&pios_video_cfg);
|
PIOS_Video_Init(&pios_video_cfg);
|
||||||
|
#endif
|
||||||
//uint8_t * rx_buffer = (uint8_t *) pvPortMalloc(PIOS_COM_HKOSD_RX_BUF_LEN);
|
|
||||||
|
|
||||||
//uint8_t test[16];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t supv_timer=0;
|
uint16_t supv_timer=0;
|
||||||
|
@ -137,30 +137,6 @@ TIM4 | STOPWATCH |
|
|||||||
#define PIOS_LED_HEARTBEAT 0
|
#define PIOS_LED_HEARTBEAT 0
|
||||||
#define PIOS_LED_ALARM 1
|
#define PIOS_LED_ALARM 1
|
||||||
|
|
||||||
#if 0
|
|
||||||
#define PIOS_LED_LED1_GPIO_PORT GPIOD
|
|
||||||
#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_13 //LD3
|
|
||||||
#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOD
|
|
||||||
#define PIOS_LED_LED2_GPIO_PORT GPIOD
|
|
||||||
#define PIOS_LED_LED2_GPIO_PIN GPIO_Pin_12 //LD4
|
|
||||||
#define PIOS_LED_LED2_GPIO_CLK RCC_APB2Periph_GPIOD
|
|
||||||
#define PIOS_LED_LED3_GPIO_PORT GPIOD
|
|
||||||
#define PIOS_LED_LED3_GPIO_PIN GPIO_Pin_14 //LD5
|
|
||||||
#define PIOS_LED_LED3_GPIO_CLK RCC_APB2Periph_GPIOD
|
|
||||||
#define PIOS_LED_LED4_GPIO_PORT GPIOD
|
|
||||||
#define PIOS_LED_LED4_GPIO_PIN GPIO_Pin_15 //LD6
|
|
||||||
#define PIOS_LED_LED4_GPIO_CLK RCC_APB2Periph_GPIOD
|
|
||||||
#define PIOS_LED_NUM 4
|
|
||||||
#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT, PIOS_LED_LED3_GPIO_PORT, PIOS_LED_LED4_GPIO_PORT }
|
|
||||||
#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN }
|
|
||||||
#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*#define USB_LED_ON PIOS_LED_On(LED1)
|
|
||||||
#define USB_LED_OFF PIOS_LED_Off(LED1)
|
|
||||||
#define USB_LED_TOGGLE PIOS_LED_Toggle(LED1)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
// Delay Timer
|
// Delay Timer
|
||||||
|
|
||||||
@ -206,17 +182,12 @@ extern uint32_t pios_com_telem_rf_id;
|
|||||||
extern uint32_t pios_com_gps_id;
|
extern uint32_t pios_com_gps_id;
|
||||||
extern uint32_t pios_com_aux_id;
|
extern uint32_t pios_com_aux_id;
|
||||||
extern uint32_t pios_com_telem_usb_id;
|
extern uint32_t pios_com_telem_usb_id;
|
||||||
extern uint32_t pios_com_cotelem_id;
|
|
||||||
#define PIOS_COM_AUX (pios_com_aux_id)
|
#define PIOS_COM_AUX (pios_com_aux_id)
|
||||||
#define PIOS_COM_GPS (pios_com_gps_id)
|
#define PIOS_COM_GPS (pios_com_gps_id)
|
||||||
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
|
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
|
||||||
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
|
#define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
|
||||||
#define PIOS_COM_COTELEM (pios_com_cotelem_id)
|
|
||||||
#define PIOS_COM_DEBUG PIOS_COM_AUX
|
#define PIOS_COM_DEBUG PIOS_COM_AUX
|
||||||
|
#define PIOS_COM_OSD (pios_com_aux_id)
|
||||||
|
|
||||||
extern uint32_t pios_com_hkosd_id;
|
|
||||||
#define PIOS_COM_OSD (pios_com_hkosd_id)
|
|
||||||
|
|
||||||
//extern uint32_t pios_com_serial_id;
|
//extern uint32_t pios_com_serial_id;
|
||||||
//#define PIOS_COM_SERIAL (pios_com_serial_id)
|
//#define PIOS_COM_SERIAL (pios_com_serial_id)
|
||||||
@ -269,158 +240,6 @@ extern uint32_t pios_com_telem_usb_id;
|
|||||||
#define PIOS_ADC_MAX_OVERSAMPLING 10
|
#define PIOS_ADC_MAX_OVERSAMPLING 10
|
||||||
#define PIOS_ADC_USE_ADC2 0
|
#define PIOS_ADC_USE_ADC2 0
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
// *****************************************************************
|
|
||||||
// GPIO output pins
|
|
||||||
|
|
||||||
// GPIO_Mode_Out_OD Open Drain Output
|
|
||||||
// GPIO_Mode_Out_PP Push-Pull Output
|
|
||||||
// GPIO_Mode_AF_OD Open Drain Output Alternate-Function
|
|
||||||
// GPIO_Mode_AF_PP Push-Pull Output Alternate-Function
|
|
||||||
|
|
||||||
// Serial port RTS line
|
|
||||||
#define PIOS_GPIO_OUT_0_PORT GPIOB
|
|
||||||
#define PIOS_GPIO_OUT_0_PIN GPIO_Pin_15
|
|
||||||
#define PIOS_GPIO_OUT_0_GPIO_CLK RCC_APB2Periph_GPIOB
|
|
||||||
|
|
||||||
// RF module chip-select line
|
|
||||||
#define PIOS_GPIO_OUT_1_PORT GPIOA
|
|
||||||
#define PIOS_GPIO_OUT_1_PIN GPIO_Pin_4
|
|
||||||
#define PIOS_GPIO_OUT_1_GPIO_CLK RCC_APB2Periph_GPIOA
|
|
||||||
|
|
||||||
// PPM OUT line
|
|
||||||
#define PIOS_GPIO_OUT_2_PORT GPIOB
|
|
||||||
#define PIOS_GPIO_OUT_2_PIN GPIO_Pin_10
|
|
||||||
#define PIOS_GPIO_OUT_2_GPIO_CLK RCC_APB2Periph_GPIOB
|
|
||||||
|
|
||||||
// spare pin
|
|
||||||
#define PIOS_GPIO_OUT_3_PORT GPIOA
|
|
||||||
#define PIOS_GPIO_OUT_3_PIN GPIO_Pin_0
|
|
||||||
#define PIOS_GPIO_OUT_3_GPIO_CLK RCC_APB2Periph_GPIOA
|
|
||||||
|
|
||||||
// spare pin
|
|
||||||
#define PIOS_GPIO_OUT_4_PORT GPIOA
|
|
||||||
#define PIOS_GPIO_OUT_4_PIN GPIO_Pin_1
|
|
||||||
#define PIOS_GPIO_OUT_4_GPIO_CLK RCC_APB2Periph_GPIOA
|
|
||||||
|
|
||||||
// spare pin
|
|
||||||
#define PIOS_GPIO_OUT_5_PORT GPIOC
|
|
||||||
#define PIOS_GPIO_OUT_5_PIN GPIO_Pin_13
|
|
||||||
#define PIOS_GPIO_OUT_5_GPIO_CLK RCC_APB2Periph_GPIOC
|
|
||||||
|
|
||||||
// spare pin
|
|
||||||
#define PIOS_GPIO_OUT_6_PORT GPIOC
|
|
||||||
#define PIOS_GPIO_OUT_6_PIN GPIO_Pin_14
|
|
||||||
#define PIOS_GPIO_OUT_6_GPIO_CLK RCC_APB2Periph_GPIOC
|
|
||||||
|
|
||||||
// spare pin
|
|
||||||
#define PIOS_GPIO_OUT_7_PORT GPIOC
|
|
||||||
#define PIOS_GPIO_OUT_7_PIN GPIO_Pin_15
|
|
||||||
#define PIOS_GPIO_OUT_7_GPIO_CLK RCC_APB2Periph_GPIOC
|
|
||||||
|
|
||||||
#define PIOS_GPIO_NUM 8
|
|
||||||
#define PIOS_GPIO_PORTS {PIOS_GPIO_OUT_0_PORT, PIOS_GPIO_OUT_1_PORT, PIOS_GPIO_OUT_2_PORT, PIOS_GPIO_OUT_3_PORT, PIOS_GPIO_OUT_4_PORT, PIOS_GPIO_OUT_5_PORT, PIOS_GPIO_OUT_6_PORT, PIOS_GPIO_OUT_7_PORT}
|
|
||||||
#define PIOS_GPIO_PINS {PIOS_GPIO_OUT_0_PIN, PIOS_GPIO_OUT_1_PIN, PIOS_GPIO_OUT_2_PIN, PIOS_GPIO_OUT_3_PIN, PIOS_GPIO_OUT_4_PIN, PIOS_GPIO_OUT_5_PIN, PIOS_GPIO_OUT_6_PIN, PIOS_GPIO_OUT_7_PIN}
|
|
||||||
#define PIOS_GPIO_CLKS {PIOS_GPIO_OUT_0_GPIO_CLK, PIOS_GPIO_OUT_1_GPIO_CLK, PIOS_GPIO_OUT_2_GPIO_CLK, PIOS_GPIO_OUT_3_GPIO_CLK, PIOS_GPIO_OUT_4_GPIO_CLK, PIOS_GPIO_OUT_5_GPIO_CLK, PIOS_GPIO_OUT_6_GPIO_CLK, PIOS_GPIO_OUT_7_GPIO_CLK}
|
|
||||||
|
|
||||||
#define SERIAL_RTS_ENABLE PIOS_GPIO_Enable(0)
|
|
||||||
#define SERIAL_RTS_SET PIOS_GPIO_Off(0)
|
|
||||||
#define SERIAL_RTS_CLEAR PIOS_GPIO_On(0)
|
|
||||||
|
|
||||||
#define RF_CS_ENABLE PIOS_GPIO_Enable(1)
|
|
||||||
#define RF_CS_HIGH PIOS_GPIO_Off(1)
|
|
||||||
#define RF_CS_LOW PIOS_GPIO_On(1)
|
|
||||||
|
|
||||||
#define PPM_OUT_PIN PIOS_GPIO_OUT_2_PIN
|
|
||||||
#define PPM_OUT_PORT PIOS_GPIO_OUT_2_PORT
|
|
||||||
#define PPM_OUT_ENABLE PIOS_GPIO_Enable(2)
|
|
||||||
#define PPM_OUT_HIGH PIOS_GPIO_Off(2)
|
|
||||||
#define PPM_OUT_LOW PIOS_GPIO_On(2)
|
|
||||||
|
|
||||||
#define SPARE1_ENABLE PIOS_GPIO_Enable(3)
|
|
||||||
#define SPARE1_HIGH PIOS_GPIO_Off(3)
|
|
||||||
#define SPARE1_LOW PIOS_GPIO_On(3)
|
|
||||||
|
|
||||||
#define SPARE2_ENABLE PIOS_GPIO_Enable(4)
|
|
||||||
#define SPARE2_HIGH PIOS_GPIO_Off(4)
|
|
||||||
#define SPARE2_LOW PIOS_GPIO_On(4)
|
|
||||||
|
|
||||||
#define SPARE3_ENABLE PIOS_GPIO_Enable(5)
|
|
||||||
#define SPARE3_HIGH PIOS_GPIO_Off(5)
|
|
||||||
#define SPARE3_LOW PIOS_GPIO_On(5)
|
|
||||||
|
|
||||||
#define SPARE4_ENABLE PIOS_GPIO_Enable(6)
|
|
||||||
#define SPARE4_HIGH PIOS_GPIO_Off(6)
|
|
||||||
#define SPARE4_LOW PIOS_GPIO_On(6)
|
|
||||||
|
|
||||||
#define SPARE5_ENABLE PIOS_GPIO_Enable(7)
|
|
||||||
#define SPARE5_HIGH PIOS_GPIO_Off(7)
|
|
||||||
#define SPARE5_LOW PIOS_GPIO_On(7)
|
|
||||||
|
|
||||||
// *****************************************************************
|
|
||||||
// GPIO input pins
|
|
||||||
|
|
||||||
// GPIO_Mode_AIN Analog Input
|
|
||||||
// GPIO_Mode_IN_FLOATING Input Floating
|
|
||||||
// GPIO_Mode_IPD Input Pull-Down
|
|
||||||
// GPIO_Mode_IPU Input Pull-up
|
|
||||||
|
|
||||||
// API mode line
|
|
||||||
#define GPIO_IN_0_PORT GPIOB
|
|
||||||
#define GPIO_IN_0_PIN GPIO_Pin_13
|
|
||||||
#define GPIO_IN_0_MODE GPIO_Mode_IPU
|
|
||||||
|
|
||||||
// Serial port CTS line
|
|
||||||
#define GPIO_IN_1_PORT GPIOB
|
|
||||||
#define GPIO_IN_1_PIN GPIO_Pin_14
|
|
||||||
#define GPIO_IN_1_MODE GPIO_Mode_IPU
|
|
||||||
|
|
||||||
// VBUS sense line
|
|
||||||
#define GPIO_IN_2_PORT GPIOA
|
|
||||||
#define GPIO_IN_2_PIN GPIO_Pin_8
|
|
||||||
#define GPIO_IN_2_MODE GPIO_Mode_IN_FLOATING
|
|
||||||
|
|
||||||
// 868MHz jumper option
|
|
||||||
#define GPIO_IN_3_PORT GPIOB
|
|
||||||
#define GPIO_IN_3_PIN GPIO_Pin_8
|
|
||||||
#define GPIO_IN_3_MODE GPIO_Mode_IPU
|
|
||||||
|
|
||||||
// 915MHz jumper option
|
|
||||||
#define GPIO_IN_4_PORT GPIOB
|
|
||||||
#define GPIO_IN_4_PIN GPIO_Pin_9
|
|
||||||
#define GPIO_IN_4_MODE GPIO_Mode_IPU
|
|
||||||
|
|
||||||
// RF INT line
|
|
||||||
#define GPIO_IN_5_PORT GPIOA
|
|
||||||
#define GPIO_IN_5_PIN GPIO_Pin_2
|
|
||||||
#define GPIO_IN_5_MODE GPIO_Mode_IN_FLOATING
|
|
||||||
|
|
||||||
// RF misc line
|
|
||||||
#define GPIO_IN_6_PORT GPIOB
|
|
||||||
#define GPIO_IN_6_PIN GPIO_Pin_0
|
|
||||||
#define GPIO_IN_6_MODE GPIO_Mode_IN_FLOATING
|
|
||||||
|
|
||||||
// PPM IN line
|
|
||||||
#define PPM_IN_PORT GPIOB
|
|
||||||
#define PPM_IN_PIN GPIO_Pin_11
|
|
||||||
#define PPM_IN_MODE GPIO_Mode_IPD
|
|
||||||
|
|
||||||
#define GPIO_IN_NUM 8
|
|
||||||
#define GPIO_IN_PORTS { GPIO_IN_0_PORT, GPIO_IN_1_PORT, GPIO_IN_2_PORT, GPIO_IN_3_PORT, GPIO_IN_4_PORT, GPIO_IN_5_PORT, GPIO_IN_6_PORT, PPM_IN_PORT }
|
|
||||||
#define GPIO_IN_PINS { GPIO_IN_0_PIN, GPIO_IN_1_PIN, GPIO_IN_2_PIN, GPIO_IN_3_PIN, GPIO_IN_4_PIN, GPIO_IN_5_PIN, GPIO_IN_6_PIN, PPM_IN_PIN }
|
|
||||||
#define GPIO_IN_MODES { GPIO_IN_0_MODE, GPIO_IN_1_MODE, GPIO_IN_2_MODE, GPIO_IN_3_MODE, GPIO_IN_4_MODE, GPIO_IN_5_MODE, GPIO_IN_6_MODE, PPM_IN_MODE }
|
|
||||||
|
|
||||||
#define API_MODE_PIN 0
|
|
||||||
#define SERIAL_CTS_PIN 1
|
|
||||||
#define VBUS_SENSE_PIN 2
|
|
||||||
#define _868MHz_PIN 3
|
|
||||||
#define _915MHz_PIN 4
|
|
||||||
#define RF_INT_PIN 5
|
|
||||||
#define RF_MISC_PIN 6
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
// USB
|
// USB
|
||||||
|
|
||||||
@ -435,33 +254,6 @@ extern uint32_t pios_com_telem_usb_id;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// *****************************************************************
|
|
||||||
// VIDEO
|
|
||||||
#define PIOS_VIDEO_HSYNC_GPIO_PORT GPIOD
|
|
||||||
#define PIOS_VIDEO_HSYNC_GPIO_PIN GPIO_Pin_0
|
|
||||||
#define PIOS_VIDEO_HSYNC_PORT_SOURCE GPIO_PortSourceGPIOD
|
|
||||||
#define PIOS_VIDEO_HSYNC_PIN_SOURCE GPIO_PinSource0
|
|
||||||
#define PIOS_VIDEO_HSYNC_CLK RCC_AHB1Periph_GPIOD
|
|
||||||
#define PIOS_VIDEO_HSYNC_EXTI_LINE EXTI_Line0
|
|
||||||
#define PIOS_VIDEO_HSYNC_EXTI_PORT_SOURCE EXTI_PortSourceGPIOD
|
|
||||||
#define PIOS_VIDEO_HSYNC_EXTI_PIN_SOURCE EXTI_PinSource0
|
|
||||||
#define PIOS_VIDEO_HSYNC_IRQn EXTI0_IRQn
|
|
||||||
#define PIOS_VIDEO_HSYNC_PRIO PIOS_IRQ_PRIO_HIGHEST
|
|
||||||
//#define PIOS_VIDEO_SYNC_PRIO 1
|
|
||||||
|
|
||||||
#define PIOS_VIDEO_VSYNC_GPIO_PORT GPIOC
|
|
||||||
#define PIOS_VIDEO_VSYNC_GPIO_PIN GPIO_Pin_11
|
|
||||||
#define PIOS_VIDEO_VSYNC_PORT_SOURCE GPIO_PortSourceGPIOC
|
|
||||||
#define PIOS_VIDEO_VSYNC_PIN_SOURCE GPIO_PinSource11
|
|
||||||
#define PIOS_VIDEO_VSYNC_CLK RCC_AHB1Periph_GPIOC
|
|
||||||
#define PIOS_VIDEO_VSYNC_EXTI_LINE EXTI_Line11
|
|
||||||
#define PIOS_VIDEO_VSYNC_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
|
||||||
#define PIOS_VIDEO_VSYNC_EXTI_PIN_SOURCE EXTI_PinSource11
|
|
||||||
#define PIOS_VIDEO_VSYNC_IRQn EXTI15_10_IRQn
|
|
||||||
#define PIOS_VIDEO_VSYNC_PRIO PIOS_IRQ_PRIO_HIGHEST
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// *****************************************************************
|
// *****************************************************************
|
||||||
//--------------------------
|
//--------------------------
|
||||||
// Timer controller settings
|
// Timer controller settings
|
||||||
|
@ -129,7 +129,7 @@ static const struct pios_usart_cfg pios_usart_aux_cfg = {
|
|||||||
.regs = USART2,
|
.regs = USART2,
|
||||||
.remap = GPIO_AF_USART2,
|
.remap = GPIO_AF_USART2,
|
||||||
.init = {
|
.init = {
|
||||||
.USART_BaudRate = 230400,
|
.USART_BaudRate = 57600,
|
||||||
.USART_WordLength = USART_WordLength_8b,
|
.USART_WordLength = USART_WordLength_8b,
|
||||||
.USART_Parity = USART_Parity_No,
|
.USART_Parity = USART_Parity_No,
|
||||||
.USART_StopBits = USART_StopBits_1,
|
.USART_StopBits = USART_StopBits_1,
|
||||||
@ -217,56 +217,6 @@ static const struct pios_usart_cfg pios_usart_telem_main_cfg = {
|
|||||||
|
|
||||||
#endif /* PIOS_COM_TELEM */
|
#endif /* PIOS_COM_TELEM */
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/*
|
|
||||||
* COTelemetry on main USART
|
|
||||||
*/
|
|
||||||
static const struct pios_usart_cfg pios_usart_cotelem_main_cfg = {
|
|
||||||
.regs = UART4,
|
|
||||||
.remap = GPIO_AF_UART4,
|
|
||||||
.init = {
|
|
||||||
.USART_BaudRate = 57600,
|
|
||||||
.USART_WordLength = USART_WordLength_8b,
|
|
||||||
.USART_Parity = USART_Parity_No,
|
|
||||||
.USART_StopBits = USART_StopBits_1,
|
|
||||||
.USART_HardwareFlowControl =
|
|
||||||
USART_HardwareFlowControl_None,
|
|
||||||
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
|
|
||||||
},
|
|
||||||
.irq = {
|
|
||||||
.init = {
|
|
||||||
.NVIC_IRQChannel = UART4_IRQn,
|
|
||||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
|
|
||||||
.NVIC_IRQChannelSubPriority = 0,
|
|
||||||
.NVIC_IRQChannelCmd = ENABLE,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.rx = {
|
|
||||||
.gpio = GPIOA,
|
|
||||||
.init = {
|
|
||||||
.GPIO_Pin = GPIO_Pin_1,
|
|
||||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
|
||||||
.GPIO_Mode = GPIO_Mode_AF,
|
|
||||||
.GPIO_OType = GPIO_OType_PP,
|
|
||||||
.GPIO_PuPd = GPIO_PuPd_UP
|
|
||||||
},
|
|
||||||
},
|
|
||||||
.tx = {
|
|
||||||
.gpio = GPIOA,
|
|
||||||
.init = {
|
|
||||||
.GPIO_Pin = GPIO_Pin_0,
|
|
||||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
|
||||||
.GPIO_Mode = GPIO_Mode_AF,
|
|
||||||
.GPIO_OType = GPIO_OType_PP,
|
|
||||||
.GPIO_PuPd = GPIO_PuPd_UP
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PIOS_COM_COTELEM */
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(PIOS_INCLUDE_COM)
|
#if defined(PIOS_INCLUDE_COM)
|
||||||
|
|
||||||
#include <pios_com_priv.h>
|
#include <pios_com_priv.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user