delete modbus files
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* FreeModbus Libary: BARE Port
|
||||
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* File: $Id$
|
||||
*/
|
||||
|
||||
#ifndef _MOD_PORT_H
|
||||
#define _MOD_PORT_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define INLINE inline
|
||||
#define PR_BEGIN_EXTERN_C extern "C" {
|
||||
#define PR_END_EXTERN_C }
|
||||
|
||||
#define ENTER_CRITICAL_SECTION( ) __disable_irq()
|
||||
#define EXIT_CRITICAL_SECTION( ) __enable_irq()
|
||||
|
||||
typedef uint8_t BOOL;
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef char CHAR;
|
||||
|
||||
typedef uint16_t USHORT;
|
||||
typedef int16_t SHORT;
|
||||
|
||||
typedef uint32_t ULONG;
|
||||
typedef int32_t LONG;
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* FreeModbus Libary: BARE Port
|
||||
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* File: $Id$
|
||||
*/
|
||||
|
||||
/* ----------------------- Modbus includes ----------------------------------*/
|
||||
#include "mb.h"
|
||||
#include "mbport.h"
|
||||
|
||||
/* ----------------------- Variables ----------------------------------------*/
|
||||
static eMBEventType eQueuedEvent;
|
||||
static BOOL xEventInQueue;
|
||||
|
||||
/* ----------------------- Start implementation -----------------------------*/
|
||||
BOOL
|
||||
xMBPortEventInit( void )
|
||||
{
|
||||
xEventInQueue = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
xMBPortEventPost( eMBEventType eEvent )
|
||||
{
|
||||
xEventInQueue = TRUE;
|
||||
eQueuedEvent = eEvent;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
xMBPortEventGet( eMBEventType * eEvent )
|
||||
{
|
||||
BOOL xEventHappened = FALSE;
|
||||
|
||||
if( xEventInQueue )
|
||||
{
|
||||
*eEvent = eQueuedEvent;
|
||||
xEventInQueue = FALSE;
|
||||
xEventHappened = TRUE;
|
||||
}
|
||||
return xEventHappened;
|
||||
}
|
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* FreeModbus Libary: BARE Port
|
||||
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* File: $Id$
|
||||
*/
|
||||
|
||||
#include "mod_port.h"
|
||||
|
||||
/* ----------------------- Modbus includes ----------------------------------*/
|
||||
#include "mb.h"
|
||||
#include "mbport.h"
|
||||
#include "mcu_init.h"
|
||||
|
||||
extern UART_HandleTypeDef huart3;
|
||||
/* ----------------------- static functions ---------------------------------*/
|
||||
void prvvUARTTxReadyISR( void );
|
||||
void prvvUARTRxISR( void );
|
||||
|
||||
/* ----------------------- Start implementation -----------------------------*/
|
||||
void
|
||||
vMBPortSerialEnable( BOOL xRxEnable, BOOL xTxEnable )
|
||||
{
|
||||
/* If xRXEnable enable serial receive interrupts. If xTxENable enable
|
||||
* transmitter empty interrupts.
|
||||
*/
|
||||
if (xRxEnable) {
|
||||
__HAL_UART_ENABLE_IT(&huart3, UART_IT_RXNE);
|
||||
} else {
|
||||
__HAL_UART_DISABLE_IT(&huart3, UART_IT_RXNE);
|
||||
}
|
||||
|
||||
if (xTxEnable) {
|
||||
__HAL_UART_ENABLE_IT(&huart3, UART_IT_TXE);
|
||||
} else {
|
||||
__HAL_UART_DISABLE_IT(&huart3, UART_IT_TXE);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL
|
||||
xMBPortSerialInit( UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, eMBParity eParity )
|
||||
{
|
||||
/*
|
||||
Do nothing, Initialization is handled by MX_USART3_UART_Init()
|
||||
Fixed port, baudrate, databit and parity
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
xMBPortSerialPutByte( CHAR ucByte )
|
||||
{
|
||||
/* Put a byte in the UARTs transmit buffer. This function is called
|
||||
* by the protocol stack if pxMBFrameCBTransmitterEmpty( ) has been
|
||||
* called. */
|
||||
return (HAL_OK == HAL_UART_Transmit(&huart3, (uint8_t*)&ucByte, 1, 10));
|
||||
}
|
||||
|
||||
BOOL
|
||||
xMBPortSerialGetByte( CHAR * pucByte )
|
||||
{
|
||||
/* Return the byte in the UARTs receive buffer. This function is called
|
||||
* by the protocol stack after pxMBFrameCBByteReceived( ) has been called.
|
||||
*/
|
||||
*pucByte = (uint8_t)(huart3.Instance->RDR & (uint8_t)0x00FF);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Create an interrupt handler for the transmit buffer empty interrupt
|
||||
* (or an equivalent) for your target processor. This function should then
|
||||
* call pxMBFrameCBTransmitterEmpty( ) which tells the protocol stack that
|
||||
* a new character can be sent. The protocol stack will then call
|
||||
* xMBPortSerialPutByte( ) to send the character.
|
||||
*/
|
||||
//void prvvUARTTxReadyISR( void )
|
||||
//{
|
||||
// pxMBFrameCBTransmitterEmpty( );
|
||||
//}
|
||||
|
||||
/* Create an interrupt handler for the receive interrupt for your target
|
||||
* processor. This function should then call pxMBFrameCBByteReceived( ). The
|
||||
* protocol stack will then call xMBPortSerialGetByte( ) to retrieve the
|
||||
* character.
|
||||
*/
|
||||
//void prvvUARTRxISR( void )
|
||||
//{
|
||||
// pxMBFrameCBByteReceived( );
|
||||
//}
|
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* FreeModbus Libary: BARE Port
|
||||
* Copyright (C) 2006 Christian Walter <wolti@sil.at>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* File: $Id$
|
||||
*/
|
||||
|
||||
/* ----------------------- Platform includes --------------------------------*/
|
||||
#include "mod_port.h"
|
||||
#include "mcu_init.h"
|
||||
/* ----------------------- Modbus includes ----------------------------------*/
|
||||
#include "mb.h"
|
||||
#include "mbport.h"
|
||||
|
||||
/* ----------------------- static functions ---------------------------------*/
|
||||
void prvvTIMERExpiredISR( void );
|
||||
extern TIM_HandleTypeDef htim6;
|
||||
uint16_t timeout = 0;
|
||||
uint16_t downcounter = 0;
|
||||
/* ----------------------- Start implementation -----------------------------*/
|
||||
BOOL
|
||||
xMBPortTimersInit( USHORT usTim1Timerout50us )
|
||||
{
|
||||
TIM_MasterConfigTypeDef sMasterConfig;
|
||||
|
||||
htim6.Instance = TIM6;
|
||||
htim6.Init.Prescaler = (HAL_RCC_GetPCLK1Freq() / 1000000) - 1;
|
||||
htim6.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim6.Init.Period = 50 - 1;
|
||||
|
||||
timeout = usTim1Timerout50us;
|
||||
|
||||
if (HAL_TIM_Base_Init(&htim6) != HAL_OK)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_UPDATE;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
vMBPortTimersEnable( )
|
||||
{
|
||||
/* Enable the timer with the timeout passed to xMBPortTimersInit( ) */
|
||||
downcounter = timeout;
|
||||
HAL_TIM_Base_Start_IT(&htim6);
|
||||
|
||||
|
||||
}
|
||||
|
||||
inline void
|
||||
vMBPortTimersDisable( )
|
||||
{
|
||||
/* Disable any pending timers. */
|
||||
HAL_TIM_Base_Stop_IT(&htim6);
|
||||
}
|
||||
|
||||
/* Create an ISR which is called whenever the timer has expired. This function
|
||||
* must then call pxMBPortCBTimerExpired( ) to notify the protocol stack that
|
||||
* the timer has expired.
|
||||
*/
|
||||
//void prvvTIMERExpiredISR( void )
|
||||
//{
|
||||
// ( void )pxMBPortCBTimerExpired( );
|
||||
//}
|
||||
|
Reference in New Issue
Block a user