diff --git a/README.md b/README.md index 87632a3f..ae22ab0f 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ Example for the **LineFollowerTarget** application: | Library | Description | License | | ------------------------------------------------------------------ | ---------------------------------------------------- | ------- | +| [ArduinoNative](https://github.com/BlueAndi/ArduinoNative) | The Arduino for native environment. | MIT | | [SerialMuxProt](https://github.com/gabryelreyes/SerialMuxProt) | Multiplexing Communication Protocol | MIT | | [ZumoHALATmega32u4](https://github.com/BlueAndi/ZumoHALATmega32u4) | C++ HAL for ATmega32u4 on the Pololu Zumo32u4 | MIT | | [ZumoHALInterfaces](https://github.com/BlueAndi/ZumoHALInterfaces) | Abstract C++ HAL interfaces | MIT | diff --git a/lib/ArduinoNative/library.json b/lib/ArduinoNative/library.json deleted file mode 100644 index f976272d..00000000 --- a/lib/ArduinoNative/library.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "ArduinoNative", - "version": "0.1.0", - "description": "...", - "authors": [{ - "name": "Andreas Merkle", - "email": "web@blue-andi.de", - "url": "https://github.com/BlueAndi", - "maintainer": true - }], - "license": "MIT", - "dependencies": [], - "frameworks": "*", - "platforms": "*" -} \ No newline at end of file diff --git a/lib/ArduinoNative/src/Arduino.cpp b/lib/ArduinoNative/src/Arduino.cpp deleted file mode 100644 index 4ff27f92..00000000 --- a/lib/ArduinoNative/src/Arduino.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Arduino native - * @author Andreas Merkle - */ - -/****************************************************************************** - * Includes - *****************************************************************************/ -#include -#include "Terminal.h" - -/****************************************************************************** - * Compiler Switches - *****************************************************************************/ - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and classes - *****************************************************************************/ - -/****************************************************************************** - * Prototypes - *****************************************************************************/ - -extern void setup(); -extern void loop(); - -/****************************************************************************** - * Local Variables - *****************************************************************************/ - -/** Terminal/Console stream. */ -static Terminal gTerminalStream; - -/** Serial driver, used by Arduino applications. */ -Serial_ Serial(gTerminalStream); - -/** Function pointer to get the system tick in ms. */ -static GetSystemTick gGetSystemTickFunc = nullptr; - -/** Function pointer to delay for some time in ms. */ -static SystemDelay gSystemDelayFunc = nullptr; - -/****************************************************************************** - * Public Methods - *****************************************************************************/ - -/****************************************************************************** - * Protected Methods - *****************************************************************************/ - -/****************************************************************************** - * Private Methods - *****************************************************************************/ - -/****************************************************************************** - * External Functions - *****************************************************************************/ - -void Arduino::setup(GetSystemTick getSystemTickFunc, SystemDelay systemDelayFunc) -{ - gGetSystemTickFunc = getSystemTickFunc; - gSystemDelayFunc = systemDelayFunc; - - ::setup(); -} - -void Arduino::loop() -{ - ::loop(); -} - -extern unsigned long millis() -{ - unsigned long timestamp = 0U; - - if (nullptr != gGetSystemTickFunc) - { - timestamp = gGetSystemTickFunc(); - } - - return timestamp; -} - -extern void delay(unsigned long ms) -{ - if (nullptr != gSystemDelayFunc) - { - gSystemDelayFunc(ms); - } -} - -/****************************************************************************** - * Local Functions - *****************************************************************************/ diff --git a/lib/ArduinoNative/src/Arduino.h b/lib/ArduinoNative/src/Arduino.h deleted file mode 100644 index 51ba47a4..00000000 --- a/lib/ArduinoNative/src/Arduino.h +++ /dev/null @@ -1,116 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Arduino native - * @author Andreas Merkle - * - * @addtogroup HAL - * - * @{ - */ - -#ifndef ARDUINO_H -#define ARDUINO_H - -/****************************************************************************** - * Compile Switches - *****************************************************************************/ - -#define _USE_MATH_DEFINES - -/****************************************************************************** - * Includes - *****************************************************************************/ -#include -#include -#include "Serial.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) - -#ifndef PSTR -#define PSTR -#endif - -#ifndef PROGMEM -#define PROGMEM -#endif - -#define PI M_PI - -/****************************************************************************** - * Types and Classes - *****************************************************************************/ - -/** - * This type defines the prototype to get the system tick counter in ms. - */ -typedef unsigned long (*GetSystemTick)(); - -/** - * This type defines the prototype to delay for a specific time in ms. - */ -typedef void (*SystemDelay)(unsigned long ms); - -/****************************************************************************** - * Functions - *****************************************************************************/ - -/** Arduino internal specific functionality.*/ -namespace Arduino -{ - /** - * Setup the Arduino library and call the application setup() function. - */ - void setup(GetSystemTick getSystemTickFunc, SystemDelay systemDelayFunc); - - /** - * Loop shall be called periodically and handles Arduino library - * functionality and call the application loop() function. - */ - void loop(); -} - -/** - * Returns the number of milliseconds passed since the system start. - * - * @return The number of milliseconds. - */ -extern unsigned long millis(); - -/** - * Delays the program for the specified amount of milliseconds. In the mean time the - * simulation still steps to prevent an endless loop. - * - * @param[in] ms The amount of milliseconds that the program should be delayed by. - */ -extern void delay(unsigned long ms); - -#endif /* ARDUINO_H */ \ No newline at end of file diff --git a/lib/ArduinoNative/src/Print.h b/lib/ArduinoNative/src/Print.h deleted file mode 100644 index 2f8e2f50..00000000 --- a/lib/ArduinoNative/src/Print.h +++ /dev/null @@ -1,168 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Print class definition - * @author Gabryel Reyes - */ - -#ifndef PRINT_H -#define PRINT_H - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include -#include - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and Classes - *****************************************************************************/ - -/** - * Class for definition of Print - */ -class Print -{ -public: - /** Destruct Print */ - virtual ~Print() - { - } - - /** - * Print argument. - * @param[in] str Argument to print. - */ - virtual void print(const char str[]) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(uint8_t value) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(uint16_t value) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(uint32_t value) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(int8_t value) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(int16_t value) = 0; - - /** - * Print argument. - * @param[in] value Argument to print. - */ - virtual void print(int32_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] str Argument to print. - */ - virtual void println(const char str[]) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(uint8_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(uint16_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(uint32_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(int8_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(int16_t value) = 0; - - /** - * Print argument. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - virtual void println(int32_t value) = 0; - - /** - * Write bytes. - * @param[in] buffer Byte Array to send. - * @param[in] length Length of Buffer. - * @returns Number of bytes written - */ - virtual size_t write(const uint8_t* buffer, size_t length) = 0; - -protected: - /** Construct Print */ - Print() - { - } -}; - -#endif /* PRINT_H_ */ -/** @} */ diff --git a/lib/ArduinoNative/src/Serial.cpp b/lib/ArduinoNative/src/Serial.cpp deleted file mode 100644 index 38001a6f..00000000 --- a/lib/ArduinoNative/src/Serial.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Implementation of Arduino Serial - * @author Gabryel Reyes - */ - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include "Serial.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and classes - *****************************************************************************/ - -/****************************************************************************** - * Prototypes - *****************************************************************************/ - -/****************************************************************************** - * Local Variables - *****************************************************************************/ - -/****************************************************************************** - * Public Methods - *****************************************************************************/ - -Serial_::Serial_(Stream& stream) : Stream(), m_stream(&stream) -{ -} - -Serial_::~Serial_() -{ -} - -void Serial_::setStream(Stream& stream) -{ - m_stream = &stream; -} - -void Serial_::begin(unsigned long baudrate) -{ - (void)baudrate; -} - -void Serial_::end() -{ -} - -void Serial_::print(const char str[]) -{ - m_stream->print(str); -} - -void Serial_::print(uint8_t value) -{ - m_stream->print(value); -} - -void Serial_::print(uint16_t value) -{ - m_stream->print(value); -} - -void Serial_::print(uint32_t value) -{ - m_stream->print(value); -} - -void Serial_::print(int8_t value) -{ - m_stream->print(value); -} - -void Serial_::print(int16_t value) -{ - m_stream->print(value); -} - -void Serial_::print(int32_t value) -{ - m_stream->print(value); -} - -void Serial_::println(const char str[]) -{ - m_stream->println(str); -} - -void Serial_::println(uint8_t value) -{ - m_stream->println(value); -} - -void Serial_::println(uint16_t value) -{ - m_stream->println(value); -} - -void Serial_::println(uint32_t value) -{ - m_stream->println(value); -} - -void Serial_::println(int8_t value) -{ - m_stream->println(value); -} - -void Serial_::println(int16_t value) -{ - m_stream->println(value); -} - -void Serial_::println(int32_t value) -{ - m_stream->println(value); -} - -size_t Serial_::write(const uint8_t* buffer, size_t length) -{ - return m_stream->write(buffer, length); -} - -int Serial_::available() const -{ - return m_stream->available(); -} - -size_t Serial_::readBytes(uint8_t* buffer, size_t length) -{ - return m_stream->readBytes(buffer, length); -} - -/****************************************************************************** - * Private Methods - *****************************************************************************/ - -/****************************************************************************** - * Local Functions - *****************************************************************************/ diff --git a/lib/ArduinoNative/src/Serial.h b/lib/ArduinoNative/src/Serial.h deleted file mode 100644 index 8427e59c..00000000 --- a/lib/ArduinoNative/src/Serial.h +++ /dev/null @@ -1,242 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Implementation of Arduino Serial - * @author Gabryel Reyes - * - * @addtogroup HAL - * - * @{ - */ - -#ifndef SERIAL_H -#define SERIAL_H - -/****************************************************************************** - * Compile Switches - *****************************************************************************/ - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include "Stream.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and Classes - *****************************************************************************/ - -/** Serial driver, used by Arduino applications. */ -class Serial_ : public Stream -{ -public: - /** - * Construct Serial_. - * - * @param[in] stream Output stream. - */ - Serial_(Stream& stream); - - /** - * Destroy Serial_. - */ - ~Serial_(); - - /** - * Set stream where serial data shall be sent to. - * - * @param[in] stream Output stream. - */ - void setStream(Stream& stream); - - /** - * Begin Serial_ communication. - * - * @param[in] baudrate Comm. speed in bits per second - */ - void begin(unsigned long baudrate); - - /** - * End the Serial_ communication. - */ - void end(); - - /** - * Print argument to the output stream. - * - * @param[in] str Argument to print. - */ - void print(const char str[]) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(uint8_t value) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(uint16_t value) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(uint32_t value) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(int8_t value) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(int16_t value) final; - - /** - * Print argument to the output stream. - * - * @param[in] value Argument to print. - */ - void print(int32_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] str Argument to print. - */ - void println(const char str[]) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(uint8_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(uint16_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(uint32_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(int8_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(int16_t value) final; - - /** - * Print argument to the output stream. - * Appends Carriage Return at the end of the argument. - * - * @param[in] value Argument to print. - */ - void println(int32_t value) final; - - /** - * Write bytes to stream. - * - * @param[in] buffer Byte Array to send. - * @param[in] length Length of Buffer. - * - * @returns Number of bytes written - */ - size_t write(const uint8_t* buffer, size_t length) final; - - /** - * Check if there are available bytes in the Stream. - * - * @returns Number of available bytes. - */ - int available() const final; - - /** - * Read bytes into a buffer. - * - * @param[in] buffer Array to write bytes to. - * @param[in] length number of bytes to be read. - * - * @returns Number of bytes read from Stream. - */ - size_t readBytes(uint8_t* buffer, size_t length) final; - -private: - /** - * Stream for input and output of data. - */ - Stream* m_stream; - - /* Prevent empty constructor*/ - Serial_(); -}; - -/* Serial driver, used by Arduino applications. */ -extern Serial_ Serial; - -/****************************************************************************** - * Functions - *****************************************************************************/ - -#endif /* SERIAL_H */ -/** @} */ diff --git a/lib/ArduinoNative/src/Stream.h b/lib/ArduinoNative/src/Stream.h deleted file mode 100644 index de1f3cb7..00000000 --- a/lib/ArduinoNative/src/Stream.h +++ /dev/null @@ -1,83 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Data Stream class definition - * @author Gabryel Reyes - */ - -#ifndef STREAM_H -#define STREAM_H - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include -#include "Print.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and Classes - *****************************************************************************/ - -/** - * Class for definition of data Streams - */ -class Stream : public Print -{ -public: - /** Destruct Stream */ - virtual ~Stream() - { - } - - /** - * Check if there are available bytes in the Stream. - * @returns Number of available bytes. - */ - virtual int available() const = 0; - - /** - * Read bytes into a buffer. - * @param[in] buffer Array to write bytes to. - * @param[in] length number of bytes to be read. - * @returns Number of bytes read from Stream. - */ - virtual size_t readBytes(uint8_t* buffer, size_t length) = 0; - -protected: - /** Construct Stream */ - Stream() : Print() - { - } -}; - -#endif /* STREAM_H_ */ -/** @} */ diff --git a/lib/ArduinoNative/src/Terminal.cpp b/lib/ArduinoNative/src/Terminal.cpp deleted file mode 100644 index 5f43f2eb..00000000 --- a/lib/ArduinoNative/src/Terminal.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Implementation of the Terminal/Console Stream - * @author Gabryel Reyes - */ - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include -#include "Terminal.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and classes - *****************************************************************************/ - -/****************************************************************************** - * Prototypes - *****************************************************************************/ - -/****************************************************************************** - * Local Variables - *****************************************************************************/ - -/****************************************************************************** - * Public Methods - *****************************************************************************/ - -Terminal::Terminal() : Stream() -{ -} - -Terminal::~Terminal() -{ -} - -void Terminal::print(const char str[]) -{ - printf("%s", str); -} - -void Terminal::print(uint8_t value) -{ - printf("%u", value); -} - -void Terminal::print(uint16_t value) -{ - printf("%u", value); -} - -void Terminal::print(uint32_t value) -{ - printf("%u", value); -} - -void Terminal::print(int8_t value) -{ - printf("%d", value); -} - -void Terminal::print(int16_t value) -{ - printf("%d", value); -} - -void Terminal::print(int32_t value) -{ - printf("%d", value); -} - -void Terminal::println(const char str[]) -{ - printf("%s\n", str); -} - -void Terminal::println(uint8_t value) -{ - printf("%u\n", value); -} - -void Terminal::println(uint16_t value) -{ - printf("%u\n", value); -} - -void Terminal::println(uint32_t value) -{ - printf("%u\n", value); -} - -void Terminal::println(int8_t value) -{ - printf("%d\n", value); -} - -void Terminal::println(int16_t value) -{ - printf("%d\n", value); -} - -void Terminal::println(int32_t value) -{ - printf("%d\n", value); -} - -size_t Terminal::write(const uint8_t* buffer, size_t length) -{ - size_t count = 0; - - if ((nullptr != buffer) && (0U != length)) - { - for (count = 0; count < length; count++) - { - printf("%u", buffer[count]); - } - } - - return count; -} - -int Terminal::available() const -{ - /* Not implemented*/ - return 0; -} - -size_t Terminal::readBytes(uint8_t* buffer, size_t length) -{ - /* Not implemented*/ - (void) buffer; - (void) length; - return 0; -} - -/****************************************************************************** - * Private Methods - *****************************************************************************/ - -/****************************************************************************** - * Local Functions - *****************************************************************************/ diff --git a/lib/ArduinoNative/src/Terminal.h b/lib/ArduinoNative/src/Terminal.h deleted file mode 100644 index 7f71efb6..00000000 --- a/lib/ArduinoNative/src/Terminal.h +++ /dev/null @@ -1,189 +0,0 @@ -/* MIT License - * - * Copyright (c) 2023 - 2024 Andreas Merkle - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/******************************************************************************* - DESCRIPTION -*******************************************************************************/ -/** - * @brief Implementation of the Terminal/Console Stream - * @author Gabryel Reyes - * - * @addtogroup HAL - * - * @{ - */ - -#ifndef TERMINAL_H -#define TERMINAL_H - -/****************************************************************************** - * Compile Switches - *****************************************************************************/ - -/****************************************************************************** - * Includes - *****************************************************************************/ - -#include "Stream.h" - -/****************************************************************************** - * Macros - *****************************************************************************/ - -/****************************************************************************** - * Types and Classes - *****************************************************************************/ - -/** Implementation of the Terminal/Console Stream. */ -class Terminal : public Stream -{ -public: - /** - * Construct Terminal. - */ - Terminal(); - - /** - * Destroy Terminal. - */ - ~Terminal(); - - /** - * Print argument to the Output Stream. - * @param[in] str Argument to print. - */ - void print(const char str[]) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(uint8_t value) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(uint16_t value) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(uint32_t value) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(int8_t value) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(int16_t value) final; - - /** - * Print argument to the Output Stream. - * @param[in] value Argument to print. - */ - void print(int32_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] str Argument to print. - */ - void println(const char str[]) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(uint8_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(uint16_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(uint32_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(int8_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(int16_t value) final; - - /** - * Print argument to the Output Stream. - * Appends Carriage Return at the end of the argument. - * @param[in] value Argument to print. - */ - void println(int32_t value) final; - - /** - * Write bytes to stream. - * @param[in] buffer Byte Array to send. - * @param[in] length Length of Buffer. - * @returns Number of bytes written - */ - size_t write(const uint8_t* buffer, size_t length) final; - - /** - * Check if there are available bytes in the Stream. - * @returns Number of available bytes. - */ - int available() const final; - - /** - * Read bytes into a buffer. - * @param[in] buffer Array to write bytes to. - * @param[in] length number of bytes to be read. - * @returns Number of bytes read from Stream. - */ - size_t readBytes(uint8_t* buffer, size_t length) final; -}; - -/****************************************************************************** - * Functions - *****************************************************************************/ - -#endif /* TERMINAL_H */ \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index d19772d3..10d2c47c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -98,8 +98,8 @@ build_flags = -I./lib/Webots/include/c -I./lib/Webots/include/cpp lib_deps = - ArduinoNative MainNative + BlueAndi/ArduinoNative @ ~0.1.0 BlueAndi/ZumoHALWebots @ ~0.2.0 Webots lib_ignore = @@ -125,8 +125,8 @@ build_flags = -DUNIT_TEST -Itest/common lib_deps = - ArduinoNative MainTestNative + BlueAndi/ArduinoNative @ ~0.1.0 BlueAndi/ZumoHALInterfaces @ ~0.2.0 HALTest lib_ignore =