You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.9 KiB

1 year ago
#ifndef USART0_H_
#define USART0_H_
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <inttypes.h>
#include "USART_COM.h"
#include <avr/io.h>
#include <avr/interrupt.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
volatile USART_TypeDef USART0_ADR;
volatile USART_HANDLER_TYPE USART0STR;
volatile USART_INTERFACE_TYPE USART0_INTERFACE;
volatile USART_IDIBUS_ROUTINE_TYPE USART0_IDIBUS;
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#define USART0_BUF_SIZE 64 // Buffer size
volatile uint8_t USART0_RX_BUF[USART0_BUF_SIZE]; // RX buffer
volatile uint8_t USART0_TX_BUF[USART0_BUF_SIZE]; // TX buffer
void USART0_Init(void);
void USART0_SetBaudrate(uint32_t Boudrate);
//inline void USART0_IRQN_HANDLER(void);
//inline void USART0_RX_TIMER_HANDLER(void);
void USART0_SendByteBuf(uint8_t *Buf, uint16_t Count);
void USART0_SendTxBuf(uint16_t Count);
uint8_t USART0_IsTxActive(void);
uint8_t USART0_IsNewRxMessage(void);
uint8_t USART0_IsRxError(void);
uint16_t USART0_getRxBufSize(void);
void USART0_copyRxBuf(uint8_t *Dst, uint16_t StartPos, uint16_t Count);
volatile uint8_t *USART0_getRxBuf(void);
volatile uint8_t *USART0_getTxBuf(void);
void USART0_RxTransferRestart(void);
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#endif /* USART0_H_ */