-
Notifications
You must be signed in to change notification settings - Fork 100
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
Conversation
/clang-format-run |
There was a problem hiding this 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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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()) != |
There was a problem hiding this comment.
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()) != |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
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.