summaryrefslogtreecommitdiff
path: root/bsp/efm32/dev_led.c
diff options
context:
space:
mode:
authoronelife.real <[email protected]>2011-12-16 01:05:50 +0000
committeronelife.real <[email protected]>2011-12-16 01:05:50 +0000
commit3c3b3697ad4d3e08cfd2c98e03e8f877e0211337 (patch)
treee28dfb9eee52c31c8f3d23bd57484596c11b185c /bsp/efm32/dev_led.c
parent44b3b3ad87733ec82c0e2af64faa3882c6fe6f9a (diff)
*** EFM32 branch ***
1. Upgrade EFM32 driver libraries (CMSIS and efm32lib) to version 2.3.0 (from version 2.2.2) 2. Add EFM32GG-DK3750 development kit support (driver version 1.2.1) 3. Add giant gecko (EFM32GG) support 4. Add LEUART module driver (max 9600bsp) git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1839 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'bsp/efm32/dev_led.c')
-rw-r--r--bsp/efm32/dev_led.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/bsp/efm32/dev_led.c b/bsp/efm32/dev_led.c
index c1cceb92e8..bf357a023d 100644
--- a/bsp/efm32/dev_led.c
+++ b/bsp/efm32/dev_led.c
@@ -6,7 +6,7 @@
* @version 0.4 beta
**********************************************************************
* @section License
- * The license and distribution terms for this file may be found in the file LICENSE in this
+ * The license and distribution terms for this file may be found in the file LICENSE in this
* distribution or at http://www.rt-thread.org/license/LICENSE
**********************************************************************
* @section Change Logs
@@ -14,6 +14,7 @@
* 2009-01-05 Bernard the first version
* 2010-12-27 onelife Modify for EFM32
* 2011-05-06 onelife Add EFM32 development kit support
+ * 2011-12-08 onelife Add giant gecko development kit support
*********************************************************************/
/******************************************************************//**
@@ -29,7 +30,7 @@
/* Private define --------------------------------------------------------------*/
/* Private macro --------------------------------------------------------------*/
/* Private constants -----------------------------------------------------------*/
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
static const rt_uint8_t leds_list[LEDS_MAX_NUMBER][2] = \
{
{LEDS_PIN_PORT_0, LEDS_PIN_NUMBER_0},
@@ -58,12 +59,12 @@ void rt_hw_led_on(rt_uint8_t num)
{
RT_ASSERT(num < LEDS_MAX_NUMBER);
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
GPIO_PinOutSet(leds_list[num][0], leds_list[num][1]);
-#elif defined(EFM32_G290_DK)
+#elif (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
{
rt_uint16_t leds;
-
+
leds = DVK_getLEDs() | (rt_uint16_t)(1 << num);
DVK_setLEDs(leds);
}
@@ -86,12 +87,12 @@ void rt_hw_led_off(rt_uint8_t num)
{
RT_ASSERT(num < LEDS_MAX_NUMBER);
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
GPIO_PinOutClear(leds_list[num][0], leds_list[num][1]);
-#elif defined(EFM32_G290_DK)
+#elif (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
{
rt_uint16_t leds;
-
+
leds = DVK_getLEDs() & ~(rt_uint16_t)(1 << num);
DVK_setLEDs(leds);
}
@@ -114,12 +115,12 @@ void rt_hw_led_toggle(rt_uint8_t num)
{
RT_ASSERT(num < LEDS_MAX_NUMBER);
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
GPIO_PinOutToggle(leds_list[num][0], leds_list[num][1]);
-#elif defined(EFM32_G290_DK)
+#elif (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
{
rt_uint16_t leds;
-
+
leds = DVK_getLEDs() ^ (rt_uint16_t)(1 << num);
DVK_setLEDs(leds);
}
@@ -130,9 +131,9 @@ rt_uint8_t rt_hw_led_state(rt_uint8_t num)
{
RT_ASSERT(num < LEDS_MAX_NUMBER);
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
return (rt_uint8_t)GPIO_PinInGet(leds_list[num][0], leds_list[num][1]);
-#elif defined(EFM32_G290_DK)
+#elif (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
return ((DVK_getLEDs() & (rt_uint16_t)(1 << num)) >> num);
#endif
@@ -151,9 +152,9 @@ rt_uint8_t rt_hw_led_state(rt_uint8_t num)
*********************************************************************/
rt_err_t rt_hw_led_init(void)
{
-#if defined(EFM32_G890_STK)
+#if defined(EFM32_G8XX_STK)
rt_uint8_t i;
-
+
/* Configure GPIO */
for (i = 0; i < LEDS_MAX_NUMBER; i++)
{
@@ -182,14 +183,14 @@ void list_leds(void)
for (i = 0; i < LEDS_MAX_NUMBER; i++)
{
-#if defined(EFM32_G890_STK)
- rt_kprintf(" %d \t %x \t %x \t %x \n",
+#if defined(EFM32_G8XX_STK)
+ rt_kprintf(" %d \t %x \t %x \t %x \n",
i, leds_list[i][0], leds_list[i][1], rt_hw_led_state(i));
-#elif defined(EFM32_G290_DK)
+#elif (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
rt_uint16_t leds;
-
+
leds = DVK_getLEDs();
- rt_kprintf(" %d \t FPGA \t FPGA \t %x \n",
+ rt_kprintf(" %d \t FPGA \t FPGA \t %x \n",
i, (leds & (1 << i))? 1 : 0);
#endif
}