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

fix(PeriphDrivers): Fix build warnings for MAX32672 and MAX32662 ADC #1105

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions Libraries/PeriphDrivers/Source/ADC/adc_me12.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

#define MXC_F_MCR_ADC_CFG2_CH 0x3

#define TEMP_FACTOR 530.582f / 4096.0
#define TEMP_FACTOR1V25 1.25 * TEMP_FACTOR
#define TEMP_FACTOR2V048 2.048 * TEMP_FACTOR
#define TEMP_FACTOR (double)530.582f / (double)4096.0f
#define TEMP_FACTOR1V25 (double)1.25f * TEMP_FACTOR
#define TEMP_FACTOR2V048 (double)2.048f * TEMP_FACTOR

static void initGPIOForChannel(mxc_adc_chsel_t channel)
{
Expand Down Expand Up @@ -284,7 +284,7 @@ int MXC_ConvertTemperature_ToK(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref
{
switch (ref) {
case MXC_ADC_REF_EXT:
*temp_k = tempSensor_Readout * TEMP_FACTOR * ext_ref;
*temp_k = (double)tempSensor_Readout * (double)TEMP_FACTOR * (double)ext_ref;
break;

case MXC_ADC_REF_INT_1V25:
Expand Down Expand Up @@ -316,7 +316,7 @@ int MXC_ConvertTemperature_ToF(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref
float *temp)
{
if (MXC_ConvertTemperature_ToK(tempSensor_Readout, ref, ext_ref, temp) == E_NO_ERROR) {
*temp = ((*temp * 1.8) - 459.67f);
*temp = (*temp * 1.8f) - 459.67f;
return E_NO_ERROR;
} else {
return E_BAD_PARAM;
Expand Down
10 changes: 5 additions & 5 deletions Libraries/PeriphDrivers/Source/ADC/adc_me21.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

#define MXC_F_MCR_ADC_CFG2_CH 0x3

#define TEMP_FACTOR 530.582f / 4096.0
#define TEMP_FACTOR1V25 1.25 * TEMP_FACTOR
#define TEMP_FACTOR2V048 2.048 * TEMP_FACTOR
#define TEMP_FACTOR (double)530.582f / (double)4096.0f
#define TEMP_FACTOR1V25 (double)1.25f * TEMP_FACTOR
#define TEMP_FACTOR2V048 (double)2.048f * TEMP_FACTOR

static void initGPIOForChannel(mxc_adc_chsel_t channel)
{
Expand Down Expand Up @@ -405,7 +405,7 @@ int MXC_ConvertTemperature_ToK(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref
{
switch (ref) {
case MXC_ADC_REF_EXT:
*temp_k = tempSensor_Readout * TEMP_FACTOR * ext_ref;
*temp_k = (double)tempSensor_Readout * (double)TEMP_FACTOR * (double)ext_ref;
break;

case MXC_ADC_REF_INT_1V25:
Expand Down Expand Up @@ -437,7 +437,7 @@ int MXC_ConvertTemperature_ToF(uint16_t tempSensor_Readout, mxc_adc_refsel_t ref
float *temp)
{
if (MXC_ConvertTemperature_ToK(tempSensor_Readout, ref, ext_ref, temp) == E_NO_ERROR) {
*temp = ((*temp * 1.8) - 459.67f);
*temp = (*temp * 1.8f) - 459.67f;
return E_NO_ERROR;
} else {
return E_BAD_PARAM;
Expand Down
Loading