mirror of
https://github.com/apache/nuttx.git
synced 2026-06-09 10:54:43 +08:00
Add LED support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2108 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -140,7 +140,7 @@ int stm32_configgpio(uint32 cfgset)
|
||||
|
||||
/* Input or output? */
|
||||
|
||||
output = ((cfgset & GPIO_OUTPUT_PIN) != 0);
|
||||
output = ((cfgset & GPIO_OUTPUT) != 0);
|
||||
|
||||
/* Decode the mode and configuration */
|
||||
|
||||
@@ -170,7 +170,7 @@ int stm32_configgpio(uint32 cfgset)
|
||||
* pin output value
|
||||
*/
|
||||
|
||||
if ((cfgset & GPIO_OUTPUT_VALUE) != 0)
|
||||
if ((cfgset & GPIO_OUTPUT_SET) != 0)
|
||||
{
|
||||
/* Use the BSRR register to set the output */
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@
|
||||
* .... .... .... .... O... .... VPPP BBBB
|
||||
*/
|
||||
|
||||
#define GPIO_OUTPUT_PIN (1 << 15) /* Bit 15: Output mode */
|
||||
#define GPIO_OUTPUT (1 << 15) /* Bit 15: Output mode */
|
||||
#define GPIO_INPUT (0)
|
||||
|
||||
/* These bits set the primary function of the pin:
|
||||
* .... .... .... .... FFF. .... .... ....
|
||||
@@ -101,7 +102,8 @@
|
||||
* .... .... .... .... .... .... V... ....
|
||||
*/
|
||||
|
||||
#define GPIO_OUTPUT_VALUE (1 << 7) /* Bit 7: If output, inital value of output */
|
||||
#define GPIO_OUTPUT_SET (1 << 7) /* Bit 7: If output, inital value of output */
|
||||
#define GPIO_OUTPUT_CLEAR (0)
|
||||
|
||||
/* This identifies the GPIO port:
|
||||
* .... .... .... .... .... .... .PPP ....
|
||||
@@ -123,6 +125,21 @@
|
||||
|
||||
#define GPIO_PIN_SHIFT 0 /* Bits 0-3: GPIO number: 0-15 */
|
||||
#define GPIO_PIN_MASK (15 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT)
|
||||
#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT)
|
||||
|
||||
/************************************************************************************
|
||||
* Public Types
|
||||
|
||||
Reference in New Issue
Block a user