Skip to content

Commit 668dbca

Browse files
committed
libraries/Wire: Removed unnecessary comments.
Signed-off-by: MDin <Dinesh.M-EE@infineon.com>
1 parent f519728 commit 668dbca

2 files changed

Lines changed: 3 additions & 69 deletions

File tree

libraries/Wire/src/Wire.cpp

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,6 @@
11
#include "Arduino.h"
22
#include "Wire.h"
33

4-
//****************************************************************************
5-
// @Global Variables
6-
//****************************************************************************
7-
8-
// Initialize Class Variables //////////////////////////////////////////////////
9-
10-
//****************************************************************************
11-
// @Local Functions
12-
//****************************************************************************
13-
14-
// Constructors ////////////////////////////////////////////////////////////////
154
TwoWire::TwoWire(XMC_I2C_t *conf) {
165
XMC_I2C_config = conf;
176

@@ -35,11 +24,11 @@ TwoWire::TwoWire(XMC_I2C_t *conf) {
3524
// Public Methods //////////////////////////////////////////////////////////////
3625

3726
void TwoWire::begin(void) {
38-
// Check if desire USIC channel is already in use
27+
// To-Do for future work need to check
28+
// Check if desire USIC channel is already in use
3929
// if ((XMC_I2C_config->channel->CCR & USIC_CH_CCR_MODE_Msk) == XMC_USIC_CH_OPERATING_MODE_SPI) {
4030
// SPI.end();
4131
// }
42-
4332
hasError = false;
4433
isMaster = true;
4534

@@ -77,6 +66,7 @@ void TwoWire::begin(void) {
7766
}
7867

7968
void TwoWire::begin(uint8_t address) {
69+
//To-Do for future work need to check
8070
// Check if desire USIC channel is already in use
8171
// if ((XMC_I2C_config->channel->CCR & USIC_CH_CCR_MODE_Msk) == XMC_USIC_CH_OPERATING_MODE_SPI) {
8272
// SPI.end();
@@ -129,8 +119,6 @@ void TwoWire::begin(uint8_t address) {
129119
&(XMC_I2C_config->scl_config));
130120
}
131121

132-
//void TwoWire::begin(int address) { begin((uint8_t)address); }
133-
134122
void TwoWire::end(void) {
135123
// Only disable HW when USIC is used for I2C
136124
if ((XMC_I2C_config->channel->CCR & USIC_CH_CCR_MODE_Msk) == XMC_USIC_CH_OPERATING_MODE_I2C) {
@@ -174,12 +162,10 @@ uint8_t TwoWire::requestFrom(
174162
uint8_t address, size_t quantity, uint32_t iaddress, uint8_t isize, bool sendStop) {
175163
uint32_t StatusFlag;
176164
beginTransmission(address);
177-
178165
// clamp to buffer length
179166
if (quantity > BUFFER_LENGTH) {
180167
quantity = BUFFER_LENGTH;
181168
}
182-
183169
// send internal address; this mode allows sending a repeated start to access
184170
// some devices' internal registers. This function is executed by the hardware
185171
// TWI module on other processors (for example Due's TWI_IADR and TWI_MMR registers)
@@ -298,14 +284,6 @@ uint8_t TwoWire::requestFrom(uint8_t address, size_t quantity) {
298284
return requestFrom((uint8_t)address, quantity, true);
299285
}
300286

301-
// uint8_t TwoWire::requestFrom(int address, int quantity) {
302-
// return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t) true);
303-
// }
304-
305-
// uint8_t TwoWire::requestFrom(int address, int quantity, int sendStop) {
306-
// return requestFrom((uint8_t)address, (uint8_t)quantity, (uint8_t)sendStop);
307-
// }
308-
309287
void TwoWire::beginTransmission(uint8_t address) {
310288
if ((XMC_I2C_config->channel->CCR & USIC_CH_CCR_MODE_Msk) != XMC_USIC_CH_OPERATING_MODE_I2C) {
311289
if (isMaster) {
@@ -326,9 +304,6 @@ void TwoWire::beginTransmission(uint8_t address) {
326304
XMC_I2C_CH_ClearStatusFlag(XMC_I2C_config->channel, 0xFFFFFFFF);
327305
}
328306

329-
//void TwoWire::beginTransmission(int address) { beginTransmission((uint8_t)address); }
330-
331-
//
332307
// Originally, 'endTransmission' was an f(void) function.
333308
// It has been modified to take one parameter indicating
334309
// whether or not a STOP should be performed on the bus.
@@ -394,7 +369,6 @@ uint8_t TwoWire::endTransmission(bool sendStop) {
394369

395370
// This provides backwards compatibility with the original
396371
// definition, and expected behaviour, of endTransmission
397-
//
398372
uint8_t TwoWire::endTransmission(void) { return endTransmission(true); }
399373

400374
// must be called in:
@@ -665,8 +639,6 @@ void USIC1_4_IRQHandler() { Wire1.ProtocolHandler(); }
665639
#endif
666640
} // extern "C"
667641

668-
// Preinstantiate Objects //////////////////////////////////////////////////////
669-
670642
TwoWire Wire = TwoWire(&XMC_I2C_default);
671643
#if (NUM_I2C > 1)
672644
TwoWire Wire1 = TwoWire(&XMC_I2C_1);

libraries/Wire/src/Wire.h

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,3 @@
1-
/*
2-
* TwoWire.h - TWI/I2C library for Arduino & Wiring
3-
* Copyright (c) 2006 Nicholas Zambetti. All right reserved.
4-
*
5-
* This library is free software; you can redistribute it and/or
6-
* modify it under the terms of the GNU Lesser General Public
7-
* License as published by the Free Software Foundation; either
8-
* version 2.1 of the License, or (at your option) any later version.
9-
*
10-
* This library is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13-
* Lesser General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU Lesser General Public
16-
* License along with this library; if not, write to the Free Software
17-
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18-
*
19-
* Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
20-
*
21-
* Copyright (c) 2018 Infineon Technologies AG
22-
* This library has been modified for the XMC microcontroller series.
23-
*/
24-
251
#ifndef TwoWire_h
262
#define TwoWire_h
273

@@ -34,8 +10,6 @@
3410
// @Defines
3511
//****************************************************************************
3612
#define BUFFER_LENGTH 32
37-
// WIRE_HAS_END means Wire has end()
38-
#define WIRE_HAS_END 1
3913

4014
#define WIRE_COMMUNICATION_TIMEOUT 5000u
4115

@@ -74,18 +48,14 @@ class TwoWire : public Stream {
7448
TwoWire(XMC_I2C_t *conf);
7549
void begin();
7650
void begin(uint8_t);
77-
// void begin(int);
7851
void end();
7952
void setClock(uint32_t);
8053
void beginTransmission(uint8_t);
81-
// void beginTransmission(int);
8254
uint8_t endTransmission(void);
8355
uint8_t endTransmission(bool);
8456
uint8_t requestFrom(uint8_t, size_t);
8557
uint8_t requestFrom(uint8_t, size_t, bool);
8658
uint8_t requestFrom(uint8_t, size_t, uint32_t, uint8_t, bool);
87-
// uint8_t requestFrom(int, int);
88-
// uint8_t requestFrom(int, int, int);
8959
virtual size_t write(uint8_t);
9060
virtual size_t write(const uint8_t *, size_t);
9161
virtual int available(void);
@@ -97,14 +67,6 @@ class TwoWire : public Stream {
9767
void ReceiveHandler(void);
9868
void ProtocolHandler(void);
9969

100-
inline size_t write(unsigned long n) { return write((uint8_t)n); }
101-
102-
inline size_t write(long n) { return write((uint8_t)n); }
103-
104-
inline size_t write(unsigned int n) { return write((uint8_t)n); }
105-
106-
inline size_t write(int n) { return write((uint8_t)n); }
107-
10870
using Print::write;
10971
};
11072

0 commit comments

Comments
 (0)