msousa@0: /* msousa@0: * Copyright (c) 2002,2016 Mario de Sousa (msousa@fe.up.pt) msousa@0: * msousa@0: * This file is part of the Modbus library for Beremiz and matiec. msousa@0: * msousa@0: * This Modbus library is free software: you can redistribute it and/or modify msousa@0: * it under the terms of the GNU Lesser General Public License as published by msousa@0: * the Free Software Foundation, either version 3 of the License, or msousa@0: * (at your option) any later version. msousa@0: * msousa@0: * This program is distributed in the hope that it will be useful, but msousa@0: * WITHOUT ANY WARRANTY; without even the implied warranty of msousa@0: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser msousa@0: * General Public License for more details. msousa@0: * msousa@0: * You should have received a copy of the GNU Lesser General Public License msousa@0: * along with this Modbus library. If not, see . msousa@0: * msousa@0: * This code is made available on the understanding that it will not be msousa@0: * used in safety-critical situations without a full and competent review. msousa@0: */ msousa@0: msousa@0: msousa@0: msousa@0: #ifndef MODBUS_ASCII_PRIVATE_H msousa@0: #define MODBUS_ASCII_PRIVATE_H msousa@0: msousa@0: msousa@0: msousa@0: #include "mb_util.h" msousa@0: msousa@0: msousa@0: /* serial port default configuration... */ msousa@0: #define DEF_DATA_BITS 7 msousa@0: #define DEF_STOP_BITS_PAR 1 /* default stop bits if parity is used */ msousa@0: #define DEF_STOP_BITS_NOP 2 /* default stop bits if parity is not used */ msousa@0: #define DEF_BAUD_RATE 9600 msousa@0: msousa@0: msousa@0: /* Send retries of ascii frames... */ msousa@0: #define ASC_FRAME_SEND_RETRY 0 msousa@0: /* NOTES: msousa@0: * - the above are the retries at the layer1 level, msousa@0: * higher layers may decide to retry for themselves! msousa@0: * - For ascii frames, it doesn't make much sense to retry msousa@0: * if the first try failed... msousa@0: */ msousa@0: msousa@0: msousa@0: /* Buffer sizes... */ msousa@0: #define SEND_BUFFER_SIZE_SMALL (MAX_ASC_FRAME_LENGTH / 2) msousa@0: #define SEND_BUFFER_SIZE_LARGE (MAX_ASC_FRAME_LENGTH) msousa@0: #define RECV_BUFFER_SIZE_SMALL (MAX_ASC_FRAME_LENGTH / 2) msousa@0: #define RECV_BUFFER_SIZE_LARGE (MAX_ASC_FRAME_LENGTH) msousa@0: msousa@0: msousa@0: /* Frame lengths... */ msousa@0: msousa@0: /* The smallest element in an ascii frame. msousa@0: * This is used later to define the smallest value of certain buffers... msousa@0: */ msousa@0: #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_HEADER_LENGTH msousa@0: msousa@0: #if ASC_FRAME_MIN_ELE_LENGTH < ASC_FRAME_TAIL_LENGTH msousa@0: #undef ASC_FRAME_MIN_ELE_LENGTH msousa@0: #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_TAIL_LENGTH msousa@0: #endif msousa@0: msousa@0: #if ASC_FRAME_MIN_ELE_LENGTH < ASC_FRAME_LRC_LENGTH msousa@0: #undef ASC_FRAME_MIN_ELE_LENGTH msousa@0: #define ASC_FRAME_MIN_ELE_LENGTH ASC_FRAME_LRC_LENGTH msousa@0: #endif msousa@0: msousa@0: #if ASC_FRAME_MIN_ELE_LENGTH < L2_TO_ASC_CODING msousa@0: #undef ASC_FRAME_MIN_ELE_LENGTH msousa@0: #define ASC_FRAME_MIN_ELE_LENGTH L2_TO_ASC_CODING msousa@0: #endif msousa@0: msousa@0: msousa@0: #endif /* MODBUS_ASCII_PRIVATE_H */ msousa@0: msousa@0: msousa@0: msousa@0: msousa@0: msousa@0: msousa@0: msousa@0: