Примененан функция проверки полностью ли отправлен буфер в UART. Вроде бы работает, но там бесконечный цикл, а работать вроде бы должно не так...
This commit is contained in:
@@ -40,25 +40,25 @@ int main(void) {
|
||||
initialization_of_UART();
|
||||
|
||||
while (1) {
|
||||
if (count < 10000000) {
|
||||
DataBuf = XGpio_DiscreteRead(&Gpio_1, 1);
|
||||
if (DataBufPrev != DataBuf) {
|
||||
bild_send_buffer(2, DataBuf);
|
||||
terminal_uart_send();
|
||||
}
|
||||
DataBufPrev = DataBuf;
|
||||
if (count < 1000000) {
|
||||
count++;
|
||||
} else {
|
||||
if (latch) {
|
||||
Xil_Out32(XPAR_IP_AXI_LEDS_0_S00_AXI_BASEADDR, 0x00000000);
|
||||
XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, ~LED);
|
||||
XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, LED);
|
||||
latch = 0;
|
||||
|
||||
} else {
|
||||
Xil_Out32(XPAR_IP_AXI_LEDS_0_S00_AXI_BASEADDR, 0x00000001);
|
||||
XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, LED);
|
||||
XGpio_DiscreteWrite(&Gpio_0, LED_CHANNEL, ~LED);
|
||||
latch = 1;
|
||||
}
|
||||
DataBuf = XGpio_DiscreteRead(&Gpio_1, 1);
|
||||
if (DataBufPrev != DataBuf) {
|
||||
bild_send_buffer(2, DataBuf);
|
||||
terminal_uart_send();
|
||||
}
|
||||
DataBufPrev = DataBuf;
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,11 +67,14 @@ void terminal_uart_send() {
|
||||
SendBuffer[0] = 160;
|
||||
SendBuffer[1] = 160;
|
||||
XUartPs_Send(&UartPs, SendBuffer, TEST_BUFFER_SIZE);
|
||||
while(UartPs.SendBuffer.RemainingBytes!=0)
|
||||
{
|
||||
XUartPs_Send(&UartPs, UartPs.SendBuffer.NextBytePtr, UartPs.SendBuffer.RemainingBytes);
|
||||
}
|
||||
}
|
||||
|
||||
void terminal_uart_recv() {
|
||||
XUartPs_Recv(&UartPs, RecvBuffer, TEST_BUFFER_SIZE);
|
||||
//update_from_terminal(&RecvBuffer);
|
||||
u32 terminal_uart_recv() {
|
||||
return XUartPs_Recv(&UartPs, RecvBuffer, TEST_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
void initialization_of_UART(){
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
void inverting_the_signal_count_transmitter();
|
||||
void bild_send_buffer(u32 address, u32 data);
|
||||
void terminal_uart_send();
|
||||
void terminal_uart_recv();
|
||||
u32 terminal_uart_recv();
|
||||
void initialization_of_UART();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user