Skip to content

Commit 6ccc963

Browse files
author
Cruz Monrreal
authored
Merge pull request #6733 from maximmbed/fix-compiler-warnings
Fix compiler warnings for Maxim platforms
2 parents 95156ce + fc7c70d commit 6ccc963

File tree

16 files changed

+48
-45
lines changed

16 files changed

+48
-45
lines changed

targets/TARGET_Maxim/TARGET_MAX32620C/analogin_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void analogin_init(analogin_t *obj, PinName pin)
5050

5151
// Set the object pointer and channel encoding
5252
obj->adc = MXC_ADC;
53-
obj->channel = pinmap_find_function(pin, PinMap_ADC);
53+
obj->channel = (mxc_adc_chsel_t)pinmap_find_function(pin, PinMap_ADC);
5454

5555
if (!initialized) {
5656
MBED_ASSERT(ADC_Init() == E_NO_ERROR);
@@ -93,4 +93,3 @@ uint16_t analogin_read_u16(analogin_t *obj)
9393

9494
return result;
9595
}
96-

targets/TARGET_Maxim/TARGET_MAX32620C/i2c_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
7878
//******************************************************************************
7979
void i2c_frequency(i2c_t *obj, int hz)
8080
{
81-
I2CM_Init(obj->i2c, &obj->sys_cfg, hz);
81+
I2CM_Init(obj->i2c, &obj->sys_cfg, (i2cm_speed_t)hz);
8282
}
8383

8484
//******************************************************************************

targets/TARGET_Maxim/TARGET_MAX32620C/mxc/lp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int LP_ConfigGPIOWakeUpDetect(const gpio_cfg_t *gpio, unsigned int act_high, lp_
179179
return result;
180180
}
181181

182-
uint8_t LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio)
182+
int LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio)
183183
{
184184
uint8_t gpioWokeUp = 0;
185185

targets/TARGET_Maxim/TARGET_MAX32620C/mxc/lp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ int LP_ClearGPIOWakeUpDetect(const gpio_cfg_t *gpio);
138138
* nonzero = at least one of the gpio passed in triggered a wake up
139139
* the bit set represents which pin is the wake up source
140140
*/
141-
uint8_t LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio);
141+
int LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio);
142142

143143
/**
144144
* @brief Wake on USB plug or unplug

targets/TARGET_Maxim/TARGET_MAX32620C/mxc/mxc_sys.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ uint32_t SYS_CPU_GetFreq(void);
125125
* @returns E_NO_ERROR if everything is successful
126126
*/
127127
int SYS_ADC_Init(void);
128-
128+
129129
/**
130130
* @brief System level initialization for AES module.
131131
* @returns E_NO_ERROR if everything is successful
@@ -240,13 +240,13 @@ int SYS_SPIX_Init(const sys_cfg_spix_t *sys_cfg, uint32_t baud);
240240
* @brief System level shutdown for SPIX module
241241
* @returns E_NO_ERROR if everything is successful
242242
*/
243-
int SYS_SPIX_Shutdown();
243+
int SYS_SPIX_Shutdown(void);
244244

245245
/**
246246
* @brief Get the frequency of the SPIX module source clock
247247
* @returns frequency in Hz
248248
*/
249-
uint32_t SYS_SPIX_GetFreq();
249+
uint32_t SYS_SPIX_GetFreq(void);
250250

251251
/**
252252
* @brief System level initialization for SPIS module.
@@ -259,13 +259,13 @@ int SYS_SPIS_Init(const sys_cfg_spix_t *sys_cfg);
259259
* @brief System level shutdown for SPIS module
260260
* @returns E_NO_ERROR if everything is successful
261261
*/
262-
int SYS_SPIS_Shutdown();
262+
int SYS_SPIS_Shutdown(void);
263263

264264
/**
265265
* @brief Get the frequency of the SPIS module source clock
266266
* @returns frequency in Hz
267267
*/
268-
uint32_t SYS_SPIS_GetFreq();
268+
uint32_t SYS_SPIS_GetFreq(void);
269269

270270
/**
271271
* @brief System level initialization for OWM module.
@@ -436,7 +436,7 @@ uint32_t SYS_SRAM_GetSize(void);
436436
* @returns size of Flash in bytes
437437
*/
438438
uint32_t SYS_FLASH_GetSize(void);
439-
439+
440440
#ifdef __cplusplus
441441
}
442442
#endif

targets/TARGET_Maxim/TARGET_MAX32620C/mxc/spis.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
#include "spis.h"
4747

4848
/**
49-
* @ingroup spis
49+
* @ingroup spis
5050
* @{
51-
*/
51+
*/
5252
/* **** Definitions **** */
5353
#define SPIS_FIFO_BUFFER 6
5454

@@ -119,7 +119,7 @@ int SPIS_Shutdown(mxc_spis_regs_t *spis)
119119
}
120120

