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.

44 lines
2.9 KiB

1 year ago
//#############################################################################################################################################################################################################
#ifndef _INC_RSLINK_H_
#define _INC_RSLINK_H_
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include <inttypes.h>
#include "SYSTEM.h"
#include "IDIBUS_IMPL.h"
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// DELAYS FOR LEDS status
#define RSLINK_LED_T1_DEFAULT_S 15UL
#define RSLINK_LED_T2_DEFAULT_S 60UL
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
struct RSLINK_STRUCT
{
USART_INTERFACE_TYPE *USI;
USART_IDIBUS_ROUTINE_TYPE *USIID;
uint8_t Address;
uint8_t Address_Error; // <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint8_t SpeedCode;
uint8_t NeedSpeedChangeFlag; // <09><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
uint32_t LastMMES_TimeInstance; // <09><><EFBFBD> led
};
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
uint8_t RxMesageBuf[IDIMMES_MAX_MES_SIZE]; //RX buffer for copy
struct RSLINK_STRUCT RSLINK;
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void RSLink_Init(USART_INTERFACE_TYPE *USART_INTERFACE, USART_IDIBUS_ROUTINE_TYPE *USART_ID_INTERFACE);
uint8_t RSLink_SpeedCheckAndUpdate(void);
void RSLink_AddressCheckAndUpdate(void);
void RSLink_Handler(void);
void RSLink_SendSMES(IDIBUS_FARG_TYPE *farg);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void RSLink_StatusLedInit(void);
void RSLink_StatusLedSetOn(void);
void RSLink_StatusLedSetOff(void);
void RSLink_DipsInit(void);
uint8_t RSLink_AddrDecode(void);
uint8_t RSLink_SpeedDecode(void);
uint8_t RSLink_TypeDecode(void);
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#endif // #ifndef _INC_RSLINK_H_
//#############################################################################################################################################################################################################