Skip to content

Add OPAMP library for Uno R4 (WiFi, Minima) #97

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

Merged
merged 23 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0379ba3
Add files via upload
maxgerhardt Aug 12, 2023
73d77f2
Declare architecture properly
maxgerhardt Aug 12, 2023
1c60323
Add OPAMP examples to CI
maxgerhardt Aug 12, 2023
e8a6cab
Fix CI
maxgerhardt Aug 12, 2023
8893eb9
Add files via upload
maxgerhardt Aug 12, 2023
c7ecddc
Add Fritzing circuit
maxgerhardt Aug 12, 2023
e37f4b0
Fix schematic
maxgerhardt Aug 12, 2023
12b7b85
Apply suggestions from code review
maxgerhardt Aug 12, 2023
c84a823
Minify PNGs
maxgerhardt Aug 13, 2023
8bc14eb
Merge branch 'main' into main
maxgerhardt Sep 1, 2023
c6f564e
Dont compile OTA examples for stable version
maxgerhardt Sep 1, 2023
18a59a5
Merge branch 'arduino:main' into main
maxgerhardt Sep 5, 2023
57c7f97
Revert removal of OTAUpdate CI run
maxgerhardt Sep 5, 2023
ef3472a
Rework begin(), end() to use channel masks, create isRunning() instead
maxgerhardt Sep 5, 2023
2720ef5
Add newline at end of file
maxgerhardt Sep 5, 2023
35d2d6e
Unify usage of space before brace for if, for
maxgerhardt Sep 5, 2023
7434247
Explain OPAMP channel pins in sketch code
maxgerhardt Sep 5, 2023
f340349
Center images and adjust size (can be further readjusted).
aentinger Sep 6, 2023
1098501
Replace default arguments with overloaded functions
maxgerhardt Sep 13, 2023
6dd13b1
Use const on all uint8_t params
maxgerhardt Sep 13, 2023
1ad825b
Make macro name more explicit, use official product name
maxgerhardt Sep 13, 2023
5a43138
Merge branch 'main' into main
aentinger Sep 14, 2023
9f82290
Apply suggestions from code review
maxgerhardt Sep 14, 2023
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
Prev Previous commit
Next Next commit
Use const on all uint8_t params
  • Loading branch information
maxgerhardt committed Sep 13, 2023
commit 6dd13b199472122a9de9c4ce5033c2a460ccf190
8 changes: 4 additions & 4 deletions libraries/OPAMP/src/OPAMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static const opamp_channel_pins_t opamp_channels[] = {
{BSP_IO_PORT_00_PIN_05, BSP_IO_PORT_00_PIN_06, BSP_IO_PORT_00_PIN_07}, /* CH3 */
};

bool OpampClass::initPins(uint8_t channel_mask) {
bool OpampClass::initPins(uint8_t const channel_mask) {
fsp_err_t err;
ioport_instance_ctrl_t ioport_ctrl {};
// Make sure to return false if nothing was given to initialize
Expand All @@ -53,7 +53,7 @@ bool OpampClass::initPins(uint8_t channel_mask) {
return true;
}

void OpampClass::initOpamp(OpampSpeedMode speed, uint8_t channel_mask) {
void OpampClass::initOpamp(OpampSpeedMode speed, uint8_t const channel_mask) {
uint8_t ampmc_val = 0U;
/* setup amplifier speed mode within amplifier mode control */
/* for all boards, this is at bit position 7 with either 0 (lowspeed) or 1 (highspeed) */
Expand Down Expand Up @@ -85,7 +85,7 @@ bool OpampClass::begin(OpampSpeedMode speed) {
return this->begin(1u << ARDUINO_DEFAULT_OPAMP_CHANNEL, speed);
}

bool OpampClass::begin(uint8_t channel_mask, OpampSpeedMode speed) {
bool OpampClass::begin(uint8_t const channel_mask, OpampSpeedMode speed) {
if (!initPins(channel_mask)) {
return false;
}
Expand All @@ -102,7 +102,7 @@ void OpampClass::end() {
R_OPAMP->AMPC = 0;
}

void OpampClass::end(uint8_t channel_mask) {
void OpampClass::end(uint8_t const channel_mask) {
// deactivate given channels
R_OPAMP->AMPC &= ~channel_mask;
}
Expand Down
8 changes: 4 additions & 4 deletions libraries/OPAMP/src/OPAMP.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ class OpampClass {
/* startup the OPAMP on channel 0 with specific mode */
bool begin(OpampSpeedMode speed);
/* startup the OPAMP with arbitrary channel mask */
bool begin(uint8_t channel_mask, OpampSpeedMode speed);
bool begin(uint8_t const channel_mask, OpampSpeedMode speed);
/* stop all OPAMP channels */
void end();
/* stop specific OPAMP channel(s) */
void end(uint8_t channel_mask);
void end(uint8_t const channel_mask);
/* returns true if the specified OPAMP channel number is running */
bool isRunning(uint8_t const channel);
private:
/* initializes OPAMP pins for given channel(s) */
bool initPins(uint8_t channel_mask);
bool initPins(uint8_t const channel_mask);
/* activates OPAMP for given speed and channel(s) */
void initOpamp(OpampSpeedMode speed, uint8_t channel_mask);
void initOpamp(OpampSpeedMode speed, uint8_t const channel_mask);
};

extern OpampClass OPAMP;
Expand Down