Rajit Singh / Mbed OS Modbus

Dependents:   NUCLEO-F401-printf

Committer:
Rajit Singh
Date:
Wed Aug 16 17:31:26 2017 +0100
Revision:
1:3e360cf155b6
Parent:
0:9db3bed8fffd
Remove main.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rajit Singh 0:9db3bed8fffd 1 /*
Rajit Singh 0:9db3bed8fffd 2 * FreeModbus Libary: BARE Port
Rajit Singh 0:9db3bed8fffd 3 * Copyright (C) 2006 Christian Walter <wolti@sil.at>
Rajit Singh 0:9db3bed8fffd 4 *
Rajit Singh 0:9db3bed8fffd 5 * This library is free software; you can redistribute it and/or
Rajit Singh 0:9db3bed8fffd 6 * modify it under the terms of the GNU Lesser General Public
Rajit Singh 0:9db3bed8fffd 7 * License as published by the Free Software Foundation; either
Rajit Singh 0:9db3bed8fffd 8 * version 2.1 of the License, or (at your option) any later version.
Rajit Singh 0:9db3bed8fffd 9 *
Rajit Singh 0:9db3bed8fffd 10 * This library is distributed in the hope that it will be useful,
Rajit Singh 0:9db3bed8fffd 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Rajit Singh 0:9db3bed8fffd 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Rajit Singh 0:9db3bed8fffd 13 * Lesser General Public License for more details.
Rajit Singh 0:9db3bed8fffd 14 *
Rajit Singh 0:9db3bed8fffd 15 * You should have received a copy of the GNU Lesser General Public
Rajit Singh 0:9db3bed8fffd 16 * License along with this library; if not, write to the Free Software
Rajit Singh 0:9db3bed8fffd 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Rajit Singh 0:9db3bed8fffd 18 *
Rajit Singh 0:9db3bed8fffd 19 * File: $Id: portevent.c,v 1.1 2006/08/22 21:35:13 wolti Exp $
Rajit Singh 0:9db3bed8fffd 20 */
Rajit Singh 0:9db3bed8fffd 21
Rajit Singh 0:9db3bed8fffd 22 /* ----------------------- Modbus includes ----------------------------------*/
Rajit Singh 0:9db3bed8fffd 23 #include "mb.h"
Rajit Singh 0:9db3bed8fffd 24 #include "mbport.h"
Rajit Singh 0:9db3bed8fffd 25
Rajit Singh 0:9db3bed8fffd 26 /* ----------------------- Variables ----------------------------------------*/
Rajit Singh 0:9db3bed8fffd 27 static eMBEventType eQueuedEvent;
Rajit Singh 0:9db3bed8fffd 28 static BOOL xEventInQueue;
Rajit Singh 0:9db3bed8fffd 29
Rajit Singh 0:9db3bed8fffd 30 /* ----------------------- Start implementation -----------------------------*/
Rajit Singh 0:9db3bed8fffd 31 BOOL
Rajit Singh 0:9db3bed8fffd 32 xMBPortEventInit( void )
Rajit Singh 0:9db3bed8fffd 33 {
Rajit Singh 0:9db3bed8fffd 34 xEventInQueue = FALSE;
Rajit Singh 0:9db3bed8fffd 35 return TRUE;
Rajit Singh 0:9db3bed8fffd 36 }
Rajit Singh 0:9db3bed8fffd 37
Rajit Singh 0:9db3bed8fffd 38 BOOL
Rajit Singh 0:9db3bed8fffd 39 xMBPortEventPost( eMBEventType eEvent )
Rajit Singh 0:9db3bed8fffd 40 {
Rajit Singh 0:9db3bed8fffd 41 xEventInQueue = TRUE;
Rajit Singh 0:9db3bed8fffd 42 eQueuedEvent = eEvent;
Rajit Singh 0:9db3bed8fffd 43 return TRUE;
Rajit Singh 0:9db3bed8fffd 44 }
Rajit Singh 0:9db3bed8fffd 45
Rajit Singh 0:9db3bed8fffd 46 BOOL
Rajit Singh 0:9db3bed8fffd 47 xMBPortEventGet( eMBEventType * eEvent )
Rajit Singh 0:9db3bed8fffd 48 {
Rajit Singh 0:9db3bed8fffd 49 BOOL xEventHappened = FALSE;
Rajit Singh 0:9db3bed8fffd 50
Rajit Singh 0:9db3bed8fffd 51 if( xEventInQueue )
Rajit Singh 0:9db3bed8fffd 52 {
Rajit Singh 0:9db3bed8fffd 53 *eEvent = eQueuedEvent;
Rajit Singh 0:9db3bed8fffd 54 xEventInQueue = FALSE;
Rajit Singh 0:9db3bed8fffd 55 xEventHappened = TRUE;
Rajit Singh 0:9db3bed8fffd 56 }
Rajit Singh 0:9db3bed8fffd 57 return xEventHappened;
Rajit Singh 0:9db3bed8fffd 58 }