Skip to content

Conversation

@cmaglie
Copy link
Member

@cmaglie cmaglie commented Aug 13, 2015

This pull request implements the optimizations suggested in #20.

/cc @hfvogt @facchinm

In the wire library there are several functions where
an unnecessarily complex coding has been used:

  - endTransmission: the availability of data is already
    checked in while(...), therefore need not be checked
    again in the loop.
  - requestFrom: the for-loop has a predefined and fixed
    number of loops. Therefore a check whether the last
    element has been reached is unnecessary and does not
    add any benefit.

Fixes arduino#20
@ArduinoBot
Copy link

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b24_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request [Wire] simplified coding unnecessarily complex (hfvogt) #25
  5. Select one of the boards under SAMD Pull Request [Wire] simplified coding unnecessarily complex (hfvogt) #25 in Tools->Board menu
  6. Compile/Upload as usual

@facchinm
Copy link
Member

Seems good to me 👍

@aethaniel
Copy link
Contributor

idem 👍

@cmaglie cmaglie merged commit 024e089 into arduino:master Aug 19, 2015
@cmaglie cmaglie deleted the wire-fixes branch August 19, 2015 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants