1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Updated to use the new fifo_init function

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2172 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-11-28 11:00:20 +00:00 committed by pip
parent 912ba59cf9
commit d4c24de556
3 changed files with 13 additions and 4 deletions

View File

@ -70,8 +70,8 @@ void PIOS_USART_Init(void)
PIOS_DEBUG_Assert(usart_dev);
/* Clear buffer counters */
fifoBuf_init(&usart_dev->rx);
fifoBuf_init(&usart_dev->tx);
fifoBuf_init(&usart_dev->rx, usart_dev->rx_buffer, UART_BUFFER_SIZE);
fifoBuf_init(&usart_dev->tx, usart_dev->tx_buffer, UART_BUFFER_SIZE);
/* Enable the USART Pins Software Remapping */
if (usart_dev->cfg->remap) {

View File

@ -55,7 +55,10 @@ static uint8_t transfer_possible = 0;
static uint8_t rx_packet_buffer[PIOS_USB_HID_DATA_LENGTH + 2] = { 0 };
static uint8_t tx_packet_buffer[PIOS_USB_HID_DATA_LENGTH + 2] = { 0 };
uint8_t rx_pios_fifo_buf[1024];
t_fifo_buffer rx_pios_fifo_buffer;
uint8_t tx_pios_fifo_buf[1024];
t_fifo_buffer tx_pios_fifo_buffer;
/**
* Initialises USB COM layer
@ -71,8 +74,8 @@ int32_t PIOS_USB_HID_Init(uint32_t mode)
return -1;
}
fifoBuf_init(&rx_pios_fifo_buffer);
fifoBuf_init(&tx_pios_fifo_buffer);
fifoBuf_init(&rx_pios_fifo_buffer, rx_pios_fifo_buf, sizeof(rx_pios_fifo_buf));
fifoBuf_init(&tx_pios_fifo_buffer, tx_pios_fifo_buf, sizeof(tx_pios_fifo_buf));
PIOS_USB_HID_Reenumerate();

View File

@ -36,6 +36,8 @@
#include <pios_stm32.h>
#include <fifo_buffer.h>
#define UART_BUFFER_SIZE 1024
struct pios_usart_cfg {
USART_TypeDef *regs;
uint32_t remap; /* GPIO_Remap_* */
@ -47,7 +49,11 @@ struct pios_usart_cfg {
struct pios_usart_dev {
const struct pios_usart_cfg *const cfg;
uint8_t rx_buffer[UART_BUFFER_SIZE];
t_fifo_buffer rx;
uint8_t tx_buffer[UART_BUFFER_SIZE];
t_fifo_buffer tx;
};