diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-04-24 18:00:55 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-04-24 18:00:55 +0000 |
commit | eb1792e5e7111aa922fcf38fbf5d0eb37ffb8083 (patch) | |
tree | f4b0ee0cf59073a88327dabc24077d89d19c08c4 /nuttx/configs | |
parent | aee2480fc6f591ac4b0d62cbba3770a033331819 (diff) | |
download | px4-nuttx-eb1792e5e7111aa922fcf38fbf5d0eb37ffb8083.tar.gz px4-nuttx-eb1792e5e7111aa922fcf38fbf5d0eb37ffb8083.tar.bz2 px4-nuttx-eb1792e5e7111aa922fcf38fbf5d0eb37ffb8083.zip |
Minor fixes to PIC32MX7MMB led controls
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4651 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/configs')
-rw-r--r-- | nuttx/configs/pic32mx7mmb/include/board.h | 5 | ||||
-rw-r--r-- | nuttx/configs/pic32mx7mmb/ostest/defconfig | 4 | ||||
-rw-r--r-- | nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h | 8 | ||||
-rw-r--r-- | nuttx/configs/pic32mx7mmb/src/up_leds.c | 25 |
4 files changed, 28 insertions, 14 deletions
diff --git a/nuttx/configs/pic32mx7mmb/include/board.h b/nuttx/configs/pic32mx7mmb/include/board.h index 91c767e5b..126b4170f 100644 --- a/nuttx/configs/pic32mx7mmb/include/board.h +++ b/nuttx/configs/pic32mx7mmb/include/board.h @@ -102,11 +102,14 @@ /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the * schematics: * + * --- ----- -------------------------------------------------------------- * PIN Board Notes - * --- ----- -------------------------------- + * --- ----- -------------------------------------------------------------- * RA0 LED0 Pulled-up, low value illuminates * RA1 LED1 Pulled-up, low value illuminates * RD9 LED2 Pulled-up, low value illuminates + * --- LED4 Not controllable by software, indicates MMC/SD activity + * --- LED5 Not controllable by software, indicates power-on */ /* LED index values for use with pic32mx_setled() */ diff --git a/nuttx/configs/pic32mx7mmb/ostest/defconfig b/nuttx/configs/pic32mx7mmb/ostest/defconfig index 85ce60627..efd547d14 100644 --- a/nuttx/configs/pic32mx7mmb/ostest/defconfig +++ b/nuttx/configs/pic32mx7mmb/ostest/defconfig @@ -300,8 +300,8 @@ CONFIG_UART6_2STOP=0 # enabled; 0=RMII enabled # CONFIG_PHY_KS8721=n -CONFIG_PHY_DP83848C=y -CONFIG_PHY_LAN8720=n +CONFIG_PHY_DP83848C=n +CONFIG_PHY_LAN8720=y CONFIG_PHY_AUTONEG=y CONFIG_PHY_SPEED100=n CONFIG_PHY_FDUPLEX=y diff --git a/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h index fceee92f7..dceb3c070 100644 --- a/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h +++ b/nuttx/configs/pic32mx7mmb/src/pic32mx7mmb_internal.h @@ -49,12 +49,14 @@ /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the * schematics: * - * --- ----- -------------------------------- - * PIN BOARD NOTES - * --- ----- -------------------------------- + * --- ----- -------------------------------------------------------------- + * PIN Board Notes + * --- ----- -------------------------------------------------------------- * RA0 LED0 Pulled-up, low value illuminates * RA1 LED1 Pulled-up, low value illuminates * RD9 LED2 Pulled-up, low value illuminates + * --- LED4 Not controllable by software, indicates MMC/SD activity + * --- LED5 Not controllable by software, indicates power-on */ /* The Mikroelektronika PIC32MX7 MMB has a joystick: diff --git a/nuttx/configs/pic32mx7mmb/src/up_leds.c b/nuttx/configs/pic32mx7mmb/src/up_leds.c index 6424994c1..56e00f2ae 100644 --- a/nuttx/configs/pic32mx7mmb/src/up_leds.c +++ b/nuttx/configs/pic32mx7mmb/src/up_leds.c @@ -61,11 +61,14 @@ /* The Mikroelektronika PIC32MX7 MMB has 3 user LEDs labeled LED0-2 in the * schematics: * + * --- ----- -------------------------------------------------------------- * PIN Board Notes - * --- ----- -------------------------------- + * --- ----- -------------------------------------------------------------- * RA0 LED0 Pulled-up, low value illuminates * RA1 LED1 Pulled-up, low value illuminates * RD9 LED2 Pulled-up, low value illuminates + * --- LED4 Not controllable by software, indicates MMC/SD activity + * --- LED5 Not controllable by software, indicates power-on * * If CONFIG_ARCH_LEDS is defined, then NuttX will control these LEDs as follows: * @@ -83,9 +86,9 @@ * LED_PANIC 5 ON N/C N/C OFF N/C N/C */ -#define GPIO_LED_0 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTA|GPIO_PIN0) -#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTA|GPIO_PIN1) -#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTD|GPIO_PIN9) +#define GPIO_LED_0 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN0) +#define GPIO_LED_1 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTA|GPIO_PIN1) +#define GPIO_LED_2 (GPIO_OUTPUT|GPIO_VALUE_ONE|GPIO_PORTD|GPIO_PIN9) /* LED Management Definitions ***********************************************/ @@ -176,19 +179,21 @@ static const uint16_t g_ledpincfg[PIC32MX_PIC32MX7MMB_NLEDS] = #ifdef CONFIG_ARCH_LEDS void up_setleds(FAR const struct led_setting_s *setting) { + /* LEDs are pulled up so writing a low value (false) illuminates them */ + if (setting->led0 != LED_NC) { - pic32mx_gpiowrite(GPIO_LED_0, setting->led0 == LED_ON); + pic32mx_gpiowrite(GPIO_LED_0, setting->led0 != LED_ON); } if (setting->led1 != LED_NC) { - pic32mx_gpiowrite(GPIO_LED_1, setting->led1 == LED_ON); + pic32mx_gpiowrite(GPIO_LED_1, setting->led1 != LED_ON); } if (setting->led2 != LED_NC) { - pic32mx_gpiowrite(GPIO_LED_2, setting->led2 == LED_ON); + pic32mx_gpiowrite(GPIO_LED_2, setting->led2 != LED_ON); } } #endif @@ -217,9 +222,11 @@ void pic32mx_ledinit(void) #ifndef CONFIG_ARCH_LEDS void pic32mx_setled(int led, bool ledon) { + /* LEDs are pulled up so writing a low value (false) illuminates them */ + if ((unsigned)led < PIC32MX_PIC32MX7MMB_NLEDS) { - pic32mx_gpiowrite(g_ledpincfg[led], ledon); + pic32mx_gpiowrite(g_ledpincfg[led], !ledon); } } #endif @@ -231,6 +238,8 @@ void pic32mx_setled(int led, bool ledon) #ifndef CONFIG_ARCH_LEDS void pic32mx_setleds(uint8_t ledset) { + /* Call pic32mx_setled() with ledon == true to illuminated the LED */ + pic32mx_setled(PIC32MX_PIC32MX7MMB_LED0, (ledset & PIC32MX_PIC32MX7MMB_LED0_BIT) != 0); pic32mx_setled(PIC32MX_PIC32MX7MMB_LED1, (ledset & PIC32MX_PIC32MX7MMB_LED1_BIT) != 0); pic32mx_setled(PIC32MX_PIC32MX7MMB_LED2, (ledset & PIC32MX_PIC32MX7MMB_LED2_BIT) != 0); |