Browse Source

mraa: change all existing code to use libmraa.

* Made CMake depend on 0.4 libmraa

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Thomas Ingleby 10 years ago
parent
commit
36be22cb90
53 changed files with 640 additions and 640 deletions
  1. 5
    5
      CMakeLists.txt
  2. 1
    1
      Doxyfile.in
  3. 3
    3
      README.md
  4. 1
    1
      docs/contributions.md
  5. 1
    1
      docs/max31855.md
  6. 5
    5
      docs/porting.md
  7. 4
    4
      src/CMakeLists.txt
  8. 7
    7
      src/buzzer/buzzer.cxx
  9. 2
    2
      src/buzzer/buzzer.h
  10. 19
    19
      src/grove/grove.cxx
  11. 8
    8
      src/grove/grove.h
  12. 16
    16
      src/gy65/gy65.cxx
  13. 3
    3
      src/gy65/gy65.h
  14. 16
    16
      src/hcsr04/hcsr04.cxx
  15. 5
    5
      src/hcsr04/hcsr04.h
  16. 10
    10
      src/hmc5883l/hmc5883l.cxx
  17. 2
    2
      src/hmc5883l/hmc5883l.h
  18. 21
    21
      src/lcd/i2clcd.cxx
  19. 11
    11
      src/lcd/i2clcd.h
  20. 10
    10
      src/lcd/jhd1313m1.cxx
  21. 5
    5
      src/lcd/jhd1313m1.h
  22. 15
    15
      src/lcd/lcm1602.cxx
  23. 9
    9
      src/lcd/lcm1602.h
  24. 14
    14
      src/lcd/ssd1308.cxx
  25. 9
    9
      src/lcd/ssd1308.h
  26. 17
    17
      src/lcd/ssd1327.cxx
  27. 11
    11
      src/lcd/ssd1327.h
  28. 15
    15
      src/max31855/max31855.cxx
  29. 4
    4
      src/max31855/max31855.h
  30. 16
    16
      src/max44000/max44000.cxx
  31. 3
    3
      src/max44000/max44000.h
  32. 6
    6
      src/mic/mic.cxx
  33. 3
    3
      src/mic/mic.h
  34. 26
    26
      src/mma7455/mma7455.cxx
  35. 5
    5
      src/mma7455/mma7455.h
  36. 21
    21
      src/mpu9150/mpu9150.cxx
  37. 8
    8
      src/mpu9150/mpu9150.h
  38. 29
    29
      src/my9221/my9221.cxx
  39. 7
    7
      src/my9221/my9221.h
  40. 39
    39
      src/nrf24l01/nrf24l01.cxx
  41. 10
    10
      src/nrf24l01/nrf24l01.h
  42. 3
    3
      src/pulsensor/pulsensor.cxx
  43. 4
    4
      src/pulsensor/pulsensor.h
  44. 10
    10
      src/servo/servo.cxx
  45. 3
    3
      src/servo/servo.h
  46. 3
    3
      src/st7735/gfx.cxx
  47. 2
    2
      src/st7735/gfx.h
  48. 83
    83
      src/st7735/st7735.cxx
  49. 14
    14
      src/st7735/st7735.h
  50. 30
    30
      src/stepmotor/stepmotor.cxx
  51. 10
    10
      src/stepmotor/stepmotor.h
  52. 45
    45
      src/tm1637/tm1637.cxx
  53. 11
    11
      src/tm1637/tm1637.h

+ 5
- 5
CMakeLists.txt View File

@@ -8,9 +8,9 @@ endif ()
8 8
 
9 9
 find_package (Threads REQUIRED)
10 10
 find_package (PkgConfig REQUIRED)
11
-# force the libmaa version to be the required version
12
-pkg_check_modules (MAA REQUIRED maa>=0.3.1)
13
-message (INFO " found libmaa version: ${MAA_VERSION}")
11
+# force the libmraa version to be the required version
12
+pkg_check_modules (MRAA REQUIRED mraa>=0.4.0)
13
+message (INFO " found libmraa version: ${MRAA_VERSION}")
14 14
 
15 15
 # Appends the cmake/modules path to MAKE_MODULE_PATH variable.
16 16
 set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
@@ -19,7 +19,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_
19 19
 include (GetGitRevisionDescription)
20 20
 git_describe (VERSION "--tags")
21 21
 if ("x_${VERSION}" STREQUAL "x_GIT-NOTFOUND")
22
-  message (WARNING " - Install git to compile a production libmaa!")
22
+  message (WARNING " - Install git to compile a production libmraa!")
23 23
   set (VERSION "v0.1.4-dirty")
24 24
 endif ()
25 25
 
@@ -81,7 +81,7 @@ if (IPK)
81 81
   set(CPACK_DEBIAN_PACKAGE_SECTION "libs")
82 82
   set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DETECTED_ARCH})
83 83
   set(CPACK_SYSTEM_NAME ${DETECTED_ARCH})
84
-  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmaa0 (>= ${MAA_VERSION})")
84
+  set(CPACK_DEBIAN_PACKAGE_DEPENDS "libmraa0 (>= ${MRAA_VERSION})")
85 85
   set(CPACK_DEBIAN_PACKAGE_PROVIDES "upm-dev, upm-dbg, upm-doc")
86 86
   set(CPACK_DEBIAN_PACKAGE_REPLACES ${CPACK_DEBIAN_PACKAGE_PROVIDES})
87 87
   set(CPACK_DEBIAN_PACKAGE_CONFLICTS ${CPACK_DEBIAN_PACKAGE_PROVIDES})

+ 1
- 1
Doxyfile.in View File

@@ -44,7 +44,7 @@ PROJECT_NUMBER         = @upm_VERSION_STRING@
44 44
 # for a project that appears at the top of each page and should give viewer a
45 45
 # quick idea about the purpose of the project. Keep the description short.
46 46
 
47
-PROJECT_BRIEF          = "Sensor/Actuator repository for libmaa (v@MAA_VERSION@)"
47
+PROJECT_BRIEF          = "Sensor/Actuator repository for libmraa (v@MRAA_VERSION@)"
48 48
 
49 49
 # With the PROJECT_LOGO tag one can specify an logo or icon that is included in
50 50
 # the documentation. The maximum height of the logo should not exceed 55 pixels

+ 3
- 3
README.md View File

@@ -1,8 +1,8 @@
1
-UPM - Sensor/Actuator repository for Maa
1
+UPM - Sensor/Actuator repository for Mraa
2 2
 ==============
3 3
 
4
-UPM is a high level repository for sensors that use maa. Each sensor links to
5
-libmaa and are not meant to be interlinked although some groups of sensors may
4
+UPM is a high level repository for sensors that use mraa. Each sensor links to
5
+libmraa and are not meant to be interlinked although some groups of sensors may
6 6
 be. Each sensor contains a header which allows to interface with it. Typically
7 7
 a sensor is represented as a class and instanciated.
8 8
 

+ 1
- 1
docs/contributions.md View File

@@ -11,6 +11,6 @@ Here are the rules of contribution:
11 11
   avoid GPL. (LGPL is fine). If your license is not MIT please include a
12 12
   LICENSE file in src/<mymodule>/
13 13
 - Please test your module builds before contributing and make sure it works on
14
-  the latest version of maa. If you tested on a specific board/platform please
14
+  the latest version of mraa. If you tested on a specific board/platform please
15 15
   tell us what this was in your PR.
16 16
 

+ 1
- 1
docs/max31855.md View File

@@ -9,7 +9,7 @@ people made arduino code already so we'll use that as a
9 9
 
10 10
 ### Basics
11 11
 
12
-This is a spi module so we will use the maa spi functions to build our module.
12
+This is a spi module so we will use the mraa spi functions to build our module.
13 13
 First thing to do is to create a tree structure like this in upm/src/max31855:
14 14
 
15 15
 * max31855.cxx

+ 5
- 5
docs/porting.md View File

