diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-05-06 11:07:53 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-05-06 11:07:53 -0600 |
commit | b6d1d101fc17a7627ca5cc88366fd7a1904bf74e (patch) | |
tree | bfaa13406f44c39949b0b0c4e2a46b00f2ebb2fb /nuttx/arch/arm/src | |
parent | e21898b25ae82d55bd2e80b86e3ad61c1ed56643 (diff) | |
download | px4-nuttx-b6d1d101fc17a7627ca5cc88366fd7a1904bf74e.tar.gz px4-nuttx-b6d1d101fc17a7627ca5cc88366fd7a1904bf74e.tar.bz2 px4-nuttx-b6d1d101fc17a7627ca5cc88366fd7a1904bf74e.zip |
Fixes LEDs on the Freedom KL25Z board
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r-- | nuttx/arch/arm/src/kl/kl_gpio.c | 7 | ||||
-rw-r--r-- | nuttx/arch/arm/src/kl/kl_gpio.h | 18 |
2 files changed, 17 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/kl/kl_gpio.c b/nuttx/arch/arm/src/kl/kl_gpio.c index 78d49e0c9..58de0eea1 100644 --- a/nuttx/arch/arm/src/kl/kl_gpio.c +++ b/nuttx/arch/arm/src/kl/kl_gpio.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/kl/kl_pin.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -103,7 +103,7 @@ int kl_configgpio(uint32_t cfgset) * options are applicable. */ - if (mode == _PIN_MODE_ANALOG) + if (mode == PIN_MODE_ANALOG) { /* Set the analog mode with all digital options zeroed */ @@ -184,7 +184,7 @@ int kl_configgpio(uint32_t cfgset) /* Additional configuration for the case of Alternative 1 (GPIO) modes */ - if (mode == _PIN_MODE_GPIO) + if (mode == PIN_MODE_GPIO) { /* Set the GPIO port direction */ @@ -213,6 +213,7 @@ int kl_configgpio(uint32_t cfgset) return OK; } + return -EINVAL; } diff --git a/nuttx/arch/arm/src/kl/kl_gpio.h b/nuttx/arch/arm/src/kl/kl_gpio.h index 17f947a4f..647fbe45d 100644 --- a/nuttx/arch/arm/src/kl/kl_gpio.h +++ b/nuttx/arch/arm/src/kl/kl_gpio.h @@ -62,18 +62,26 @@ /* Bits 25-31: 7 bits are used to encode the basic pin configuration: * * oooo mmm- ---- ---- ---- ---- ---- ---- - * oooommm: - * | `--- mmm: mode + * | `--- mmm: mode * `------- oooo: options (may be combined) */ -#define _PIN_MODE_SHIFT (25) /* Bits 25-27: Pin mode */ +#define _PIN_MODE_SHIFT (25) /* Bits 25-27: Pin mode */ #define _PIN_MODE_MASK (7 << _PIN_MODE_SHIFT) -#define _PIN_OPTIONS_SHIFT (28) /* Bits 28-31: Pin mode options */ +#define _PIN_OPTIONS_SHIFT (28) /* Bits 28-31: Pin mode options */ #define _PIN_OPTIONS_MASK (15 << _PIN_OPTIONS_SHIFT) /* Port Modes */ +#define PIN_MODE_ANALOG (0) /* 000 Pin Disabled (Analog) */ +#define PIN_MODE_GPIO (1) /* 001 Alternative 1 (GPIO) */ +#define PIN_MODE_ALT2 (2) /* 010 Alternative 2 */ +#define PIN_MODE_ALT3 (3) /* 011 Alternative 3 */ +#define PIN_MODE_ALT4 (4) /* 100 Alternative 4 */ +#define PIN_MODE_ALT5 (5) /* 101 Alternative 5 */ +#define PIN_MODE_ALT6 (6) /* 110 Alternative 6 */ +#define PIN_MODE_ALT7 (7) /* 111 Alternative 7 */ + #define _PIN_MODE_ANALOG (0 << _PIN_MODE_SHIFT) /* 000 Pin Disabled (Analog) */ #define _PIN_MODE_GPIO (1 << _PIN_MODE_SHIFT) /* 001 Alternative 1 (GPIO) */ #define _PIN_MODE_ALT2 (2 << _PIN_MODE_SHIFT) /* 010 Alternative 2 */ @@ -294,7 +302,7 @@ * Public Types ****************************************************************************/ -typedef uint16_t gpio_cfgset_t; +typedef uint32_t gpio_cfgset_t; /**************************************************************************** * Public Data |