Merge pull request #5224 from haukepetersen/fix_periph_undef
drivers/periph: fixed UNDEF values to UINT_MAX
This commit is contained in:
commit
e6d15f2d36
@ -43,6 +43,8 @@
|
|||||||
#ifndef PERIPH_ADC_H
|
#ifndef PERIPH_ADC_H
|
||||||
#define PERIPH_ADC_H
|
#define PERIPH_ADC_H
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
|
|
||||||
@ -73,7 +75,7 @@ typedef unsigned int adc_t;
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef ADC_UNDEF
|
#ifndef ADC_UNDEF
|
||||||
#define ADC_UNDEF (0xffff)
|
#define ADC_UNDEF (UINT_MAX)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
#define I2C_H
|
#define I2C_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
/**
|
/**
|
||||||
@ -91,7 +92,7 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef I2C_UNDEF
|
#ifndef I2C_UNDEF
|
||||||
#define I2C_UNDEF (-1)
|
#define I2C_UNDEF (UINT_MAX)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#define PERIPH_PWM_H
|
#define PERIPH_PWM_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
@ -53,7 +54,7 @@ extern "C" {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef PWM_UNDEF
|
#ifndef PWM_UNDEF
|
||||||
#define PWM_UNDEF (-1)
|
#define PWM_UNDEF (UINT_MAX)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@
|
|||||||
#ifndef PERIPH_TIMER_H
|
#ifndef PERIPH_TIMER_H
|
||||||
#define PERIPH_TIMER_H
|
#define PERIPH_TIMER_H
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
/** @todo remove dev_enums.h include once all platforms are ported to the updated periph interface */
|
/** @todo remove dev_enums.h include once all platforms are ported to the updated periph interface */
|
||||||
#include "periph/dev_enums.h"
|
#include "periph/dev_enums.h"
|
||||||
@ -42,7 +44,7 @@ extern "C" {
|
|||||||
* @brief Default value for timer not defined
|
* @brief Default value for timer not defined
|
||||||
*/
|
*/
|
||||||
#ifndef TIMER_UNDEF
|
#ifndef TIMER_UNDEF
|
||||||
#define TIMER_UNDEF (-1)
|
#define TIMER_UNDEF (UINT_MAX)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "periph_cpu.h"
|
#include "periph_cpu.h"
|
||||||
#include "periph_conf.h"
|
#include "periph_conf.h"
|
||||||
@ -79,7 +80,7 @@ typedef unsigned int uart_t;
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#ifndef UART_UNDEF
|
#ifndef UART_UNDEF
|
||||||
#define UART_UNDEF (-1)
|
#define UART_UNDEF (UINT_MAX)
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|||||||
@ -51,15 +51,15 @@ static char printer_stack[THREAD_STACKSIZE_MAIN];
|
|||||||
|
|
||||||
static int parse_dev(char *arg)
|
static int parse_dev(char *arg)
|
||||||
{
|
{
|
||||||
int dev = atoi(arg);
|
unsigned dev = (unsigned)atoi(arg);
|
||||||
if (dev == UART_STDIO_DEV) {
|
if (dev >= UART_NUMOF) {
|
||||||
printf("Error: The selected UART_DEV(%i) is used for the shell!\n", dev);
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (dev < 0 || (uart_t) dev >= UART_NUMOF) {
|
|
||||||
printf("Error: Invalid UART_DEV device specified (%i).\n", dev);
|
printf("Error: Invalid UART_DEV device specified (%i).\n", dev);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
else if (UART_DEV(dev) == UART_STDIO_DEV) {
|
||||||
|
printf("Error: The selected UART_DEV(%i) is used for the shell!\n", dev);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ int main(void)
|
|||||||
printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", UART_STDIO_DEV);
|
printf("UART used for STDIO (the shell): UART_DEV(%i)\n\n", UART_STDIO_DEV);
|
||||||
|
|
||||||
/* initialize ringbuffers */
|
/* initialize ringbuffers */
|
||||||
for (uart_t i = 0; i < UART_NUMOF; i++) {
|
for (unsigned i = 0; i < UART_NUMOF; i++) {
|
||||||
ringbuffer_init(&(ctx[i].rx_buf), ctx[i].rx_mem, UART_BUFSIZE);
|
ringbuffer_init(&(ctx[i].rx_buf), ctx[i].rx_mem, UART_BUFSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user