Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Modbus by
portevent.cpp@2:8f30046c1399, 2016-05-25 (annotated)
- Committer:
- alarcon
- Date:
- Wed May 25 18:44:43 2016 +0000
- Revision:
- 2:8f30046c1399
- Parent:
- 0:0453a0a7e500
publicacion
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cam | 0:0453a0a7e500 | 1 | /* |
| cam | 0:0453a0a7e500 | 2 | * FreeModbus Libary: BARE Port |
| cam | 0:0453a0a7e500 | 3 | * Copyright (C) 2006 Christian Walter <wolti@sil.at> |
| cam | 0:0453a0a7e500 | 4 | * |
| cam | 0:0453a0a7e500 | 5 | * This library is free software; you can redistribute it and/or |
| cam | 0:0453a0a7e500 | 6 | * modify it under the terms of the GNU Lesser General Public |
| cam | 0:0453a0a7e500 | 7 | * License as published by the Free Software Foundation; either |
| cam | 0:0453a0a7e500 | 8 | * version 2.1 of the License, or (at your option) any later version. |
| cam | 0:0453a0a7e500 | 9 | * |
| cam | 0:0453a0a7e500 | 10 | * This library is distributed in the hope that it will be useful, |
| cam | 0:0453a0a7e500 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| cam | 0:0453a0a7e500 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| cam | 0:0453a0a7e500 | 13 | * Lesser General Public License for more details. |
| cam | 0:0453a0a7e500 | 14 | * |
| cam | 0:0453a0a7e500 | 15 | * You should have received a copy of the GNU Lesser General Public |
| cam | 0:0453a0a7e500 | 16 | * License along with this library; if not, write to the Free Software |
| cam | 0:0453a0a7e500 | 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| cam | 0:0453a0a7e500 | 18 | * |
| cam | 0:0453a0a7e500 | 19 | * File: $Id: portevent.c,v 1.1 2006/08/22 21:35:13 wolti Exp $ |
| cam | 0:0453a0a7e500 | 20 | */ |
| cam | 0:0453a0a7e500 | 21 | |
| cam | 0:0453a0a7e500 | 22 | /* ----------------------- Modbus includes ----------------------------------*/ |
| cam | 0:0453a0a7e500 | 23 | #include "mb.h" |
| cam | 0:0453a0a7e500 | 24 | #include "mbport.h" |
| cam | 0:0453a0a7e500 | 25 | |
| cam | 0:0453a0a7e500 | 26 | /* ----------------------- Variables ----------------------------------------*/ |
| cam | 0:0453a0a7e500 | 27 | static eMBEventType eQueuedEvent; |
| cam | 0:0453a0a7e500 | 28 | static BOOL xEventInQueue; |
| cam | 0:0453a0a7e500 | 29 | |
| cam | 0:0453a0a7e500 | 30 | /* ----------------------- Start implementation -----------------------------*/ |
| cam | 0:0453a0a7e500 | 31 | BOOL |
| cam | 0:0453a0a7e500 | 32 | xMBPortEventInit( void ) |
| cam | 0:0453a0a7e500 | 33 | { |
| cam | 0:0453a0a7e500 | 34 | xEventInQueue = FALSE; |
| cam | 0:0453a0a7e500 | 35 | return TRUE; |
| cam | 0:0453a0a7e500 | 36 | } |
| cam | 0:0453a0a7e500 | 37 | |
| cam | 0:0453a0a7e500 | 38 | BOOL |
| cam | 0:0453a0a7e500 | 39 | xMBPortEventPost( eMBEventType eEvent ) |
| cam | 0:0453a0a7e500 | 40 | { |
| cam | 0:0453a0a7e500 | 41 | xEventInQueue = TRUE; |
| cam | 0:0453a0a7e500 | 42 | eQueuedEvent = eEvent; |
| cam | 0:0453a0a7e500 | 43 | return TRUE; |
| cam | 0:0453a0a7e500 | 44 | } |
| cam | 0:0453a0a7e500 | 45 | |
| cam | 0:0453a0a7e500 | 46 | BOOL |
| cam | 0:0453a0a7e500 | 47 | xMBPortEventGet( eMBEventType * eEvent ) |
| cam | 0:0453a0a7e500 | 48 | { |
| cam | 0:0453a0a7e500 | 49 | BOOL xEventHappened = FALSE; |
| cam | 0:0453a0a7e500 | 50 | |
| cam | 0:0453a0a7e500 | 51 | if( xEventInQueue ) |
| cam | 0:0453a0a7e500 | 52 | { |
| cam | 0:0453a0a7e500 | 53 | *eEvent = eQueuedEvent; |
| cam | 0:0453a0a7e500 | 54 | xEventInQueue = FALSE; |
| cam | 0:0453a0a7e500 | 55 | xEventHappened = TRUE; |
| cam | 0:0453a0a7e500 | 56 | } |
| cam | 0:0453a0a7e500 | 57 | return xEventHappened; |
| cam | 0:0453a0a7e500 | 58 | } |
