mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
548:1abac31e188e
Parent:
526:7c4bdfe6a168
Child:
593:78ee8643776a
--- a/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/gpio_irq_api.c	Fri May 22 09:45:08 2015 +0100
+++ b/targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/gpio_irq_api.c	Fri May 22 10:45:46 2015 +0100
@@ -37,9 +37,9 @@
 #define GPIOINT_MASK2IDX(mask) (countTrailingZeros(mask))
 __STATIC_INLINE uint32_t countTrailingZeros(uint32_t mask)
 {
-  uint32_t zeros;
-  for(zeros=0; (zeros<32) && (0 == (mask&0x1)); zeros++, mask>>=1);
-  return zeros;
+    uint32_t zeros;
+    for(zeros=0; (zeros<32) && (0 == (mask&0x1)); zeros++, mask>>=1);
+    return zeros;
 }
 #else
 #error Unsupported architecture.
@@ -85,8 +85,8 @@
 
 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id)
 {
-	/* Init pins */
-	gpio_irq_preinit(obj, pin);
+    /* Init pins */
+    gpio_irq_preinit(obj, pin);
     /* Initialize GPIO interrupt dispatcher */
     NVIC_ClearPendingIRQ(GPIO_ODD_IRQn);
     NVIC_EnableIRQ(GPIO_ODD_IRQn);
@@ -128,19 +128,19 @@
 
     /* Disable, set config and enable */
     gpio_irq_disable(obj);
-    
+
     bool was_disabled = false;
     if(GPIO->IEN == 0) was_disabled = true;
-    
+
     GPIO_IntConfig(obj->port, obj->pin, obj->risingEdge, obj->fallingEdge, obj->risingEdge || obj->fallingEdge);
     if ((GPIO->IEN != 0) && (obj->risingEdge || obj->fallingEdge) && was_disabled) {
-    	blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
+        blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
     }
 }
 
 inline void gpio_irq_enable(gpio_irq_t *obj)
 {
-	if(GPIO->IEN == 0) blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
+    if(GPIO->IEN == 0) blockSleepMode(GPIO_LEAST_ACTIVE_SLEEPMODE);
     GPIO_IntEnable(1 << obj->pin); // pin mask for pins to enable
 }
 
@@ -165,19 +165,18 @@
  ******************************************************************************/
 static void GPIOINT_IRQDispatcher(uint32_t iflags)
 {
-  uint32_t irqIdx;
+    uint32_t irqIdx;
 
-  /* check for all flags set in IF register */
-  while(iflags)
-  {
-    irqIdx = GPIOINT_MASK2IDX(iflags);
+    /* check for all flags set in IF register */
+    while(iflags) {
+        irqIdx = GPIOINT_MASK2IDX(iflags);
 
-    /* clear flag*/
-    iflags &= ~(1 << irqIdx);
+        /* clear flag*/
+        iflags &= ~(1 << irqIdx);
 
-    /* call user callback */
-    handle_interrupt_in(irqIdx);
-  }
+        /* call user callback */
+        handle_interrupt_in(irqIdx);
+    }
 }
 
 /***************************************************************************//**
@@ -188,15 +187,15 @@
  ******************************************************************************/
 void GPIO_EVEN_IRQHandler(void)
 {
-  uint32_t iflags;
+    uint32_t iflags;
 
-  /* Get all even interrupts. */
-  iflags = GPIO_IntGetEnabled() & 0x00005555;
+    /* Get all even interrupts. */
+    iflags = GPIO_IntGetEnabled() & 0x00005555;
 
-  /* Clean only even interrupts. */
-  GPIO_IntClear(iflags);
+    /* Clean only even interrupts. */
+    GPIO_IntClear(iflags);
 
-  GPIOINT_IRQDispatcher(iflags);
+    GPIOINT_IRQDispatcher(iflags);
 }
 
 
@@ -208,15 +207,15 @@
  ******************************************************************************/
 void GPIO_ODD_IRQHandler(void)
 {
-  uint32_t iflags;
+    uint32_t iflags;
 
-  /* Get all odd interrupts. */
-  iflags = GPIO_IntGetEnabled() & 0x0000AAAA;
+    /* Get all odd interrupts. */
+    iflags = GPIO_IntGetEnabled() & 0x0000AAAA;
 
-  /* Clean only even interrupts. */
-  GPIO_IntClear(iflags);
+    /* Clean only even interrupts. */
+    GPIO_IntClear(iflags);
 
-  GPIOINT_IRQDispatcher(iflags);
+    GPIOINT_IRQDispatcher(iflags);
 }
 
 #endif