121121
// Clear system level configurations
122-
if ((err = SYS_SPIS_Shutdown(spis)) != E_NO_ERROR) {
122+
if ((err = SYS_SPIS_Shutdown()) != E_NO_ERROR) {
123123
return err;
124124
}
125125

@@ -162,7 +162,7 @@ int SPIS_Trans(mxc_spis_regs_t *spis, spis_req_t *req)
162162

163163
// Start the transaction, keep calling the handler until complete
164164
spis->intfl = (MXC_F_SPIS_INTFL_SS_DEASSERTED | MXC_F_SPIS_INTFL_TX_UNDERFLOW);
165-
while(SPIS_TransHandler(spis, req, spis_num) & (MXC_F_SPIS_INTEN_RX_FIFO_AF |
165+
while(SPIS_TransHandler(spis, req, spis_num) & (MXC_F_SPIS_INTEN_RX_FIFO_AF |
166166
MXC_F_SPIS_INTEN_TX_FIFO_AE)) {
167167

168168
if((req->tx_data != NULL) && (spis->intfl & MXC_F_SPIS_INTFL_TX_UNDERFLOW)) {
@@ -174,7 +174,7 @@ int SPIS_Trans(mxc_spis_regs_t *spis, spis_req_t *req)
174174
}
175175

176176
if((req->deass) && (spis->intfl & MXC_F_SPIS_INTFL_SS_DEASSERTED)) {
177-
if(((req->rx_data != NULL) && ((req->read_num + SPIS_NumReadAvail(spis)) < req->len)) ||
177+
if(((req->rx_data != NULL) && ((req->read_num + SPIS_NumReadAvail(spis)) < req->len)) ||
178178
((req->tx_data != NULL) && (req->write_num < req->len))) {
179179

180180
return E_COMM_ERR;
@@ -306,7 +306,7 @@ void SPIS_Handler(mxc_spis_regs_t *spis)
306306
if((flags & MXC_F_SPIS_INTFL_SS_DEASSERTED) && (req != NULL) &&
307307
(req->deass)) {
308308

309-
if(((req->rx_data != NULL) && ((req->read_num + SPIS_NumReadAvail(spis)) < req->len)) ||
309+
if(((req->rx_data != NULL) && ((req->read_num + SPIS_NumReadAvail(spis)) < req->len)) ||
310310
((req->tx_data != NULL) && (req->write_num < req->len))) {
311311

312312
// Unlock this SPIS

targets/TARGET_Maxim/TARGET_MAX32620C/rtc_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "lp_ticker_api.h"
3636
#include "rtc.h"
3737
#include "lp.h"
38+
#include <string.h>
3839

3940
// LOG2 for 32-bit powers of 2
4041
#define LOG2_1(n) (((n) >= (1 << 1)) ? 1 : 0)
@@ -65,7 +66,8 @@ static void init_rtc(void)
6566
* if it is already running.
6667
*/
6768
if (!RTC_IsActive()) {
68-
rtc_cfg_t cfg = { 0 };
69+
rtc_cfg_t cfg;
70+
memset(&cfg, 0, sizeof(rtc_cfg_t));
6971
cfg.prescaler = LP_TIMER_PRESCALE;
7072
cfg.snoozeMode = RTC_SNOOZE_DISABLE;
7173

targets/TARGET_Maxim/TARGET_MAX32625/analogin_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void analogin_init(analogin_t *obj, PinName pin)
5050

5151
// Set the object pointer and channel encoding
5252
obj->adc = MXC_ADC;
53-
obj->channel = pinmap_find_function(pin, PinMap_ADC);
53+
obj->channel = (mxc_adc_chsel_t)pinmap_find_function(pin, PinMap_ADC);
5454

5555
if (!initialized) {
5656
MBED_ASSERT(ADC_Init() == E_NO_ERROR);
@@ -93,4 +93,3 @@ uint16_t analogin_read_u16(analogin_t *obj)
9393

9494
return result;
9595
}
96-

targets/TARGET_Maxim/TARGET_MAX32625/i2c_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void i2c_init(i2c_t *obj, PinName sda, PinName scl)
7979
//******************************************************************************
8080
void i2c_frequency(i2c_t *obj, int hz)
8181
{
82-
I2CM_SetFrequency(obj->i2c, hz);
82+
I2CM_SetFrequency(obj->i2c, (i2cm_speed_t)hz);
8383
}
8484

8585
//******************************************************************************

targets/TARGET_Maxim/TARGET_MAX32625/mxc/lp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ int LP_ConfigGPIOWakeUpDetect(const gpio_cfg_t *gpio, unsigned int act_high, lp_
178178
return result;
179179
}
180180

181-
uint8_t LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio)
181+
int LP_IsGPIOWakeUpSource(const gpio_cfg_t *gpio)
182182
{
183183
uint8_t gpioWokeUp = 0;
184184

0 commit comments

Comments
 (0)