Forking https://os.mbed.com/users/cam/code/Modbus/ to work for NUCLEO 64 boards
Fork of Cam's original FreeModbus port (https://os.mbed.com/users/cam/code/Modbus/)
Change: - Serial implementation to work for NUCLEO 64 boards and receive interrupts instead of timer. (see `portserial.cpp`)
Added: - Custom RTU mode. Allows for external implementation of packet receiving and sending. Sends and receives packets as whole frames (address + PDU) (i.e. this was added for a custom LoRa implementation). implement `xMBRTUCustGetPDU` and `xMBRTUCustSendResponse` (see `mbport.h`) and call `eMBRTUCustomInit( address )`. implementations need to be fully initialised as `eMBRTUCustomInit` only sets the address and nothing else.
port.h@4:7621103c5a40, 2020-08-04 (annotated)
- Committer:
- danielmckinnell
- Date:
- Tue Aug 04 04:42:52 2020 +0000
- Revision:
- 4:7621103c5a40
- Parent:
- 0:0453a0a7e500
RTU Serial updates
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: port.h,v 1.1 2006/08/22 21:35:13 wolti Exp $ |
cam | 0:0453a0a7e500 | 20 | */ |
cam | 0:0453a0a7e500 | 21 | |
cam | 0:0453a0a7e500 | 22 | #ifndef _PORT_H |
cam | 0:0453a0a7e500 | 23 | #define _PORT_H |
cam | 0:0453a0a7e500 | 24 | |
cam | 0:0453a0a7e500 | 25 | #include <assert.h> |
cam | 0:0453a0a7e500 | 26 | #include <inttypes.h> |
cam | 0:0453a0a7e500 | 27 | |
cam | 0:0453a0a7e500 | 28 | #define INLINE //inline |
cam | 0:0453a0a7e500 | 29 | #define PR_BEGIN_EXTERN_C //extern "C" { |
cam | 0:0453a0a7e500 | 30 | #define PR_END_EXTERN_C //} |
cam | 0:0453a0a7e500 | 31 | |
cam | 0:0453a0a7e500 | 32 | #define ENTER_CRITICAL_SECTION( ) |
cam | 0:0453a0a7e500 | 33 | #define EXIT_CRITICAL_SECTION( ) |
cam | 0:0453a0a7e500 | 34 | |
cam | 0:0453a0a7e500 | 35 | typedef uint8_t BOOL; |
cam | 0:0453a0a7e500 | 36 | |
cam | 0:0453a0a7e500 | 37 | typedef unsigned char UCHAR; |
cam | 0:0453a0a7e500 | 38 | typedef char CHAR; |
cam | 0:0453a0a7e500 | 39 | |
cam | 0:0453a0a7e500 | 40 | typedef uint16_t USHORT; |
cam | 0:0453a0a7e500 | 41 | typedef int16_t SHORT; |
cam | 0:0453a0a7e500 | 42 | |
cam | 0:0453a0a7e500 | 43 | typedef uint32_t ULONG; |
cam | 0:0453a0a7e500 | 44 | typedef int32_t LONG; |
cam | 0:0453a0a7e500 | 45 | |
cam | 0:0453a0a7e500 | 46 | #ifndef TRUE |
cam | 0:0453a0a7e500 | 47 | #define TRUE 1 |
cam | 0:0453a0a7e500 | 48 | #endif |
cam | 0:0453a0a7e500 | 49 | |
cam | 0:0453a0a7e500 | 50 | #ifndef FALSE |
cam | 0:0453a0a7e500 | 51 | #define FALSE 0 |
cam | 0:0453a0a7e500 | 52 | #endif |
cam | 0:0453a0a7e500 | 53 | |
cam | 0:0453a0a7e500 | 54 | #endif |