Browse Source

renaming of serial bool returning vars into isFoo(), also fixed bool returned as uint16_t type

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@354 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
master
timecop@gmail.com 12 years ago
parent
commit
4bd505972d
  1. 4
      obj/baseflight.hex
  2. 2
      src/cli.c
  3. 10
      src/drv_uart.c
  4. 8
      src/drv_uart.h
  5. 2
      src/gps.c
  6. 2
      src/main.c
  7. 4
      src/serial.c

4
obj/baseflight.hex

@ -290,8 +290,8 @@
:101200004572726F72733A2025642C20636F6E668C
:1012100069672073697A653A2025640D0A00000029
:101220004166726F333220434C4920766572736990
:101230006F6E20322E31204A756E203232203230CD
:101240003133202F2031383A30393A34340000001D
:101230006F6E20322E31204A756E203235203230CA
:101240003133202F2031303A33343A343300000028
:10125000B60100200D0A456E746572696E67204301
:101260004C49204D6F64652C20747970652027658A
:101270007869742720746F2072657475726E2C20E3

2
src/cli.c

@ -913,7 +913,7 @@ void cliProcess(void)
cliPrompt();
}
while (uartAvailable()) {
while (isUartAvailable()) {
uint8_t c = uartRead();
/* first step: translate "ESC[" -> "CSI" */

10
src/drv_uart.c

@ -107,17 +107,17 @@ void uartInit(uint32_t speed)
USART_Cmd(USART1, ENABLE);
}
uint16_t uartAvailable(void)
bool isUartAvailable(void)
{
return (DMA_GetCurrDataCounter(DMA1_Channel5) != rxDMAPos) ? true : false;
}
bool uartTransmitDMAEmpty(void)
bool isUartTransmitDMAEmpty(void)
{
return txDMAEmpty;
}
bool uartTransmitEmpty(void)
bool isUartTransmitEmpty(void)
{
return (txBufferTail == txBufferHead);
}
@ -136,7 +136,7 @@ uint8_t uartRead(void)
uint8_t uartReadPoll(void)
{
while (!uartAvailable()); // wait for some bytes
while (!isUartAvailable()); // wait for some bytes
return uartRead();
}
@ -229,7 +229,7 @@ void uart2Write(uint8_t ch)
USART_ITConfig(USART2, USART_IT_TXE, ENABLE);
}
bool uart2TransmitEmpty(void)
bool isUart2TransmitEmpty(void)
{
return tx2BufferTail == tx2BufferHead;
}

8
src/drv_uart.h

@ -2,9 +2,9 @@
// USART1
void uartInit(uint32_t speed);
uint16_t uartAvailable(void);
bool uartTransmitEmpty(void);
bool uartTransmitDMAEmpty(void);
bool isUartAvailable(void);
bool isUartTransmitEmpty(void);
bool isUartTransmitDMAEmpty(void);
uint8_t uartRead(void);
uint8_t uartReadPoll(void);
void uartWrite(uint8_t ch);
@ -13,5 +13,5 @@ void uartPrint(char *str);
// USART2 (GPS, Spektrum)
void uart2Init(uint32_t speed, uartReceiveCallbackPtr func, bool rxOnly);
void uart2ChangeBaud(uint32_t speed);
bool uart2TransmitEmpty(void);
bool isUart2TransmitEmpty(void);
void uart2Write(uint8_t ch);

2
src/gps.c

@ -97,7 +97,7 @@ static void gpsPrint(const char *str)
str++;
}
// wait to send all
while (!uart2TransmitEmpty());
while (!isUart2TransmitEmpty());
delay(30);
}

2
src/main.c

@ -19,7 +19,7 @@ static void _putc(void *p, char c)
int fputc(int c, FILE *f)
{
// let DMA catch up a bit when using set or dump, we're too fast.
while (!uartTransmitDMAEmpty());
while (!isUartTransmitDMAEmpty());
uartWrite(c);
return c;
}

4
src/serial.c

@ -668,7 +668,7 @@ void serialCom(void)
return;
}
while (uartAvailable()) {
while (isUartAvailable()) {
c = uartRead();
if (c_state == IDLE) {
@ -705,7 +705,7 @@ void serialCom(void)
c_state = IDLE;
}
}
if (!cliMode && !uartAvailable() && feature(FEATURE_TELEMETRY) && f.ARMED) { // The first 2 conditions should never evaluate to true but I'm putting it here anyway - silpstream
if (!cliMode && !isUartAvailable() && feature(FEATURE_TELEMETRY) && f.ARMED) { // The first 2 conditions should never evaluate to true but I'm putting it here anyway - silpstream
sendTelemetry();
return;
}

Loading…
Cancel
Save