Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/libmodbus/modbus-rtu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,11 @@ static int _modbus_rtu_connect(modbus_t *ctx)
return -1;
}
#elif defined(ARDUINO)
#ifdef ARDUINO_ARCH_SAM
ctx_rtu->rs485->begin(ctx_rtu->baud, static_cast<UARTClass::UARTModes>(ctx_rtu->config));
#else
ctx_rtu->rs485->begin(ctx_rtu->baud, ctx_rtu->config);
#endif
ctx_rtu->rs485->receive();
#else
/* The O_NOCTTY flag tells UNIX that this program doesn't want
Expand Down
23 changes: 18 additions & 5 deletions src/libmodbus/modbus.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
/*
* Copyright © 2001-2011 Stéphane Raimbault <stephane.raimbault@gmail.com>
* Copyright © 2018 Arduino SA. All rights reserved.
* Copyright 2001-2011 St�phane Raimbault <stephane.raimbault@gmail.com>
* Copyright 2018 Arduino SA. All rights reserved.
*
* SPDX-License-Identifier: LGPL-2.1+
*
* This library implements the Modbus protocol.
* http://libmodbus.org/
*/

#ifdef ARDUINO_SAM_DUE
#include <Arduino.h> //moust be include here to compile
#endif


#ifndef _MSC_VER
#ifndef ARDUINO_SAM_DUE
//compile with DUE without those includes
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <limits.h>
#include <time.h>
#ifndef _MSC_VER
//make due not compile if included
#include <unistd.h>
#endif
#include <errno.h>
#endif
#ifdef ARDUINO
#include <stdbool.h>

#ifndef ARDUINO_SAM_DUE
#include <Arduino.h>
#endif


#ifndef DEBUG
#define printf(...) {}
Expand Down Expand Up @@ -1926,4 +1939,4 @@ size_t strlcpy(char *dest, const char *src, size_t dest_size)

return (s - src - 1); /* count does not include NUL */
}
#endif
#endif