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.
67 lines
3.6 KiB
67 lines
3.6 KiB
//#############################################################################################################################################################################################################
|
|
#ifndef _INC_RSLINK_H_
|
|
#define _INC_RSLINK_H_
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#include <inttypes.h>
|
|
#include <avr/io.h>
|
|
#include "../Required/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; // ????????????
|
|
uint8_t SpeedCode;
|
|
uint8_t NeedSpeedChangeFlag; // ???? ??? ????????? ????????
|
|
uint32_t LastMMES_TimeInstance; // ??? led
|
|
};
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
extern uint8_t mmes_buf[IDIMMES_MAX_MES_SIZE]; //RX buffer for copy
|
|
extern 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 IdiBusProccessMessage();
|
|
void RSLink_SendSMES(idibus_farg_t *farg);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
// Typedef for callback function
|
|
typedef uint8_t (*rslink_func_i_t)(void);
|
|
|
|
typedef void (*rslink_func_v_t)(void);
|
|
|
|
typedef struct {
|
|
rslink_func_v_t status_led_init;
|
|
rslink_func_v_t status_led_on;
|
|
rslink_func_v_t status_led_off;
|
|
rslink_func_v_t dips_init;
|
|
rslink_func_i_t disp_read_addr;
|
|
rslink_func_i_t disp_read_speed;
|
|
}rslink_func_pack_t;
|
|
|
|
// Callback registration
|
|
void RSLink_register_hw_functions(rslink_func_pack_t callback);
|
|
|
|
void RSLlink_pass_module(idibus_slave_module_t* MODULE);
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif // #ifndef _INC_RSLINK_H_
|
|
//#############################################################################################################################################################################################################
|