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.
73 lines
3.3 KiB
73 lines
3.3 KiB
//#############################################################################################################################################################################################################
|
|
#ifndef _INC_USART_COM_H_
|
|
#define _INC_USART_COM_H_
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
//#include "stm32f4xx.h"
|
|
#include <inttypes.h>
|
|
#include <string.h>
|
|
//#include "SYSTEM.h"
|
|
//#include "CUST_GPIO.h"
|
|
//#include "TIMERS.h"
|
|
#include "IDIBUS_DEFS.h"
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef __ATmega328PB__ //Maybe move this
|
|
#include "m328pb_defs.h"
|
|
#endif // #ifdef _CPU_ATMEGA328PB_
|
|
#ifdef __ATmega1280__
|
|
#include "m2560_defs.h"
|
|
#endif // _CPU_ATMEGA2560_
|
|
#ifdef __ATmega2560__
|
|
#include "m2560_defs.h"
|
|
#endif // _CPU_ATMEGA2560_
|
|
#ifdef __ATmega128__
|
|
#include "m128_defs.h"
|
|
#endif // _CPU_ATMEGA2560_
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
typedef struct {
|
|
volatile uint8_t *UCRSA;
|
|
volatile uint8_t *UCRSB;
|
|
volatile uint8_t *UCRSC;
|
|
volatile uint8_t *UBRRL;
|
|
volatile uint8_t *UBRRH;
|
|
volatile uint8_t *UDR;
|
|
} USART_TypeDef;
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
typedef struct {
|
|
USART_TypeDef *USART;
|
|
//DMA_Stream_TypeDef *DMATX;
|
|
|
|
uint8_t *TX_BUF;
|
|
uint8_t *RX_BUF;
|
|
uint16_t TxBufCount;
|
|
//uint16_t TxPacketSize;
|
|
uint16_t TxSendedCount;
|
|
uint16_t RxBufCount;
|
|
|
|
volatile uint8_t TxComplete;
|
|
uint8_t RxError;
|
|
uint8_t RxComplete;
|
|
|
|
uint16_t InterFrameTimeoutTicks; //Currently there are ticks for timer
|
|
} USART_HANDLER_TYPE;
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
typedef struct {
|
|
uint8_t TimerMode;
|
|
uint16_t ResponseTimeoutUS;
|
|
uint16_t AlarmTimeoutUS;
|
|
volatile uint8_t ResponseTimeoutComplete;
|
|
void (*SetIdiBusBoudrate)(enum IDIBUS_SERIAL_BAUDRATE);
|
|
void (*RxAlarmFrameStart)(void);
|
|
} USART_IDIBUS_ROUTINE_TYPE;
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif //_INC_USART_COM_H_
|
|
//#############################################################################################################################################################################################################
|