1 /* 2 * Author: Brendan Le Foll <brendan.le.foll@intel.com> 3 * Copyright © 2014 Intel Corporation 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a copy 6 * of this software and associated documentation files (the "Software"), to 7 * deal in the Software without restriction, including without limitation the 8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9 * sell copies of the Software, and to permit persons to whom the Software is 10 * furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be included in 13 * all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21 * IN THE SOFTWARE. 22 */ 23 24 #pragma once 25 26 /** @file 27 * 28 * This file defines the basic shared types for libmraa 29 * this file is different to common.h in that swig takes this as an input 30 */ 31 32 namespace mraa 33 { 34 35 //These enums must match the enums in types.h 36 37 /** 38 * MRAA supported platform types 39 */ 40 typedef enum { 41 INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */ 42 INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */ 43 INTEL_EDISON_FAB_C = 2, /**< The Intel Edison (FAB C) */ 44 INTEL_DE3815 = 3, /**< The Intel DE3815 Baytrail NUC */ 45 INTEL_MINNOWBOARD_MAX = 4, /**< The Intel Minnow Board Max */ 46 RASPBERRY_PI = 5, /**< The different Raspberry PI Models -like A,B,A+,B+ */ 47 BEAGLEBONE = 6, /**< The different BeagleBone Black Modes B/C */ 48 BANANA = 7, /**< Allwinner A20 based Banana Pi and Banana Pro */ 49 50 UNKNOWN_PLATFORM = 51 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */ 52 } Platform; 53 54 /** 55 * Intel edison miniboard numbering enum 56 */ 57 typedef enum { 58 INTEL_EDISON_MINIBOARD_J17_1 = 0, 59 INTEL_EDISON_MINIBOARD_J17_5 = 4, 60 INTEL_EDISON_MINIBOARD_J17_7 = 6, 61 INTEL_EDISON_MINIBOARD_J17_8 = 7, 62 INTEL_EDISON_MINIBOARD_J17_9 = 8, 63 INTEL_EDISON_MINIBOARD_J17_10 = 9, 64 INTEL_EDISON_MINIBOARD_J17_11 = 10, 65 INTEL_EDISON_MINIBOARD_J17_12 = 11, 66 INTEL_EDISON_MINIBOARD_J17_14 = 13, 67 INTEL_EDISON_MINIBOARD_J18_1 = 14, 68 INTEL_EDISON_MINIBOARD_J18_2 = 15, 69 INTEL_EDISON_MINIBOARD_J18_6 = 19, 70 INTEL_EDISON_MINIBOARD_J18_7 = 20, 71 INTEL_EDISON_MINIBOARD_J18_8 = 21, 72 INTEL_EDISON_MINIBOARD_J18_10 = 23, 73 INTEL_EDISON_MINIBOARD_J18_11 = 24, 74 INTEL_EDISON_MINIBOARD_J18_12 = 25, 75 INTEL_EDISON_MINIBOARD_J18_13 = 26, 76 INTEL_EDISON_MINIBOARD_J19_4 = 31, 77 INTEL_EDISON_MINIBOARD_J19_5 = 32, 78 INTEL_EDISON_MINIBOARD_J19_6 = 33, 79 INTEL_EDISON_MINIBOARD_J19_8 = 35, 80 INTEL_EDISON_MINIBOARD_J19_9 = 36, 81 INTEL_EDISON_MINIBOARD_J19_10 = 37, 82 INTEL_EDISON_MINIBOARD_J19_11 = 38, 83 INTEL_EDISON_MINIBOARD_J19_12 = 39, 84 INTEL_EDISON_MINIBOARD_J19_13 = 40, 85 INTEL_EDISON_MINIBOARD_J19_14 = 41, 86 INTEL_EDISON_MINIBOARD_J20_3 = 44, 87 INTEL_EDISON_MINIBOARD_J20_4 = 45, 88 INTEL_EDISON_MINIBOARD_J20_5 = 46, 89 INTEL_EDISON_MINIBOARD_J20_6 = 47, 90 INTEL_EDISON_MINIBOARD_J20_7 = 48, 91 INTEL_EDISON_MINIBOARD_J20_8 = 49, 92 INTEL_EDISON_MINIBOARD_J20_9 = 50, 93 INTEL_EDISON_MINIBOARD_J20_10 = 51, 94 INTEL_EDISON_MINIBOARD_J20_11 = 52, 95 INTEL_EDISON_MINIBOARD_J20_12 = 53, 96 INTEL_EDISON_MINIBOARD_J20_13 = 54, 97 INTEL_EDISON_MINIBOARD_J20_14 = 55 98 } IntelEdisonMiniboard; 99 100 /** 101 * Intel Edison raw GPIO numbering enum 102 */ 103 typedef enum { 104 INTEL_EDISON_GP182 = 0, 105 INTEL_EDISON_GP135 = 4, 106 INTEL_EDISON_GP27 = 6, 107 INTEL_EDISON_GP20 = 7, 108 INTEL_EDISON_GP28 = 8, 109 INTEL_EDISON_GP111 = 0, 110 INTEL_EDISON_GP109 = 10, 111 INTEL_EDISON_GP115 = 11, 112 INTEL_EDISON_GP128 = 13, 113 INTEL_EDISON_GP13 = 14, 114 INTEL_EDISON_GP165 = 15, 115 INTEL_EDISON_GP19 = 19, 116 INTEL_EDISON_GP12 = 20, 117 INTEL_EDISON_GP183 = 21, 118 INTEL_EDISON_GP110 = 23, 119 INTEL_EDISON_GP114 = 24, 120 INTEL_EDISON_GP129 = 25, 121 INTEL_EDISON_GP130 = 26, 122 INTEL_EDISON_GP44 = 31, 123 INTEL_EDISON_GP46 = 32, 124 INTEL_EDISON_GP48 = 33, 125 INTEL_EDISON_GP131 = 35, 126 INTEL_EDISON_GP14 = 36, 127 INTEL_EDISON_GP40 = 37, 128 INTEL_EDISON_GP43 = 38, 129 INTEL_EDISON_GP77 = 39, 130 INTEL_EDISON_GP82 = 40, 131 INTEL_EDISON_GP83 = 41, 132 INTEL_EDISON_GP134 = 44, 133 INTEL_EDISON_GP45 = 45, 134 INTEL_EDISON_GP47 = 46, 135 INTEL_EDISON_GP49 = 47, 136 INTEL_EDISON_GP15 = 48, 137 INTEL_EDISON_GP84 = 49, 138 INTEL_EDISON_GP42 = 50, 139 INTEL_EDISON_GP41 = 51, 140 INTEL_EDISON_GP78 = 52, 141 INTEL_EDISON_GP79 = 53, 142 INTEL_EDISON_GP80 = 54, 143 INTEL_EDISON_GP81 = 55 144 } IntelEdison; 145 146 /** 147 * Raspberry PI Wiring compatible numbering enum 148 */ 149 typedef enum { 150 RASPBERRY_WIRING_PIN8 = 3, 151 RASPBERRY_WIRING_PIN9 = 5, 152 RASPBERRY_WIRING_PIN7 = 7, 153 RASPBERRY_WIRING_PIN15 = 8, 154 RASPBERRY_WIRING_PIN16 = 10, 155 RASPBERRY_WIRING_PIN0 = 11, 156 RASPBERRY_WIRING_PIN1 = 12, 157 RASPBERRY_WIRING_PIN2 = 13, 158 RASPBERRY_WIRING_PIN3 = 15, 159 RASPBERRY_WIRING_PIN4 = 16, 160 RASPBERRY_WIRING_PIN5 = 18, 161 RASPBERRY_WIRING_PIN12 = 19, 162 RASPBERRY_WIRING_PIN13 = 21, 163 RASPBERRY_WIRING_PIN6 = 22, 164 RASPBERRY_WIRING_PIN14 = 23, 165 RASPBERRY_WIRING_PIN10 = 24, 166 RASPBERRY_WIRING_PIN11 = 26, 167 RASPBERRY_WIRING_PIN17 = 29, // RPi B V2 168 RASPBERRY_WIRING_PIN21 = 29, 169 RASPBERRY_WIRING_PIN18 = 30, // RPi B V2 170 RASPBERRY_WIRING_PIN19 = 31, // RPI B V2 171 RASPBERRY_WIRING_PIN22 = 31, 172 RASPBERRY_WIRING_PIN20 = 32, // RPi B V2 173 RASPBERRY_WIRING_PIN26 = 32, 174 RASPBERRY_WIRING_PIN23 = 33, 175 RASPBERRY_WIRING_PIN24 = 35, 176 RASPBERRY_WIRING_PIN27 = 36, 177 RASPBERRY_WIRING_PIN25 = 37, 178 RASPBERRY_WIRING_PIN28 = 38, 179 RASPBERRY_WIRING_PIN29 = 40 180 } RaspberryWiring; 181 182 /** 183 * MRAA return codes 184 */ 185 typedef enum { 186 SUCCESS = 0, /**< Expected response */ 187 ERROR_FEATURE_NOT_IMPLEMENTED = 1, /**< Feature TODO */ 188 ERROR_FEATURE_NOT_SUPPORTED = 2, /**< Feature not supported by HW */ 189 ERROR_INVALID_VERBOSITY_LEVEL = 3, /**< Verbosity level wrong */ 190 ERROR_INVALID_PARAMETER = 4, /**< Parameter invalid */ 191 ERROR_INVALID_HANDLE = 5, /**< Handle invalid */ 192 ERROR_NO_RESOURCES = 6, /**< No resource of that type avail */ 193 ERROR_INVALID_RESOURCE = 7, /**< Resource invalid */ 194 ERROR_INVALID_QUEUE_TYPE = 8, /**< Queue type incorrect */ 195 ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */ 196 ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */ 197 ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */ 198 ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */ 199 200 ERROR_UNSPECIFIED = 99 /**< Unknown Error */ 201 } Result; 202 203 /** 204 * Enum representing different possible modes for a pin. 205 */ 206 typedef enum { 207 PIN_VALID = 0, /**< Pin Valid */ 208 PIN_GPIO = 1, /**< General Purpose IO */ 209 PIN_PWM = 2, /**< Pulse Width Modulation */ 210 PIN_FAST_GPIO = 3, /**< Faster GPIO */ 211 PIN_SPI = 4, /**< SPI */ 212 PIN_I2C = 5, /**< I2C */ 213 PIN_AIO = 6, /**< Analog in */ 214 PIN_UART = 7 /**< UART */ 215 } Pinmodes; 216 217 /** 218 * Enum reprensenting different i2c speeds/modes 219 */ 220 typedef enum { 221 I2C_STD = 0, /**< up to 100Khz */ 222 I2C_FAST = 1, /**< up to 400Khz */ 223 I2C_HIGH = 2 /**< up to 3.4Mhz */ 224 } I2cMode; 225 226 typedef enum { 227 UART_PARITY_NONE = 0, 228 UART_PARITY_EVEN = 1, 229 UART_PARITY_ODD = 2, 230 UART_PARITY_MARK = 3, 231 UART_PARITY_SPACE = 4 232 } UartParity; 233 234 } 235