|
|
|
|
@ -52,7 +52,6 @@ extern "C" {
|
|
|
|
|
|
|
|
|
|
/* ************* USART1 ***************** */
|
|
|
|
|
|
|
|
|
|
volatile uint32_t intcount1;
|
|
|
|
|
volatile uint8_t TXSerialfifo1[TX_SERIAL_FIFO_SIZE];
|
|
|
|
|
volatile uint8_t RXSerialfifo1[RX_SERIAL_FIFO_SIZE];
|
|
|
|
|
volatile uint16_t TXSerialfifohead1, TXSerialfifotail1;
|
|
|
|
|
@ -139,7 +138,6 @@ void USART1_IRQHandler()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
USART_ClearITPendingBit(USART1, USART_IT_RXNE);
|
|
|
|
|
intcount1++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (USART_GetITStatus(USART1, USART_IT_TXE)) {
|
|
|
|
|
@ -208,7 +206,7 @@ void InitUSART1(int speed)
|
|
|
|
|
RXSerialfifoinit1();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t AvailUSART1(void)
|
|
|
|
|
uint8_t AvailUSART1()
|
|
|
|
|
{
|
|
|
|
|
if (RXSerialfifolevel1() > 0U)
|
|
|
|
|
return 1U;
|
|
|
|
|
@ -216,7 +214,7 @@ uint8_t AvailUSART1(void)
|
|
|
|
|
return 0U;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t ReadUSART1(void)
|
|
|
|
|
uint8_t ReadUSART1()
|
|
|
|
|
{
|
|
|
|
|
uint8_t data_c = RXSerialfifo1[RXSerialfifotail1];
|
|
|
|
|
|
|
|
|
|
@ -245,7 +243,6 @@ extern "C" {
|
|
|
|
|
|
|
|
|
|
/* ************* USART2 ***************** */
|
|
|
|
|
|
|
|
|
|
volatile uint32_t intcount2;
|
|
|
|
|
volatile uint8_t TXSerialfifo2[TX_SERIAL_FIFO_SIZE];
|
|
|
|
|
volatile uint8_t RXSerialfifo2[RX_SERIAL_FIFO_SIZE];
|
|
|
|
|
volatile uint16_t TXSerialfifohead2, TXSerialfifotail2;
|
|
|
|
|
@ -317,7 +314,6 @@ uint8_t TXSerialfifoput2(uint8_t next)
|
|
|
|
|
void USART2_IRQHandler()
|
|
|
|
|
{
|
|
|
|
|
uint8_t c;
|
|
|
|
|
io.DEB_pin(HIGH);
|
|
|
|
|
|
|
|
|
|
if (USART_GetITStatus(USART2, USART_IT_RXNE)) {
|
|
|
|
|
c = (uint8_t) USART_ReceiveData(USART2);
|
|
|
|
|
@ -333,7 +329,6 @@ void USART2_IRQHandler()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
USART_ClearITPendingBit(USART2, USART_IT_RXNE);
|
|
|
|
|
intcount2++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (USART_GetITStatus(USART2, USART_IT_TXE)) {
|
|
|
|
|
@ -403,7 +398,7 @@ void InitUSART2(int speed)
|
|
|
|
|
RXSerialfifoinit2();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t AvailUSART2(void)
|
|
|
|
|
uint8_t AvailUSART2()
|
|
|
|
|
{
|
|
|
|
|
if (RXSerialfifolevel2() > 0U)
|
|
|
|
|
return 1U;
|
|
|
|
|
@ -411,7 +406,7 @@ uint8_t AvailUSART2(void)
|
|
|
|
|
return 0U;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint8_t ReadUSART2(void)
|
|
|
|
|
uint8_t ReadUSART2()
|
|
|
|
|
{
|
|
|
|
|
uint8_t data_c = RXSerialfifo2[RXSerialfifotail2];
|
|
|
|
|
|
|
|
|
|
@ -468,7 +463,7 @@ int CSerialPort::availableInt(uint8_t n)
|
|
|
|
|
return AvailUSART2();
|
|
|
|
|
#endif
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -502,8 +497,8 @@ void CSerialPort::writeInt(uint8_t n, const uint8_t* data, uint16_t length, bool
|
|
|
|
|
usbserial.write(data, length);
|
|
|
|
|
if (flush)
|
|
|
|
|
usbserial.flush();
|
|
|
|
|
break;
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
#if defined(SERIAL_REPEATER)
|
|
|
|
|
case 3U:
|
|
|
|
|
WriteUSART2(data, length);
|
|
|
|
|
|