Skip to content
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

MAX32670: Adding the Temp_Monitor example #281

Merged
merged 7 commits into from
Dec 12, 2022
Merged

MAX32670: Adding the Temp_Monitor example #281

merged 7 commits into from
Dec 12, 2022

Conversation

Jacob-Scheiffler
Copy link
Contributor

This PR adds the Temp_Monitor example to the MAX32670. The example is intended to be a simple application which incorporates more than just one of our peripherals as most of our examples do. Note also, that this is just a rough draft so any suggestions concerning structure, style, and functionality are greatly appreciated.

@Jacob-Scheiffler
Copy link
Contributor Author

/clang-format-run

Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean! Some minor housekeeping things below

@@ -0,0 +1,42 @@
## Description

This simple example demonstrates the use of the MAX32670 as a temperature monitor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add (in bold) "It requires an additional MAX31889EVSYS" or something similar


Additionally, pressing push button SW3 will print the last 12 temperature readings in the terminal.

The temperature limits, flash storage page, and RTC time-of-day alarm period are defined in temp_monitor.c with the HI/LO_TEMP_THRESHOLD, TR_STORAGE_PAGE, and TEMP_CHECK_PERIOD defines respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use markdown link. Ex: temp_monitor.c

/**
* @file main.c
* @brief Low-Power Temp Sensor example.
* @details This is a demo example for reading and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete details

}
}

void print_temperatures(void *pb)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming to PB_Handler or something similar to reduce redundant function names.

{
int err;

MXC_Delay(MXC_DELAY_SEC(2)); //Prevent bricking device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chang //Prevent bricking device to // Delay to give debugger a connection window


if ((err = init_flash()) != E_NO_ERROR) { // Initialize flash space used to store temp readings
return err;
} else if ((err = init_temp_sensor()) !=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird clang-format. Put comment inside of if else body so the line doesn't get wrapped.

} else if ((err = init_temp_sensor()) !=
E_NO_ERROR) { // Initialize temperature sensor (and I2C)
return err;
} else if ((err = start_rtc()) !=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird clang-format. Put comment inside of if else body so the line doesn't get wrapped.

uint16_t time, temp;

// Read all temperature readings stored in flash
MXC_FLC_Read(TR_STORAGE_BASE_ADDR + addr_offset, (void *)temps, sizeof(temps));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need to cast to void pointer here, right? Just pass in temps pointer directly

Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Jake-Carter Jake-Carter merged commit 49ba417 into analogdevicesinc:main Dec 12, 2022
@Jacob-Scheiffler Jacob-Scheiffler deleted the tm_add branch December 12, 2022 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants