* Fix ambiguous for TwoWire::requestFrom() methods. * Remove TwoWire::begin(int) overload Inside the function, this overload truncated the data type to a shorter one. This could break some users' hopes. * Rewrite TwoWire with using HardwareI2C - implement proposal https://github.com/espressif/arduino-esp32/pull/8818#issuecomment-1792191815 to bring the HARDWARE interface into compliance * Fix TwoWire::end() return type. * Fix TwoWire::setClock() return type. * Fix no return statement in the TwoWire::requestFrom. * fix(libraries/Wire): fix bad return-statement Remove non-void values of the return-statements in function returning 'void'. * style(libraries/Wire): replace tabs with spaces * refactor(libraries/Wire): use slave without support TwoWire::begin(uint8_t address) should be available without slave support by SoC? * refactor(libraries/Wire): remove unused variables Compiler reports "Wire.cpp:393:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]". * refactor(libraries/Wire): remove unused variables Compiler reports "Wire.cpp:337:15: error: variable 'err' set but not used [-Werror=unused-but-set-variable]". * fix(libraries/Wire): hide slave support elements TwoWire::user_onRequest is used only in conjunction with slave support? * refactor(libraries/Wire): remove temporary comment * fix(libraries/Wire): restore an accidentally deleted implementation TwoWire::endTransmission() was accidentally deleted from a cpp file. * refactor(libraries/Wire): return return types In TwoWire class return return types. * fix(libraries/Wire): fix return type * refactor(libraries/Wire): add return statement if slave isn't supported Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): fix indentation Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com> * refactor(libraries/Wire): remove unnecessary empty lines --------- Co-authored-by: Lucas Saavedra Vaz <32426024+lucasssvaz@users.noreply.github.com> Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
42 lines
1.4 KiB
C++
42 lines
1.4 KiB
C++
/*
|
|
Copyright (c) 2016 Arduino LLC. All right reserved.
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
See the GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with this library; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <inttypes.h>
|
|
#include "Stream.h"
|
|
|
|
class HardwareI2C : public Stream
|
|
{
|
|
public:
|
|
virtual bool begin() = 0;
|
|
virtual bool begin(uint8_t address) = 0;
|
|
virtual bool end() = 0;
|
|
|
|
virtual bool setClock(uint32_t freq) = 0;
|
|
|
|
virtual void beginTransmission(uint8_t address) = 0;
|
|
virtual uint8_t endTransmission(bool stopBit) = 0;
|
|
virtual uint8_t endTransmission(void) = 0;
|
|
|
|
virtual size_t requestFrom(uint8_t address, size_t len, bool stopBit) = 0;
|
|
virtual size_t requestFrom(uint8_t address, size_t len) = 0;
|
|
|
|
virtual void onReceive(void(*)(int)) = 0;
|
|
virtual void onRequest(void(*)(void)) = 0;
|
|
};
|