Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: warning no return statement in function returning non-void #30

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/PF1550.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ PF1550::PF1550(PF1550_IO & io)
PUBLIC MEMBER FUNCTIONS
******************************************************************************/

int PF1550::begin()
void PF1550::begin()
{
if (_debug) {
_debug->println("PF1550 begin");
}
return _control.begin();
_control.begin();
}

void PF1550::debug(Stream& stream)
Expand Down
2 changes: 1 addition & 1 deletion src/PF1550.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class PF1550

PF1550(PF1550_IO & io);

int begin();
void begin();

void debug(Stream& stream);

Expand Down
4 changes: 2 additions & 2 deletions src/PF1550/PF1550_Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ PF1550_Control::PF1550_Control(PF1550_IO & io)
PUBLIC MEMBER FUNCTIONS
******************************************************************************/

int PF1550_Control::begin()
void PF1550_Control::begin()
{
return _io.begin();
_io.begin();
}

void PF1550_Control::debug(Stream& stream)
Expand Down
2 changes: 1 addition & 1 deletion src/PF1550/PF1550_Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PF1550_Control
PF1550_Control(PF1550_IO & io);


int begin();
void begin();
void debug(Stream& stream);

void setBit (Register const reg, uint8_t const bit_pos);
Expand Down
4 changes: 2 additions & 2 deletions src/PF1550/PF1550_IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ PF1550_IO::PF1550_IO(arduino::HardwareI2C * wire, uint8_t const i2c_addr)
PUBLIC MEMBER FUNCTIONS
******************************************************************************/

int PF1550_IO::begin()
void PF1550_IO::begin()
{
_wire->begin();
Copy link
Collaborator

@aentinger aentinger May 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hideakitai ☕ 👋

Instead of eliminating the return value altogether I think it makes more sense to also return the return code of _wire->begin(); and _wire->setClock(100000); in case there's an error. Can you please adjust this PR to that end?

Copy link
Author

@hideakitai hideakitai May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aentinger Thanks. I think both arduino::HardwareI2C (and TwoWire) 's begin() and setClock() returns void, so I made it void. If I have any misunderstandings, please let me know.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aentinger What should I do about this one?

_wire->setClock(100000);
return derived_begin();
derived_begin();
}

void PF1550_IO::readRegister(Register const reg_addr, uint8_t * data)
Expand Down
4 changes: 2 additions & 2 deletions src/PF1550/PF1550_IO.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PF1550_IO
void debug (Stream& stream) { _debug = &stream; }


int begin();
void begin();

void readRegister (Register const reg_addr, uint8_t * data);
void writeRegister(Register const reg_addr, uint8_t const data);
Expand All @@ -60,7 +60,7 @@ class PF1550_IO


protected:
virtual int derived_begin() = 0;
virtual void derived_begin() = 0;

private:
arduino::HardwareI2C * _wire;
Expand Down
2 changes: 1 addition & 1 deletion src/PF1550/PF1550_IO_C33.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PF1550_IO_C33 : public PF1550_IO


protected:
virtual int derived_begin() override
virtual void derived_begin() override
{
/* Enable LED. */
setBit(Register::CHARGER_LED_PWM, REG_LED_PWM_LED_EN_bp);
Expand Down
2 changes: 1 addition & 1 deletion src/PF1550/PF1550_IO_Nicla_Vision.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PF1550_IO_Nicla_Vision : public PF1550_IO


protected:
virtual int derived_begin() override { }
virtual void derived_begin() override { }
};

#endif /* PF1550_IO_NICLA_VISION_H_ */
2 changes: 1 addition & 1 deletion src/PF1550/PF1550_IO_Portenta_H7.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PF1550_IO_Portenta_H7 : public PF1550_IO


protected:
virtual int derived_begin() override { }
virtual void derived_begin() override { }
};

#endif /* PF1550_IO_ENVIEH747_H_ */
Loading