]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/include/rpp/lout.h
Make the RPP layer thread safe
[pes-rpp/rpp-lib.git] / rpp / include / rpp / lout.h
index 03fb4b78f12137122221b492b651a9d202aaaf8b..4873a73e6f7bfaecac075348644edf7cebfbc3f4 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * Logic Output RPP API header file.
  *
- * @file rpp_lout.h
+ * @file lout.h
  *
  * @copyright Copyright (C) 2013 Czech Technical University in Prague
  *
 
 /**
  * LOUT module initialization.
+ *
  * Call this method before using this module.
  *
- * @return SUCCESS if initialization successful.
- *         FAIL is module already initialized.
+ * This function is not thread safe. Do not call it from multiple threads.
+ *
+ * @return SUCCESS if initialization successful.\n
+ *         FAILURE if module already initialized.
  */
 int8_t rpp_lout_init();
 
 
 /**
  * Set the output cache of given pin to given value.
+ *
+ * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
+ *
  * Call rpp_lout_update() to flush cached values to real hardware.
  *
  * @param[in] pin       The pin number to set [1-8].
  * @param[in] val       The value to be set [HIGH|LOW].
  *
- * @return SUCCESS when success.
+ * @return SUCCESS when success.\n
  *         -1 if pin number is out of range.
  */
-int8_t rpp_lout_set(uint8_t pin, int8_t val);
+int8_t rpp_lout_set(uint8_t pin, uint8_t val);
 
 
 /**
  * Get the diagnostic cached value for given pin.
+ *
+ * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
+ *
  * Call rpp_lout_update() to update cached values.
  *
  * @param[in] pin       The pin number to read [1-8].
  *
- * @return HIGH or LOW if successful.
+ * @return HIGH or LOW if successful.\n
  *         -1 if pin number is out of range.
  */
 int8_t rpp_lout_diag(uint8_t pin);
@@ -50,8 +59,10 @@ int8_t rpp_lout_diag(uint8_t pin);
 /**
  * Flush cached output values and read back diagnostic values of all pins.
  *
- * @return SUCCESS when transaction was successful.
- *          FAIL if outputs could not be confirmed.
+ * The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
+ *
+ * @return SUCCESS when transaction was successful.\n
+ *         FAILURE if transaction could not be confirmed.
  */
 int8_t rpp_lout_update();