@@ -1,7 +1,7 @@
1 1
 Porting a module from Arduino                         {#porting}
2 2
 =============================
3 3
 
4
-Porting arduino libraries to libmaa as UPM libraries is usually fairly easy.
4
+Porting arduino libraries to libmraa as UPM libraries is usually fairly easy.
5 5
 The issues typically come from misunderstanding of how a non real time OS deals
6 6
 with interupts and timers. It also highly depends on the sensor. A concrete
7 7
 example is explained in detail on @ref max31855
@@ -31,22 +31,22 @@ upm_module_init()
31 31
 
32 32
 The easiest way to do this is to have a look at a similar sensor to yours.
33 33
 Typically create a class for your sensor with a constructor that defines the
34
-pins it is on. This constructor will create the maa_*_context structs that are
34
+pins it is on. This constructor will create the mraa_*_context structs that are
35 35
 required to talk to the board's IO. An I2c sensor will create a
36
-maa_i2c_context, keep it as a private member and require a bus number and slave
36
+mraa_i2c_context, keep it as a private member and require a bus number and slave
37 37
 address in it's constructor.
38 38
 
39 39
 Typically in sensors a simple object->read() function is prefered, depending on
40 40
 your sensor/actuaotr this may or may not be easy or not even make sense. Most
41 41
 UPM apis have a simple set of functions.
42 42
 
43
-### Mapping arduino API to libmaa
43
+### Mapping arduino API to libmraa
44 44
 
45 45
 Your constructor is similar to the setup() function in arduino, you should
46 46
 initialise your IO the way you want it. This means initialising contexts
47 47
 (private members) and setting the correct modes for them.
48 48
 
49
-See the maa API documentation for exact API.
49
+See the mraa API documentation for exact API.
50 50
 
51 51
 ### Building
52 52
 

+ 4
- 4
src/CMakeLists.txt View File

@@ -20,7 +20,7 @@ macro(upm_SWIG_PYTHON)
20 20
     set (CMAKE_C_FLAGS -DSWIGPYTHON=${SWIG_FOUND})
21 21
     set_source_files_properties (pyupm_${libname}.i PROPERTIES CPLUSPLUS ON)
22 22
     swig_add_module (pyupm_${libname} python pyupm_${libname}.i ${module_src})
23
-    swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MAA_LIBRARIES})
23
+    swig_link_libraries (pyupm_${libname} ${PYTHON_LIBRARIES} ${MRAA_LIBRARIES})
24 24
     target_include_directories ( ${SWIG_MODULE_pyupm_${libname}_REAL_NAME}
25 25
       PUBLIC
26 26
       "${PYTHON_INCLUDE_PATH}"
@@ -39,7 +39,7 @@ macro(upm_SWIG_NODE)
39 39
     set_source_files_properties (jsupm_${libname}.i PROPERTIES CPLUSPLUS ON)
40 40
     set_source_files_properties (jsupm_${libname}.i PROPERTIES SWIG_FLAGS "-node")
41 41
     swig_add_module (jsupm_${libname} javascript jsupm_${libname}.i ${module_src})
42
-    swig_link_libraries (jsupm_${libname} ${MAA_LIBRARIES} ${NODE_LIBRARIES})
42
+    swig_link_libraries (jsupm_${libname} ${MRAA_LIBRARIES} ${NODE_LIBRARIES})
43 43
     target_include_directories ( ${SWIG_MODULE_jsupm_${libname}_REAL_NAME}
44 44
       PUBLIC
45 45
       "${NODE_INCLUDE_DIRS}"
@@ -95,8 +95,8 @@ endif()
95 95
 
96 96
 macro(upm_module_init)
97 97
   add_library (${libname} SHARED ${module_src})
98
-  include_directories (${MAA_INCLUDE_DIR} .)
99
-  target_link_libraries (${libname} ${MAA_LIBRARIES})
98
+  include_directories (${MRAA_INCLUDE_DIR} .)
99
+  target_link_libraries (${libname} ${MRAA_LIBRARIES})
100 100
   set_target_properties(
101 101
     ${libname}
102 102
     PROPERTIES PREFIX "libupm-"

+ 7
- 7
src/buzzer/buzzer.cxx View File

@@ -30,22 +30,22 @@
30 30
 using namespace upm;
31 31
 
32 32
 Buzzer::Buzzer (int pinNumber) {
33
-    m_pwm_context = maa_pwm_init (pinNumber);
33
+    m_pwm_context = mraa_pwm_init (pinNumber);
34 34
     m_name = "Buzzer";
35 35
 }
36 36
 
37 37
 int Buzzer::playSound (int note, int delay) {
38
-    maa_pwm_enable (m_pwm_context, 1);
39
-    maa_pwm_period_us (m_pwm_context, note);
40
-    maa_pwm_pulsewidth_us (m_pwm_context, note / 2);
38
+    mraa_pwm_enable (m_pwm_context, 1);
39
+    mraa_pwm_period_us (m_pwm_context, note);
40
+    mraa_pwm_pulsewidth_us (m_pwm_context, note / 2);
41 41
     usleep (delay);
42
-    maa_pwm_enable (m_pwm_context, 0);
42
+    mraa_pwm_enable (m_pwm_context, 0);
43 43
 
44 44
     return note;
45 45
 }
46 46
 
47 47
 Buzzer::~Buzzer() {
48
-    maa_pwm_close(m_pwm_context);
49
-    std::cout << "executed maa_pwm_close" << std::endl;
48
+    mraa_pwm_close(m_pwm_context);
49
+    std::cout << "executed mraa_pwm_close" << std::endl;
50 50
 }
51 51
 

+ 2
- 2
src/buzzer/buzzer.h View File

@@ -24,7 +24,7 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/pwm.h>
27
+#include <mraa/pwm.h>
28 28
 
29 29
 #define  DO     3300    // 261 Hz 3830
30 30
 #define  RE     2930    // 294 Hz
@@ -76,6 +76,6 @@ class Buzzer {
76 76
     protected:
77 77
         std::string m_name;
78 78
     private:
79
-        maa_pwm_context m_pwm_context;
79
+        mraa_pwm_context m_pwm_context;
80 80
 };
81 81
 }

+ 19
- 19
src/grove/grove.cxx View File

@@ -33,31 +33,31 @@ using namespace upm;
33 33
 
34 34
 GroveLed::GroveLed(int pin)
35 35
 {
36
-    maa_init();
37
-    m_gpio = maa_gpio_init(pin);
38
-    maa_gpio_dir(m_gpio, MAA_GPIO_OUT);
36
+    mraa_init();
37
+    m_gpio = mraa_gpio_init(pin);
38
+    mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
39 39
     m_name = "LED Socket";
40 40
 }
41 41
 
42 42
 GroveLed::~GroveLed()
43 43
 {
44
-    maa_gpio_close(m_gpio);
44
+    mraa_gpio_close(m_gpio);
45 45
 }
46 46
 
47
-maa_result_t GroveLed::write(int value)
47
+mraa_result_t GroveLed::write(int value)
48 48
 {
49 49
     if (value >= 1) {
50
-        return maa_gpio_write(m_gpio, 1);
50
+        return mraa_gpio_write(m_gpio, 1);
51 51
     }
52
-    return maa_gpio_write(m_gpio, 0);
52
+    return mraa_gpio_write(m_gpio, 0);
53 53
 }
54 54
 
55
-maa_result_t GroveLed::on()
55
+mraa_result_t GroveLed::on()
56 56
 {
57 57
     return write(1);
58 58
 }
59 59
 
60
-maa_result_t GroveLed::off()
60
+mraa_result_t GroveLed::off()
61 61
 {
62 62
     return write(0);
63 63
 }
@@ -66,19 +66,19 @@ maa_result_t GroveLed::off()
66 66
 
67 67
 GroveTemp::GroveTemp(unsigned int pin)
68 68
 {
69
-    maa_init();
70
-    m_aio = maa_aio_init(pin);
69
+    mraa_init();
70
+    m_aio = mraa_aio_init(pin);
71 71
     m_name = "Temperature Sensor";
72 72
 }
73 73
 
74 74
 GroveTemp::~GroveTemp()
75 75
 {
76
-    maa_aio_close(m_aio);
76
+    mraa_aio_close(m_aio);
77 77
 }
78 78
 
79 79
 int GroveTemp::value ()
80 80
 {
81
-    int a = maa_aio_read(m_aio);
81
+    int a = mraa_aio_read(m_aio);
82 82
     float r = (float)(1023-a)*10000/a;
83 83
     float t = 1/(logf(r/10000)/3975 + 1/298.15)-273.15;
84 84
     return (int) t;
@@ -86,32 +86,32 @@ int GroveTemp::value ()
86 86
 
87 87
 float GroveTemp::raw_value()
88 88
 {
89
-    return (float) maa_aio_read(m_aio);
89
+    return (float) mraa_aio_read(m_aio);
90 90
 }
91 91
 
92 92
 //// GroveLight ////
93 93
 
94 94
 GroveLight::GroveLight(unsigned int pin)
95 95
 {
96
-    maa_init();
97
-    m_aio = maa_aio_init(pin);
96
+    mraa_init();
97
+    m_aio = mraa_aio_init(pin);
98 98
     m_name = "Light Sensor";
99 99
 }
100 100
 
101 101
 GroveLight::~GroveLight()
102 102
 {
103
-    maa_aio_close(m_aio);
103
+    mraa_aio_close(m_aio);
104 104
 }
105 105
 
106 106
 int GroveLight::value ()
107 107
 {
108 108
     // rough conversion to Lux
109
-    int a = maa_aio_read(m_aio);
109
+    int a = mraa_aio_read(m_aio);
110 110
     a = 10000/(((1023-a)*10/a)*15)^(4/3);
111 111
     return a;
112 112
 }
113 113
 
114 114
 float GroveLight::raw_value()
115 115
 {
116
-    return (float) maa_aio_read(m_aio);
116
+    return (float) mraa_aio_read(m_aio);
117 117
 }

+ 8
- 8
src/grove/grove.h View File

@@ -24,8 +24,8 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/aio.h>
28
-#include <maa/gpio.h>
27
+#include <mraa/aio.h>
28
+#include <mraa/gpio.h>
29 29
 
30 30
 namespace upm {
31 31
 
@@ -44,11 +44,11 @@ class GroveLed: public Grove {
44 44
     public:
45 45
         GroveLed(int pin);
46 46
         ~GroveLed();
47
-        maa_result_t write(int value);
48
-        maa_result_t off();
49
-        maa_result_t on();
47
+        mraa_result_t write(int value);
48
+        mraa_result_t off();
49
+        mraa_result_t on();
50 50
     private:
51
-        maa_gpio_context m_gpio;
51
+        mraa_gpio_context m_gpio;
52 52
 };
53 53
 
54 54
 class GroveTemp: public Grove {
@@ -58,7 +58,7 @@ class GroveTemp: public Grove {
58 58
         float raw_value();
59 59
         int value();
60 60
     private:
61
-        maa_aio_context m_aio;
61
+        mraa_aio_context m_aio;
62 62
 };
63 63
 
64 64
 class GroveLight: public Grove {
@@ -68,7 +68,7 @@ class GroveLight: public Grove {
68 68
         float raw_value();
69 69
         int value();
70 70
     private:
71
-        maa_aio_context m_aio;
71
+        mraa_aio_context m_aio;
72 72
 };
73 73
 
74 74
 }

+ 16
- 16
src/gy65/gy65.cxx View File

@@ -36,10 +36,10 @@ GY65::GY65 (int bus, int devAddr, uint8_t mode) {
36 36
     m_controlAddr = devAddr;
37 37
     m_bus = bus;
38 38
 
39
-    m_i2ControlCtx = maa_i2c_init(m_bus);
39
+    m_i2ControlCtx = mraa_i2c_init(m_bus);
40 40
 
41
-    maa_result_t ret = maa_i2c_address(m_i2ControlCtx, m_controlAddr);
42
-    if (ret != MAA_SUCCESS) {
41
+    mraa_result_t ret = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
42
+    if (ret != MRAA_SUCCESS) {
43 43
         fprintf(stderr, "Messed up i2c bus\n");
44 44
     }
45 45
 
@@ -70,7 +70,7 @@ GY65::GY65 (int bus, int devAddr, uint8_t mode) {
70 70
 }
71 71
 
72 72
 GY65::~GY65() {
73
-    maa_i2c_stop(m_i2ControlCtx);
73
+    mraa_i2c_stop(m_i2ControlCtx);
74 74
 }
75 75
 
76 76
 int32_t
@@ -180,13 +180,13 @@ GY65::computeB5(int32_t UT) {
180 180
     return X1 + X2;
181 181
 }
182 182
 
183
-maa_result_t
183
+mraa_result_t
184 184
 GY65::i2cWriteReg (uint8_t reg, uint8_t value) {
185
-    maa_result_t error = MAA_SUCCESS;
185
+    mraa_result_t error = MRAA_SUCCESS;
186 186
 
187 187
     uint8_t data[2] = { reg, value };
188
-    error = maa_i2c_address (m_i2ControlCtx, m_controlAddr);
189
-    error = maa_i2c_write (m_i2ControlCtx, data, 2);
188
+    error = mraa_i2c_address (m_i2ControlCtx, m_controlAddr);
189
+    error = mraa_i2c_write (m_i2ControlCtx, data, 2);
190 190
 
191 191
     return error;
192 192
 }
@@ -195,11 +195,11 @@ uint16_t
195 195
 GY65::i2cReadReg_16 (int reg) {
196 196
     uint16_t data;
197 197
 
198
-    maa_i2c_address(m_i2ControlCtx, m_controlAddr);
199
-    maa_i2c_write_byte(m_i2ControlCtx, reg);
198
+    mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
199
+    mraa_i2c_write_byte(m_i2ControlCtx, reg);
200 200
 
201
-    maa_i2c_address(m_i2ControlCtx, m_controlAddr);
202
-    maa_i2c_read(m_i2ControlCtx, (uint8_t *)&data, 0x2);
201
+    mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
202
+    mraa_i2c_read(m_i2ControlCtx, (uint8_t *)&data, 0x2);
203 203
 
204 204
     uint8_t high = (data & 0xFF00) >> 8;
205 205
     data = (data << 8) & 0xFF00;
@@ -212,11 +212,11 @@ uint8_t
212 212
 GY65::i2cReadReg_8 (int reg) {
213 213
     uint8_t data;
214 214
 
215
-    maa_i2c_address(m_i2ControlCtx, m_controlAddr);
216
-    maa_i2c_write_byte(m_i2ControlCtx, reg);
215
+    mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
216
+    mraa_i2c_write_byte(m_i2ControlCtx, reg);
217 217
 
218
-    maa_i2c_address(m_i2ControlCtx, m_controlAddr);
219
-    maa_i2c_read(m_i2ControlCtx, &data, 0x1);
218
+    mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
219
+    mraa_i2c_read(m_i2ControlCtx, &data, 0x1);
220 220
 
221 221
     return data;
222 222
 }

+ 3
- 3
src/gy65/gy65.h View File

@@ -27,7 +27,7 @@
27 27
 #pragma once
28 28
 
29 29
 #include <string>
30
-#include <maa/i2c.h>
30
+#include <mraa/i2c.h>
31 31
 #include <math.h>
32 32
 
33 33
 #define ADDR               0x77 // device address
@@ -137,7 +137,7 @@ class GY65 {
137 137
          * @param reg address of a register
138 138
          * @param value byte to be written
139 139
          */
140
-        maa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
140
+        mraa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
141 141
 
142 142
         /**
143 143
          * Read one byte register
@@ -151,7 +151,7 @@ class GY65 {
151 151
 
152 152
         int m_controlAddr;
153 153
         int m_bus;
154
-        maa_i2c_context m_i2ControlCtx;
154
+        mraa_i2c_context m_i2ControlCtx;
155 155
 
156 156
         uint8_t oversampling;
157 157
         int16_t ac1, ac2, ac3, b1, b2, mb, mc, md;

+ 16
- 16
src/hcsr04/hcsr04.cxx View File

@@ -32,43 +32,43 @@
32 32
 using namespace upm;
33 33
 
34 34
 HCSR04::HCSR04 (uint8_t triggerPin, uint8_t echoPin, void (*fptr)(void *)) {
35
-    maa_result_t error  = MAA_SUCCESS;
35
+    mraa_result_t error  = MRAA_SUCCESS;
36 36
     m_name              = "HCSR04";
37 37
 
38
-    m_pwmTriggerCtx     = maa_pwm_init (triggerPin);
38
+    m_pwmTriggerCtx     = mraa_pwm_init (triggerPin);
39 39
     if (m_pwmTriggerCtx == NULL) {
40 40
         std::cout << "PWM context is NULL" << std::endl;
41 41
         exit (1);
42 42
     }
43 43
 
44
-    maa_init();
45
-    m_echoPinCtx = maa_gpio_init(echoPin);
44
+    mraa_init();
45
+    m_echoPinCtx = mraa_gpio_init(echoPin);
46 46
     if (m_echoPinCtx == NULL) {
47 47
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", echoPin);
48 48
         exit (1);
49 49
     }
50 50
 
51
-    maa_gpio_dir(m_echoPinCtx, MAA_GPIO_IN);
52
-    gpio_edge_t edge = MAA_GPIO_EDGE_BOTH;
53
-    maa_gpio_isr (m_echoPinCtx, edge, fptr, NULL);
51
+    mraa_gpio_dir(m_echoPinCtx, MRAA_GPIO_IN);
52
+    gpio_edge_t edge = MRAA_GPIO_EDGE_BOTH;
53
+    mraa_gpio_isr (m_echoPinCtx, edge, fptr, NULL);
54 54
 }
55 55
 
56 56
 HCSR04::~HCSR04 () {
57
-    maa_result_t error = MAA_SUCCESS;
57
+    mraa_result_t error = MRAA_SUCCESS;
58 58
 
59
-    maa_pwm_close (m_pwmTriggerCtx);
60
-    error = maa_gpio_close (m_echoPinCtx);
61
-    if (error != MAA_SUCCESS) {
62
-        maa_result_print (error);
59
+    mraa_pwm_close (m_pwmTriggerCtx);
60
+    error = mraa_gpio_close (m_echoPinCtx);
61
+    if (error != MRAA_SUCCESS) {
62
+        mraa_result_print (error);
63 63
     }
64 64
 }
65 65
 
66 66
 int
67 67
 HCSR04::getDistance () {
68
-    maa_pwm_enable (m_pwmTriggerCtx, 1);
69
-    maa_pwm_period_us (m_pwmTriggerCtx, MAX_PERIOD);
70
-    maa_pwm_pulsewidth_us (m_pwmTriggerCtx, TRIGGER_PULSE);
71
-    maa_pwm_enable (m_pwmTriggerCtx, 0);
68
+    mraa_pwm_enable (m_pwmTriggerCtx, 1);
69
+    mraa_pwm_period_us (m_pwmTriggerCtx, MAX_PERIOD);
70
+    mraa_pwm_pulsewidth_us (m_pwmTriggerCtx, TRIGGER_PULSE);
71
+    mraa_pwm_enable (m_pwmTriggerCtx, 0);
72 72
 
73 73
     m_doWork = 0;
74 74
     m_InterruptCounter = 0;

+ 5
- 5
src/hcsr04/hcsr04.h View File

@@ -24,9 +24,9 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/aio.h>
28
-#include <maa/gpio.h>
29
-#include <maa/pwm.h>
27
+#include <mraa/aio.h>
28
+#include <mraa/gpio.h>
29
+#include <mraa/pwm.h>
30 30
 #include <sys/time.h>
31 31
 
32 32
 #define HIGH                   1
@@ -85,8 +85,8 @@ class HCSR04 {
85 85
         }
86 86
 
87 87
     private:
88
-        maa_pwm_context     m_pwmTriggerCtx;
89
-        maa_gpio_context    m_echoPinCtx;
88
+        mraa_pwm_context     m_pwmTriggerCtx;
89
+        mraa_gpio_context    m_echoPinCtx;
90 90
 
91 91
         uint8_t m_waitEcho;
92 92
         long    m_RisingTimeStamp;

+ 10
- 10
src/hmc5883l/hmc5883l.cxx View File

@@ -79,17 +79,17 @@ using namespace upm;
79 79
 
80 80
 Hmc5883l::Hmc5883l(int bus)
81 81
 {
82
-    m_i2c = maa_i2c_init(bus);
82
+    m_i2c = mraa_i2c_init(bus);
83 83
 
84
-    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
84
+    mraa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
85 85
     m_rx_tx_buf[0] = HMC5883L_CONF_REG_B;
86 86
     m_rx_tx_buf[1] = GA_1_3_REG;
87
-    maa_i2c_write(m_i2c, m_rx_tx_buf, 2);
87
+    mraa_i2c_write(m_i2c, m_rx_tx_buf, 2);
88 88
 
89
-    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
89
+    mraa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
90 90
     m_rx_tx_buf[0] = HMC5883L_MODE_REG;
91 91
     m_rx_tx_buf[1] = HMC5883L_CONT_MODE;
92
-    maa_i2c_write(m_i2c, m_rx_tx_buf, 2);
92
+    mraa_i2c_write(m_i2c, m_rx_tx_buf, 2);
93 93
 
94 94
     Hmc5883l::update();
95 95
 }
@@ -97,11 +97,11 @@ Hmc5883l::Hmc5883l(int bus)
97 97
 int
98 98
 Hmc5883l::update(void)
99 99
 {
100
-    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
101
-    maa_i2c_write_byte(m_i2c, HMC5883L_DATA_REG);
100
+    mraa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
101
+    mraa_i2c_write_byte(m_i2c, HMC5883L_DATA_REG);
102 102
 
103
-    maa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
104
-    maa_i2c_read(m_i2c, m_rx_tx_buf, DATA_REG_SIZE);
103
+    mraa_i2c_address(m_i2c, HMC5883L_I2C_ADDR);
104
+    mraa_i2c_read(m_i2c, m_rx_tx_buf, DATA_REG_SIZE);
105 105
 
106 106
     // x
107 107
     m_coor[0] = (m_rx_tx_buf[HMC5883L_X_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_X_LSB_REG];
@@ -110,7 +110,7 @@ Hmc5883l::update(void)
110 110
     // y
111 111
     m_coor[1] = (m_rx_tx_buf[HMC5883L_Y_MSB_REG] << 8 ) | m_rx_tx_buf[HMC5883L_Y_LSB_REG];
112 112
 
113
-    return MAA_SUCCESS;
113
+    return MRAA_SUCCESS;
114 114
 }
115 115
 
116 116
 float

+ 2
- 2
src/hmc5883l/hmc5883l.h View File

@@ -23,7 +23,7 @@
23 23
  */
24 24
 #pragma once
25 25
 
26
-#include <maa/i2c.h>
26
+#include <mraa/i2c.h>
27 27
 
28 28
 #define MAX_BUFFER_LENGTH 6
29 29
 
@@ -55,7 +55,7 @@ public:
55 55
 private:
56 56
     int m_coor[3];
57 57
     uint8_t m_rx_tx_buf[MAX_BUFFER_LENGTH];
58
-    maa_i2c_context m_i2c;
58
+    mraa_i2c_context m_i2c;
59 59
 };
60 60
 
61 61
 }

+ 21
- 21
src/lcd/i2clcd.cxx View File

@@ -33,54 +33,54 @@ I2CLcd::I2CLcd (int bus, int lcdAddress) {
33 33
     m_lcd_control_address = lcdAddress;
34 34
     m_bus = bus;
35 35
 
36
-    m_i2c_lcd_control = maa_i2c_init(m_bus);
36
+    m_i2c_lcd_control = mraa_i2c_init(m_bus);
37 37
 
38
-    maa_result_t ret = maa_i2c_address(m_i2c_lcd_control, m_lcd_control_address);
39
-    if (ret != MAA_SUCCESS) {
38
+    mraa_result_t ret = mraa_i2c_address(m_i2c_lcd_control, m_lcd_control_address);
39
+    if (ret != MRAA_SUCCESS) {
40 40
         fprintf(stderr, "Messed up i2c bus\n");
41 41
     }
42 42
 }
43 43
 
44
-maa_result_t
44
+mraa_result_t
45 45
 I2CLcd::write (int row, int column, std::string msg) {
46 46
     setCursor (row, column);
47 47
     write (msg);
48 48
 }
49 49
 
50
-maa_result_t
50
+mraa_result_t
51 51
 I2CLcd::close() {
52
-    return maa_i2c_stop(m_i2c_lcd_control);
52
+    return mraa_i2c_stop(m_i2c_lcd_control);
53 53
 }
54 54
 
55
-maa_result_t
56
-I2CLcd::i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
57
-    maa_result_t error = MAA_SUCCESS;
55
+mraa_result_t
56
+I2CLcd::i2cReg (mraa_i2c_context ctx, int deviceAdress, int addr, uint8_t value) {
57
+    mraa_result_t error = MRAA_SUCCESS;
58 58
 
59 59
     uint8_t data[2] = { addr, value };
60
-    error = maa_i2c_address (ctx, deviceAdress);
61
-    error = maa_i2c_write (ctx, data, 2);
60
+    error = mraa_i2c_address (ctx, deviceAdress);
61
+    error = mraa_i2c_write (ctx, data, 2);
62 62
 
63 63
     return error;
64 64
 }
65 65
 
66
-maa_result_t
67
-I2CLcd::i2Cmd (maa_i2c_context ctx, uint8_t value) {
68
-    maa_result_t error = MAA_SUCCESS;
66
+mraa_result_t
67
+I2CLcd::i2Cmd (mraa_i2c_context ctx, uint8_t value) {
68
+    mraa_result_t error = MRAA_SUCCESS;
69 69
 
70 70
     uint8_t data[2] = { LCD_CMD, value };
71
-    error = maa_i2c_address (ctx, m_lcd_control_address);
72
-    error = maa_i2c_write (ctx, data, 2);
71
+    error = mraa_i2c_address (ctx, m_lcd_control_address);
72
+    error = mraa_i2c_write (ctx, data, 2);
73 73
 
74 74
     return error;
75 75
 }
76 76
 
77
-maa_result_t
78
-I2CLcd::i2cData (maa_i2c_context ctx, uint8_t value) {
79
-    maa_result_t error = MAA_SUCCESS;
77
+mraa_result_t
78
+I2CLcd::i2cData (mraa_i2c_context ctx, uint8_t value) {
79
+    mraa_result_t error = MRAA_SUCCESS;
80 80
 
81 81
     uint8_t data[2] = { LCD_DATA, value };
82
-    error = maa_i2c_address (ctx, m_lcd_control_address);
83
-    error = maa_i2c_write (ctx, data, 2);
82
+    error = mraa_i2c_address (ctx, m_lcd_control_address);
83
+    error = mraa_i2c_write (ctx, data, 2);
84 84
 
85 85
     return error;
86 86
 }

+ 11
- 11
src/lcd/i2clcd.h View File

@@ -24,7 +24,7 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/i2c.h>
27
+#include <mraa/i2c.h>
28 28
 
29 29
 namespace upm {
30 30
 
@@ -70,17 +70,17 @@ namespace upm {
70 70
 class I2CLcd {
71 71
     public:
72 72
         I2CLcd (int bus, int lcdAddress);
73
-        maa_result_t write (int x, int y, std::string msg);
73
+        mraa_result_t write (int x, int y, std::string msg);
74 74
         
75
-        virtual maa_result_t write (std::string msg) = 0;
76
-        virtual maa_result_t setCursor (int row, int column) = 0;
77
-        virtual maa_result_t clear () = 0;
78
-        virtual maa_result_t home () = 0;
79
-        virtual maa_result_t i2Cmd (maa_i2c_context ctx, uint8_t value);
80
-        virtual maa_result_t i2cReg (maa_i2c_context ctx, int deviceAdress, int addr, uint8_t data);
81
-        virtual maa_result_t i2cData (maa_i2c_context ctx, uint8_t value);
75
+        virtual mraa_result_t write (std::string msg) = 0;
76
+        virtual mraa_result_t setCursor (int row, int column) = 0;
77
+        virtual mraa_result_t clear () = 0;
78
+        virtual mraa_result_t home () = 0;
79
+        virtual mraa_result_t i2Cmd (mraa_i2c_context ctx, uint8_t value);
80
+        virtual mraa_result_t i2cReg (mraa_i2c_context ctx, int deviceAdress, int addr, uint8_t data);
81
+        virtual mraa_result_t i2cData (mraa_i2c_context ctx, uint8_t value);
82 82
         
83
-        maa_result_t close();
83
+        mraa_result_t close();
84 84
         std::string name()
85 85
         {
86 86
             return m_name;
@@ -89,7 +89,7 @@ class I2CLcd {
89 89
         std::string m_name;
90 90
         int m_lcd_control_address;
91 91
         int m_bus;
92
-        maa_i2c_context m_i2c_lcd_control;
92
+        mraa_i2c_context m_i2c_lcd_control;
93 93
 };
94 94
 
95 95
 }

+ 10
- 10
src/lcd/jhd1313m1.cxx View File

@@ -30,13 +30,13 @@
30 30
 using namespace upm;
31 31
 
32 32
 Jhd1313m1::Jhd1313m1 (int bus, int lcdAddress, int rgbAddress) : I2CLcd(bus, lcdAddress) {
33
-    maa_result_t error = MAA_SUCCESS;
33
+    mraa_result_t error = MRAA_SUCCESS;
34 34
 
35 35
     m_rgb_address = rgbAddress;
36
-    m_i2c_lcd_rgb = maa_i2c_init(m_bus);
36
+    m_i2c_lcd_rgb = mraa_i2c_init(m_bus);
37 37
 
38
-    maa_result_t ret = maa_i2c_address(m_i2c_lcd_rgb, m_rgb_address);
39
-    if (ret != MAA_SUCCESS) {
38
+    mraa_result_t ret = mraa_i2c_address(m_i2c_lcd_rgb, m_rgb_address);
39
+    if (ret != MRAA_SUCCESS) {
40 40
         fprintf(stderr, "Messed up i2c bus\n");
41 41
     }
42 42
 
@@ -75,9 +75,9 @@ Jhd1313m1::~Jhd1313m1() {
75 75
  *  virtual area
76 76
  * **************
77 77
  */
78
-maa_result_t
78
+mraa_result_t
79 79
 Jhd1313m1::write (std::string msg) {
80
-    maa_result_t error = MAA_SUCCESS;
80
+    mraa_result_t error = MRAA_SUCCESS;
81 81
     uint8_t data[2] = {0x40, 0};
82 82
     for (std::string::size_type i = 0; i < msg.size(); ++i) {
83 83
         error = i2cData (m_i2c_lcd_control, msg[i]);
@@ -86,9 +86,9 @@ Jhd1313m1::write (std::string msg) {
86 86
     return error;
87 87
 }
88 88
 
89
-maa_result_t
89
+mraa_result_t
90 90
 Jhd1313m1::setCursor (int row, int column) {
91
-    maa_result_t error = MAA_SUCCESS;
91
+    mraa_result_t error = MRAA_SUCCESS;
92 92
     int row_addr[] = { 0x80, 0xc0, 0x14, 0x54};
93 93
     uint8_t offset = ((column % 16) + row_addr[row]);
94 94
     error =  i2Cmd (m_i2c_lcd_control, offset);
@@ -96,12 +96,12 @@ Jhd1313m1::setCursor (int row, int column) {
96 96
     return error;
97 97
 }
98 98
 
99
-maa_result_t
99
+mraa_result_t
100 100
 Jhd1313m1::clear () {
101 101
     return i2Cmd (m_i2c_lcd_control, LCD_CLEARDISPLAY);
102 102
 }
103 103
 
104
-maa_result_t
104
+mraa_result_t
105 105
 Jhd1313m1::home () {
106 106
     return i2Cmd (m_i2c_lcd_control, LCD_RETURNHOME);
107 107
 }

+ 5
- 5
src/lcd/jhd1313m1.h View File

@@ -32,14 +32,14 @@ class Jhd1313m1 : public I2CLcd {
32 32
     public:
33 33
         Jhd1313m1 (int bus, int lcdAddress, int rgbAddress);
34 34
         ~Jhd1313m1 ();
35
-        maa_result_t write (std::string msg);
36
-        maa_result_t setCursor (int row, int column);
37
-        maa_result_t clear ();
38
-        maa_result_t home ();
35
+        mraa_result_t write (std::string msg);
36
+        mraa_result_t setCursor (int row, int column);
37
+        mraa_result_t clear ();
38
+        mraa_result_t home ();
39 39
 
40 40
     private:
41 41
         int m_rgb_address;
42
-        maa_i2c_context m_i2c_lcd_rgb;
42
+        mraa_i2c_context m_i2c_lcd_rgb;
43 43
 };
44 44
 
45 45
 }

+ 15
- 15
src/lcd/lcm1602.cxx View File

@@ -33,7 +33,7 @@
33 33
 using namespace upm;
34 34
 
35 35
 Lcm1602::Lcm1602(int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
36
-    maa_result_t error = MAA_SUCCESS;
36
+    mraa_result_t error = MRAA_SUCCESS;
37 37
 
38 38
     usleep(50000);
39 39
     expandWrite(LCD_BACKLIGHT);
@@ -69,18 +69,18 @@ Lcm1602::~Lcm1602 () {
69 69
  *  virtual area
70 70
  * **************
71 71
  */
72
-maa_result_t
72
+mraa_result_t
73 73
 Lcm1602::write (std::string msg) {
74
-    maa_result_t error = MAA_SUCCESS;
74
+    mraa_result_t error = MRAA_SUCCESS;
75 75
     for (std::string::size_type i = 0; i < msg.size(); ++i) {
76 76
         error = send (msg[i], LCD_RS);
77 77
     }
78 78
     return error;
79 79
 }
80 80
 
81
-maa_result_t
81
+mraa_result_t
82 82
 Lcm1602::setCursor (int row, int column) {
83
-    maa_result_t error = MAA_SUCCESS;
83
+    mraa_result_t error = MRAA_SUCCESS;
84 84
 
85 85
     int row_addr[] = { 0x80, 0xc0, 0x14, 0x54};
86 86
     uint8_t offset = ((column % 16) + row_addr[row]);
@@ -88,12 +88,12 @@ Lcm1602::setCursor (int row, int column) {
88 88
     return send (LCD_CMD | offset, 0);
89 89
 }
90 90
 
91
-maa_result_t
91
+mraa_result_t
92 92
 Lcm1602::clear () {
93 93
     return send(LCD_CLEARDISPLAY, 0);
94 94
 }
95 95
 
96
-maa_result_t
96
+mraa_result_t
97 97
 Lcm1602::home () {
98 98
     return send(LCD_RETURNHOME, 0);
99 99
 }
@@ -103,9 +103,9 @@ Lcm1602::home () {
103 103
  *  private area
104 104
  * **************
105 105
  */
106
-maa_result_t
106
+mraa_result_t
107 107
 Lcm1602::send (uint8_t value, int mode) {
108
-    maa_result_t ret = MAA_SUCCESS;
108
+    mraa_result_t ret = MRAA_SUCCESS;
109 109
     uint8_t h = value & 0xf0;
110 110
     uint8_t l = (value << 4) & 0xf0;
111 111
     ret = write4bits(h | mode);
@@ -113,26 +113,26 @@ Lcm1602::send (uint8_t value, int mode) {
113 113
     return ret;
114 114
 }
115 115
 
116
-maa_result_t
116
+mraa_result_t
117 117
 Lcm1602::write4bits(uint8_t value)
118 118
 {
119
-    maa_result_t ret = MAA_SUCCESS;
119
+    mraa_result_t ret = MRAA_SUCCESS;
120 120
     ret = expandWrite(value);
121 121
     ret = pulseEnable(value);
122 122
     return ret;
123 123
 }
124 124
 
125
-maa_result_t
125
+mraa_result_t
126 126
 Lcm1602::expandWrite(uint8_t value)
127 127
 {
128 128
     uint8_t buffer = value | LCD_BACKLIGHT;
129
-    return maa_i2c_write_byte(m_i2c_lcd_control, buffer);
129
+    return mraa_i2c_write_byte(m_i2c_lcd_control, buffer);
130 130
 }
131 131
 
132
-maa_result_t
132
+mraa_result_t
133 133
 Lcm1602::pulseEnable(uint8_t value)
134 134
 {
135
-    maa_result_t ret = MAA_SUCCESS;
135
+    mraa_result_t ret = MRAA_SUCCESS;
136 136
     ret = expandWrite(value | LCD_EN);
137 137
     usleep(1);
138 138
     ret = expandWrite(value & ~LCD_EN);

+ 9
- 9
src/lcd/lcm1602.h View File

@@ -35,21 +35,21 @@ namespace upm {
35 35
 class Lcm1602 : public I2CLcd {
36 36
     public:
37 37
         /** LCM1602 Constructor.
38
-         * Calls MAA initialisation functions.
38
+         * Calls MRAA initialisation functions.
39 39
          * @param bus i2c bus to use
40 40
          * @param address the slave address the lcd is registered on.
41 41
          */
42 42
         Lcm1602(int bus, int address);
43 43
         ~Lcm1602();
44
-        maa_result_t write (std::string msg);
45
-        maa_result_t setCursor (int row, int column);
46
-        maa_result_t clear ();
47
-        maa_result_t home ();
44
+        mraa_result_t write (std::string msg);
45
+        mraa_result_t setCursor (int row, int column);
46
+        mraa_result_t clear ();
47
+        mraa_result_t home ();
48 48
 
49 49
     private :
50
-        maa_result_t send (uint8_t value, int mode);
51
-        maa_result_t write4bits(uint8_t value);
52
-        maa_result_t expandWrite(uint8_t value);
53
-        maa_result_t pulseEnable(uint8_t value);
50
+        mraa_result_t send (uint8_t value, int mode);
51
+        mraa_result_t write4bits(uint8_t value);
52
+        mraa_result_t expandWrite(uint8_t value);
53
+        mraa_result_t pulseEnable(uint8_t value);
54 54
     };
55 55
 }

+ 14
- 14
src/lcd/ssd1308.cxx View File

@@ -45,9 +45,9 @@ SSD1308::~SSD1308 () {
45 45
 
46 46
 }
47 47
 
48
-maa_result_t
48
+mraa_result_t
49 49
 SSD1308::draw (uint8_t *data, int bytes) {
50
-    maa_result_t error = MAA_SUCCESS;
50
+    mraa_result_t error = MRAA_SUCCESS;
51 51
 
52 52
     setAddressingMode (HORIZONTAL);
53 53
     for (int idx = 0; idx < bytes; idx++) {
@@ -62,9 +62,9 @@ SSD1308::draw (uint8_t *data, int bytes) {
62 62
  *  virtual area
63 63
  * **************
64 64
  */
65
-maa_result_t
65
+mraa_result_t
66 66
 SSD1308::write (std::string msg) {
67
-    maa_result_t error = MAA_SUCCESS;
67
+    mraa_result_t error = MRAA_SUCCESS;
68 68
     uint8_t data[2] = {0x40, 0};
69 69
 
70 70
     setAddressingMode (PAGE);
@@ -75,9 +75,9 @@ SSD1308::write (std::string msg) {
75 75
     return error;
76 76
 }
77 77
 
78
-maa_result_t
78
+mraa_result_t
79 79
 SSD1308::setCursor (int row, int column) {
80
-    maa_result_t error = MAA_SUCCESS;
80
+    mraa_result_t error = MRAA_SUCCESS;
81 81
 
82 82
     error = i2Cmd (m_i2c_lcd_control, BASE_PAGE_START_ADDR + row);                           // set page address
83 83
     error = i2Cmd (m_i2c_lcd_control, BASE_LOW_COLUMN_ADDR + (8 * column & 0x0F));           // set column lower address
@@ -86,9 +86,9 @@ SSD1308::setCursor (int row, int column) {
86 86
     return error;
87 87
 }
88 88
 
89
-maa_result_t
89
+mraa_result_t
90 90
 SSD1308::clear () {
91
-    maa_result_t error = MAA_SUCCESS;
91
+    mraa_result_t error = MRAA_SUCCESS;
92 92
     uint8_t columnIdx, rowIdx;
93 93
 
94 94
     i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_OFF);  // display off
@@ -103,10 +103,10 @@ SSD1308::clear () {
103 103
     i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_ON);   // display on
104 104
     home ();
105 105
 
106
-    return MAA_SUCCESS;
106
+    return MRAA_SUCCESS;
107 107
 }
108 108
 
109
-maa_result_t
109
+mraa_result_t
110 110
 SSD1308::home () {
111 111
     return setCursor (0, 0);
112 112
 }
@@ -116,8 +116,8 @@ SSD1308::home () {
116 116
  *  private area
117 117
  * **************
118 118
  */
119
-maa_result_t
120
-SSD1308::writeChar (maa_i2c_context ctx, uint8_t value) {
119
+mraa_result_t
120
+SSD1308::writeChar (mraa_i2c_context ctx, uint8_t value) {
121 121
     if (value < 0x20 || value > 0x7F) {
122 122
         value = 0x20; // space
123 123
     }
@@ -127,12 +127,12 @@ SSD1308::writeChar (maa_i2c_context ctx, uint8_t value) {
127 127
     }
128 128
 }
129 129
 
130
-maa_result_t
130
+mraa_result_t
131 131
 SSD1308::setNormalDisplay () {
132 132
     return i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_SET_NORMAL);    // set to normal display '1' is ON
133 133
 }
134 134
 
135
-maa_result_t
135
+mraa_result_t
136 136
 SSD1308::setAddressingMode (displayAddressingMode mode) {
137 137
     i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_MEM_ADDR_MODE); //set addressing mode
138 138
     i2Cmd (m_i2c_lcd_control, mode); //set page addressing mode

+ 9
- 9
src/lcd/ssd1308.h View File

@@ -148,23 +148,23 @@ typedef enum {
148 148
 class SSD1308 : public I2CLcd {
149 149
     public:
150 150
         /** SSD1308 Constructor.
151
-         * Calls MAA initialisation functions.
151
+         * Calls MRAA initialisation functions.
152 152
          * @param bus i2c bus to use
153 153
          * @param address the slave address the lcd is registered on.
154 154
          */
155 155
         SSD1308 (int bus, int address);
156 156
         ~SSD1308 ();
157
-        maa_result_t draw(uint8_t *data, int bytes);
157
+        mraa_result_t draw(uint8_t *data, int bytes);
158 158
 
159 159
         // pure virtual methods
160
-        maa_result_t write (std::string msg);
161
-        maa_result_t setCursor (int row, int column);
162
-        maa_result_t clear ();
163
-        maa_result_t home ();
160
+        mraa_result_t write (std::string msg);
161
+        mraa_result_t setCursor (int row, int column);
162
+        mraa_result_t clear ();
163
+        mraa_result_t home ();
164 164
 
165 165
     private:
166
-        maa_result_t writeChar (maa_i2c_context ctx, uint8_t value);
167
-        maa_result_t setNormalDisplay ();
168
-        maa_result_t setAddressingMode (displayAddressingMode mode);
166
+        mraa_result_t writeChar (mraa_i2c_context ctx, uint8_t value);
167
+        mraa_result_t setNormalDisplay ();
168
+        mraa_result_t setAddressingMode (displayAddressingMode mode);
169 169
     };
170 170
 }

+ 17
- 17
src/lcd/ssd1327.cxx View File

@@ -33,7 +33,7 @@ using namespace upm;
33 33
 #define CMD_SLEEP  10000
34 34
 
35 35
 SSD1327::SSD1327 (int bus_in, int addr_in) : I2CLcd (bus_in, addr_in) {
36
-    maa_result_t error  = MAA_SUCCESS;
36
+    mraa_result_t error  = MRAA_SUCCESS;
37 37
     usleep (INIT_SLEEP);
38 38
     i2Cmd (m_i2c_lcd_control, 0xFD); // Unlock OLED driver IC MCU interface from entering command. i.e: Accept commands
39 39
     usleep (INIT_SLEEP);
@@ -123,9 +123,9 @@ SSD1327::~SSD1327 () {
123 123
 
124 124
 }
125 125
 
126
-maa_result_t
126
+mraa_result_t
127 127
 SSD1327::draw (uint8_t *data, int bytes) {
128
-    maa_result_t error = MAA_SUCCESS;
128
+    mraa_result_t error = MRAA_SUCCESS;
129 129
 
130 130
     setHorizontalMode ();
131 131
     for (int row = 0; row < bytes; row++) {
@@ -151,9 +151,9 @@ SSD1327::draw (uint8_t *data, int bytes) {
151 151
  *  virtual area
152 152
  * **************
153 153
  */
154
-maa_result_t
154
+mraa_result_t
155 155
 SSD1327::write (std::string msg) {
156
-    maa_result_t error = MAA_SUCCESS;
156
+    mraa_result_t error = MRAA_SUCCESS;
157 157
 
158 158
     setVerticalMode ();
159 159
     for (std::string::size_type i = 0; i < msg.size(); ++i) {
@@ -163,9 +163,9 @@ SSD1327::write (std::string msg) {
163 163
     return error;
164 164
 }
165 165
 
166
-maa_result_t
166
+mraa_result_t
167 167
 SSD1327::setCursor (int row, int column) {
168
-    maa_result_t error = MAA_SUCCESS;
168
+    mraa_result_t error = MRAA_SUCCESS;
169 169
 
170 170
     //Column Address
171 171
     i2Cmd (m_i2c_lcd_control, 0x15);                /* Set Column Address */
@@ -185,9 +185,9 @@ SSD1327::setCursor (int row, int column) {
185 185
     return error;
186 186
 }
187 187
 
188
-maa_result_t
188
+mraa_result_t
189 189
 SSD1327::clear () {
190
-    maa_result_t error = MAA_SUCCESS;
190
+    mraa_result_t error = MRAA_SUCCESS;
191 191
     uint8_t columnIdx, rowIdx;
192 192
 
193 193
     for(rowIdx = 0; rowIdx < 12; rowIdx++) {
@@ -197,15 +197,15 @@ SSD1327::clear () {
197 197
         }
198 198
     }
199 199
 
200
-    return MAA_SUCCESS;
200
+    return MRAA_SUCCESS;
201 201
 }
202 202
 
203
-maa_result_t
203
+mraa_result_t
204 204
 SSD1327::home () {
205 205
     return setCursor (0, 0);
206 206
 }
207 207
 
208
-maa_result_t
208
+mraa_result_t
209 209
 SSD1327::setGrayLevel (uint8_t level) {
210 210
     grayHigh = (level << 4) & 0xF0;
211 211
     grayLow  =  level & 0x0F;
@@ -216,8 +216,8 @@ SSD1327::setGrayLevel (uint8_t level) {
216 216
  *  private area
217 217
  * **************
218 218
  */
219
-maa_result_t
220
-SSD1327::writeChar (maa_i2c_context ctx, uint8_t value) {
219
+mraa_result_t
220
+SSD1327::writeChar (mraa_i2c_context ctx, uint8_t value) {
221 221
     if (value < 0x20 || value > 0x7F) {
222 222
         value = 0x20; // space
223 223
     }
@@ -238,12 +238,12 @@ SSD1327::writeChar (maa_i2c_context ctx, uint8_t value) {
238 238
     }
239 239
 }
240 240
 
241
-maa_result_t
241
+mraa_result_t
242 242
 SSD1327::setNormalDisplay () {
243 243
     return i2Cmd (m_i2c_lcd_control, DISPLAY_CMD_SET_NORMAL);    // set to normal display '1' is ON
244 244
 }
245 245
 
246
-maa_result_t
246
+mraa_result_t
247 247
 SSD1327::setHorizontalMode () {
248 248
     i2Cmd (m_i2c_lcd_control, 0xA0); // remap to
249 249
     usleep (CMD_SLEEP);
@@ -267,7 +267,7 @@ SSD1327::setHorizontalMode () {
267 267
     usleep (CMD_SLEEP);
268 268
 }
269 269
 
270
-maa_result_t
270
+mraa_result_t
271 271
 SSD1327::setVerticalMode () {
272 272
     i2Cmd (m_i2c_lcd_control, 0xA0); // remap to
273 273
     usleep (CMD_SLEEP);

+ 11
- 11
src/lcd/ssd1327.h View File

@@ -148,26 +148,26 @@ typedef enum {
148 148
 class SSD1327 : public I2CLcd {
149 149
     public:
150 150
         /** SSD1308 Constructor.
151
-         * Calls MAA initialisation functions.
151
+         * Calls MRAA initialisation functions.
152 152
          * @param bus i2c bus to use
153 153
          * @param address the slave address the lcd is registered on.
154 154
          */
155 155
         SSD1327 (int bus, int address);
156 156
         ~SSD1327 ();
157
-        maa_result_t draw(uint8_t *data, int bytes);
157
+        mraa_result_t draw(uint8_t *data, int bytes);
158 158
 
159 159
         // virtual methods
160
-        maa_result_t write (std::string msg);
161
-        maa_result_t setCursor (int row, int column);
162
-        maa_result_t clear ();
163
-        maa_result_t home ();
164
-        maa_result_t setGrayLevel (uint8_t level);
160
+        mraa_result_t write (std::string msg);
161
+        mraa_result_t setCursor (int row, int column);
162
+        mraa_result_t clear ();
163
+        mraa_result_t home ();
164
+        mraa_result_t setGrayLevel (uint8_t level);
165 165
 
166 166
     private:
167
-        maa_result_t writeChar (maa_i2c_context ctx, uint8_t value);
168
-        maa_result_t setNormalDisplay ();
169
-        maa_result_t setHorizontalMode ();
170
-        maa_result_t setVerticalMode ();
167
+        mraa_result_t writeChar (mraa_i2c_context ctx, uint8_t value);
168
+        mraa_result_t setNormalDisplay ();
169
+        mraa_result_t setHorizontalMode ();
170
+        mraa_result_t setVerticalMode ();
171 171
 
172 172
         uint8_t grayHigh;
173 173
         uint8_t grayLow;

+ 15
- 15
src/max31855/max31855.cxx View File

@@ -36,12 +36,12 @@ using namespace upm;
36 36
 MAX31855::MAX31855(int bus, int cs)
37 37
 {
38 38
     // initialise chip select as a normal gpio
39
-    m_gpio = maa_gpio_init(cs);
40
-    maa_gpio_dir(m_gpio, MAA_GPIO_OUT);
39
+    m_gpio = mraa_gpio_init(cs);
40
+    mraa_gpio_dir(m_gpio, MRAA_GPIO_OUT);
41 41
 
42 42
     // initialise the spi bus with a 2Mhz clock
43
-    m_sensor = maa_spi_init(bus);
44
-    maa_spi_frequency(m_sensor, 2000000);
43
+    m_sensor = mraa_spi_init(bus);
44
+    mraa_spi_frequency(m_sensor, 2000000);
45 45
 }
46 46
 //! [Constructor]
47 47
 
@@ -49,14 +49,14 @@ MAX31855::MAX31855(int bus, int cs)
49 49
 MAX31855::~MAX31855()
50 50
 {
51 51
     // close both m_sensor & m_gpio cleanly
52
-    maa_result_t error;
53
-    error = maa_spi_stop(m_sensor);
54
-    if (error != MAA_SUCCESS) {
55
-        maa_result_print(error);
52
+    mraa_result_t error;
53
+    error = mraa_spi_stop(m_sensor);
54
+    if (error != MRAA_SUCCESS) {
55
+        mraa_result_print(error);
56 56
     }
57
-    error = maa_gpio_close(m_gpio);
58
-    if (error != MAA_SUCCESS) {
59
-        maa_result_print(error);
57
+    error = mraa_gpio_close(m_gpio);
58
+    if (error != MRAA_SUCCESS) {
59
+        mraa_result_print(error);
60 60
     }
61 61
 }
62 62
 //! [Destructor]
@@ -66,7 +66,7 @@ MAX31855::getTemp()
66 66
 {
67 67
 //! [spi]
68 68
     // set chip select low
69
-    maa_gpio_write(m_gpio, 0);
69
+    mraa_gpio_write(m_gpio, 0);
70 70
 
71 71
     uint8_t buf[4];
72 72
 
@@ -74,14 +74,14 @@ MAX31855::getTemp()
74 74
     memset(buf, 0, sizeof(uint8_t)*4);
75 75
 
76 76
     // Write buffer to the spi slave
77
-    uint8_t* x = maa_spi_write_buf(m_sensor, buf, 4);
77
+    uint8_t* x = mraa_spi_write_buf(m_sensor, buf, 4);
78 78
 //! [spi]
79 79
 
80 80
 //! [conversion]
81 81
     // Endian correct way of making our char array into an 32bit int
82 82
     int32_t temp = (x[0] << 24) | (x[1] << 16) | (x[2] << 8) | x[3];;
83 83
 
84
-    // maa_spi_write_buf does not free the return buffer
84
+    // mraa_spi_write_buf does not free the return buffer
85 85
     free(x);
86 86
 
87 87
     if (temp & 0x7) {
@@ -97,7 +97,7 @@ MAX31855::getTemp()
97 97
 //! [conversion]
98 98
 
99 99
     // set chip select high
100
-    maa_gpio_write(m_gpio, 1);
100
+    mraa_gpio_write(m_gpio, 1);
101 101
 
102 102
     return c;
103 103
 }

+ 4
- 4
src/max31855/max31855.h View File

@@ -24,8 +24,8 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/spi.h>
28
-#include <maa/gpio.h>
27
+#include <mraa/spi.h>
28
+#include <mraa/gpio.h>
29 29
 
30 30
 namespace upm {
31 31
 
@@ -61,8 +61,8 @@ class MAX31855 {
61 61
         double getTemp();
62 62
 
63 63
     private:
64
-        maa_spi_context m_sensor;
65
-        maa_gpio_context m_gpio;
64
+        mraa_spi_context m_sensor;
65
+        mraa_gpio_context m_gpio;
66 66
 };
67 67
 //! [Interesting]
68 68
 

+ 16
- 16
src/max44000/max44000.cxx View File

@@ -36,10 +36,10 @@ MAX44000::MAX44000 (int bus, int devAddr) {
36 36
     m_maxControlAddr = devAddr;
37 37
     m_bus = bus;
38 38
 
39
-    m_i2cMaxControlCtx = maa_i2c_init(m_bus);
39
+    m_i2cMaxControlCtx = mraa_i2c_init(m_bus);
40 40
 
41
-    maa_result_t ret = maa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
42
-    if (ret != MAA_SUCCESS) {
41
+    mraa_result_t ret = mraa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
42
+    if (ret != MRAA_SUCCESS) {
43 43
         fprintf(stderr, "Messed up i2c bus\n");
44 44
     }
45 45
 
@@ -48,7 +48,7 @@ MAX44000::MAX44000 (int bus, int devAddr) {
48 48
 }
49 49
 
50 50
 MAX44000::~MAX44000() {
51
-    maa_i2c_stop(m_i2cMaxControlCtx);
51
+    mraa_i2c_stop(m_i2cMaxControlCtx);
52 52
 }
53 53
 
54 54
 uint16_t
@@ -80,11 +80,11 @@ uint8_t
80 80
 MAX44000::i2cReadReg_8 (int reg) {
81 81
     uint8_t data;
82 82
 
83
-    maa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
84
-    maa_i2c_write_byte(m_i2cMaxControlCtx, reg);
83
+    mraa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
84
+    mraa_i2c_write_byte(m_i2cMaxControlCtx, reg);
85 85
 
86
-    maa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
87
-    maa_i2c_read(m_i2cMaxControlCtx, &data, 0x1);
86
+    mraa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
87
+    mraa_i2c_read(m_i2cMaxControlCtx, &data, 0x1);
88 88
 
89 89
     return data;
90 90
 }
@@ -93,22 +93,22 @@ uint16_t
93 93
 MAX44000::i2cReadReg_16 (int reg) {
94 94
     uint16_t data;
95 95
 
96
-    maa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
97
-    maa_i2c_write_byte(m_i2cMaxControlCtx, reg);
96
+    mraa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
97
+    mraa_i2c_write_byte(m_i2cMaxControlCtx, reg);
98 98
 
99
-    maa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
100
-    maa_i2c_read(m_i2cMaxControlCtx, (uint8_t *)&data, 0x2);
99
+    mraa_i2c_address(m_i2cMaxControlCtx, m_maxControlAddr);
100
+    mraa_i2c_read(m_i2cMaxControlCtx, (uint8_t *)&data, 0x2);
101 101
 
102 102
     return data;
103 103
 }
104 104
 
105
-maa_result_t
105
+mraa_result_t
106 106
 MAX44000::i2cWriteReg (uint8_t reg, uint8_t value) {
107
-    maa_result_t error = MAA_SUCCESS;
107
+    mraa_result_t error = MRAA_SUCCESS;
108 108
 
109 109
     uint8_t data[2] = { reg, value };
110
-    error = maa_i2c_address (m_i2cMaxControlCtx, m_maxControlAddr);
111
-    error = maa_i2c_write (m_i2cMaxControlCtx, data, 2);
110
+    error = mraa_i2c_address (m_i2cMaxControlCtx, m_maxControlAddr);
111
+    error = mraa_i2c_write (m_i2cMaxControlCtx, data, 2);
112 112
 
113 113
     return error;
114 114
 }

+ 3
- 3
src/max44000/max44000.h View File

@@ -24,7 +24,7 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/i2c.h>
27
+#include <mraa/i2c.h>
28 28
 
29 29
 #define ADDR               0x4A // device address
30 30
 
@@ -122,14 +122,14 @@ class MAX44000 {
122 122
          * @param reg address of a register
123 123
          * @param value byte to be written
124 124
          */
125
-        maa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
125
+        mraa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
126 126
 
127 127
     private:
128 128
         std::string m_name;
129 129
 
130 130
         int m_maxControlAddr;
131 131
         int m_bus;
132
-        maa_i2c_context m_i2cMaxControlCtx;
132
+        mraa_i2c_context m_i2cMaxControlCtx;
133 133
 };
134 134
 
135 135
 }

+ 6
- 6
src/mic/mic.cxx View File

@@ -33,17 +33,17 @@ using namespace upm;
33 33
 
34 34
 Microphone::Microphone(int micPin) {
35 35
     // initialise analog mic input
36
-    m_micCtx = maa_aio_init(micPin);
36
+    m_micCtx = mraa_aio_init(micPin);
37 37
 
38 38
 
39 39
 }
40 40
 
41 41
 Microphone::~Microphone() {
42 42
     // close analog input
43
-    maa_result_t error;
44
-    error = maa_aio_close(m_micCtx);
45
-    if (error != MAA_SUCCESS) {
46
-        maa_result_print(error);
43
+    mraa_result_t error;
44
+    error = mraa_aio_close(m_micCtx);
45
+    if (error != MRAA_SUCCESS) {
46
+        mraa_result_print(error);
47 47
     }
48 48
 }
49 49
 
@@ -63,7 +63,7 @@ Microphone::getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples,
63 63
     }
64 64
 
65 65
     while (sampleIdx < numberOfSamples) {
66
-        buffer[sampleIdx++] = maa_aio_read (m_micCtx);
66
+        buffer[sampleIdx++] = mraa_aio_read (m_micCtx);
67 67
         usleep(freqMS * 1000);
68 68
     }
69 69
 

+ 3
- 3
src/mic/mic.h View File

@@ -24,8 +24,8 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/gpio.h>
28
-#include <maa/aio.h>
27
+#include <mraa/gpio.h>
28
+#include <mraa/aio.h>
29 29
 
30 30
 struct thresholdContext {
31 31
     long averageReading;
@@ -80,7 +80,7 @@ class Microphone {
80 80
         void printGraph (thresholdContext* ctx);
81 81
 
82 82
     private:
83
-        maa_aio_context    m_micCtx;
83
+        mraa_aio_context    m_micCtx;
84 84
 };
85 85
 
86 86
 }

+ 26
- 26
src/mma7455/mma7455.cxx View File

@@ -42,10 +42,10 @@ MMA7455::MMA7455 (int bus, int devAddr) {
42 42
     m_controlAddr = devAddr;
43 43
     m_bus = bus;
44 44
 
45
-    m_i2ControlCtx = maa_i2c_init(m_bus);
45
+    m_i2ControlCtx = mraa_i2c_init(m_bus);
46 46
 
47
-    maa_result_t error = maa_i2c_address(m_i2ControlCtx, m_controlAddr);
48
-    if (error != MAA_SUCCESS) {
47
+    mraa_result_t error = mraa_i2c_address(m_i2ControlCtx, m_controlAddr);
48
+    if (error != MRAA_SUCCESS) {
49 49
         fprintf(stderr, "Messed up i2c bus\n");
50 50
         return;
51 51
     }
@@ -53,24 +53,24 @@ MMA7455::MMA7455 (int bus, int devAddr) {
53 53
     // setting GLVL 0x1 (64LSB/g) and MODE 0x1 (Measurement Mode)
54 54
     data = (BIT (MMA7455_GLVL0) | BIT (MMA7455_MODE0));
55 55
     error = ic2WriteReg (MMA7455_MCTL, &data, 0x1);
56
-    if (error != MAA_SUCCESS) {
56
+    if (error != MRAA_SUCCESS) {
57 57
         std::cout << "ERROR :: MMA7455 instance wan not created (Mode)" << std::endl;
58 58
         return;
59 59
     }
60 60
     
61
-    if (MAA_SUCCESS != calibrate ()) {
61
+    if (MRAA_SUCCESS != calibrate ()) {
62 62
         std::cout << "ERROR :: MMA7455 instance wan not created (Calibrate)" << std::endl;
63 63
         return;
64 64
     }
65 65
 }
66 66
 
67 67
 MMA7455::~MMA7455() {
68
-    maa_i2c_stop(m_i2ControlCtx);
68
+    mraa_i2c_stop(m_i2ControlCtx);
69 69
 }
70 70
 
71
-maa_result_t 
71
+mraa_result_t 
72 72
 MMA7455::calibrate () {
73
-    maa_result_t error = MAA_SUCCESS;
73
+    mraa_result_t error = MRAA_SUCCESS;
74 74
     int i = 0;
75 75
     
76 76
     accelData xyz;
@@ -78,7 +78,7 @@ MMA7455::calibrate () {
78 78
     
79 79
     do {
80 80
         error = readData (&xyz.value.x, &xyz.value.y, &xyz.value.z);
81
-        if (MAA_SUCCESS != error) {
81
+        if (MRAA_SUCCESS != error) {
82 82
             return error;
83 83
         }
84 84
         
@@ -87,7 +87,7 @@ MMA7455::calibrate () {
87 87
         xyz.value.z += 2 * -(xyz.value.z - 64);
88 88
         
89 89
         error = ic2WriteReg (MMA7455_XOFFL,  (unsigned char *) &xyz, 0x6);
90
-        if (error != MAA_SUCCESS) {
90
+        if (error != MRAA_SUCCESS) {
91 91
             return error;
92 92
         }
93 93
     
@@ -96,7 +96,7 @@ MMA7455::calibrate () {
96 96
     return error;
97 97
 }
98 98
 
99
-maa_result_t 
99
+mraa_result_t 
100 100
 MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) {
101 101
     accelData xyz;
102 102
     unsigned char data = 0;
@@ -104,17 +104,17 @@ MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) {
104 104
     
105 105
     /*do {
106 106
         nBytes = ic2ReadReg (MMA7455_STATUS, &data, 0x1);
107
-    } while ( !(data & MMA7455_DRDY) && nBytes == MAA_SUCCESS);
107
+    } while ( !(data & MMA7455_DRDY) && nBytes == MRAA_SUCCESS);
108 108
     
109
-    if (nBytes == MAA_SUCCESS) {
109
+    if (nBytes == MRAA_SUCCESS) {
110 110
         std::cout << "NO_GDB :: 1" << std::endl;
111
-        return MAA_SUCCESS;
111
+        return MRAA_SUCCESS;
112 112
     }*/
113 113
     
114 114
     nBytes = ic2ReadReg (MMA7455_XOUTL, (unsigned char *) &xyz, 0x6);
115 115
     if (nBytes == 0) {
116 116
         std::cout << "NO_GDB :: 2" << std::endl;
117
-        return MAA_ERROR_UNSPECIFIED;
117
+        return MRAA_ERROR_UNSPECIFIED;
118 118
     }
119 119
     
120 120
     if (xyz.reg.x_msb & 0x02) {
@@ -134,40 +134,40 @@ MMA7455::readData (short * ptrX, short * ptrY, short * ptrZ) {
134 134
     *ptrY = xyz.value.y;
135 135
     *ptrZ = xyz.value.z;
136 136
     
137
-    return MAA_SUCCESS;
137
+    return MRAA_SUCCESS;
138 138
 }
139 139
 
140 140
 int 
141 141
 MMA7455::ic2ReadReg (unsigned char reg, unsigned char * buf, unsigned char size) {
142
-    if (MAA_SUCCESS != maa_i2c_address(m_i2ControlCtx, m_controlAddr)) {
142
+    if (MRAA_SUCCESS != mraa_i2c_address(m_i2ControlCtx, m_controlAddr)) {
143 143
         return 0;
144 144
     }
145 145
     
146
-    if (MAA_SUCCESS != maa_i2c_write_byte(m_i2ControlCtx, reg)) {
146
+    if (MRAA_SUCCESS != mraa_i2c_write_byte(m_i2ControlCtx, reg)) {
147 147
         return 0;
148 148
     }
149 149
 
150
-    if (MAA_SUCCESS != maa_i2c_address(m_i2ControlCtx, m_controlAddr)) {
150
+    if (MRAA_SUCCESS != mraa_i2c_address(m_i2ControlCtx, m_controlAddr)) {
151 151
         return 0;
152 152
     }
153 153
     
154
-    return (int) maa_i2c_read(m_i2ControlCtx, buf, size);
154
+    return (int) mraa_i2c_read(m_i2ControlCtx, buf, size);
155 155
 }
156 156
 
157
-maa_result_t 
157
+mraa_result_t 
158 158
 MMA7455::ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size) {
159
-    maa_result_t error = MAA_SUCCESS;
159
+    mraa_result_t error = MRAA_SUCCESS;
160 160
 
161 161
     uint8_t data[size + 1];
162 162
     data[0] = reg;
163 163
     memcpy(&data[1], buf, size);
164 164
 
165
-    error = maa_i2c_address (m_i2ControlCtx, m_controlAddr);
166
-    if (error != MAA_SUCCESS) {
165
+    error = mraa_i2c_address (m_i2ControlCtx, m_controlAddr);
166
+    if (error != MRAA_SUCCESS) {
167 167
         return error;
168 168
     }
169
-    error = maa_i2c_write (m_i2ControlCtx, data, size + 1);
170
-    if (error != MAA_SUCCESS) {
169
+    error = mraa_i2c_write (m_i2ControlCtx, data, size + 1);
170
+    if (error != MRAA_SUCCESS) {
171 171
         return error;
172 172
     }
173 173
 

+ 5
- 5
src/mma7455/mma7455.h View File

@@ -24,7 +24,7 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/i2c.h>
27
+#include <mraa/i2c.h>
28 28
 
29 29
 #define ADDR               0x1D // device address
30 30
 
@@ -183,7 +183,7 @@ class MMA7455 {
183 183
         /**
184 184
          * Calibrate the sensor
185 185
          */
186
-        maa_result_t calibrate ();
186
+        mraa_result_t calibrate ();
187 187
         
188 188
         /**
189 189
          * Read X, Y and Z acceleration data
@@ -192,7 +192,7 @@ class MMA7455 {
192 192
          * @param ptrY Y axis
193 193
          * @param ptrZ Z axis
194 194
          */
195
-        maa_result_t readData (short * ptrX, short * ptrY, short * ptrZ);
195
+        mraa_result_t readData (short * ptrX, short * ptrY, short * ptrZ);
196 196
         
197 197
         /**
198 198
          * 
@@ -210,14 +210,14 @@ class MMA7455 {
210 210
          * @param buf register data buffer 
211 211
          * @param size buffer size
212 212
          */
213
-        maa_result_t ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size);
213
+        mraa_result_t ic2WriteReg (unsigned char reg, unsigned char * buf, unsigned char size);
214 214
 
215 215
     private:
216 216
         std::string m_name;
217 217
 
218 218
         int              m_controlAddr;
219 219
         int              m_bus;
220
-        maa_i2c_context  m_i2ControlCtx;
220
+        mraa_i2c_context  m_i2ControlCtx;
221 221
 };
222 222
 
223 223
 }

+ 21
- 21
src/mpu9150/mpu9150.cxx View File

@@ -39,10 +39,10 @@ MPU9150::MPU9150 (int bus, int devAddr) {
39 39
     m_i2cAddr = devAddr;
40 40
     m_bus = bus;
41 41
 
42
-    m_i2Ctx = maa_i2c_init(m_bus);
42
+    m_i2Ctx = mraa_i2c_init(m_bus);
43 43
 
44
-    maa_result_t ret = maa_i2c_address(m_i2Ctx, m_i2cAddr);
45
-    if (ret != MAA_SUCCESS) {
44
+    mraa_result_t ret = mraa_i2c_address(m_i2Ctx, m_i2cAddr);
45
+    if (ret != MRAA_SUCCESS) {
46 46
         fprintf(stderr, "Messed up i2c bus\n");
47 47
     }
48 48
 
@@ -50,10 +50,10 @@ MPU9150::MPU9150 (int bus, int devAddr) {
50 50
 }
51 51
 
52 52
 MPU9150::~MPU9150() {
53
-    maa_i2c_stop(m_i2Ctx);
53
+    mraa_i2c_stop(m_i2Ctx);
54 54
 }
55 55
 
56
-maa_result_t
56
+mraa_result_t
57 57
 MPU9150::initSensor () {
58 58
     uint8_t regData = 0x0;
59 59
 
@@ -71,7 +71,7 @@ MPU9150::initSensor () {
71 71
     regData &= ~(1 << MPU6050_PWR1_SLEEP_BIT);
72 72
     i2cWriteReg (MPU6050_RA_PWR_MGMT_1, regData);
73 73
 
74
-    return MAA_SUCCESS;
74
+    return MRAA_SUCCESS;
75 75
 }
76 76
 
77 77
 uint8_t
@@ -81,7 +81,7 @@ MPU9150::getDeviceID () {
81 81
     return regData;
82 82
 }
83 83
 
84
-maa_result_t
84
+mraa_result_t
85 85
 MPU9150::getData () {
86 86
     uint8_t buffer[14];
87 87
 
@@ -130,31 +130,31 @@ MPU9150::getData () {
130 130
     axisMagnetomer.data.axisZ = axisMagnetomer.sumData.axisZ / SMOOTH_TIMES;
131 131
 }
132 132
 
133
-maa_result_t
133
+mraa_result_t
134 134
 MPU9150::getAcceleromter (Vector3D * data) {
135 135
     data->axisX = axisAcceleromter.data.axisX;
136 136
     data->axisY = axisAcceleromter.data.axisY;
137 137
     data->axisZ = axisAcceleromter.data.axisZ;
138 138
 
139
-    return MAA_SUCCESS;
139
+    return MRAA_SUCCESS;
140 140
 }
141 141
 
142
-maa_result_t
142
+mraa_result_t
143 143
 MPU9150::getGyro (Vector3D * data) {
144 144
     data->axisX = axisGyroscope.data.axisX;
145 145
     data->axisY = axisGyroscope.data.axisY;
146 146
     data->axisZ = axisGyroscope.data.axisZ;
147 147
 
148
-    return MAA_SUCCESS;
148
+    return MRAA_SUCCESS;
149 149
 }
150 150
 
151
-maa_result_t
151
+mraa_result_t
152 152
 MPU9150::getMagnometer (Vector3D * data) {
153 153
     data->axisX = axisMagnetomer.data.axisX;
154 154
     data->axisY = axisMagnetomer.data.axisY;
155 155
     data->axisZ = axisMagnetomer.data.axisZ;
156 156
 
157
-    return MAA_SUCCESS;
157
+    return MRAA_SUCCESS;
158 158
 }
159 159
 
160 160
 float
@@ -177,21 +177,21 @@ MPU9150::getTemperature () {
177 177
 uint16_t
178 178
 MPU9150::i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer) {
179 179
     int readByte = 0;
180
-    maa_i2c_address(m_i2Ctx, m_i2cAddr);
181
-    maa_i2c_write_byte(m_i2Ctx, reg);
180
+    mraa_i2c_address(m_i2Ctx, m_i2cAddr);
181
+    mraa_i2c_write_byte(m_i2Ctx, reg);
182 182
 
183
-    maa_i2c_address(m_i2Ctx, m_i2cAddr);
184
-    readByte = maa_i2c_read(m_i2Ctx, buffer, len);
183
+    mraa_i2c_address(m_i2Ctx, m_i2cAddr);
184
+    readByte = mraa_i2c_read(m_i2Ctx, buffer, len);
185 185
     return readByte;
186 186
 }
187 187
 
188
-maa_result_t
188
+mraa_result_t
189 189
 MPU9150::i2cWriteReg (uint8_t reg, uint8_t value) {
190
-    maa_result_t error = MAA_SUCCESS;
190
+    mraa_result_t error = MRAA_SUCCESS;
191 191
 
192 192
     uint8_t data[2] = { reg, value };
193
-    error = maa_i2c_address (m_i2Ctx, m_i2cAddr);
194
-    error = maa_i2c_write (m_i2Ctx, data, 2);
193
+    error = mraa_i2c_address (m_i2Ctx, m_i2cAddr);
194
+    error = mraa_i2c_write (m_i2Ctx, data, 2);
195 195
 
196 196
     return error;
197 197
 }

+ 8
- 8
src/mpu9150/mpu9150.h View File

@@ -27,7 +27,7 @@
27 27
 #pragma once
28 28
 
29 29
 #include <string>
30
-#include <maa/i2c.h>
30
+#include <mraa/i2c.h>
31 31
 
32 32
 #define MPU6050_ADDRESS_AD0_LOW             0x68 // address pin low (GND), default for InvenSense evaluation board
33 33
 #define MPU6050_ADDRESS_AD0_HIGH            0x69 // address pin high (VCC)
@@ -133,7 +133,7 @@ class MPU9150 {
133 133
         /**
134 134
          * Initiate MPU9150 chips
135 135
          */
136
-        maa_result_t initSensor ();
136
+        mraa_result_t initSensor ();
137 137
 
138 138
         /**
139 139
          * Get identity of the device
@@ -144,22 +144,22 @@ class MPU9150 {
144 144
          * Get the Accelerometer, Gyro and Compass data from the chip and
145 145
          * save it in private section.
146 146
          */
147
-        maa_result_t getData ();
147
+        mraa_result_t getData ();
148 148
 
149 149
         /**
150 150
          * @param data structure with 3 axis (x,y,z)
151 151
          */
152
-        maa_result_t getAcceleromter (Vector3D * data);
152
+        mraa_result_t getAcceleromter (Vector3D * data);
153 153
 
154 154
         /**
155 155
          * @param data structure with 3 axis (x,y,z)
156 156
          */
157
-        maa_result_t getGyro (Vector3D * data);
157
+        mraa_result_t getGyro (Vector3D * data);
158 158
 
159 159
         /**
160 160
          * @param data structure with 3 axis (x,y,z)
161 161
          */
162
-        maa_result_t getMagnometer (Vector3D * data);
162
+        mraa_result_t getMagnometer (Vector3D * data);
163 163
 
164 164
         /**
165 165
          * Read on die temperature from the chip
@@ -179,14 +179,14 @@ class MPU9150 {
179 179
 
180 180
         int m_i2cAddr;
181 181
         int m_bus;
182
-        maa_i2c_context m_i2Ctx;
182
+        mraa_i2c_context m_i2Ctx;
183 183
 
184 184
         AxisData axisMagnetomer;
185 185
         AxisData axisAcceleromter;
186 186
         AxisData axisGyroscope;
187 187
 
188 188
         uint16_t i2cReadReg_N (int reg, unsigned int len, uint8_t * buffer);
189
-        maa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
189
+        mraa_result_t i2cWriteReg (uint8_t reg, uint8_t value);
190 190
         int updateRegBits (uint8_t reg, uint8_t bitStart,
191 191
                                     uint8_t length, uint16_t data);
192 192
         uint8_t getRegBits (uint8_t reg, uint8_t bitStart,

+ 29
- 29
src/my9221/my9221.cxx View File

@@ -31,51 +31,51 @@
31 31
 using namespace upm;
32 32
 
33 33
 MY9221::MY9221 (uint8_t di, uint8_t dcki) {
34
-    maa_result_t error = MAA_SUCCESS;
35
-    maa_init();
34
+    mraa_result_t error = MRAA_SUCCESS;
35
+    mraa_init();
36 36
 
37 37
     // init clock context
38
-    m_clkPinCtx = maa_gpio_init(dcki);
38
+    m_clkPinCtx = mraa_gpio_init(dcki);
39 39
     if (m_clkPinCtx == NULL) {
40 40
         fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", dcki);
41 41
         exit(1);
42 42
     }
43 43
     // init data context
44
-    m_dataPinCtx = maa_gpio_init(di);
44
+    m_dataPinCtx = mraa_gpio_init(di);
45 45
     if (m_dataPinCtx == NULL) {
46 46
         fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", di);
47 47
         exit(1);
48 48
     }
49 49
     
50 50
     // set direction (out)
51
-    error = maa_gpio_dir(m_clkPinCtx, MAA_GPIO_OUT);
52
-    if (error != MAA_SUCCESS) {
53
-        maa_result_print(error);
51
+    error = mraa_gpio_dir(m_clkPinCtx, MRAA_GPIO_OUT);
52
+    if (error != MRAA_SUCCESS) {
53
+        mraa_result_print(error);
54 54
     }
55 55
 
56 56
     // set direction (out)
57
-    error = maa_gpio_dir(m_dataPinCtx, MAA_GPIO_OUT);
58
-    if (error != MAA_SUCCESS) {
59
-        maa_result_print(error);
57
+    error = mraa_gpio_dir(m_dataPinCtx, MRAA_GPIO_OUT);
58
+    if (error != MRAA_SUCCESS) {
59
+        mraa_result_print(error);
60 60
     }
61 61
 }
62 62
 
63 63
 MY9221::~MY9221() {
64
-    maa_result_t error = MAA_SUCCESS;
65
-    error = maa_gpio_close (m_dataPinCtx);
66
-    if (error != MAA_SUCCESS) {
67
-        maa_result_print(error);
64
+    mraa_result_t error = MRAA_SUCCESS;
65
+    error = mraa_gpio_close (m_dataPinCtx);
66
+    if (error != MRAA_SUCCESS) {
67
+        mraa_result_print(error);
68 68
     }
69
-    error = maa_gpio_close (m_clkPinCtx);
70
-    if (error != MAA_SUCCESS) {
71
-        maa_result_print(error);
69
+    error = mraa_gpio_close (m_clkPinCtx);
70
+    if (error != MRAA_SUCCESS) {
71
+        mraa_result_print(error);
72 72
     }
73 73
 }
74 74
 
75
-maa_result_t
75
+mraa_result_t
76 76
 MY9221::setBarLevel (uint8_t level) {
77 77
     if (level > 10) {
78
-        return MAA_ERROR_INVALID_PARAMETER;
78
+        return MRAA_ERROR_INVALID_PARAMETER;
79 79
     }
80 80
 
81 81
     send16bitBlock (CMDMODE);
@@ -86,25 +86,25 @@ MY9221::setBarLevel (uint8_t level) {
86 86
     lockData ();
87 87
 }
88 88
 
89
-maa_result_t
89
+mraa_result_t
90 90
 MY9221::lockData () {
91
-    maa_result_t error = MAA_SUCCESS;
92
-    error = maa_gpio_write (m_dataPinCtx, LOW);
91
+    mraa_result_t error = MRAA_SUCCESS;
92
+    error = mraa_gpio_write (m_dataPinCtx, LOW);
93 93
     usleep(100);
94 94
     
95 95
     for(int idx = 0; idx < 4; idx++) {
96
-        error = maa_gpio_write (m_dataPinCtx, HIGH);
97
-        error = maa_gpio_write (m_dataPinCtx, LOW);
96
+        error = mraa_gpio_write (m_dataPinCtx, HIGH);
97
+        error = mraa_gpio_write (m_dataPinCtx, LOW);
98 98
     }
99 99
 }
100 100
 
101
-maa_result_t
101
+mraa_result_t
102 102
 MY9221::send16bitBlock (short data) {
103
-    maa_result_t error = MAA_SUCCESS;
103
+    mraa_result_t error = MRAA_SUCCESS;
104 104
     for (uint8_t bit_idx = 0; bit_idx < MAX_BIT_PER_BLOCK; bit_idx++) {
105 105
         uint32_t state = (data & 0x8000) ? HIGH : LOW;
106
-        error = maa_gpio_write (m_dataPinCtx, state);
107
-        state = maa_gpio_read (m_clkPinCtx);
106
+        error = mraa_gpio_write (m_dataPinCtx, state);
107
+        state = mraa_gpio_read (m_clkPinCtx);
108 108
 
109 109
         if (state) {
110 110
             state = LOW;
@@ -112,7 +112,7 @@ MY9221::send16bitBlock (short data) {
112 112
             state = HIGH;
113 113
         }
114 114
 
115
-        error = maa_gpio_write (m_clkPinCtx, state);
115
+        error = mraa_gpio_write (m_clkPinCtx, state);
116 116
 
117 117
         data <<= 1;
118 118
     }

+ 7
- 7
src/my9221/my9221.h View File

@@ -24,8 +24,8 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/aio.h>
28
-#include <maa/gpio.h>
27
+#include <mraa/aio.h>
28
+#include <mraa/gpio.h>
29 29
 
30 30
 #define MAX_BIT_PER_BLOCK     16
31 31
 #define CMDMODE               0x0000
@@ -64,7 +64,7 @@ class MY9221 {
64 64
          *
65 65
          * @param level selected level for the bar (1 - 10)
66 66
          */
67
-        maa_result_t setBarLevel (uint8_t level);
67
+        mraa_result_t setBarLevel (uint8_t level);
68 68
 
69 69
         /**
70 70
          * Return name of the component
@@ -74,12 +74,12 @@ class MY9221 {
74 74
             return m_name;
75 75
         }
76 76
     private:
77
-        maa_result_t lockData ();
78
-        maa_result_t send16bitBlock (short data);
77
+        mraa_result_t lockData ();
78
+        mraa_result_t send16bitBlock (short data);
79 79
 
80 80
         std::string m_name;
81
-        maa_gpio_context m_clkPinCtx;
82
-        maa_gpio_context m_dataPinCtx;
81
+        mraa_gpio_context m_clkPinCtx;
82
+        mraa_gpio_context m_dataPinCtx;
83 83
 };
84 84
 
85 85
 }

+ 39
- 39
src/nrf24l01/nrf24l01.cxx View File

@@ -31,58 +31,58 @@
31 31
 using namespace upm;
32 32
 
33 33
 NRF24l01::NRF24l01 (uint8_t cs) {
34
-    maa_init();
34
+    mraa_init();
35 35
     nrfInitModule (cs, 8);
36 36
 }
37 37
 
38 38
 NRF24l01::~NRF24l01 () {
39
-    maa_result_t error = MAA_SUCCESS;
40
-    error = maa_spi_stop(m_spi);
41
-    if (error != MAA_SUCCESS) {
42
-        maa_result_print(error);
39
+    mraa_result_t error = MRAA_SUCCESS;
40
+    error = mraa_spi_stop(m_spi);
41
+    if (error != MRAA_SUCCESS) {
42
+        mraa_result_print(error);
43 43
     }
44
-    error = maa_gpio_close (m_cePinCtx);
45
-    if (error != MAA_SUCCESS) {
46
-        maa_result_print(error);
44
+    error = mraa_gpio_close (m_cePinCtx);
45
+    if (error != MRAA_SUCCESS) {
46
+        mraa_result_print(error);
47 47
     }
48
-    error = maa_gpio_close (m_csnPinCtx);
49
-    if (error != MAA_SUCCESS) {
50
-        maa_result_print(error);
48
+    error = mraa_gpio_close (m_csnPinCtx);
49
+    if (error != MRAA_SUCCESS) {
50
+        mraa_result_print(error);
51 51
     }
52 52
 }
53 53
 
54 54
 void
55 55
 NRF24l01::nrfInitModule (uint8_t chip_select, uint8_t chip_enable) {
56
-    maa_result_t error = MAA_SUCCESS;
56
+    mraa_result_t error = MRAA_SUCCESS;
57 57
 
58 58
     m_csn         = chip_select;
59 59
     m_ce         = chip_enable;
60 60
     m_channel     = 1;
61 61
 
62
-    m_csnPinCtx = maa_gpio_init (m_csn);
62
+    m_csnPinCtx = mraa_gpio_init (m_csn);
63 63
     if (m_csnPinCtx == NULL) {
64 64
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_csn);
65 65
         exit (1);
66 66
     }
67 67
 
68
-    m_cePinCtx = maa_gpio_init (m_ce);
68
+    m_cePinCtx = mraa_gpio_init (m_ce);
69 69
     if (m_cePinCtx == NULL) {
70 70
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_ce);
71 71
         exit (1);
72 72
     }
73 73
 
74
-    error = maa_gpio_dir (m_csnPinCtx, MAA_GPIO_OUT);
75
-    if (error != MAA_SUCCESS) {
76
-        maa_result_print (error);
74
+    error = mraa_gpio_dir (m_csnPinCtx, MRAA_GPIO_OUT);
75
+    if (error != MRAA_SUCCESS) {
76
+        mraa_result_print (error);
77 77
     }
78 78
 
79
-    error = maa_gpio_dir (m_cePinCtx, MAA_GPIO_OUT);
80
-    if (error != MAA_SUCCESS) {
81
-        maa_result_print (error);
79
+    error = mraa_gpio_dir (m_cePinCtx, MRAA_GPIO_OUT);
80
+    if (error != MRAA_SUCCESS) {
81
+        mraa_result_print (error);
82 82
     }
83 83
 
84 84
     nrfCELow ();
85
-    m_spi = maa_spi_init (0);
85
+    m_spi = mraa_spi_init (0);
86 86
 }
87 87
 
88 88
 void
@@ -105,8 +105,8 @@ NRF24l01::nrfConfigModule() {
105 105
 void
106 106
 NRF24l01::nrfConfigRegister(uint8_t reg, uint8_t value) {
107 107
     nrfCSOn ();
108
-    maa_spi_write (m_spi, W_REGISTER | (REGISTER_MASK & reg));
109
-    maa_spi_write (m_spi, value);
108
+    mraa_spi_write (m_spi, W_REGISTER | (REGISTER_MASK & reg));
109
+    mraa_spi_write (m_spi, value);
110 110
     nrfCSOff ();
111 111
 }
112 112
 
@@ -122,7 +122,7 @@ NRF24l01::nrfPowerUpRX() {
122 122
 void
123 123
 NRF24l01::nrfFlushRX() {
124 124
     nrfCSOn ();
125
-    maa_spi_write (m_spi, FLUSH_RX);
125
+    mraa_spi_write (m_spi, FLUSH_RX);
126 126
     nrfCSOff ();
127 127
 }
128 128
 
@@ -160,7 +160,7 @@ void
160 160
 NRF24l01::nrfWriteRegister(uint8_t reg, uint8_t * value, uint8_t len)
161 161
 {
162 162
     nrfCSOn ();
163
-    maa_spi_write (m_spi, W_REGISTER | (REGISTER_MASK & reg));
163
+    mraa_spi_write (m_spi, W_REGISTER | (REGISTER_MASK & reg));
164 164
     nrfTransmitSync(value, len);
165 165
     nrfCSOff ();
166 166
 }
@@ -169,7 +169,7 @@ void
169 169
 NRF24l01::nrfTransmitSync(uint8_t *dataout, uint8_t len){
170 170
     uint8_t i;
171 171
     for(i = 0; i < len; i++) {
172
-        maa_spi_write (m_spi, dataout[i]);
172
+        mraa_spi_write (m_spi, dataout[i]);
173 173
     }
174 174
 }
175 175
 
@@ -196,7 +196,7 @@ void
196 196
 NRF24l01::nrfReadRegister (uint8_t reg, uint8_t * value, uint8_t len)
197 197
 {
198 198
     nrfCSOn ();
199
-    maa_spi_write (m_spi, R_REGISTER | (REGISTER_MASK & reg));
199
+    mraa_spi_write (m_spi, R_REGISTER | (REGISTER_MASK & reg));
200 200
     nrfTransferSync (value, value, len);
201 201
     nrfCSOff ();
202 202
 }
@@ -205,7 +205,7 @@ void
205 205
 NRF24l01::nrfTransferSync (uint8_t *dataout,uint8_t *datain,uint8_t len) {
206 206
     uint8_t i;
207 207
     for(i = 0;i < len;i++) {
208
-        datain[i] = maa_spi_write (m_spi, dataout[i]);
208
+        datain[i] = mraa_spi_write (m_spi, dataout[i]);
209 209
     }
210 210
 }
211 211
 
@@ -222,7 +222,7 @@ NRF24l01::nrfGetData (uint8_t * data)
222 222
 {
223 223
     nrfCSOn ();
224 224
     /* Send cmd to read rx payload */
225
-    maa_spi_write (m_spi, R_RX_PAYLOAD);
225
+    mraa_spi_write (m_spi, R_RX_PAYLOAD);
226 226
     /* Read payload */
227 227
     nrfTransferSync(data, data, m_payload);
228 228
     nrfCSOff ();
@@ -248,11 +248,11 @@ NRF24l01::nrfSend(uint8_t * value) {
248 248
     nrfCELow();
249 249
     nrfPowerUpTX();                            // Set to transmitter mode , Power up
250 250
     nrfCSOn ();
251
-    maa_spi_write (m_spi, FLUSH_TX);        // Write cmd to flush tx fifo
251
+    mraa_spi_write (m_spi, FLUSH_TX);        // Write cmd to flush tx fifo
252 252
     nrfCSOff ();
253 253
 
254 254
     nrfCSOn ();
255
-    maa_spi_write (m_spi, W_TX_PAYLOAD);     // Write cmd to write payload
255
+    mraa_spi_write (m_spi, W_TX_PAYLOAD);     // Write cmd to write payload
256 256
     nrfTransmitSync(value, m_payload);        // Write payload
257 257
     nrfCSOff ();
258 258
     nrfCEHigh();                            // Start transmission
@@ -290,24 +290,24 @@ NRF24l01::nrfPowerDown () {
290 290
     nrfConfigRegister (CONFIG, NRF_CONFIG);
291 291
 }
292 292
 
293
-maa_result_t
293
+mraa_result_t
294 294
 NRF24l01::nrfCEHigh () {
295
-    return maa_gpio_write (m_cePinCtx, HIGH);
295
+    return mraa_gpio_write (m_cePinCtx, HIGH);
296 296
 }
297 297
 
298
-maa_result_t
298
+mraa_result_t
299 299
 NRF24l01::nrfCELow () {
300
-    return maa_gpio_write (m_cePinCtx, LOW);
300
+    return mraa_gpio_write (m_cePinCtx, LOW);
301 301
 }
302 302
 
303
-maa_result_t
303
+mraa_result_t
304 304
 NRF24l01::nrfCSOn () {
305
-    return maa_gpio_write (m_csnPinCtx, LOW);
305
+    return mraa_gpio_write (m_csnPinCtx, LOW);
306 306
 }
307 307
 
308
-maa_result_t
308
+mraa_result_t
309 309
 NRF24l01::nrfCSOff () {
310
-    return maa_gpio_write (m_csnPinCtx, HIGH);
310
+    return mraa_gpio_write (m_csnPinCtx, HIGH);
311 311
 }
312 312
 
313 313
 void

+ 10
- 10
src/nrf24l01/nrf24l01.h View File

@@ -24,9 +24,9 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/aio.h>
28
-#include <maa/gpio.h>
29
-#include <maa/spi.h>
27
+#include <mraa/aio.h>
28
+#include <mraa/gpio.h>
29
+#include <mraa/spi.h>
30 30
 
31 31
 /* Memory Map */
32 32
 #define CONFIG              0x00
@@ -297,22 +297,22 @@ class NRF24l01 {
297 297
         /**
298 298
          * Set chip enable pin HIGH
299 299
          */
300
-        maa_result_t nrfCEHigh ();
300
+        mraa_result_t nrfCEHigh ();
301 301
 
302 302
         /**
303 303
          * Set chip enable LOW
304 304
          */
305
-        maa_result_t nrfCELow ();
305
+        mraa_result_t nrfCELow ();
306 306
 
307 307
         /**
308 308
          * Set chip select pin LOW
309 309
          */
310
-        maa_result_t nrfCSOn ();
310
+        mraa_result_t nrfCSOn ();
311 311
 
312 312
         /**
313 313
          * Set chip select pin HIGH
314 314
          */
315
-        maa_result_t nrfCSOff ();
315
+        mraa_result_t nrfCSOff ();
316 316
 
317 317
         /**
318 318
          * Flush reciver stack
@@ -330,7 +330,7 @@ class NRF24l01 {
330 330
 
331 331
         funcPtrVoidVoid dataRecievedHandler; /**< Data arrived handler */
332 332
     private:
333
-        maa_spi_context        m_spi;
333
+        mraa_spi_context        m_spi;
334 334
         uint8_t                m_ce;
335 335
         uint8_t                m_csn;
336 336
         uint8_t                m_channel;
@@ -338,8 +338,8 @@ class NRF24l01 {
338 338
         uint8_t                m_payload;
339 339
         uint8_t                m_localAddress[5];
340 340
 
341
-        maa_gpio_context     m_csnPinCtx;
342
-        maa_gpio_context     m_cePinCtx;
341
+        mraa_gpio_context     m_csnPinCtx;
342
+        mraa_gpio_context     m_cePinCtx;
343 343
 
344 344
         std::string         m_name;
345 345
 };

+ 3
- 3
src/pulsensor/pulsensor.cxx View File

@@ -29,7 +29,7 @@
29 29
 void init_pulsensor (pulsensor_context * ctx, callback_handler handler) {
30 30
     ctx->callback = handler;
31 31
     
32
-    ctx->pin_ctx = maa_aio_init(0);
32
+    ctx->pin_ctx = mraa_aio_init(0);
33 33
     
34 34
     ctx->sample_counter = 0;
35 35
     ctx->last_beat_time = 0;
@@ -63,8 +63,8 @@ void * do_sample (void * arg) {
63 63
     clbk_data callback_data;
64 64
     while (ctx_counter) {
65 65
         pulsensor_context * ctx = (pulsensor_context *) arg;
66
-        maa_aio_context pin = ctx->pin_ctx;
67
-        data_from_sensor = maa_aio_read (pin);
66
+        mraa_aio_context pin = ctx->pin_ctx;
67
+        data_from_sensor = mraa_aio_read (pin);
68 68
         ctx->ret = FALSE;
69 69
         
70 70
         ctx->sample_counter += 2;

+ 4
- 4
src/pulsensor/pulsensor.h View File

@@ -28,9 +28,9 @@
28 28
 
29 29
 #include <string>
30 30
 #include <math.h>
31
-#include <maa/pwm.h>
32
-#include <maa/aio.h>
33
-#include <maa/gpio.h>
31
+#include <mraa/pwm.h>
32
+#include <mraa/aio.h>
33
+#include <mraa/gpio.h>
34 34
 #include <pthread.h>
35 35
 
36 36
 #define HIGH               1
@@ -62,7 +62,7 @@ struct pulsensor_context {
62 62
     uint8_t          second_beat;
63 63
     uint8_t          pin;
64 64
     uint8_t          ret;
65
-    maa_aio_context  pin_ctx;
65
+    mraa_aio_context  pin_ctx;
66 66
     
67 67
     callback_handler callback;
68 68
 };

+ 10
- 10
src/servo/servo.cxx View File

@@ -32,7 +32,7 @@
32 32
 using namespace upm;
33 33
 
34 34
 Servo::Servo (int pin) {
35
-    maa_result_t error = MAA_SUCCESS;
35
+    mraa_result_t error = MRAA_SUCCESS;
36 36
 
37 37
     m_minPulseWidth   = MIN_PULSE_WIDTH;
38 38
     m_maxPulseWidth   = MAX_PULSE_WIDTH;
@@ -40,7 +40,7 @@ Servo::Servo (int pin) {
40 40
 
41 41
     m_maxAngle        = 180.0;
42 42
     m_servoPin        = pin;
43
-    m_pwmServoContext = maa_pwm_init (m_servoPin);
43
+    m_pwmServoContext = mraa_pwm_init (m_servoPin);
44 44
     
45 45
     m_currAngle = 180;
46 46
     
@@ -48,7 +48,7 @@ Servo::Servo (int pin) {
48 48
 }
49 49
 
50 50
 Servo::~Servo () {
51
-    maa_pwm_close (m_pwmServoContext);
51
+    mraa_pwm_close (m_pwmServoContext);
52 52
 }
53 53
 
54 54
 /*
@@ -62,14 +62,14 @@ Servo::~Servo () {
62 62
  * Max period can be only 7968750(nses) which is ~8(msec)
63 63
  * so the servo wil not work as expected.
64 64
  * */
65
-maa_result_t Servo::setAngle (int angle) {
65
+mraa_result_t Servo::setAngle (int angle) {
66 66
     if (m_pwmServoContext == NULL) {
67 67
         std::cout << "PWM context is NULL" << std::endl;
68
-        return MAA_ERROR_UNSPECIFIED;
68
+        return MRAA_ERROR_UNSPECIFIED;
69 69
     }
70 70
     
71 71
     if (angle > m_maxAngle || angle < 0) {
72
-        return MAA_ERROR_UNSPECIFIED;
72
+        return MRAA_ERROR_UNSPECIFIED;
73 73
     }
74 74
 
75 75
     int period = (m_maxPulseWidth - m_minPulseWidth) / m_maxAngle;
@@ -78,12 +78,12 @@ maa_result_t Servo::setAngle (int angle) {
78 78
 
79 79
     // int cycles = (int)(100.0 * ((float)angle / (float)m_maxAngle));
80 80
 
81
-    maa_pwm_enable (m_pwmServoContext, 1);
81
+    mraa_pwm_enable (m_pwmServoContext, 1);
82 82
     for (int cycle = 0; cycle < cycles; cycle++) {
83
-        maa_pwm_period_us (m_pwmServoContext, m_maxPeriod);
84
-        maa_pwm_pulsewidth_us (m_pwmServoContext, calcPulseTraveling(angle));
83
+        mraa_pwm_period_us (m_pwmServoContext, m_maxPeriod);
84
+        mraa_pwm_pulsewidth_us (m_pwmServoContext, calcPulseTraveling(angle));
85 85
     }
86
-    maa_pwm_enable (m_pwmServoContext, 0);
86
+    mraa_pwm_enable (m_pwmServoContext, 0);
87 87
 
88 88
     std::cout << "angle = " << angle << " ,pulse = " << calcPulseTraveling(angle) << ", cycles " << cycles << std::endl;
89 89
     

+ 3
- 3
src/servo/servo.h View File

@@ -24,7 +24,7 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/pwm.h>
27
+#include <mraa/pwm.h>
28 28
 
29 29
 namespace upm {
30 30
 
@@ -70,7 +70,7 @@ class Servo {
70 70
          *
71 71
          * @param angle number between 0 and 180
72 72
          */
73
-        maa_result_t setAngle (int angle);
73
+        mraa_result_t setAngle (int angle);
74 74
 
75 75
         /**
76 76
          * Return name of the component
@@ -122,7 +122,7 @@ class Servo {
122 122
         std::string         m_name;
123 123
         int                 m_servoPin;
124 124
         float               m_maxAngle;
125
-        maa_pwm_context     m_pwmServoContext;
125
+        mraa_pwm_context     m_pwmServoContext;
126 126
         int                 m_currAngle;
127 127
         
128 128
         int                 m_minPulseWidth;

+ 3
- 3
src/st7735/gfx.cxx View File

@@ -40,17 +40,17 @@ GFX::GFX (int width, int height, uint8_t * screenBuffer, const unsigned char * f
40 40
 GFX::~GFX () {
41 41
 }
42 42
 
43
-maa_result_t
43
+mraa_result_t
44 44
 GFX::setPixel (int x, int y, uint16_t color) {
45 45
     if((x < 0) ||(x >= m_width) || (y < 0) || (y >= m_height)) {
46
-        return MAA_ERROR_UNSPECIFIED;
46
+        return MRAA_ERROR_UNSPECIFIED;
47 47
     }
48 48
 
49 49
     int index = ((y * m_width) + x) * sizeof(uint16_t);
50 50
     m_map[index] = (uint8_t) (color >> 8);
51 51
     m_map[++index] = (uint8_t)(color);
52 52
 
53
-    return MAA_SUCCESS;
53
+    return MRAA_SUCCESS;
54 54
 }
55 55
 
56 56
 void

+ 2
- 2
src/st7735/gfx.h View File

@@ -27,7 +27,7 @@
27 27
 #include <stdio.h>
28 28
 #include <unistd.h>
29 29
 #include <stdint.h>
30
-#include <maa.h>
30
+#include <mraa.h>
31 31
 
32 32
 #define swap(a, b) { int16_t t = a; a = b; b = t; }
33 33
 
@@ -106,7 +106,7 @@ class GFX {
106 106
          * @param y axis on vertical scale
107 107
          * @param color pixel's color
108 108
          */
109
-        maa_result_t setPixel (int x, int y, uint16_t color);
109
+        mraa_result_t setPixel (int x, int y, uint16_t color);
110 110
 
111 111
         /**
112 112
          * Fill screen with selected color

+ 83
- 83
src/st7735/st7735.cxx View File

@@ -33,7 +33,7 @@
33 33
 using namespace upm;
34 34
 
35 35
 ST7735::ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst) : GFX (160, 128, m_map, font) {
36
-    maa_init();
36
+    mraa_init();
37 37
 
38 38
     m_csLCD = csLCD;
39 39
     m_cSD   = cSD;
@@ -45,84 +45,84 @@ ST7735::ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst) : GFX (160,
45 45
 }
46 46
 
47 47
 ST7735::~ST7735 () {
48
-    maa_result_t error = MAA_SUCCESS;
49
-    error = maa_spi_stop(m_spi);
50
-    if (error != MAA_SUCCESS) {
51
-        maa_result_print(error);
48
+    mraa_result_t error = MRAA_SUCCESS;
49
+    error = mraa_spi_stop(m_spi);
50
+    if (error != MRAA_SUCCESS) {
51
+        mraa_result_print(error);
52 52
     }
53
-    error = maa_gpio_close (m_csLCDPinCtx);
54
-    if (error != MAA_SUCCESS) {
55
-        maa_result_print(error);
53
+    error = mraa_gpio_close (m_csLCDPinCtx);
54
+    if (error != MRAA_SUCCESS) {
55
+        mraa_result_print(error);
56 56
     }
57
-    error = maa_gpio_close (m_cSDPinCtx);
58
-    if (error != MAA_SUCCESS) {
59
-        maa_result_print(error);
57
+    error = mraa_gpio_close (m_cSDPinCtx);
58
+    if (error != MRAA_SUCCESS) {
59
+        mraa_result_print(error);
60 60
     }
61
-    error = maa_gpio_close (m_rSTPinCtx);
62
-    if (error != MAA_SUCCESS) {
63
-        maa_result_print(error);
61
+    error = mraa_gpio_close (m_rSTPinCtx);
62
+    if (error != MRAA_SUCCESS) {
63
+        mraa_result_print(error);
64 64
     }
65
-    error = maa_gpio_close (m_rSPinCtx);
66
-    if (error != MAA_SUCCESS) {
67
-        maa_result_print(error);
65
+    error = mraa_gpio_close (m_rSPinCtx);
66
+    if (error != MRAA_SUCCESS) {
67
+        mraa_result_print(error);
68 68
     }
69 69
 }
70 70
 
71 71
 void
72 72
 ST7735::initModule () {
73
-    maa_result_t error = MAA_SUCCESS;
73
+    mraa_result_t error = MRAA_SUCCESS;
74 74
 
75 75
     m_height = 160;
76 76
     m_width  = 128;
77 77
 
78
-    m_csLCDPinCtx = maa_gpio_init (m_csLCD);
78
+    m_csLCDPinCtx = mraa_gpio_init (m_csLCD);
79 79
     if (m_csLCDPinCtx == NULL) {
80 80
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_csLCD);
81 81
         exit (1);
82 82
     }
83 83
 
84
-    m_cSDPinCtx = maa_gpio_init (m_cSD);
84
+    m_cSDPinCtx = mraa_gpio_init (m_cSD);
85 85
     if (m_cSDPinCtx == NULL) {
86 86
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_cSD);
87 87
         exit (1);
88 88
     }
89 89
 
90
-    m_rSTPinCtx = maa_gpio_init (m_rST);
90
+    m_rSTPinCtx = mraa_gpio_init (m_rST);
91 91
     if (m_rSTPinCtx == NULL) {
92 92
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_rST);
93 93
         exit (1);
94 94
     }
95 95
 
96
-    m_rSPinCtx = maa_gpio_init (m_rS);
96
+    m_rSPinCtx = mraa_gpio_init (m_rS);
97 97
     if (m_rSPinCtx == NULL) {
98 98
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_rS);
99 99
         exit (1);
100 100
     }
101 101
 
102
-    error = maa_gpio_dir (m_csLCDPinCtx, MAA_GPIO_OUT);
103
-    if (error != MAA_SUCCESS) {
104
-        maa_result_print (error);
102
+    error = mraa_gpio_dir (m_csLCDPinCtx, MRAA_GPIO_OUT);
103
+    if (error != MRAA_SUCCESS) {
104
+        mraa_result_print (error);
105 105
     }
106 106
 
107
-    error = maa_gpio_dir (m_cSDPinCtx, MAA_GPIO_OUT);
108
-    if (error != MAA_SUCCESS) {
109
-        maa_result_print (error);
107
+    error = mraa_gpio_dir (m_cSDPinCtx, MRAA_GPIO_OUT);
108
+    if (error != MRAA_SUCCESS) {
109
+        mraa_result_print (error);
110 110
     }
111 111
 
112
-    error = maa_gpio_dir (m_rSTPinCtx, MAA_GPIO_OUT);
113
-    if (error != MAA_SUCCESS) {
114
-        maa_result_print (error);
112
+    error = mraa_gpio_dir (m_rSTPinCtx, MRAA_GPIO_OUT);
113
+    if (error != MRAA_SUCCESS) {
114
+        mraa_result_print (error);
115 115
     }
116 116
 
117
-    error = maa_gpio_dir (m_rSPinCtx, MAA_GPIO_OUT);
118
-    if (error != MAA_SUCCESS) {
119
-        maa_result_print (error);
117
+    error = mraa_gpio_dir (m_rSPinCtx, MRAA_GPIO_OUT);
118
+    if (error != MRAA_SUCCESS) {
119
+        mraa_result_print (error);
120 120
     }
121 121
 
122
-    m_spi = maa_spi_init (0);
123
-    error = maa_spi_frequency(m_spi, 15 * 1000000);
124
-    if (error != MAA_SUCCESS) {
125
-        maa_result_print (error);
122
+    m_spi = mraa_spi_init (0);
123
+    error = mraa_spi_frequency(m_spi, 15 * 1000000);
124
+    if (error != MRAA_SUCCESS) {
125
+        mraa_result_print (error);
126 126
     }
127 127
 
128 128
     lcdCSOn ();
@@ -131,13 +131,13 @@ ST7735::initModule () {
131 131
 void
132 132
 ST7735::write (uint8_t value) {
133 133
     rsLOW ();
134
-    maa_spi_write (m_spi, value);
134
+    mraa_spi_write (m_spi, value);
135 135
 }
136 136
 
137 137
 void
138 138
 ST7735::data (uint8_t value) {
139 139
     rsHIGH ();
140
-    maa_spi_write (m_spi, value);
140
+    mraa_spi_write (m_spi, value);
141 141
 }
142 142
 
143 143
 void
@@ -177,7 +177,7 @@ ST7735::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
177 177
     m_spiBuffer[1] = x0 + colstart;             // XSTART
178 178
     m_spiBuffer[2] = 0x00;
179 179
     m_spiBuffer[3] = x1 + colstart;             // XEND
180
-    maa_spi_write_buf(m_spi, m_spiBuffer, 4);
180
+    mraa_spi_write_buf(m_spi, m_spiBuffer, 4);
181 181
 
182 182
     write (ST7735_RASET);                       // Row addr set
183 183
 
@@ -186,14 +186,14 @@ ST7735::setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) {
186 186
     m_spiBuffer[1] = y0 + rowstart;             // YSTART
187 187
     m_spiBuffer[2] = 0x00;
188 188
     m_spiBuffer[3] = y1 + rowstart;             // YEND
189
-    maa_spi_write_buf(m_spi, m_spiBuffer, 4);
189
+    mraa_spi_write_buf(m_spi, m_spiBuffer, 4);
190 190
 
191 191
     write (ST7735_RAMWR);                       // write to RAM
192 192
 }
193 193
 
194 194
 void
195 195
 ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
196
-    if (MAA_SUCCESS != setPixel (x, y, color)) {
196
+    if (MRAA_SUCCESS != setPixel (x, y, color)) {
197 197
         return;
198 198
     }
199 199
 
@@ -206,7 +206,7 @@ ST7735::refresh () {
206 206
 
207 207
     int fragmentSize = m_height * m_width * 2 / 20;
208 208
     for (int fragment = 0; fragment < 20; fragment++) {
209
-        maa_spi_write_buf(m_spi, &m_map[fragment * fragmentSize], fragmentSize);
209
+        mraa_spi_write_buf(m_spi, &m_map[fragment * fragmentSize], fragmentSize);
210 210
     }
211 211
 }
212 212
 
@@ -216,11 +216,11 @@ ST7735::configModule() {
216 216
     lcdCSOff ();
217 217
     lcdCSOn ();
218 218
 
219
-    maa_gpio_write (m_rSTPinCtx, HIGH);
219
+    mraa_gpio_write (m_rSTPinCtx, HIGH);
220 220
     usleep (500000);
221
-    maa_gpio_write (m_rSTPinCtx, LOW);
221
+    mraa_gpio_write (m_rSTPinCtx, LOW);
222 222
     usleep (500000);
223
-    maa_gpio_write (m_rSTPinCtx, HIGH);
223
+    mraa_gpio_write (m_rSTPinCtx, HIGH);
224 224
     usleep (500000);
225 225
 
226 226
     executeCMDList (Rcmd1);
@@ -236,83 +236,83 @@ ST7735::configModule() {
236 236
     refresh ();
237 237
 }
238 238
 
239
-maa_result_t
239
+mraa_result_t
240 240
 ST7735::lcdCSOn () {
241
-    maa_result_t error = MAA_SUCCESS;
241
+    mraa_result_t error = MRAA_SUCCESS;
242 242
 
243
-    error = maa_gpio_write (m_csLCDPinCtx, LOW);
244
-    if (error != MAA_SUCCESS) {
245
-        maa_result_print (error);
243
+    error = mraa_gpio_write (m_csLCDPinCtx, LOW);
244
+    if (error != MRAA_SUCCESS) {
245
+        mraa_result_print (error);
246 246
     }
247 247
 
248
-    error = maa_gpio_write (m_cSDPinCtx, HIGH);
249
-    if (error != MAA_SUCCESS) {
250
-        maa_result_print (error);
248
+    error = mraa_gpio_write (m_cSDPinCtx, HIGH);
249
+    if (error != MRAA_SUCCESS) {
250
+        mraa_result_print (error);
251 251
     }
252 252
 
253 253
     return error;
254 254
 }
255 255
 
256
-maa_result_t
256
+mraa_result_t
257 257
 ST7735::lcdCSOff () {
258
-    maa_result_t error = MAA_SUCCESS;
258
+    mraa_result_t error = MRAA_SUCCESS;
259 259
 
260
-    error = maa_gpio_write (m_csLCDPinCtx, HIGH);
261
-    if (error != MAA_SUCCESS) {
262
-        maa_result_print (error);
260
+    error = mraa_gpio_write (m_csLCDPinCtx, HIGH);
261
+    if (error != MRAA_SUCCESS) {
262
+        mraa_result_print (error);
263 263
     }
264 264
 
265 265
     return error;
266 266
 }
267 267
 
268
-maa_result_t
268
+mraa_result_t
269 269
 ST7735::sdCSOn () {
270
-    maa_result_t error = MAA_SUCCESS;
270
+    mraa_result_t error = MRAA_SUCCESS;
271 271
 
272
-    error = maa_gpio_write (m_cSDPinCtx, LOW);
273
-    if (error != MAA_SUCCESS) {
274
-        maa_result_print (error);
272
+    error = mraa_gpio_write (m_cSDPinCtx, LOW);
273
+    if (error != MRAA_SUCCESS) {
274
+        mraa_result_print (error);
275 275
     }
276 276
 
277
-    error = maa_gpio_write (m_csLCDPinCtx, HIGH);
278
-    if (error != MAA_SUCCESS) {
279
-        maa_result_print (error);
277
+    error = mraa_gpio_write (m_csLCDPinCtx, HIGH);
278
+    if (error != MRAA_SUCCESS) {
279
+        mraa_result_print (error);
280 280
     }
281 281
 
282 282
     return error;
283 283
 }
284 284
 
285
-maa_result_t
285
+mraa_result_t
286 286
 ST7735::sdCSOff () {
287
-    maa_result_t error = MAA_SUCCESS;
287
+    mraa_result_t error = MRAA_SUCCESS;
288 288
 
289
-    error = maa_gpio_write (m_cSDPinCtx, HIGH);
290
-    if (error != MAA_SUCCESS) {
291
-        maa_result_print (error);
289
+    error = mraa_gpio_write (m_cSDPinCtx, HIGH);
290
+    if (error != MRAA_SUCCESS) {
291
+        mraa_result_print (error);
292 292
     }
293 293
 
294 294
     return error;
295 295
 }
296 296
 
297
-maa_result_t
297
+mraa_result_t
298 298
 ST7735::rsHIGH () {
299
-    maa_result_t error = MAA_SUCCESS;
299
+    mraa_result_t error = MRAA_SUCCESS;
300 300
 
301
-    error = maa_gpio_write (m_rSPinCtx, HIGH);
302
-    if (error != MAA_SUCCESS) {
303
-        maa_result_print (error);
301
+    error = mraa_gpio_write (m_rSPinCtx, HIGH);
302
+    if (error != MRAA_SUCCESS) {
303
+        mraa_result_print (error);
304 304
     }
305 305
 
306 306
     return error;
307 307
 }
308 308
 
309
-maa_result_t
309
+mraa_result_t
310 310
 ST7735::rsLOW () {
311
-    maa_result_t error = MAA_SUCCESS;
311
+    mraa_result_t error = MRAA_SUCCESS;
312 312
 
313
-    error = maa_gpio_write (m_rSPinCtx, LOW);
314
-    if (error != MAA_SUCCESS) {
315
-        maa_result_print (error);
313
+    error = mraa_gpio_write (m_rSPinCtx, LOW);
314
+    if (error != MRAA_SUCCESS) {
315
+        mraa_result_print (error);
316 316
     }
317 317
 
318 318
     return error;

+ 14
- 14
src/st7735/st7735.h View File

@@ -27,9 +27,9 @@
27 27
 #pragma once
28 28
 
29 29
 #include <string>
30
-#include <maa/aio.h>
31
-#include <maa/gpio.h>
32
-#include <maa/spi.h>
30
+#include <mraa/aio.h>
31
+#include <mraa/gpio.h>
32
+#include <mraa/spi.h>
33 33
 #include <gfx.h>
34 34
 
35 35
 #define INITR_GREENTAB      0x0
@@ -584,45 +584,45 @@ class ST7735 : public GFX {
584 584
         /**
585 585
          * LCD chip select LOW.
586 586
          */
587
-        maa_result_t lcdCSOn ();
587
+        mraa_result_t lcdCSOn ();
588 588
 
589 589
         /**
590 590
          * LCD chip select HIGH.
591 591
          */
592
-        maa_result_t lcdCSOff ();
592
+        mraa_result_t lcdCSOff ();
593 593
 
594 594
         /**
595 595
          * CD card chip select LOW.
596 596
          */
597
-        maa_result_t sdCSOn ();
597
+        mraa_result_t sdCSOn ();
598 598
 
599 599
         /**
600 600
          * CD card select HIGH.
601 601
          */
602
-        maa_result_t sdCSOff ();
602
+        mraa_result_t sdCSOff ();
603 603
 
604 604
         /**
605 605
          * Data select HIGH.
606 606
          */
607
-        maa_result_t rsHIGH ();
607
+        mraa_result_t rsHIGH ();
608 608
 
609 609
         /**
610 610
          * Data select LOW.
611 611
          */
612
-        maa_result_t rsLOW ();
612
+        mraa_result_t rsLOW ();
613 613
 
614 614
         uint8_t m_map[160 * 128 * 2]; /**< Screens buffer */
615 615
     private:
616
-        maa_spi_context      m_spi;
616
+        mraa_spi_context      m_spi;
617 617
         uint8_t              m_csLCD;
618 618
         uint8_t              m_cSD;
619 619
         uint8_t              m_rST;
620 620
         uint8_t              m_rS;
621 621
 
622
-        maa_gpio_context     m_csLCDPinCtx;
623
-        maa_gpio_context     m_cSDPinCtx;
624
-        maa_gpio_context     m_rSTPinCtx;
625
-        maa_gpio_context     m_rSPinCtx;
622
+        mraa_gpio_context     m_csLCDPinCtx;
623
+        mraa_gpio_context     m_cSDPinCtx;
624
+        mraa_gpio_context     m_rSTPinCtx;
625
+        mraa_gpio_context     m_rSPinCtx;
626 626
 
627 627
         uint8_t              m_spiBuffer[32];
628 628
 

+ 30
- 30
src/stepmotor/stepmotor.cxx View File

@@ -31,35 +31,35 @@
31 31
 using namespace upm;
32 32
 
33 33
 StepMotor::StepMotor (int dirPin, int stePin) {
34
-    maa_result_t error = MAA_SUCCESS;
34
+    mraa_result_t error = MRAA_SUCCESS;
35 35
     m_name = "StepMotor";
36 36
 
37
-    maa_init();
37
+    mraa_init();
38 38
 
39 39
     m_stePin = stePin;
40 40
     m_dirPin = dirPin;
41 41
 
42
-    m_pwmStepContext = maa_pwm_init (m_stePin);
43
-    m_dirPinCtx = maa_gpio_init (m_dirPin);
42
+    m_pwmStepContext = mraa_pwm_init (m_stePin);
43
+    m_dirPinCtx = mraa_gpio_init (m_dirPin);
44 44
     if (m_dirPinCtx == NULL) {
45 45
         fprintf (stderr, "Are you sure that pin%d you requested is valid on your platform?", m_dirPin);
46 46
         exit (1);
47 47
     }
48 48
 
49
-    error = maa_gpio_dir (m_dirPinCtx, MAA_GPIO_OUT);
50
-    if (error != MAA_SUCCESS) {
51
-        maa_result_print (error);
49
+    error = mraa_gpio_dir (m_dirPinCtx, MRAA_GPIO_OUT);
50
+    if (error != MRAA_SUCCESS) {
51
+        mraa_result_print (error);
52 52
     }
53 53
 }
54 54
 
55 55
 StepMotor::~StepMotor() {
56
-    maa_result_t error = MAA_SUCCESS;
56
+    mraa_result_t error = MRAA_SUCCESS;
57 57
 
58
-    maa_pwm_close (m_pwmStepContext);
58
+    mraa_pwm_close (m_pwmStepContext);
59 59
 
60
-    error = maa_gpio_close (m_dirPinCtx);
61
-    if (error != MAA_SUCCESS) {
62
-        maa_result_print(error);
60
+    error = mraa_gpio_close (m_dirPinCtx);
61
+    if (error != MRAA_SUCCESS) {
62
+        mraa_result_print(error);
63 63
     }
64 64
 }
65 65
 
@@ -76,51 +76,51 @@ StepMotor::setSpeed (int speed) {
76 76
     m_speed = speed;
77 77
 }
78 78
 
79
-maa_result_t
79
+mraa_result_t
80 80
 StepMotor::stepForward (int ticks) {
81 81
     dirForward ();
82 82
     move (ticks);
83 83
 }
84 84
 
85
-maa_result_t
85
+mraa_result_t
86 86
 StepMotor::stepBackwards (int ticks) {
87 87
     dirBackwards ();
88 88
     move (ticks);
89 89
 }
90 90
 
91
-maa_result_t
91
+mraa_result_t
92 92
 StepMotor::move (int ticks) {
93
-    maa_result_t error = MAA_SUCCESS;
93
+    mraa_result_t error = MRAA_SUCCESS;
94 94
 
95
-    maa_pwm_enable (m_pwmStepContext, 1);
95
+    mraa_pwm_enable (m_pwmStepContext, 1);
96 96
     for (int tick = 0; tick < ticks; tick++) {
97
-        maa_pwm_period_us (m_pwmStepContext, m_speed);
98
-        maa_pwm_pulsewidth_us (m_pwmStepContext, PULSEWIDTH);
97
+        mraa_pwm_period_us (m_pwmStepContext, m_speed);
98
+        mraa_pwm_pulsewidth_us (m_pwmStepContext, PULSEWIDTH);
99 99
     }
100
-    maa_pwm_enable (m_pwmStepContext, 0);
100
+    mraa_pwm_enable (m_pwmStepContext, 0);
101 101
 
102 102
     return error;
103 103
 }
104 104
 
105
-maa_result_t
105
+mraa_result_t
106 106
 StepMotor::dirForward () {
107
-    maa_result_t error = MAA_SUCCESS;
107
+    mraa_result_t error = MRAA_SUCCESS;
108 108
 
109
-    error = maa_gpio_write (m_dirPinCtx, HIGH);
110
-    if (error != MAA_SUCCESS) {
111
-        maa_result_print (error);
109
+    error = mraa_gpio_write (m_dirPinCtx, HIGH);
110
+    if (error != MRAA_SUCCESS) {
111
+        mraa_result_print (error);
112 112
     }
113 113
 
114 114
     return error;
115 115
 }
116 116
 
117
-maa_result_t
117
+mraa_result_t
118 118
 StepMotor::dirBackwards () {
119
-    maa_result_t error = MAA_SUCCESS;
119
+    mraa_result_t error = MRAA_SUCCESS;
120 120
 
121
-    error = maa_gpio_write (m_dirPinCtx, LOW);
122
-    if (error != MAA_SUCCESS) {
123
-        maa_result_print (error);
121
+    error = mraa_gpio_write (m_dirPinCtx, LOW);
122
+    if (error != MRAA_SUCCESS) {
123
+        mraa_result_print (error);
124 124
     }
125 125
 
126 126
     return error;

+ 10
- 10
src/stepmotor/stepmotor.h View File

@@ -28,9 +28,9 @@
28 28
 
29 29
 #include <string>
30 30
 #include <math.h>
31
-#include <maa/pwm.h>
32
-#include <maa/aio.h>
33
-#include <maa/gpio.h>
31
+#include <mraa/pwm.h>
32
+#include <mraa/aio.h>
33
+#include <mraa/gpio.h>
34 34
 
35 35
 #define MIN_PERIOD         500
36 36
 #define MAX_PERIOD         1000
@@ -75,14 +75,14 @@ class StepMotor {
75 75
          *
76 76
          * @param ticks number of tickes the motor will move
77 77
          */
78
-        maa_result_t stepForward (int ticks);
78
+        mraa_result_t stepForward (int ticks);
79 79
 
80 80
         /**
81 81
          * Rotate motor backward
82 82
          *
83 83
          * @param ticks number of tickes the motor will move
84 84
          */
85
-        maa_result_t stepBackwards (int ticks);
85
+        mraa_result_t stepBackwards (int ticks);
86 86
 
87 87
     private:
88 88
         std::string         m_name;
@@ -91,11 +91,11 @@ class StepMotor {
91 91
         int                 m_stePin;
92 92
         int                 m_speed;
93 93
 
94
-        maa_gpio_context    m_dirPinCtx;
95
-        maa_pwm_context     m_pwmStepContext;
94
+        mraa_gpio_context    m_dirPinCtx;
95
+        mraa_pwm_context     m_pwmStepContext;
96 96
 
97
-        maa_result_t move (int ticks);
98
-        maa_result_t dirForward ();
99
-        maa_result_t dirBackwards ();
97
+        mraa_result_t move (int ticks);
98
+        mraa_result_t dirForward ();
99
+        mraa_result_t dirBackwards ();
100 100
     };
101 101
 }

+ 45
- 45
src/tm1637/tm1637.cxx View File

@@ -51,56 +51,56 @@ const uint8_t digitToSegment[] = {
51 51
 };
52 52
 
53 53
 TM1637::TM1637 (uint8_t di, uint8_t dcki) {
54
-    maa_result_t error = MAA_SUCCESS;
55
-    maa_init();
54
+    mraa_result_t error = MRAA_SUCCESS;
55
+    mraa_init();
56 56
 
57 57
     // init clock context
58
-    m_clkPinCtx = maa_gpio_init(dcki);
58
+    m_clkPinCtx = mraa_gpio_init(dcki);
59 59
     if (m_clkPinCtx == NULL) {
60 60
         fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", dcki);
61 61
         exit(1);
62 62
     }
63 63
     // init data context
64
-    m_dataPinCtx = maa_gpio_init(di);
64
+    m_dataPinCtx = mraa_gpio_init(di);
65 65
     if (m_dataPinCtx == NULL) {
66 66
         fprintf(stderr, "Are you sure that pin%d you requested is valid on your platform?", di);
67 67
         exit(1);
68 68
     }
69 69
     
70 70
     // set direction (out)
71
-    error = maa_gpio_dir(m_clkPinCtx, MAA_GPIO_IN);
72
-    if (error != MAA_SUCCESS) {
73
-        maa_result_print(error);
71
+    error = mraa_gpio_dir(m_clkPinCtx, MRAA_GPIO_IN);
72
+    if (error != MRAA_SUCCESS) {
73
+        mraa_result_print(error);
74 74
     }
75 75
 
76 76
     // set direction (out)
77
-    error = maa_gpio_dir(m_dataPinCtx, MAA_GPIO_IN);
78
-    if (error != MAA_SUCCESS) {
79
-        maa_result_print(error);
77
+    error = mraa_gpio_dir(m_dataPinCtx, MRAA_GPIO_IN);
78
+    if (error != MRAA_SUCCESS) {
79
+        mraa_result_print(error);
80 80
     }
81 81
 
82
-    error = maa_gpio_write (m_dataPinCtx, LOW);
83
-    error = maa_gpio_write (m_clkPinCtx, LOW);
82
+    error = mraa_gpio_write (m_dataPinCtx, LOW);
83
+    error = mraa_gpio_write (m_clkPinCtx, LOW);
84 84
 }
85 85
 
86 86
 TM1637::~TM1637() {
87
-    maa_result_t error = MAA_SUCCESS;
88
-    error = maa_gpio_close (m_dataPinCtx);
89
-    if (error != MAA_SUCCESS) {
90
-        maa_result_print(error);
87
+    mraa_result_t error = MRAA_SUCCESS;
88
+    error = mraa_gpio_close (m_dataPinCtx);
89
+    if (error != MRAA_SUCCESS) {
90
+        mraa_result_print(error);
91 91
     }
92
-    error = maa_gpio_close (m_clkPinCtx);
93
-    if (error != MAA_SUCCESS) {
94
-        maa_result_print(error);
92
+    error = mraa_gpio_close (m_clkPinCtx);
93
+    if (error != MRAA_SUCCESS) {
94
+        mraa_result_print(error);
95 95
     }
96 96
 }
97 97
 
98
-maa_result_t
98
+mraa_result_t
99 99
 TM1637::setBrightness (uint8_t level) {
100 100
     m_brightness = level;
101 101
 }
102 102
 
103
-maa_result_t
103
+mraa_result_t
104 104
 TM1637::setSegments (const uint8_t segments[], uint8_t length, uint8_t pos) {
105 105
     start();
106 106
     writeByte(TM1637_I2C_COMM1);
@@ -118,7 +118,7 @@ TM1637::setSegments (const uint8_t segments[], uint8_t length, uint8_t pos) {
118 118
     stop();
119 119
 }
120 120
 
121
-maa_result_t
121
+mraa_result_t
122 122
 TM1637::write (std::string msg) {
123 123
     char leter = '\0';
124 124
     uint8_t data[] = { 0x0, 0x0, 0x0, 0x0 };
@@ -132,60 +132,60 @@ TM1637::write (std::string msg) {
132 132
     setSegments(data);
133 133
 }
134 134
 
135
-maa_result_t
136
-TM1637::pinMode (maa_gpio_context ctx, gpio_dir_t mode) {
137
-    maa_result_t error = MAA_SUCCESS;
138
-    error = maa_gpio_dir(ctx, mode);
139
-    if (error != MAA_SUCCESS) {
140
-        maa_result_print(error);
135
+mraa_result_t
136
+TM1637::pinMode (mraa_gpio_context ctx, gpio_dir_t mode) {
137
+    mraa_result_t error = MRAA_SUCCESS;
138
+    error = mraa_gpio_dir(ctx, mode);
139
+    if (error != MRAA_SUCCESS) {
140
+        mraa_result_print(error);
141 141
     }
142 142
 }
143 143
 
144
-maa_result_t
144
+mraa_result_t
145 145
 TM1637::start() {
146
-    pinMode (m_dataPinCtx, MAA_GPIO_OUT);
146
+    pinMode (m_dataPinCtx, MRAA_GPIO_OUT);
147 147
     usleep(PULSE_LENGTH);
148 148
 }
149 149
 
150
-maa_result_t
150
+mraa_result_t
151 151
 TM1637::stop() {
152
-    pinMode (m_dataPinCtx, MAA_GPIO_OUT);
152
+    pinMode (m_dataPinCtx, MRAA_GPIO_OUT);
153 153
     usleep(PULSE_LENGTH);
154
-    pinMode (m_clkPinCtx, MAA_GPIO_IN);
154
+    pinMode (m_clkPinCtx, MRAA_GPIO_IN);
155 155
     usleep(PULSE_LENGTH);
156
-    pinMode (m_dataPinCtx, MAA_GPIO_IN);
156
+    pinMode (m_dataPinCtx, MRAA_GPIO_IN);
157 157
     usleep(PULSE_LENGTH);
158 158
 }
159 159
 
160
-maa_result_t
160
+mraa_result_t
161 161
 TM1637::writeByte(uint8_t value) {
162 162
     for (uint8_t idx = 0; idx < 8; idx++) {
163
-        pinMode(m_clkPinCtx, MAA_GPIO_OUT);
163
+        pinMode(m_clkPinCtx, MRAA_GPIO_OUT);
164 164
         usleep(PULSE_LENGTH);
165 165
         if (value & 0x01) {
166
-              pinMode(m_dataPinCtx, MAA_GPIO_IN);
166
+              pinMode(m_dataPinCtx, MRAA_GPIO_IN);
167 167
         } else {
168
-              pinMode(m_dataPinCtx, MAA_GPIO_OUT);
168
+              pinMode(m_dataPinCtx, MRAA_GPIO_OUT);
169 169
         }
170 170
         usleep(PULSE_LENGTH);
171 171
 
172
-        pinMode(m_clkPinCtx, MAA_GPIO_IN);
172
+        pinMode(m_clkPinCtx, MRAA_GPIO_IN);
173 173
         usleep(PULSE_LENGTH);
174 174
         value = value >> 1;
175 175
     }
176 176
 
177
-    pinMode(m_clkPinCtx, MAA_GPIO_OUT);
178
-    pinMode(m_dataPinCtx, MAA_GPIO_IN);
177
+    pinMode(m_clkPinCtx, MRAA_GPIO_OUT);
178
+    pinMode(m_dataPinCtx, MRAA_GPIO_IN);
179 179
     usleep(PULSE_LENGTH);
180 180
 
181
-    pinMode(m_clkPinCtx, MAA_GPIO_IN);
181
+    pinMode(m_clkPinCtx, MRAA_GPIO_IN);
182 182
     usleep(PULSE_LENGTH);
183 183
 
184
-    uint8_t ack = maa_gpio_read (m_dataPinCtx);
184
+    uint8_t ack = mraa_gpio_read (m_dataPinCtx);
185 185
     if (ack == 0) {
186
-        pinMode(m_dataPinCtx, MAA_GPIO_OUT);
186
+        pinMode(m_dataPinCtx, MRAA_GPIO_OUT);
187 187
     } usleep(PULSE_LENGTH);
188 188
 
189
-    pinMode(m_clkPinCtx, MAA_GPIO_OUT);
189
+    pinMode(m_clkPinCtx, MRAA_GPIO_OUT);
190 190
     usleep(50);
191 191
 }

+ 11
- 11
src/tm1637/tm1637.h View File

@@ -24,8 +24,8 @@
24 24
 #pragma once
25 25
 
26 26
 #include <string>
27
-#include <maa/aio.h>
28
-#include <maa/gpio.h>
27
+#include <mraa/aio.h>
28
+#include <mraa/gpio.h>
29 29
 
30 30
 #define SEG_A               0b00000001
31 31
 #define SEG_B               0b00000010
@@ -82,7 +82,7 @@ class TM1637 {
82 82
          *
83 83
          * @param level The brightness level of leds
84 84
          */
85
-        maa_result_t setBrightness (uint8_t level);
85
+        mraa_result_t setBrightness (uint8_t level);
86 86
 
87 87
         /**
88 88
          * Set the the segment screen data and number of segments
@@ -92,14 +92,14 @@ class TM1637 {
92 92
          * @param length number of elements in segments array
93 93
          * @param pos data writing offset
94 94
          */
95
-        maa_result_t setSegments (const uint8_t segments[], uint8_t length = 4, uint8_t pos = 0);
95
+        mraa_result_t setSegments (const uint8_t segments[], uint8_t length = 4, uint8_t pos = 0);
96 96
 
97 97
         /**
98 98
          * Write message on the screen.
99 99
          *
100 100
          * @param msg The message to be written on the sreen
101 101
          */
102
-        maa_result_t write (std::string msg);
102
+        mraa_result_t write (std::string msg);
103 103
 
104 104
         /**
105 105
          * Return name of the component
@@ -110,13 +110,13 @@ class TM1637 {
110 110
         }
111 111
 
112 112
     private:
113
-        maa_result_t start();
114
-        maa_result_t stop();
115
-        maa_result_t writeByte (uint8_t value);
116
-        maa_result_t pinMode (maa_gpio_context ctx, gpio_dir_t mode);
113
+        mraa_result_t start();
114
+        mraa_result_t stop();
115
+        mraa_result_t writeByte (uint8_t value);
116
+        mraa_result_t pinMode (mraa_gpio_context ctx, gpio_dir_t mode);
117 117
 
118
-        maa_gpio_context m_clkPinCtx;
119
-        maa_gpio_context m_dataPinCtx;
118
+        mraa_gpio_context m_clkPinCtx;
119
+        mraa_gpio_context m_dataPinCtx;
120 120
 
121 121
         std::string m_name;
122 122
         uint8_t m_brightness;