]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/commitdiff
Added rpp_din_ref() to DIN API to configure voltage reference. Unimplemented and...
authorCarlos Jenkins <carlos@jenkins.co.cr>
Fri, 14 Jun 2013 01:15:44 +0000 (03:15 +0200)
committerCarlos Jenkins <carlos@jenkins.co.cr>
Fri, 14 Jun 2013 01:15:44 +0000 (03:15 +0200)
rpp/lib/rpp/include/rpp/din.h
rpp/lib/rpp/src/rpp/din.c

index 5237a67df45000bb330f39e0ff74f6bc8c0a7a0b..9c1d06febd94c6ccfb86fd38a22ab67596ee045c 100644 (file)
@@ -24,7 +24,25 @@ int8_t rpp_din_init();
 
 
 /**
- * Configure pull type for given pin.
+ * Configure voltage reference levels for digital inputs using variable
+ * reference threshold.
+ *
+ * @todo Implement.
+ *
+ * @param[in] refA      [0-12000] voltage (in millivolts) to set the reference
+ *                      voltage A (pins 13-16).
+ * @param[in] refB      [0-12000] voltage (in millivolts) to set the reference
+ *                      voltage B (pins 9-12).
+ *
+ *
+ * @return SUCCESS if successful.\n
+ *         -1 if pin millivolts is out of range.
+ */
+int8_t rpp_din_ref(uint16_t refA, uint16_t refB);
+
+
+/**
+ * Configure given pin.
  *
  * @param[in] pin       The pin number to setup [1-16].
  * @param[in] pull_type TRUE to setup pin as pull-up (a switch-to-ground device
@@ -55,7 +73,7 @@ int8_t rpp_din_setup(uint8_t pin, boolean_t pull_type,
  *                      option. Inputs [9-12] use variable threshold B and
  *                      [13-16] use variable threshold B.
  *                      FALSE to read from SPI cached value. All pins can use
- *                      this option.
+ *                      this option. See rpp_din_ref().
  *
  * @return HIGH or LOW if successful.\n
  *         -1 if pin number is out of range.\n
index cd8d48c89c8420a984d986adacf8b1891a74f764..36279bd44e3315239b146fad9445ef811f8cfa16 100644 (file)
@@ -47,6 +47,17 @@ int8_t rpp_din_init()
 }
 
 
+int8_t rpp_din_ref(uint16_t ref_a, uint16_t ref_b)
+{
+    if((ref_a > 12000) || (ref_b > 12000)) {
+        return -1;
+    }
+
+    // FIXME Implement.
+    return SUCCESS;
+}
+
+
 // Check for configuration changes to avoid SPI overhead
 static boolean_t config_changed = FALSE;