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.

39 lines
2.2 KiB

#ifndef USART1_H_
#define USART1_H_
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <inttypes.h>
#include "USART_COM.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
volatile USART_TypeDef USART1_ADR;
volatile USART_HANDLER_TYPE USART1STR;
volatile USART_INTERFACE_TYPE USART1_INTERFACE;
volatile USART_IDIBUS_ROUTINE_TYPE USART1_IDIBUS;
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#define USART1_BUF_SIZE IDIMMES_MAX_MES_SIZE + 1 // Buffer size
volatile uint8_t USART1_RX_BUF[USART1_BUF_SIZE]; // RX buffer
volatile uint8_t USART1_TX_BUF[USART1_BUF_SIZE]; // TX buffer
void USART1_Init(void);
void USART1_SetBaudrate(uint32_t Boudrate);
//inline void USART1_IRQN_HANDLER(void);
//inline void USART1_RX_TIMER_HANDLER(void);
void USART1_SendByteBuf(uint8_t *Buf, uint16_t Count);
void USART1_SendTxBuf(uint16_t Count);
uint8_t USART1_IsTxActive(void);
uint8_t USART1_IsNewRxMessage(void);
uint8_t USART1_IsRxError(void);
uint16_t USART1_getRxBufSize(void);
void USART1_copyRxBuf(uint8_t *Dst, uint16_t StartPos, uint16_t Count);
uint8_t *USART1_getRxBuf(void);
uint8_t *USART1_getTxBuf(void);
void USART1_RxTransferRestart(void);
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void USART1_SetIdiBusBoudrate(enum IDIBUS_SERIAL_BAUDRATE BoudrateCode);
void USART1_RxAlarmFrameStart(void);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#endif /* USART1_H_ */