diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogin_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogin_api.c index 33fb22d746..49e5fc6c11 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogin_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/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_KL05Z/analogout_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogout_api.c index d6b713d999..a0ec3735c6 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/analogout_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/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_KL05Z/gpio_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_api.c index 566fff8ecf..395dd7fba7 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_api.c @@ -22,7 +22,7 @@ uint32_t gpio_set(PinName pin) { } void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) { - if (pin == (uint32_t)NC) { + if (pin == (PinName)NC) { return; } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c index 7b54b932a3..e48d925f4b 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/i2c_api.c @@ -197,7 +197,9 @@ 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]); - error = (ref > hz) ? ref - hz : hz - ref; + if (ref > (uint32_t)hz) + continue; + error = hz - ref; if (error < p_error) { icr = j; mult = i/2; @@ -371,7 +373,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; + int32_t i, count = 0; // set tx mode obj->i2c->C1 |= I2C_C1_TX_MASK; diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c index b029879f05..c515c8d9b4 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pinmap.c @@ -17,7 +17,7 @@ #include "error.h" void pin_function(PinName pin, int function) { - if (pin == (uint32_t)NC) { + if (pin == (PinName)NC) { return; } @@ -32,7 +32,7 @@ void pin_function(PinName pin, int function) { } void pin_mode(PinName pin, PinMode mode) { - if (pin == (uint32_t)NC) { + if (pin == (PinName)NC) { return; } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c index cee212056a..1c717d829a 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/pwmout_api.c @@ -42,7 +42,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"); } diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c index 183bc5bf97..f3e583bd8a 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/spi_api.c @@ -123,7 +123,9 @@ void spi_frequency(spi_t *obj, int hz) { divisor = 2; for (spr = 0; spr <= 8; spr++) { ref = PCLK / (prescaler*divisor); - error = (ref > hz) ? ref - hz : hz - ref; + if (ref > (uint32_t)hz) + continue; + error = hz - ref; if (error < p_error) { ref_spr = spr; ref_prescaler = prescaler - 1; diff --git a/workspace_tools/export/coide.py b/workspace_tools/export/coide.py index 35be0ecf70..b78d046991 100644 --- a/workspace_tools/export/coide.py +++ b/workspace_tools/export/coide.py @@ -26,7 +26,7 @@ class CoIDE(Exporter): 'cpp_sources':'1', 's_sources':'1' } - TARGETS = ['KL25Z'] + TARGETS = ['KL25Z','KL05Z'] TOOLCHAIN = 'GCC_ARM' def generate(self): diff --git a/workspace_tools/export/coide_kl05z.coproj.tmpl b/workspace_tools/export/coide_kl05z.coproj.tmpl new file mode 100644 index 0000000000..99bac91547 --- /dev/null +++ b/workspace_tools/export/coide_kl05z.coproj.tmpl @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + {% for file in source_files %} + + {% endfor %} + + diff --git a/workspace_tools/export/coide_lpc1768.coproj.tmpl b/workspace_tools/export/coide_lpc1768.coproj.tmpl new file mode 100644 index 0000000000..3ecc471330 --- /dev/null +++ b/workspace_tools/export/coide_lpc1768.coproj.tmpl @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + {% for file in source_files %} + + {% endfor %} + +