Skip to content

Commit 9f82290

Browse files
Apply suggestions from code review
Add more const correctness Co-authored-by: Alexander Entinger <[email protected]>
1 parent 5a43138 commit 9f82290

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

libraries/OPAMP/examples/start_opamp/start_opamp.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void setup () {
1010
if (!OPAMP.begin(OPAMP_SPEED_HIGHSPEED)) {
1111
Serial.println("Failed to start OPAMP!");
1212
}
13-
bool isRunning = OPAMP.isRunning(0);
13+
bool const isRunning = OPAMP.isRunning(0);
1414
if (isRunning) {
1515
Serial.println("OPAMP running on channel 0!");
1616
} else {

libraries/OPAMP/src/OPAMP.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ bool OpampClass::begin() {
8181
return this->begin(OPAMP_SPEED_HIGHSPEED);
8282
}
8383

84-
bool OpampClass::begin(OpampSpeedMode speed) {
84+
bool OpampClass::begin(OpampSpeedMode const speed) {
85+
8586
return this->begin(1u << ARDUINO_UNO_R4_DEFAULT_OPAMP_CHANNEL, speed);
8687
}
8788

88-
bool OpampClass::begin(uint8_t const channel_mask, OpampSpeedMode speed) {
89+
bool OpampClass::begin(uint8_t const channel_mask, OpampSpeedMode const speed) {
90+
8991
if (!initPins(channel_mask)) {
9092
return false;
9193
}

libraries/OPAMP/src/OPAMP.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ class OpampClass {
3333
/* startup the OPAMP on channel 0 in high-speed mode */
3434
bool begin();
3535
/* startup the OPAMP on channel 0 with specific mode */
36-
bool begin(OpampSpeedMode speed);
36+
bool begin(OpampSpeedMode const speed);
37+
3738
/* startup the OPAMP with arbitrary channel mask */
38-
bool begin(uint8_t const channel_mask, OpampSpeedMode speed);
39+
bool begin(uint8_t const channel_mask, OpampSpeedMode const speed);
40+
3941
/* stop all OPAMP channels */
4042
void end();
4143
/* stop specific OPAMP channel(s) */
@@ -46,7 +48,8 @@ class OpampClass {
4648
/* initializes OPAMP pins for given channel(s) */
4749
bool initPins(uint8_t const channel_mask);
4850
/* activates OPAMP for given speed and channel(s) */
49-
void initOpamp(OpampSpeedMode speed, uint8_t const channel_mask);
51+
void initOpamp(OpampSpeedMode const speed, uint8_t const channel_mask);
52+
5053
};
5154

5255
extern OpampClass OPAMP;

0 commit comments

Comments
 (0)