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.
mbrtucustom.h@4:7621103c5a40, 2020-08-04 (annotated)
- Committer:
- danielmckinnell
- Date:
- Tue Aug 04 04:42:52 2020 +0000
- Revision:
- 4:7621103c5a40
- Parent:
- 3:4cda95d7b6c5
RTU Serial updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
danielmckinnell | 3:4cda95d7b6c5 | 1 | /* |
danielmckinnell | 3:4cda95d7b6c5 | 2 | * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. |
danielmckinnell | 3:4cda95d7b6c5 | 3 | * Copyright (c) 2006 Christian Walter <wolti@sil.at> |
danielmckinnell | 3:4cda95d7b6c5 | 4 | * All rights reserved. |
danielmckinnell | 3:4cda95d7b6c5 | 5 | * |
danielmckinnell | 3:4cda95d7b6c5 | 6 | * Redistribution and use in source and binary forms, with or without |
danielmckinnell | 3:4cda95d7b6c5 | 7 | * modification, are permitted provided that the following conditions |
danielmckinnell | 3:4cda95d7b6c5 | 8 | * are met: |
danielmckinnell | 3:4cda95d7b6c5 | 9 | * 1. Redistributions of source code must retain the above copyright |
danielmckinnell | 3:4cda95d7b6c5 | 10 | * notice, this list of conditions and the following disclaimer. |
danielmckinnell | 3:4cda95d7b6c5 | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
danielmckinnell | 3:4cda95d7b6c5 | 12 | * notice, this list of conditions and the following disclaimer in the |
danielmckinnell | 3:4cda95d7b6c5 | 13 | * documentation and/or other materials provided with the distribution. |
danielmckinnell | 3:4cda95d7b6c5 | 14 | * 3. The name of the author may not be used to endorse or promote products |
danielmckinnell | 3:4cda95d7b6c5 | 15 | * derived from this software without specific prior written permission. |
danielmckinnell | 3:4cda95d7b6c5 | 16 | * |
danielmckinnell | 3:4cda95d7b6c5 | 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
danielmckinnell | 3:4cda95d7b6c5 | 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
danielmckinnell | 3:4cda95d7b6c5 | 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
danielmckinnell | 3:4cda95d7b6c5 | 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
danielmckinnell | 3:4cda95d7b6c5 | 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
danielmckinnell | 3:4cda95d7b6c5 | 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
danielmckinnell | 3:4cda95d7b6c5 | 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
danielmckinnell | 3:4cda95d7b6c5 | 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
danielmckinnell | 3:4cda95d7b6c5 | 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
danielmckinnell | 3:4cda95d7b6c5 | 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
danielmckinnell | 3:4cda95d7b6c5 | 27 | * |
danielmckinnell | 3:4cda95d7b6c5 | 28 | * File: $Id: mbrtu.h,v 1.9 2006/12/07 22:10:34 wolti Exp $ |
danielmckinnell | 3:4cda95d7b6c5 | 29 | */ |
danielmckinnell | 3:4cda95d7b6c5 | 30 | |
danielmckinnell | 3:4cda95d7b6c5 | 31 | #ifndef _MB_RTU_CUSTOM_H |
danielmckinnell | 3:4cda95d7b6c5 | 32 | #define _MB_RTU_CUSTOM_H |
danielmckinnell | 3:4cda95d7b6c5 | 33 | |
danielmckinnell | 3:4cda95d7b6c5 | 34 | #ifdef __cplusplus |
danielmckinnell | 3:4cda95d7b6c5 | 35 | PR_BEGIN_EXTERN_C |
danielmckinnell | 3:4cda95d7b6c5 | 36 | #endif |
danielmckinnell | 3:4cda95d7b6c5 | 37 | eMBErrorCode eMBRTUCustInit( UCHAR ucMBAddress ); |
danielmckinnell | 3:4cda95d7b6c5 | 38 | void eMBRTUCustStart( void ); |
danielmckinnell | 3:4cda95d7b6c5 | 39 | void eMBRTUCustStop( void ); |
danielmckinnell | 3:4cda95d7b6c5 | 40 | eMBErrorCode eMBRTUCustReceive( UCHAR * pucRcvAddress, UCHAR ** pucFrame, USHORT * pusLength ); |
danielmckinnell | 3:4cda95d7b6c5 | 41 | eMBErrorCode eMBRTUCustSend( UCHAR slaveAddress, const UCHAR * pucFrame, USHORT usLength ); |
danielmckinnell | 3:4cda95d7b6c5 | 42 | |
danielmckinnell | 3:4cda95d7b6c5 | 43 | #ifdef __cplusplus |
danielmckinnell | 3:4cda95d7b6c5 | 44 | PR_END_EXTERN_C |
danielmckinnell | 3:4cda95d7b6c5 | 45 | #endif |
danielmckinnell | 3:4cda95d7b6c5 | 46 | #endif |