Skip to content

Commit e4b082a

Browse files
committed
cleanup
1 parent 0f4c03d commit e4b082a

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lib/rc5/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ stop bit S2 as an extension to the command value.
1313

1414
See also http://www.sbprojects.com/knowledge/ir/rc5.php
1515

16-
This library if a fork of the original [RC5 library by guyc](https://github.com/guyc/RC5) - it is adapted
16+
This library is a fork of the original [RC5 library by guyc](https://github.com/guyc/RC5) - it is adapted
1717
for use with the c't-Bot ATmega framework and ported to C++14.

src/servo.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
namespace ctbot {
3232
using namespace avr;
3333

34-
bool Servo::initialized { false };
34+
bool Servo::initialized_ { false };
3535

36-
Servo::Servo(ID num, volatile uint8_t* p_ddr, uint8_t pin, volatile uint16_t* p_ocr_reg) : id { num }, p_ocr { p_ocr_reg }, position { POS_OFF } {
36+
Servo::Servo(ID num, volatile uint8_t* p_ddr, uint8_t pin, volatile uint16_t* p_ocr_reg) : id_ { num }, p_ocr_ { p_ocr_reg }, position_ { POS_OFF } {
3737
SBI(p_ddr, pin); // set servo pin as output
3838

39-
if (! initialized) {
40-
initialized = true;
39+
if (! initialized_) {
40+
initialized_ = true;
4141
GPIOR0 = 0; // both servos shut off
4242
TCNT3 = 0; // TIMER3 init
4343
ICR3 = 40000UL;
@@ -52,21 +52,21 @@ Servo::Servo(ID num, volatile uint8_t* p_ddr, uint8_t pin, volatile uint16_t* p_
5252
void Servo::set(uint8_t pos) {
5353
if (pos == POS_OFF) {
5454
/* set pwm pin low on next overflow */
55-
if (id == ID::SERVO_1) {
55+
if (id_ == ID::SERVO_1) {
5656
CBI(&GPIOR0, static_cast<uint8_t>(0U));
5757
} else {
5858
CBI(&GPIOR0, static_cast<uint8_t>(1U));
5959
}
6060
} else {
61-
*p_ocr = calc_ocr(pos);
62-
if (id == ID::SERVO_1) {
61+
*p_ocr_ = calc_ocr(pos);
62+
if (id_ == ID::SERVO_1) {
6363
SBI(&GPIOR0, static_cast<uint8_t>(0U));
6464
} else {
6565
SBI(&GPIOR0, static_cast<uint8_t>(1U));
6666
}
67-
TIMSK3 |= BV_8(ICF3) | (id == ID::SERVO_1 ? BV_8(OCIE3A) : BV_8(OCIE3B)); // Input Capture Interrupt Enable, Output Compare A Match Interrupt Enable
67+
TIMSK3 |= BV_8(ICF3) | (id_ == ID::SERVO_1 ? BV_8(OCIE3A) : BV_8(OCIE3B)); // Input Capture Interrupt Enable, Output Compare A Match Interrupt Enable
6868
}
69-
position = pos;
69+
position_ = pos;
7070
}
7171

7272

src/servo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ class Servo {
6666
* @brief Gets the last set servo position
6767
* @return Position of servo or POS_OFF, if servo turned off
6868
*/
69-
auto get() const { return position; }
69+
auto get() const { return position_; }
7070

7171
protected:
72-
const ID id; /**< Servo ID: ID::SERVO_1 or ID::SERVO_2 */
73-
volatile uint16_t* const p_ocr; /**< Pointer to OCR timer register for this servo */
74-
uint8_t position; /**< Target position for servo */
75-
static bool initialized; /**< Flag, if at least one servo has been initialized */
72+
const ID id_; /**< Servo ID: ID::SERVO_1 or ID::SERVO_2 */
73+
volatile uint16_t* const p_ocr_; /**< Pointer to OCR timer register for this servo */
74+
uint8_t position_; /**< Target position for servo */
75+
static bool initialized_; /**< Flag, if at least one servo has been initialized */
7676

7777
/**
7878
* @brief Create a servo instance for given servo number

0 commit comments

Comments
 (0)