mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-19 09:54:15 +01:00
Updated all function comments to doxygen style.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@22 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c7a439daa5
commit
3cd296ceb4
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @file pios_board.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2009.
|
||||
* @brief Defines board hardware for the OpenPilot hardware.
|
||||
* @brief Defines board hardware for the OpenPilot Version 0.1 hardware.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
@ -35,19 +35,18 @@
|
||||
//------------------------
|
||||
// DMA Channels Used
|
||||
//------------------------
|
||||
/* Channel 1 - */
|
||||
/* Channel 1 - */
|
||||
/* Channel 2 - SPI1 (SPI_SD_RX) */
|
||||
/* Channel 3 - SPI1 (SPI_SD_TX) */
|
||||
/* Channel 4 - */
|
||||
/* Channel 5 - */
|
||||
/* Channel 6 - */
|
||||
/* Channel 7 - */
|
||||
/* Channel 8 - */
|
||||
|
||||
/* Channel 9 - */
|
||||
/* Channel 10 - */
|
||||
/* Channel 11 - */
|
||||
/* Channel 12 - */
|
||||
/* Channel 4 - */
|
||||
/* Channel 5 - */
|
||||
/* Channel 6 - */
|
||||
/* Channel 7 - */
|
||||
/* Channel 8 - */
|
||||
/* Channel 9 - */
|
||||
/* Channel 10 - */
|
||||
/* Channel 11 - */
|
||||
/* Channel 12 - */
|
||||
|
||||
//------------------------
|
||||
// Leds Definition
|
||||
@ -152,7 +151,7 @@
|
||||
#define RECEIVER6_TIM_PORT TIM1
|
||||
#define RECEIVER6_CH TIM_Channel_2 // TIM1_CH2
|
||||
|
||||
/* Not used in v1.2 HW
|
||||
/* Not used in v0.1 HW
|
||||
#define RECEIVER7_GPIO_PORT GPIOB
|
||||
#define RECEIVER7_PIN GPIO_Pin_4 // PB4
|
||||
#define RECEIVER7_TIM_PORT TIM3
|
||||
|
@ -43,11 +43,15 @@ static unsigned int prev_primask;
|
||||
|
||||
/**
|
||||
* Function Name : IRQDisable
|
||||
* Description : Disables all interrupts (nested)
|
||||
* Description :
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Zero on no error
|
||||
*/
|
||||
/**
|
||||
* Disables all interrupts (nested)
|
||||
* \return < 0 On errors
|
||||
*/
|
||||
int IRQDisable(void)
|
||||
{
|
||||
/* Get current priority if nested level == 0 */
|
||||
@ -73,11 +77,9 @@ int IRQDisable(void)
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : IRQEnable
|
||||
* Description : Enables all interrupts (nested)
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : Zero on no error, -1 on nesting error
|
||||
* Enables all interrupts (nested)
|
||||
* \return < 0 on errors
|
||||
* \return -1 on nesting errors (IRQDisable() hasn't been called before)
|
||||
*/
|
||||
int IRQEnable(void)
|
||||
{
|
||||
|
@ -34,17 +34,13 @@
|
||||
|
||||
|
||||
/* Local Variables */
|
||||
GPIO_TypeDef* LED_GPIO_PORT[NUM_LED] = {LED1_GPIO_PORT, LED2_GPIO_PORT};
|
||||
const uint16_t LED_GPIO_PIN[NUM_LED] = {LED1_GPIO_PIN, LED2_GPIO_PIN};
|
||||
const uint32_t LED_GPIO_CLK[NUM_LED] = {LED1_GPIO_CLK, LED2_GPIO_CLK};
|
||||
static GPIO_TypeDef* LED_GPIO_PORT[NUM_LED] = {LED1_GPIO_PORT, LED2_GPIO_PORT};
|
||||
static const uint16_t LED_GPIO_PIN[NUM_LED] = {LED1_GPIO_PIN, LED2_GPIO_PIN};
|
||||
static const uint32_t LED_GPIO_CLK[NUM_LED] = {LED1_GPIO_CLK, LED2_GPIO_CLK};
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : LED_INIT
|
||||
* Description : Initialises all the LED's
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Initialises all the LED's
|
||||
*/
|
||||
void LED_INIT(void)
|
||||
{
|
||||
@ -61,39 +57,30 @@ void LED_INIT(void)
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : LED_ON
|
||||
* Description : Turn on LED
|
||||
* Input : LED Number
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Turn on LED
|
||||
* \param[in] LED LED Name (LED1, LED2)
|
||||
*/
|
||||
void LED_ON(LedTypeDef LEDNum)
|
||||
void LED_ON(LedTypeDef LED)
|
||||
{
|
||||
LED_GPIO_PORT[LEDNum]->BSRR = LED_GPIO_PIN[LEDNum];
|
||||
LED_GPIO_PORT[LED]->BSRR = LED_GPIO_PIN[LED];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : LED_OFF
|
||||
* Description : Turn off LED
|
||||
* Input : LED Number
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Turn off LED
|
||||
* \param[in] LED LED Name (LED1, LED2)
|
||||
*/
|
||||
void LED_OFF(LedTypeDef LEDNum)
|
||||
void LED_OFF(LedTypeDef LED)
|
||||
{
|
||||
LED_GPIO_PORT[LEDNum]->BRR = LED_GPIO_PIN[LEDNum];
|
||||
LED_GPIO_PORT[LED]->BRR = LED_GPIO_PIN[LED];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : LED_TOGGLE
|
||||
* Description : Turn on/off LED
|
||||
* Input : LED Number
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Toggle LED on/off
|
||||
* \param[in] LED LED Name (LED1, LED2)
|
||||
*/
|
||||
void LED_TOGGLE(LedTypeDef LEDNum)
|
||||
void LED_TOGGLE(LedTypeDef LED)
|
||||
{
|
||||
LED_GPIO_PORT[LEDNum]->ODR ^= LED_GPIO_PIN[LEDNum];
|
||||
LED_GPIO_PORT[LED]->ODR ^= LED_GPIO_PIN[LED];
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ typedef enum {LED1 = 0, LED2 = 1} LedTypeDef;
|
||||
|
||||
/* Public Functions */
|
||||
extern void LED_INIT(void);
|
||||
extern void LED_ON(LedTypeDef LEDNum);
|
||||
extern void LED_OFF(LedTypeDef LEDNum);
|
||||
extern void LED_TOGGLE(LedTypeDef LEDNum);
|
||||
extern void LED_ON(LedTypeDef LED);
|
||||
extern void LED_OFF(LedTypeDef LED);
|
||||
extern void LED_TOGGLE(LedTypeDef LED);
|
||||
|
||||
#endif /* PIOS_LED_H */
|
||||
|
@ -38,30 +38,22 @@ SettingsTypeDef Settings;
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : LoadSettings
|
||||
* Description : Populate System global Vars into Structs using MinIni,
|
||||
* : defaults are also set here. Only function in the file
|
||||
* : and where all our system data is handled.
|
||||
* : Called from the end of SysInit()
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Populate System global Settings into Structs using MinIni, defaults are also set here.
|
||||
*/
|
||||
/* Value Reading: ini_getl("Section", "Key", (DefaultValue), IniFile); */
|
||||
/* Value Reading: ini_getl("Section", "Key", (DefaultValue), IniFile); */
|
||||
/* String Reading: ini_gets("Section", "Key", "DefaultValue", StrBuffer, sizearray(StrBuffer), IniFile); */
|
||||
|
||||
void LoadSettings(void)
|
||||
{
|
||||
char StrBuffer[100];
|
||||
long Result;
|
||||
|
||||
/* Section: GPS */
|
||||
Settings.GPS.Baudrate = (uint32_t) ini_getl("GPS", "Baudrate", GPS_BAUDRATE, SETTINGS_FILE);
|
||||
Settings.GPS.Baudrate = (uint32_t) ini_getl("GPS", "Baudrate", GPS_BAUDRATE, SETTINGS_FILE);
|
||||
|
||||
/* Section: Telemetry */
|
||||
Settings.Telem.Baudrate = (uint32_t) ini_getl("Telemetry", "Baudrate", TELEM_BAUDRATE, SETTINGS_FILE);
|
||||
Settings.Telem.Baudrate = (uint32_t) ini_getl("Telemetry", "Baudrate", TELEM_BAUDRATE, SETTINGS_FILE);
|
||||
|
||||
/* Section: Auxillary_UART */
|
||||
Settings.AuxUART.Enabled = (bool) ini_getl("Auxillary_UART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
|
||||
Settings.AuxUART.Enabled = (bool) ini_getl("Auxillary_UART", "Enabled", AUXUART_ENABLED, SETTINGS_FILE);
|
||||
Settings.AuxUART.Baudrate = (uint32_t) ini_getl("Auxillary_UART", "Baudrate", AUXUART_BAUDRATE, SETTINGS_FILE);
|
||||
}
|
||||
|
@ -35,17 +35,13 @@ void NVIC_Configuration(void);
|
||||
|
||||
|
||||
/* Local Variables */
|
||||
FATFS Fatfs[_DRIVES]; // File system object for each logical drive */
|
||||
/* File system object for each logical drive */
|
||||
static FATFS Fatfs[_DRIVES];
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : SysInit
|
||||
* Description : Brings up the System and Initializes peripherals
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Initializes all system peripherals
|
||||
*/
|
||||
//TODO: Get these in the right order, settings need to be loaded ASAP
|
||||
void SysInit(void)
|
||||
{
|
||||
/* Setup STM32 system (RCC, clock, PLL and Flash configuration) - CMSIS Function */
|
||||
@ -67,17 +63,14 @@ void SysInit(void)
|
||||
}
|
||||
|
||||
/* Call LoadSettings which populates System Vars */
|
||||
/* Settings can not be loaded before this point */
|
||||
LoadSettings();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : GPIO_Configuration
|
||||
* Description : Configures base level GPIO ports.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Configures base level GPIO ports.
|
||||
*/
|
||||
void GPIO_Configuration(void)
|
||||
{
|
||||
@ -86,11 +79,7 @@ void GPIO_Configuration(void)
|
||||
|
||||
|
||||
/**
|
||||
* Function Name : NVIC_Configuration
|
||||
* Description : Configures Vector Table base location and SysTick
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
* Configures Vector Table base location and SysTick
|
||||
*/
|
||||
void NVIC_Configuration(void)
|
||||
{
|
||||
|
@ -46,9 +46,7 @@ static volatile u8 tx_buffer_size[UART_NUM];
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Initialise the GPS and TELEM onboard UARTs
|
||||
*
|
||||
*/
|
||||
void UARTInit(void)
|
||||
{
|
||||
@ -141,9 +139,7 @@ void UARTInit(void)
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Enables AUX UART at the expense of servo inputs
|
||||
*
|
||||
*/
|
||||
void EnableAuxUART(void)
|
||||
{
|
||||
@ -152,9 +148,7 @@ void EnableAuxUART(void)
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Disables AUX UART reclaims two servo inputs
|
||||
*
|
||||
*/
|
||||
void DisableAuxUART(void)
|
||||
{
|
||||
@ -163,11 +157,9 @@ void DisableAuxUART(void)
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Changes the baud rate of the USART peripherial without re-initialising.
|
||||
* \param[in] USARTx UART Number
|
||||
* \param[in] USARTx UART name (GPS, TELEM, AUX)
|
||||
* \param[in] Baud Requested baud rate
|
||||
*
|
||||
*/
|
||||
void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud)
|
||||
{
|
||||
@ -175,29 +167,29 @@ void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud)
|
||||
/* Configure the USART Baud Rate */
|
||||
/* Adapted from stm32f01x_usart.c */
|
||||
|
||||
uint32_t tmpreg = 0x00, apbclock = 0x00;
|
||||
uint32_t integerdivider = 0x00;
|
||||
uint32_t fractionaldivider = 0x00;
|
||||
uint32_t usartxbase = (uint32_t)USARTx;
|
||||
uint32_t TmpReg = 0x00, ApbClock = 0x00;
|
||||
uint32_t IntegerDivider = 0x00;
|
||||
uint32_t FractionalDivider = 0x00;
|
||||
uint32_t USARTxBase = (uint32_t)USARTx;
|
||||
RCC_ClocksTypeDef RCC_ClocksStatus;
|
||||
|
||||
RCC_GetClocksFreq(&RCC_ClocksStatus);
|
||||
if (usartxbase == USART1_BASE) {
|
||||
apbclock = RCC_ClocksStatus.PCLK2_Frequency;
|
||||
if (USARTxBase == USART1_BASE) {
|
||||
ApbClock = RCC_ClocksStatus.PCLK2_Frequency;
|
||||
} else {
|
||||
apbclock = RCC_ClocksStatus.PCLK1_Frequency;
|
||||
ApbClock = RCC_ClocksStatus.PCLK1_Frequency;
|
||||
}
|
||||
|
||||
/* Determine the integer part */
|
||||
integerdivider = ((0x19 * apbclock) / (0x04 * (Baud)));
|
||||
tmpreg = (integerdivider / 0x64) << 0x04;
|
||||
IntegerDivider = ((0x19 * ApbClock) / (0x04 * (Baud)));
|
||||
TmpReg = (IntegerDivider / 0x64) << 0x04;
|
||||
|
||||
/* Determine the fractional part */
|
||||
fractionaldivider = integerdivider - (0x64 * (tmpreg >> 0x04));
|
||||
tmpreg |= ((((fractionaldivider * 0x10) + 0x32) / 0x64)) & ((uint8_t)0x0F);
|
||||
FractionalDivider = IntegerDivider - (0x64 * (TmpReg >> 0x04));
|
||||
TmpReg |= ((((FractionalDivider * 0x10) + 0x32) / 0x64)) & ((uint8_t)0x0F);
|
||||
|
||||
/* Write to USART BRR */
|
||||
USARTx->BRR = (uint16_t)tmpreg;
|
||||
USARTx->BRR = (uint16_t)TmpReg;
|
||||
}
|
||||
|
||||
|
||||
@ -205,13 +197,13 @@ void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud)
|
||||
/* WORK IN PROGRESS BELOW */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! returns number of free bytes in receive buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return uart number of free bytes
|
||||
//! \return 1: uart available
|
||||
//! \return 0: uart not available
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Returns number of free bytes in receive buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return uart number of free bytes
|
||||
* \return 1: uart available
|
||||
* \return 0: uart not available
|
||||
*/
|
||||
int UARTRxBufferFree(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -221,13 +213,13 @@ int UARTRxBufferFree(UARTNumTypeDef uart)
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! returns number of used bytes in receive buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return > 0: number of used bytes
|
||||
//! \return 0 if uart not available
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Returns number of used bytes in receive buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return > 0: number of used bytes
|
||||
* \return 0 if uart not available
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTRxBufferUsed(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -237,17 +229,16 @@ int UARTRxBufferUsed(UARTNumTypeDef uart)
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! gets a byte from the receive buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if no new byte available
|
||||
//! \return >= 0: number of received bytes
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Gets a byte from the receive buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if no new byte available
|
||||
* \return >= 0: number of received bytes
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTRxBufferGet(UARTNumTypeDef uart)
|
||||
{
|
||||
|
||||
if(uart >= UART_NUM) {
|
||||
/* UART not available */
|
||||
return -1;
|
||||
@ -259,7 +250,7 @@ int UARTRxBufferGet(UARTNumTypeDef uart)
|
||||
|
||||
/* get byte - this operation should be atomic! */
|
||||
IRQDisable();
|
||||
u8 b = rx_buffer[uart][rx_buffer_tail[uart]];
|
||||
uint8_t b = rx_buffer[uart][rx_buffer_tail[uart]];
|
||||
if(++rx_buffer_tail[uart] >= UART_RX_BUFFER_SIZE) {
|
||||
rx_buffer_tail[uart] = 0;
|
||||
}
|
||||
@ -270,14 +261,14 @@ int UARTRxBufferGet(UARTNumTypeDef uart)
|
||||
return b;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! returns the next byte of the receive buffer without taking it
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if no new byte available
|
||||
//! \return >= 0: number of received bytes
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Returns the next byte of the receive buffer without taking it
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if no new byte available
|
||||
* \return >= 0: number of received bytes
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTRxBufferPeek(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -299,15 +290,15 @@ int UARTRxBufferPeek(UARTNumTypeDef uart)
|
||||
return b;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! puts a byte onto the receive buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \param[in] b byte which should be put into Rx buffer
|
||||
//! \return 0 if no error
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if buffer full (retry)
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* puts a byte onto the receive buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \param[in] b byte which should be put into Rx buffer
|
||||
* \return 0 if no error
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if buffer full (retry)
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTRxBufferPut(UARTNumTypeDef uart, uint8_t b)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -335,13 +326,13 @@ int UARTRxBufferPut(UARTNumTypeDef uart, uint8_t b)
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! returns number of free bytes in transmit buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return number of free bytes
|
||||
//! \return 0 if uart not available
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* returns number of free bytes in transmit buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return number of free bytes
|
||||
* \return 0 if uart not available
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferFree(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -351,13 +342,13 @@ int UARTTxBufferFree(UARTNumTypeDef uart)
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! returns number of used bytes in transmit buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return number of used bytes
|
||||
//! \return 0 if uart not available
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* returns number of used bytes in transmit buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return number of used bytes
|
||||
* \return 0 if uart not available
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferUsed(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -367,14 +358,14 @@ int UARTTxBufferUsed(UARTNumTypeDef uart)
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! gets a byte from the transmit buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if no new byte available
|
||||
//! \return >= 0: transmitted byte
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* gets a byte from the transmit buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if no new byte available
|
||||
* \return >= 0: transmitted byte
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferGet(UARTNumTypeDef uart)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -400,17 +391,17 @@ int UARTTxBufferGet(UARTNumTypeDef uart)
|
||||
return b;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! puts more than one byte onto the transmit buffer (used for atomic sends)
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \param[in] *buffer pointer to buffer to be sent
|
||||
//! \param[in] len number of bytes to be sent
|
||||
//! \return 0 if no error
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if buffer full or cannot get all requested bytes (retry)
|
||||
//! \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* puts more than one byte onto the transmit buffer (used for atomic sends)
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \param[in] *buffer pointer to buffer to be sent
|
||||
* \param[in] len number of bytes to be sent
|
||||
* \return 0 if no error
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if buffer full or cannot get all requested bytes (retry)
|
||||
* \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferPutMore_NonBlocking(UARTNumTypeDef uart, uint8_t *buffer, uint16_t len)
|
||||
{
|
||||
if(uart >= UART_NUM) {
|
||||
@ -456,17 +447,17 @@ int UARTTxBufferPutMore_NonBlocking(UARTNumTypeDef uart, uint8_t *buffer, uint16
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! puts more than one byte onto the transmit buffer (used for atomic sends)<BR>
|
||||
//! (blocking function)
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \param[in] *buffer pointer to buffer to be sent
|
||||
//! \param[in] len number of bytes to be sent
|
||||
//! \return 0 if no error
|
||||
//! \return -1 if UART not available
|
||||
//! \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* puts more than one byte onto the transmit buffer (used for atomic sends)<BR>
|
||||
* (blocking function)
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \param[in] *buffer pointer to buffer to be sent
|
||||
* \param[in] len number of bytes to be sent
|
||||
* \return 0 if no error
|
||||
* \return -1 if UART not available
|
||||
* \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferPutMore(UARTNumTypeDef uart, uint8_t *buffer, uint16_t len)
|
||||
{
|
||||
int error;
|
||||
@ -476,33 +467,33 @@ int UARTTxBufferPutMore(UARTNumTypeDef uart, uint8_t *buffer, uint16_t len)
|
||||
return error;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! puts a byte onto the transmit buffer
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \param[in] b byte which should be put into Tx buffer
|
||||
//! \return 0 if no error
|
||||
//! \return -1 if UART not available
|
||||
//! \return -2 if buffer full (retry)
|
||||
//! \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* puts a byte onto the transmit buffer
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \param[in] b byte which should be put into Tx buffer
|
||||
* \return 0 if no error
|
||||
* \return -1 if UART not available
|
||||
* \return -2 if buffer full (retry)
|
||||
* \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferPut_NonBlocking(UARTNumTypeDef uart, uint8_t b)
|
||||
{
|
||||
/* For more comfortable usage... */
|
||||
/* -> Just forward to MIOS32_UART_TxBufferPutMore */
|
||||
/* -> Just forward to UARTTxBufferPutMore */
|
||||
return UARTTxBufferPutMore(uart, &b, 1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//! puts a byte onto the transmit buffer<BR>
|
||||
//! (blocking function)
|
||||
//! \param[in] uart UART number (0..1)
|
||||
//! \param[in] b byte which should be put into Tx buffer
|
||||
//! \return 0 if no error
|
||||
//! \return -1 if UART not available
|
||||
//! \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
//! \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* puts a byte onto the transmit buffer<BR>
|
||||
* (blocking function)
|
||||
* \param[in] uart UART name (GPS, TELEM, AUX)
|
||||
* \param[in] b byte which should be put into Tx buffer
|
||||
* \return 0 if no error
|
||||
* \return -1 if UART not available
|
||||
* \return -3 if UART not supported by MIOS32_UART_TxBufferPut Routine
|
||||
* \note Applications shouldn't call these functions directly, instead please use \ref MIOS32_COM or \ref MIOS32_MIDI layer functions
|
||||
*/
|
||||
int UARTTxBufferPut(UARTNumTypeDef uart, uint8_t b)
|
||||
{
|
||||
int error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user