diff --git a/.gitignore b/.gitignore index 1077dbcaa1..d7c764479d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ uVision Project/ *.bak debug.log + +# Ignore OS X Desktop Services Store files +.DS_Store \ No newline at end of file diff --git a/libraries/mbed/common/pinmap_common.c b/libraries/mbed/common/pinmap_common.c index 3abc2855d0..66ccf963ce 100644 --- a/libraries/mbed/common/pinmap_common.c +++ b/libraries/mbed/common/pinmap_common.c @@ -45,7 +45,7 @@ uint32_t pinmap_merge(uint32_t a, uint32_t b) { } uint32_t pinmap_peripheral(PinName pin, const PinMap* map) { - if (pin == (uint32_t)NC) + if (pin == (PinName)NC) return (uint32_t)NC; while (map->pin != NC) { diff --git a/libraries/mbed/common/wait_api.c b/libraries/mbed/common/wait_api.c index 5bf00aee2c..b276614ca0 100644 --- a/libraries/mbed/common/wait_api.c +++ b/libraries/mbed/common/wait_api.c @@ -26,5 +26,5 @@ void wait_ms(int ms) { void wait_us(int us) { uint32_t start = us_ticker_read(); - while ((us_ticker_read() - start) < us); + while ((us_ticker_read() - start) < (uint32_t)us); } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c index 9dcf436e45..455fa835db 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogin_api.c @@ -41,7 +41,7 @@ static const PinMap PinMap_ADC[] = { void analogin_init(analogin_t *obj, PinName pin) { obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC); - if (obj->adc == (uint32_t)NC) { + if (obj->adc == (ADCName)NC) { error("ADC pin mapping failed"); } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c index e1839c3fc5..9dfa174edb 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/analogout_api.c @@ -28,7 +28,7 @@ static const PinMap PinMap_DAC[] = { void analogout_init(dac_t *obj, PinName pin) { obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC); - if (obj->dac == (uint32_t)NC) { + if (obj->dac == (DACName)NC) { error("DAC pin mapping failed"); } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c index 602a8c725e..7cf3b2683c 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c @@ -215,7 +215,7 @@ void i2c_frequency(i2c_t *obj, int hz) { for (i = 1; i < 5; i*=2) { for (j = 0; j < 0x40; j++) { ref = PCLK / (i*ICR[j]); - if (ref > hz) + if (ref > (uint32_t)hz) continue; error = hz - ref; if (error < p_error) { @@ -392,7 +392,7 @@ int i2c_slave_read(i2c_t *obj, char *data, int length) { } int i2c_slave_write(i2c_t *obj, const char *data, int length) { - uint32_t i, count = 0; + int i, count = 0; // set tx mode obj->i2c->C1 |= I2C_C1_TX_MASK; diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c index 7b68e497c0..9bb5c3f220 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pinmap.c @@ -17,7 +17,7 @@ #include "error.h" void pin_function(PinName pin, int function) { - if (pin == (uint32_t)NC) return; + if (pin == (PinName)NC) return; uint32_t port_n = (uint32_t)pin >> PORT_SHIFT; uint32_t pin_n = (uint32_t)(pin & 0x7C) >> 2; @@ -30,7 +30,7 @@ void pin_function(PinName pin, int function) { } void pin_mode(PinName pin, PinMode mode) { - if (pin == (uint32_t)NC) { return; } + if (pin == (PinName)NC) { return; } __IO uint32_t* pin_pcr = (__IO uint32_t*)(PORTA_BASE + pin); diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c index 7353900683..b31b9e01ee 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/pwmout_api.c @@ -48,7 +48,7 @@ static const PinMap PinMap_PWM[] = { void pwmout_init(pwmout_t* obj, PinName pin) { // determine the channel PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM); - if (pwm == (uint32_t)NC) + if (pwm == (PWMName)NC) error("PwmOut pin mapping failed"); unsigned int port = (unsigned int)pin >> PORT_SHIFT; diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c index 2492c774ad..20a953aec7 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/spi_api.c @@ -153,7 +153,7 @@ void spi_frequency(spi_t *obj, int hz) { divisor = 2; for (spr = 0; spr <= 8; spr++, divisor *= 2) { ref = PCLK / (prescaler*divisor); - if (ref > hz) + if (ref > (uint32_t)hz) continue; error = hz - ref; if (error < p_error) { diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c index 43a7a237a8..9078d2c002 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/analogin_api.c @@ -46,7 +46,7 @@ static const PinMap PinMap_ADC[] = { void analogin_init(analogin_t *obj, PinName pin) { obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC); - if (obj->adc == (uint32_t)NC) { + if (obj->adc == (ADCName)NC) { error("ADC pin mapping failed"); } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c index 4e2445c658..d7a157a1df 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pinmap.c @@ -20,7 +20,7 @@ #define LPC_IOCON1_BASE (LPC_IOCON_BASE + 0x60) void pin_function(PinName pin, int function) { - if (pin == (uint32_t)NC) return; + if (pin == (PinName)NC) return; uint32_t pin_number = (uint32_t)pin; @@ -33,7 +33,7 @@ void pin_function(PinName pin, int function) { } void pin_mode(PinName pin, PinMode mode) { - if (pin == (uint32_t)NC) { return; } + if (pin == (PinName)NC) { return; } uint32_t pin_number = (uint32_t)pin; uint32_t drain = ((uint32_t) mode & (uint32_t) OpenDrain) >> 2; diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c index afd2eba76f..718d7339cc 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/pwmout_api.c @@ -71,7 +71,7 @@ static unsigned int pwm_clock_mhz; void pwmout_init(pwmout_t* obj, PinName pin) { // determine the channel PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM); - if (pwm == (uint32_t)NC) + if (pwm == (PWMName)NC) error("PwmOut pin mapping failed"); obj->pwm = pwm; diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c index 31f6c48cbf..982845b2c2 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogin_api.c @@ -44,7 +44,7 @@ static const PinMap PinMap_ADC[] = { void analogin_init(analogin_t *obj, PinName pin) { obj->adc = (ADCName)pinmap_peripheral(pin, PinMap_ADC); - if (obj->adc == (uint32_t)NC) { + if (obj->adc == (ADCName)NC) { error("ADC pin mapping failed"); } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c index d2704f37e4..103b644f17 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/analogout_api.c @@ -26,7 +26,7 @@ static const PinMap PinMap_DAC[] = { void analogout_init(dac_t *obj, PinName pin) { obj->dac = (DACName)pinmap_peripheral(pin, PinMap_DAC); - if (obj->dac == (uint32_t)NC) { + if (obj->dac == (DACName)NC) { error("DAC pin mapping failed"); } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c index ac316468dd..5afee7ed4d 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/can_api.c @@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) { obj->dev->MOD &= ~(1); // Enable NVIC if at least 1 interrupt is active - if(LPC_CAN1->IER | LPC_CAN2->IER != 0) { + if(LPC_CAN1->IER | LPC_CAN2->IER) { NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n); NVIC_EnableIRQ(CAN_IRQn); } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c index f5dcb8fdd6..97770bbd21 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/ethernet_api.c @@ -697,7 +697,7 @@ int ethernet_receive() { if(receive_idx == -1) { receive_idx = LPC_EMAC->RxConsumeIndex; } else { - while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && (receive_idx != LPC_EMAC->RxProduceIndex)) { + while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) { receive_idx = rinc(receive_idx, NUM_RX_FRAG); } unsigned int info = rxstat[receive_idx].Info; @@ -713,7 +713,7 @@ int ethernet_receive() { LPC_EMAC->RxConsumeIndex = receive_idx; } - if(receive_idx == LPC_EMAC->RxProduceIndex) { + if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) { receive_idx = -1; return 0; } @@ -762,7 +762,7 @@ int ethernet_read(char *data, int dlen) { void *pdst, *psrc; int doff = 0; - if(receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) { + if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) { return 0; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c index 64d01d3e1e..be017ce181 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pinmap.c @@ -17,7 +17,7 @@ #include "error.h" void pin_function(PinName pin, int function) { - if (pin == (uint32_t)NC) return; + if (pin == (PinName)NC) return; uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0; int index = pin_number >> 4; @@ -28,7 +28,7 @@ void pin_function(PinName pin, int function) { } void pin_mode(PinName pin, PinMode mode) { - if (pin == (uint32_t)NC) { return; } + if (pin == (PinName)NC) { return; } uint32_t pin_number = (uint32_t)pin - (uint32_t)P0_0; int index = pin_number >> 5; diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c index 93cf235201..b4e8bc6acf 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/pwmout_api.c @@ -57,7 +57,7 @@ static unsigned int pwm_clock_mhz; void pwmout_init(pwmout_t* obj, PinName pin) { // determine the channel PWMName pwm = (PWMName)pinmap_peripheral(pin, PinMap_PWM); - if (pwm == (uint32_t)NC) + if (pwm == (PWMName)NC) error("PwmOut pin mapping failed"); obj->pwm = pwm;