ads1115 only

Fork of mbed by mbed official

Revision:
122:f9eeca106725
Parent:
65:5798e58a58b1
--- a/PortIn.h	Wed May 25 16:44:06 2016 +0100
+++ b/PortIn.h	Thu Jul 07 14:34:11 2016 +0100
@@ -21,11 +21,14 @@
 #if DEVICE_PORTIN
 
 #include "port_api.h"
+#include "critical.h"
 
 namespace mbed {
 
 /** A multiple pin digital input
  *
+ * @Note Synchronization level: Interrupt safe
+ *
  *  Example:
  * @code
  * // Switch on an LED if any of mbed pins 21-26 is high
@@ -56,7 +59,9 @@
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
         */
     PortIn(PortName port, int mask = 0xFFFFFFFF) {
+        core_util_critical_section_enter();
         port_init(&_port, port, mask, PIN_INPUT);
+        core_util_critical_section_exit();
     }
 
     /** Read the value currently output on the port
@@ -73,7 +78,9 @@
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
      */
     void mode(PinMode mode) {
+        core_util_critical_section_enter();
         port_mode(&_port, mode);
+        core_util_critical_section_exit();
     }
 
     /** A shorthand for read()