Skip to content

Commit

Permalink
Merge branch 'replace-unsigned-long' into 'main'
Browse files Browse the repository at this point in the history
Replace unsigned long with uint32

See merge request MSO-SW/drivers/arduino/arduino-core!40
  • Loading branch information
Rol-la committed Jan 31, 2024
2 parents 4935b5f + 24531d1 commit ced845e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/SensirionShdlcCommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include "SensirionShdlcRxFrame.h"
#include "SensirionShdlcTxFrame.h"

static uint16_t readByte(uint8_t& data, Stream& serial, unsigned long startTime,
unsigned long timeoutMicros) {
static uint16_t readByte(uint8_t& data, Stream& serial, uint32_t startTime,
uint32_t timeoutMicros) {
do {
if (micros() - startTime > timeoutMicros) {
return ReadError | TimeoutError;
Expand All @@ -49,9 +49,8 @@ static uint16_t readByte(uint8_t& data, Stream& serial, unsigned long startTime,
return NoError;
}

static uint16_t unstuffByte(uint8_t& data, Stream& serial,
unsigned long startTime,
unsigned long timeoutMicros) {
static uint16_t unstuffByte(uint8_t& data, Stream& serial, uint32_t startTime,
uint32_t timeoutMicros) {
uint16_t error = readByte(data, serial, startTime, timeoutMicros);
if (error) {
return error;
Expand All @@ -75,9 +74,10 @@ uint16_t SensirionShdlcCommunication::sendFrame(SensirionShdlcTxFrame& frame,
return NoError;
}

uint16_t SensirionShdlcCommunication::receiveFrame(
SensirionShdlcRxFrame& frame, Stream& serial, unsigned long timeoutMicros) {
unsigned long startTime = micros();
uint16_t SensirionShdlcCommunication::receiveFrame(SensirionShdlcRxFrame& frame,
Stream& serial,
uint32_t timeoutMicros) {
uint32_t startTime = micros();
uint16_t error;
uint8_t dataLength;
uint8_t current = 0;
Expand Down Expand Up @@ -163,7 +163,7 @@ uint16_t SensirionShdlcCommunication::receiveFrame(

uint16_t SensirionShdlcCommunication::sendAndReceiveFrame(
Stream& serial, SensirionShdlcTxFrame& txFrame,
SensirionShdlcRxFrame& rxFrame, unsigned long rxTimeoutMicros) {
SensirionShdlcRxFrame& rxFrame, uint32_t rxTimeoutMicros) {
uint16_t error;
error = SensirionShdlcCommunication::sendFrame(txFrame, serial);
if (error) {
Expand Down
4 changes: 2 additions & 2 deletions src/SensirionShdlcCommunication.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class SensirionShdlcCommunication {
* @return NoError on success, an error code otherwise
*/
static uint16_t receiveFrame(SensirionShdlcRxFrame& frame, Stream& serial,
unsigned long timeoutMicros);
uint32_t timeoutMicros);

/**
* sendAndReceiveFrame() - Send and receive a frame from sensor.
Expand All @@ -89,7 +89,7 @@ class SensirionShdlcCommunication {
static uint16_t sendAndReceiveFrame(Stream& serial,
SensirionShdlcTxFrame& txFrame,
SensirionShdlcRxFrame& rxFrame,
unsigned long rxTimeoutMicros);
uint32_t rxTimeoutMicros);
};

#endif /* SENSIRION_SHDLC_COMMUNICATION_H_ */

0 comments on commit ced845e

Please sign in to comment.