1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Reconfigured to run on the real PipX board.

This commit is contained in:
Brian Webb 2012-04-06 18:44:31 -07:00
parent fb47537d8b
commit 56a2006fd8
3 changed files with 26 additions and 15 deletions

View File

@ -190,14 +190,24 @@ static void com2RadioBridgeTask(void * parameters)
uint32_t rx_bytes = 0;
portTickType packet_start_time = 0;
uint32_t timeout = 500;
uint32_t inputPort;
/* Handle usart/usb -> radio direction */
while (1) {
#if defined(PIOS_INCLUDE_USB)
// Determine input port (USB takes priority over telemetry port)
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB) {
inputPort = PIOS_COM_TELEM_USB;
} else
#endif /* PIOS_INCLUDE_USB */
{
inputPort = data->com_port;
}
// Receive data from the com port
//debug_msg = "COM receive";
uint32_t cur_rx_bytes = PIOS_COM_ReceiveBuffer(data->com_port, data->com2radio_buf +
rx_bytes, BRIDGE_BUF_LEN - rx_bytes, timeout);
uint32_t cur_rx_bytes = PIOS_COM_ReceiveBuffer(inputPort, data->com2radio_buf +
rx_bytes, BRIDGE_BUF_LEN - rx_bytes, timeout);
//debug_msg = "COM receive done";
rx_bytes += cur_rx_bytes;
@ -265,7 +275,13 @@ static void com2RadioBridgeTask(void * parameters)
*/
static int32_t transmitData(uint8_t *buf, int32_t length)
{
return PIOS_COM_SendBuffer(data->com_port, buf, length);
uint32_t inputPort = data->com_port;
#if defined(PIOS_INCLUDE_USB)
// Determine input port (USB takes priority over telemetry port)
if (PIOS_USB_CheckAvailable(0) && PIOS_COM_TELEM_USB)
inputPort = PIOS_COM_TELEM_USB;
#endif /* PIOS_INCLUDE_USB */
return PIOS_COM_SendBuffer(inputPort, buf, length);
}
/**

View File

@ -160,14 +160,9 @@ extern uint32_t pios_com_rfm22b_id;
#define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
#define PIOS_COM_VCP_USB (pios_com_vcp_usb_id)
#define PIOS_COM_RFM22B_RF (pios_com_rfm22b_id)
/*
#define PIOS_COM_DEBUG PIOS_COM_TELEM_SERIAL
#define PIOS_COM_BRIDGE_COM PIOS_COM_TELEM_USB
*/
#define PIOS_COM_DEBUG PIOS_COM_FLEXI
#define PIOS_COM_BRIDGE_COM PIOS_COM_TELEM_SERIAL
//#define PIOS_COM_BRIDGE_COM PIOS_COM_FLEXI
#define PIOS_COM_BRIDGE_RADIO PIOS_COM_RFM22B_RF
#define PIOS_COM_BRIDGE_RADIO PIOS_COM_RFM22B_RF
#define PIOS_COM_DEBUG PIOS_COM_FLEXI
#define PIOS_COM_BRIDGE_COM PIOS_COM_TELEM_SERIAL
#define DEBUG_LEVEL 2
#if DEBUG_LEVEL > 0

View File

@ -6,11 +6,11 @@
static const struct pios_led pios_leds[] = {
[PIOS_LED_USB] = {
.pin = {
//.gpio = GPIOA,
.gpio = GPIOC,
.gpio = GPIOA,
//.gpio = GPIOC,
.init = {
//.GPIO_Pin = GPIO_Pin_3,
.GPIO_Pin = GPIO_Pin_13,
.GPIO_Pin = GPIO_Pin_3,
//.GPIO_Pin = GPIO_Pin_13,
.GPIO_Mode = GPIO_Mode_Out_PP,
.GPIO_Speed = GPIO_Speed_50MHz,
},