Display_Avr_3/hdlc/main.c
2023-06-14 15:36:47 +03:00

34 lines
645 B
C

#include "hdlc.h"
#include <stdio.h>
struct HDLC hdlc;
void hdlc_sendMsg() {
uint8_t msg[] = "Hello world!";
HDLC_transmitBlock(&hdlc, msg, sizeof(msg));
}
void hdlc_receiveMsg() {
int16_t resp = HDLC_receive(&hdlc);
if(resp != 0U)
{
uint8_t buff[hdlc.RXBFLEN];
uint16_t size = HDLC_copyReceivedMessage(&hdlc, buff);
printf("Msg[%u]=%s\n", size, buff);
}
}
//нужно указать 2 функции на чтение и запись байтов, чтобы работало
int main(void)
{
HDLC_init(&hdlc);
hdlc_sendMsg();
for(;;)
{
hdlc_receiveMsg();
}
}