mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
187:0387e8f68319
Parent:
186:707f6e361f3e
Child:
189:f392fc9709a3
--- a/drivers/InterruptIn.cpp	Fri Jun 22 16:45:37 2018 +0100
+++ b/drivers/InterruptIn.cpp	Thu Sep 06 13:40:20 2018 +0100
@@ -24,45 +24,52 @@
 //       If not for that, we could simplify by having only the 2-param
 //       constructor, with a default value for the PinMode.
 InterruptIn::InterruptIn(PinName pin) : gpio(),
-                                        gpio_irq(),
-                                        _rise(NULL),
-                                        _fall(NULL) {
+    gpio_irq(),
+    _rise(NULL),
+    _fall(NULL)
+{
     // No lock needed in the constructor
     irq_init(pin);
     gpio_init_in(&gpio, pin);
 }
 
 InterruptIn::InterruptIn(PinName pin, PinMode mode) :
-                                        gpio(),
-                                        gpio_irq(),
-                                        _rise(NULL),
-                                        _fall(NULL) {
+    gpio(),
+    gpio_irq(),
+    _rise(NULL),
+    _fall(NULL)
+{
     // No lock needed in the constructor
     irq_init(pin);
     gpio_init_in_ex(&gpio, pin, mode);
 }
 
-void InterruptIn::irq_init(PinName pin) {
-   gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
+void InterruptIn::irq_init(PinName pin)
+{
+    gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
 }
 
-InterruptIn::~InterruptIn() {
+InterruptIn::~InterruptIn()
+{
     // No lock needed in the destructor
     gpio_irq_free(&gpio_irq);
 }
 
-int InterruptIn::read() {
+int InterruptIn::read()
+{
     // Read only
     return gpio_read(&gpio);
 }
 
-void InterruptIn::mode(PinMode pull) {
+void InterruptIn::mode(PinMode pull)
+{
     core_util_critical_section_enter();
     gpio_mode(&gpio, pull);
     core_util_critical_section_exit();
 }
 
-void InterruptIn::rise(Callback<void()> func) {
+void InterruptIn::rise(Callback<void()> func)
+{
     core_util_critical_section_enter();
     if (func) {
         _rise = func;
@@ -74,7 +81,8 @@
     core_util_critical_section_exit();
 }
 
-void InterruptIn::fall(Callback<void()> func) {
+void InterruptIn::fall(Callback<void()> func)
+{
     core_util_critical_section_enter();
     if (func) {
         _fall = func;
@@ -86,36 +94,41 @@
     core_util_critical_section_exit();
 }
 
-void InterruptIn::_irq_handler(uint32_t id, gpio_irq_event event) {
-    InterruptIn *handler = (InterruptIn*)id;
+void InterruptIn::_irq_handler(uint32_t id, gpio_irq_event event)
+{
+    InterruptIn *handler = (InterruptIn *)id;
     switch (event) {
-        case IRQ_RISE: 
+        case IRQ_RISE:
             if (handler->_rise) {
                 handler->_rise();
             }
             break;
-        case IRQ_FALL: 
+        case IRQ_FALL:
             if (handler->_fall) {
-                handler->_fall(); 
+                handler->_fall();
             }
             break;
-        case IRQ_NONE: break;
+        case IRQ_NONE:
+            break;
     }
 }
 
-void InterruptIn::enable_irq() {
+void InterruptIn::enable_irq()
+{
     core_util_critical_section_enter();
     gpio_irq_enable(&gpio_irq);
     core_util_critical_section_exit();
 }
 
-void InterruptIn::disable_irq() {
+void InterruptIn::disable_irq()
+{
     core_util_critical_section_enter();
     gpio_irq_disable(&gpio_irq);
     core_util_critical_section_exit();
 }
 
-InterruptIn::operator int() {
+InterruptIn::operator int()
+{
     // Underlying call is atomic
     return read();
 }