GY-63_MS5611/libraries/DEVFULL/DEVFULL.h

60 lines
999 B
C
Raw Normal View History

2022-03-11 04:15:31 -05:00
#pragma once
//
// FILE: DEVFULL.h
// AUTHOR: Rob Tillaart
2023-10-24 09:28:25 -04:00
// VERSION: 0.1.3
2022-03-11 04:15:31 -05:00
// PURPOSE: Arduino library for a /dev/full stream - useful for testing / debugging.
// URL: https://github.com/RobTillaart/DEVFULL
#include "Arduino.h"
2022-07-02 06:50:15 -04:00
#include "limits.h"
2023-10-24 09:28:25 -04:00
#define DEVFULL_LIB_VERSION (F("0.1.3"))
2022-03-11 04:15:31 -05:00
#ifndef ENOSPC
#define ENOSPC -28
#endif
2022-07-02 06:50:15 -04:00
#ifndef INT_MAX
#define INT_MAX 32767
#endif
2022-03-11 04:15:31 -05:00
class DEVFULL : public Stream
{
public:
DEVFULL()
{
2022-10-31 14:44:49 -04:00
setTimeout(0); // no timeout.
2022-03-11 04:15:31 -05:00
};
2022-07-02 06:50:15 -04:00
int available() { return INT_MAX; };
2022-03-11 04:15:31 -05:00
int peek() { return 0; };
int read() { return 0; };
2022-10-31 14:44:49 -04:00
void flush() { return; }; // placeholder to keep build CI happy
2022-03-11 04:15:31 -05:00
size_t write(const uint8_t data)
{
2022-10-31 14:44:49 -04:00
dummy = data; // keep compiler happy
2022-03-11 04:15:31 -05:00
return -28;
};
2022-07-02 06:50:15 -04:00
size_t write( const uint8_t *buffer, size_t size)
2022-03-11 04:15:31 -05:00
{
2022-10-31 14:44:49 -04:00
dummy = buffer[size-1]; // keep compiler happy
2022-03-11 04:15:31 -05:00
return -28;
};
private:
uint8_t dummy;
};
2023-10-24 09:28:25 -04:00
// -- END OF FILE --
2022-03-11 04:15:31 -05:00