Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit ce428b1

Browse files
authored
Add support for ArduinoStoneHMI library
- Add ::readBytes support - Fix header defines - RS485 inherits from HardwareSerial - Update board name header symbol
1 parent c9f3652 commit ce428b1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/AutomationCarrier.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef __AUTOMATION_CARRIER_H__
2-
#define __AUTOMATION_CARRIER_H__
1+
#ifndef __PORTENTA_MACHINE_CONTROL_H__
2+
#define __PORTENTA_MACHINE_CONTROL_H__
33

44
#include "utility/Adafruit_MAX31865/Adafruit_MAX31865.h"
55
#include "utility/THERMOCOUPLE/MAX31855.h"

src/utility/RS485/RS485.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ int RS485Class::read(void)
8383
return _serial->read();
8484
}
8585

86+
size_t RS485Class::readBytes(char *buf, size_t length)
87+
{
88+
return _serial->readBytes(buf, length);
89+
}
90+
8691
void RS485Class::flush()
8792
{
8893
return _serial->flush();

src/utility/RS485/RS485.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
#ifndef _RS485_H_INCLUDED
21-
#define _RS485_H_INCLUDED
20+
#ifndef _RS485_AUTOMATION_H_INCLUDED
21+
#define _RS485_AUTOMATION_H_INCLUDED
2222

2323
#include "Arduino.h"
2424
#include "mbed.h"
2525

26-
class RS485Class : public Stream {
26+
class RS485Class : public HardwareSerial {
2727
public:
2828
RS485Class(HardwareSerial& hwSerial, PinName txPin = NC, PinName dePin = NC, PinName rePin = NC);
2929

@@ -33,6 +33,8 @@ class RS485Class : public Stream {
3333
virtual int available();
3434
virtual int peek();
3535
virtual int read(void);
36+
virtual size_t readBytes(char *buf, size_t length);
37+
virtual size_t readBytes(uint8_t *buf, size_t length) { return readBytes((char *)buf, length); };
3638
virtual void flush();
3739
virtual size_t write(uint8_t b);
3840
using Print::write; // pull in write(str) and write(buf, size) from Print

0 commit comments

Comments
 (0)