api/spi: Add Spi_Modes to CPP headers.
authorThomas Ingleby <thomas.c.ingleby@intel.com>
Fri, 9 Jan 2015 17:00:17 +0000 (17:00 +0000)
committerThomas Ingleby <thomas.c.ingleby@intel.com>
Fri, 9 Jan 2015 17:14:50 +0000 (17:14 +0000)
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
api/mraa/spi.h
api/mraa/spi.hpp

index 331194d..4a69371 100644 (file)
@@ -48,7 +48,7 @@ extern "C" {
 #include "common.h"
 
 /**
- * MRAA supported platform types
+ * MRAA SPI Modes
  */
 typedef enum {
     MRAA_SPI_MODE0 = 0, /**< CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge, output data (change) on falling edge */
index 10c4b55..f77480c 100644 (file)
 namespace mraa {
 
 /**
+ * MRAA SPI Modes
+ */
+typedef enum {
+    SPI_MODE0 = 0, /**< CPOL = 0, CPHA = 0, Clock idle low, data is clocked in on rising edge, output data (change) on falling edge */
+    SPI_MODE1 = 1, /**< CPOL = 0, CPHA = 1, Clock idle low, data is clocked in on falling edge, output data (change) on rising edge */
+    SPI_MODE2 = 2, /**< CPOL = 1, CPHA = 0, Clock idle low, data is clocked in on falling edge, output data (change) on rising edge */
+    SPI_MODE3 = 3, /**< CPOL = 1, CPHA = 1, Clock idle low, data is clocked in on rising, edge output data (change) on falling edge */
+} Spi_Mode;
+
+
+  /**
  * @brief API to Serial Peripheral Interface
  *
  * This file defines the SPI interface for libmraa
@@ -62,8 +73,8 @@ class Spi {
          * @param mode the mode. See Linux spidev doc
          * @return Result of operation
          */
-        mraa_result_t mode(mraa_spi_mode_t mode) {
-            return mraa_spi_mode(m_spi, mode);
+        mraa_result_t mode(Spi_Mode mode) {
+            return mraa_spi_mode(m_spi, (mraa_spi_mode_t) mode);
         }
         /**
          * Set the SPI device operating clock frequency