73 lines
1.2 KiB
C
73 lines
1.2 KiB
C
#ifndef __MB_PORT_H__
|
|
#define __MB_PORT_H__
|
|
|
|
|
|
#include <rtthread.h>
|
|
#include <rthw.h>
|
|
|
|
#include <assert.h>
|
|
#include <inttypes.h>
|
|
|
|
#include <rtdef.h>
|
|
#include "drv_gpio.h"
|
|
|
|
#include "mb.h"
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef TRUE
|
|
#define TRUE 1
|
|
#endif
|
|
|
|
#ifndef FALSE
|
|
#define FALSE 0
|
|
#endif
|
|
|
|
#define RT_MODBUS_SLAVE_USE_CONTROL_PIN
|
|
#if defined(RT_MODBUS_SLAVE_USE_CONTROL_PIN)
|
|
#define MODBUS_SLAVE_RT_CONTROL_PIN_INDEX GET_PIN(A, 8)
|
|
#endif
|
|
|
|
rt_uint8_t xMBPortEventInit (void);
|
|
|
|
rt_uint8_t xMBPortEventPost (eMBEventType eEvent);
|
|
|
|
rt_uint8_t xMBPortEventGet (eMBEventType * eEvent);
|
|
|
|
rt_uint8_t xMBPortSerialInit (rt_uint8_t ucPort, rt_uint32_t ulBaudRate,
|
|
rt_uint8_t ucDataBits, eMBParity eParity);
|
|
|
|
void vMBPortClose (void);
|
|
|
|
void xMBPortSerialClose (void);
|
|
|
|
void vMBPortSerialEnable (rt_uint8_t xRxEnable, rt_uint8_t xTxEnable);
|
|
|
|
rt_uint8_t xMBPortSerialGetByte (char * pucByte );
|
|
|
|
rt_uint8_t xMBPortSerialPutByte (char ucByte );
|
|
|
|
rt_uint8_t xMBPortTimersInit (rt_uint16_t usTimeOut50us);
|
|
|
|
void xMBPortTimersClose (void);
|
|
|
|
void vMBPortTimersEnable (void);
|
|
|
|
void vMBPortTimersDisable (void);
|
|
|
|
|
|
void EnterCriticalSection (void);
|
|
void ExitCriticalSection (void);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|