Skip to content

Commit

Permalink
Some reformatting to layout rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Bolukan committed Nov 3, 2019
1 parent 601d76e commit c02fe74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions Adafruit_PWMServoDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ void Adafruit_PWMServoDriver::wakeup() {
* @param prescale
* Defines the frequency at which the outputs modulate
* @param extclk
* Sets EXTCLK pin to use the external clock
* Sets EXTCLK pin to use the external clock, default false
*/
void Adafruit_PWMServoDriver::setPrescale(uint8_t prescale, bool extclk /* = false */) {
if (prescale < PCA9685_PRESCALE_MIN) return;
void Adafruit_PWMServoDriver::setPrescale(uint8_t prescale,
bool extclk) {
if (prescale < PCA9685_PRESCALE_MIN)
return;
// if (prescale > PCA9685_PRESCALE_MAX) return;

uint8_t newmode1 = read8(PCA9685_MODE1);
Expand All @@ -120,7 +122,9 @@ void Adafruit_PWMServoDriver::setPrescale(uint8_t prescale, bool extclk /* = fal

// This sets both the SLEEP and EXTCLK bits of the MODE1 register to switch to
// use the external clock.
if (extclk) { write8(PCA9685_MODE1, (newmode1 |= MODE1_EXTCLK)); }
if (extclk) {
write8(PCA9685_MODE1, (newmode1 |= MODE1_EXTCLK));
}

write8(PCA9685_PRESCALE, prescale); // set the prescaler

Expand Down
2 changes: 1 addition & 1 deletion Adafruit_PWMServoDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Adafruit_PWMServoDriver {
void reset();
void sleep();
void wakeup();
void setPrescale(uint8_t prescale, bool extclk=false);
void setPrescale(uint8_t prescale, bool extclk = false);
void setExtClk(uint8_t prescale);
void setPWMFreq(float freq);
void setOutputMode(bool totempole);
Expand Down

0 comments on commit c02fe74

Please sign in to comment.