1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

kinetis: fix warnings

- find_closest_x: sign-compare
 - hwtimer_arch: unused-parameter
 - i2c_init_slave: unused-parameter
 - rnga: sign-compare
 - rngb: sign-compare
 - spi_transfer_bytes: sign-compare
 - spi_transfer_regs: sign-compare
 - timer: unused-parameter
This commit is contained in:
Joakim Gebart 2015-05-27 17:10:51 +02:00
parent 8a34b15964
commit d4c1436de9
6 changed files with 22 additions and 16 deletions

View File

@ -87,6 +87,7 @@ inline static void hwtimer_stop(void)
void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
{
(void) fcpu; /* fcpu does not affect the Low power timer module frequency */
timeout_handler = handler;
/* unlock LPTIMER_DEV */
@ -146,7 +147,7 @@ void hwtimer_arch_disable_interrupt(void)
void hwtimer_arch_set(unsigned long offset, short timer)
{
(void)timer;
(void)timer; /* we only support one timer */
stimer.counter32b += lptmr_get_cnr();
hwtimer_stop();
@ -165,7 +166,7 @@ void hwtimer_arch_set(unsigned long offset, short timer)
void hwtimer_arch_set_absolute(unsigned long value, short timer)
{
(void)timer;
(void)timer; /* we only support one timer */
stimer.counter32b += lptmr_get_cnr();
hwtimer_stop();
@ -184,6 +185,7 @@ void hwtimer_arch_set_absolute(unsigned long value, short timer)
void hwtimer_arch_unset(short timer)
{
(void)timer; /* we only support one timer */
stimer.counter32b += lptmr_get_cnr();
hwtimer_stop();
stimer.diff = 0;

View File

@ -155,6 +155,8 @@ int i2c_init_master(i2c_t dev, i2c_speed_t speed)
int i2c_init_slave(i2c_t dev, uint8_t address)
{
/* TODO: implement slave mode */
(void) dev;
(void) address;
return -1;
}

View File

@ -35,7 +35,7 @@ void random_init(void)
int random_read(char *buf, unsigned int num)
{
int count = 0;
unsigned int count = 0;
/* self-seeding */
while (!(KINETIS_RNGA->SR & RNG_SR_OREG_LVL_MASK));
@ -55,7 +55,7 @@ int random_read(char *buf, unsigned int num)
}
}
return count;
return (int)count;
}
void random_poweron(void)

View File

@ -37,7 +37,7 @@ void random_init(void)
int random_read(char *buf, unsigned int num)
{
int count = 0;
unsigned int count = 0;
while (count < num) {
uint32_t tmp;
@ -54,7 +54,7 @@ int random_read(char *buf, unsigned int num)
}
}
return count;
return (int)count;
}
void random_poweron(void)

View File

@ -464,12 +464,12 @@ static spi_state_t spi_config[SPI_NUMOF];
* @return The actual achieved frequency on success
* @return Less than 0 on error.
*/
static int find_closest_baudrate_scalers(const uint32_t module_clock, const uint32_t target_clock,
static long find_closest_baudrate_scalers(const uint32_t module_clock, const long target_clock,
uint8_t *closest_prescaler, uint8_t *closest_scaler)
{
uint8_t i;
uint8_t k;
int freq;
long freq;
static const uint8_t num_scalers = 16;
static const uint8_t num_prescalers = 4;
static const int br_scalers[16] = {
@ -478,7 +478,7 @@ static int find_closest_baudrate_scalers(const uint32_t module_clock, const uint
};
static const int br_prescalers[4] = {2, 3, 5, 7};
int closest_frequency = -1;
long closest_frequency = -1;
/* Test all combinations until we arrive close to the target clock */
for (i = 0; i < num_prescalers; ++i) {
@ -533,18 +533,18 @@ static int find_closest_baudrate_scalers(const uint32_t module_clock, const uint
* @return The actual achieved frequency on success
* @return Less than 0 on error.
*/
static int find_closest_delay_scalers(const uint32_t module_clock, const uint32_t target_freq,
static long find_closest_delay_scalers(const uint32_t module_clock, const long target_freq,
uint8_t *closest_prescaler, uint8_t *closest_scaler)
{
uint8_t i;
uint8_t k;
int freq;
long freq;
int prescaler;
int scaler;
static const uint8_t num_scalers = 16;
static const uint8_t num_prescalers = 4;
int closest_frequency = -1;
long closest_frequency = -1;
/* Test all combinations until we arrive close to the target clock */
for (i = 0; i < num_prescalers; ++i) {
@ -1041,13 +1041,13 @@ int spi_transfer_bytes(spi_t dev, char *out, char *in, unsigned int length)
/* Default: send idle data */
byte_out = (uint8_t)SPI_IDLE_DATA;
for (i = 0; i < length; i++) {
for (i = 0; i < (int)length; i++) {
if (out != NULL) {
/* Send given out data */
byte_out = (uint8_t)out[i];
}
if (i >= length - 1) {
if (i >= (int)length - 1) {
/* Last byte, set End-of-Queue flag, clear Continue flag. */
flags &= ~(SPI_PUSHR_CONT_MASK);
flags |= SPI_PUSHR_EOQ_MASK;
@ -1248,13 +1248,13 @@ int spi_transfer_regs(spi_t dev, uint8_t reg, char *out, char *in, unsigned int
/* Default: send idle data */
byte_out = (uint8_t)SPI_IDLE_DATA;
for (i = 0; i < length; i++) {
for (i = 0; i < (int)length; i++) {
if (out != NULL) {
/* Send given out data */
byte_out = (uint8_t)out[i];
}
if (i >= length - 1) {
if (i >= (int)length - 1) {
/* Last byte, set End-of-Queue flag, clear Continue flag. */
flags &= ~(SPI_PUSHR_CONT_MASK);
flags |= SPI_PUSHR_EOQ_MASK;

View File

@ -144,6 +144,7 @@ int timer_set(tim_t dev, int channel, unsigned int timeout)
int timer_set_absolute(tim_t dev, int channel, unsigned int value)
{
(void) channel; /* we only support one channel */
switch (dev) {
#if TIMER_0_EN
@ -179,6 +180,7 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
int timer_clear(tim_t dev, int channel)
{
(void) channel; /* we only support one channel */
switch (dev) {
#if TIMER_0_EN