MicroForce Sensors, Compensated/Amplified
MicroForce_FMA.cpp@0:e4146617a5fc, 2021-06-30 (annotated)
- Committer:
- mcm
- Date:
- Wed Jun 30 12:54:49 2021 +0000
- Revision:
- 0:e4146617a5fc
- Child:
- 1:4b8a700b3f5c
The header file is ready to be tested.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mcm | 0:e4146617a5fc | 1 | /** |
mcm | 0:e4146617a5fc | 2 | * @brief MAX7219.h |
mcm | 0:e4146617a5fc | 3 | * @details Serially Interfaced, 8-Digit LED Display Drivers. |
mcm | 0:e4146617a5fc | 4 | * Header file. |
mcm | 0:e4146617a5fc | 5 | * |
mcm | 0:e4146617a5fc | 6 | * |
mcm | 0:e4146617a5fc | 7 | * @return NA |
mcm | 0:e4146617a5fc | 8 | * |
mcm | 0:e4146617a5fc | 9 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 10 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 11 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 12 | * @pre NaN. |
mcm | 0:e4146617a5fc | 13 | * @warning NaN |
mcm | 0:e4146617a5fc | 14 | * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). |
mcm | 0:e4146617a5fc | 15 | */ |
mcm | 0:e4146617a5fc | 16 | |
mcm | 0:e4146617a5fc | 17 | #include "MAX7219.h" |
mcm | 0:e4146617a5fc | 18 | |
mcm | 0:e4146617a5fc | 19 | |
mcm | 0:e4146617a5fc | 20 | MAX7219::MAX7219 ( PinName mosi, PinName miso, PinName sclk, PinName cs, uint32_t freq ) |
mcm | 0:e4146617a5fc | 21 | : _spi ( mosi, miso, sclk ) |
mcm | 0:e4146617a5fc | 22 | , _cs ( cs ) |
mcm | 0:e4146617a5fc | 23 | { |
mcm | 0:e4146617a5fc | 24 | _spi.frequency( freq ); |
mcm | 0:e4146617a5fc | 25 | } |
mcm | 0:e4146617a5fc | 26 | |
mcm | 0:e4146617a5fc | 27 | |
mcm | 0:e4146617a5fc | 28 | MAX7219::~MAX7219() |
mcm | 0:e4146617a5fc | 29 | { |
mcm | 0:e4146617a5fc | 30 | } |
mcm | 0:e4146617a5fc | 31 | |
mcm | 0:e4146617a5fc | 32 | |
mcm | 0:e4146617a5fc | 33 | |
mcm | 0:e4146617a5fc | 34 | /** |
mcm | 0:e4146617a5fc | 35 | * @brief MAX7219_Mode ( MAX7219_shutdown_reg_t ) |
mcm | 0:e4146617a5fc | 36 | * |
mcm | 0:e4146617a5fc | 37 | * @details It puts the device in shutdown mode. |
mcm | 0:e4146617a5fc | 38 | * |
mcm | 0:e4146617a5fc | 39 | * @param[in] myMAX7219mode: Shutdown or Normal operation mode. |
mcm | 0:e4146617a5fc | 40 | * |
mcm | 0:e4146617a5fc | 41 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 42 | * |
mcm | 0:e4146617a5fc | 43 | * |
mcm | 0:e4146617a5fc | 44 | * @return Status of MAX7219_Mode. |
mcm | 0:e4146617a5fc | 45 | * |
mcm | 0:e4146617a5fc | 46 | * |
mcm | 0:e4146617a5fc | 47 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 48 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 49 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 50 | * @pre NaN |
mcm | 0:e4146617a5fc | 51 | * @warning NaN. |
mcm | 0:e4146617a5fc | 52 | */ |
mcm | 0:e4146617a5fc | 53 | MAX7219::MAX7219_status_t MAX7219::MAX7219_Mode ( MAX7219_shutdown_reg_t myMAX7219mode ) |
mcm | 0:e4146617a5fc | 54 | { |
mcm | 0:e4146617a5fc | 55 | char cmd[] = { SHUTDOWN, 0 }; |
mcm | 0:e4146617a5fc | 56 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 57 | |
mcm | 0:e4146617a5fc | 58 | |
mcm | 0:e4146617a5fc | 59 | cmd[ 1 ] = myMAX7219mode; |
mcm | 0:e4146617a5fc | 60 | |
mcm | 0:e4146617a5fc | 61 | _cs = 0; |
mcm | 0:e4146617a5fc | 62 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 63 | _cs = 1; |
mcm | 0:e4146617a5fc | 64 | |
mcm | 0:e4146617a5fc | 65 | |
mcm | 0:e4146617a5fc | 66 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 67 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 68 | else |
mcm | 0:e4146617a5fc | 69 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 70 | } |
mcm | 0:e4146617a5fc | 71 | |
mcm | 0:e4146617a5fc | 72 | |
mcm | 0:e4146617a5fc | 73 | |
mcm | 0:e4146617a5fc | 74 | /** |
mcm | 0:e4146617a5fc | 75 | * @brief MAX7219_DisplayTest ( MAX7219_display_test_reg_t ) |
mcm | 0:e4146617a5fc | 76 | * |
mcm | 0:e4146617a5fc | 77 | * @details It turns all the LEDs on ( Test mode enabled ) or normal operation. |
mcm | 0:e4146617a5fc | 78 | * |
mcm | 0:e4146617a5fc | 79 | * @param[in] myMAX7219DisplayTestMode: Mode: Test or Normal operation. |
mcm | 0:e4146617a5fc | 80 | * |
mcm | 0:e4146617a5fc | 81 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 82 | * |
mcm | 0:e4146617a5fc | 83 | * |
mcm | 0:e4146617a5fc | 84 | * @return Status of MAX7219_DisplayTest. |
mcm | 0:e4146617a5fc | 85 | * |
mcm | 0:e4146617a5fc | 86 | * |
mcm | 0:e4146617a5fc | 87 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 88 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 89 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 90 | * @pre NaN |
mcm | 0:e4146617a5fc | 91 | * @warning NaN. |
mcm | 0:e4146617a5fc | 92 | */ |
mcm | 0:e4146617a5fc | 93 | MAX7219::MAX7219_status_t MAX7219::MAX7219_DisplayTest ( MAX7219_display_test_reg_t myMAX7219DisplayTestMode ) |
mcm | 0:e4146617a5fc | 94 | { |
mcm | 0:e4146617a5fc | 95 | char cmd[] = { DISPLAY_TEST, 0 }; |
mcm | 0:e4146617a5fc | 96 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 97 | |
mcm | 0:e4146617a5fc | 98 | |
mcm | 0:e4146617a5fc | 99 | cmd[ 1 ] = myMAX7219DisplayTestMode; |
mcm | 0:e4146617a5fc | 100 | |
mcm | 0:e4146617a5fc | 101 | |
mcm | 0:e4146617a5fc | 102 | _cs = 0; |
mcm | 0:e4146617a5fc | 103 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 104 | _cs = 1; |
mcm | 0:e4146617a5fc | 105 | |
mcm | 0:e4146617a5fc | 106 | |
mcm | 0:e4146617a5fc | 107 | |
mcm | 0:e4146617a5fc | 108 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 109 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 110 | else |
mcm | 0:e4146617a5fc | 111 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 112 | } |
mcm | 0:e4146617a5fc | 113 | |
mcm | 0:e4146617a5fc | 114 | |
mcm | 0:e4146617a5fc | 115 | |
mcm | 0:e4146617a5fc | 116 | /** |
mcm | 0:e4146617a5fc | 117 | * @brief MAX7219_DecodeMode ( MAX7219_decode_mode_reg_t ) |
mcm | 0:e4146617a5fc | 118 | * |
mcm | 0:e4146617a5fc | 119 | * @details It enables and configures the decode-mode or turns it off. |
mcm | 0:e4146617a5fc | 120 | * |
mcm | 0:e4146617a5fc | 121 | * @param[in] myMAX7219DecodeMode: Decode-mode option. |
mcm | 0:e4146617a5fc | 122 | * |
mcm | 0:e4146617a5fc | 123 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 124 | * |
mcm | 0:e4146617a5fc | 125 | * |
mcm | 0:e4146617a5fc | 126 | * @return Status of MAX7219_DecodeMode. |
mcm | 0:e4146617a5fc | 127 | * |
mcm | 0:e4146617a5fc | 128 | * |
mcm | 0:e4146617a5fc | 129 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 130 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 131 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 132 | * @pre NaN |
mcm | 0:e4146617a5fc | 133 | * @warning NaN. |
mcm | 0:e4146617a5fc | 134 | */ |
mcm | 0:e4146617a5fc | 135 | MAX7219::MAX7219_status_t MAX7219::MAX7219_DecodeMode ( MAX7219_decode_mode_reg_t myMAX7219DecodeMode ) |
mcm | 0:e4146617a5fc | 136 | { |
mcm | 0:e4146617a5fc | 137 | char cmd[] = { DECODE_MODE, 0 }; |
mcm | 0:e4146617a5fc | 138 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 139 | |
mcm | 0:e4146617a5fc | 140 | |
mcm | 0:e4146617a5fc | 141 | cmd[ 1 ] = myMAX7219DecodeMode; |
mcm | 0:e4146617a5fc | 142 | |
mcm | 0:e4146617a5fc | 143 | |
mcm | 0:e4146617a5fc | 144 | _cs = 0; |
mcm | 0:e4146617a5fc | 145 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 146 | _cs = 1; |
mcm | 0:e4146617a5fc | 147 | |
mcm | 0:e4146617a5fc | 148 | |
mcm | 0:e4146617a5fc | 149 | |
mcm | 0:e4146617a5fc | 150 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 151 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 152 | else |
mcm | 0:e4146617a5fc | 153 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 154 | } |
mcm | 0:e4146617a5fc | 155 | |
mcm | 0:e4146617a5fc | 156 | |
mcm | 0:e4146617a5fc | 157 | |
mcm | 0:e4146617a5fc | 158 | /** |
mcm | 0:e4146617a5fc | 159 | * @brief MAX7219_SetIntensity ( MAX7219_intensity_reg_t ) |
mcm | 0:e4146617a5fc | 160 | * |
mcm | 0:e4146617a5fc | 161 | * @details It configures the intensity of the device. |
mcm | 0:e4146617a5fc | 162 | * |
mcm | 0:e4146617a5fc | 163 | * @param[in] myMAX7219Intensity: Intensity option. |
mcm | 0:e4146617a5fc | 164 | * |
mcm | 0:e4146617a5fc | 165 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 166 | * |
mcm | 0:e4146617a5fc | 167 | * |
mcm | 0:e4146617a5fc | 168 | * @return Status of MAX7219_SetIntensity. |
mcm | 0:e4146617a5fc | 169 | * |
mcm | 0:e4146617a5fc | 170 | * |
mcm | 0:e4146617a5fc | 171 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 172 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 173 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 174 | * @pre NaN |
mcm | 0:e4146617a5fc | 175 | * @warning NaN. |
mcm | 0:e4146617a5fc | 176 | */ |
mcm | 0:e4146617a5fc | 177 | MAX7219::MAX7219_status_t MAX7219::MAX7219_SetIntensity ( MAX7219_intensity_reg_t myMAX7219Intensity ) |
mcm | 0:e4146617a5fc | 178 | { |
mcm | 0:e4146617a5fc | 179 | char cmd[] = { INTENSITY, 0 }; |
mcm | 0:e4146617a5fc | 180 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 181 | |
mcm | 0:e4146617a5fc | 182 | |
mcm | 0:e4146617a5fc | 183 | cmd[ 1 ] = myMAX7219Intensity; |
mcm | 0:e4146617a5fc | 184 | |
mcm | 0:e4146617a5fc | 185 | |
mcm | 0:e4146617a5fc | 186 | _cs = 0; |
mcm | 0:e4146617a5fc | 187 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 188 | _cs = 1; |
mcm | 0:e4146617a5fc | 189 | |
mcm | 0:e4146617a5fc | 190 | |
mcm | 0:e4146617a5fc | 191 | |
mcm | 0:e4146617a5fc | 192 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 193 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 194 | else |
mcm | 0:e4146617a5fc | 195 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 196 | } |
mcm | 0:e4146617a5fc | 197 | |
mcm | 0:e4146617a5fc | 198 | |
mcm | 0:e4146617a5fc | 199 | |
mcm | 0:e4146617a5fc | 200 | /** |
mcm | 0:e4146617a5fc | 201 | * @brief MAX7219_SetScanLimit ( MAX7219_scan_limit_reg_t ) |
mcm | 0:e4146617a5fc | 202 | * |
mcm | 0:e4146617a5fc | 203 | * @details It configures duty cycle of the device. |
mcm | 0:e4146617a5fc | 204 | * |
mcm | 0:e4146617a5fc | 205 | * @param[in] MAX7219_scan_limit_reg_t: Duty cycle option. |
mcm | 0:e4146617a5fc | 206 | * |
mcm | 0:e4146617a5fc | 207 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 208 | * |
mcm | 0:e4146617a5fc | 209 | * |
mcm | 0:e4146617a5fc | 210 | * @return Status of MAX7219_SetScanLimit. |
mcm | 0:e4146617a5fc | 211 | * |
mcm | 0:e4146617a5fc | 212 | * |
mcm | 0:e4146617a5fc | 213 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 214 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 215 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 216 | * @pre NaN |
mcm | 0:e4146617a5fc | 217 | * @warning NaN. |
mcm | 0:e4146617a5fc | 218 | */ |
mcm | 0:e4146617a5fc | 219 | MAX7219::MAX7219_status_t MAX7219::MAX7219_SetScanLimit ( MAX7219_scan_limit_reg_t myMAX7219ScanLimit ) |
mcm | 0:e4146617a5fc | 220 | { |
mcm | 0:e4146617a5fc | 221 | char cmd[] = { SCAN_LIMIT, 0 }; |
mcm | 0:e4146617a5fc | 222 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 223 | |
mcm | 0:e4146617a5fc | 224 | |
mcm | 0:e4146617a5fc | 225 | cmd[ 1 ] = myMAX7219ScanLimit; |
mcm | 0:e4146617a5fc | 226 | |
mcm | 0:e4146617a5fc | 227 | |
mcm | 0:e4146617a5fc | 228 | _cs = 0; |
mcm | 0:e4146617a5fc | 229 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 230 | _cs = 1; |
mcm | 0:e4146617a5fc | 231 | |
mcm | 0:e4146617a5fc | 232 | |
mcm | 0:e4146617a5fc | 233 | |
mcm | 0:e4146617a5fc | 234 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 235 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 236 | else |
mcm | 0:e4146617a5fc | 237 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 238 | } |
mcm | 0:e4146617a5fc | 239 | |
mcm | 0:e4146617a5fc | 240 | |
mcm | 0:e4146617a5fc | 241 | |
mcm | 0:e4146617a5fc | 242 | /** |
mcm | 0:e4146617a5fc | 243 | * @brief MAX7219_SetDigit ( MAX7219_digit_t , MAX7219_code_b_font_reg_t , MAX7219_code_b_dp_t ) |
mcm | 0:e4146617a5fc | 244 | * |
mcm | 0:e4146617a5fc | 245 | * @details It sets the digit to be written and its value. |
mcm | 0:e4146617a5fc | 246 | * |
mcm | 0:e4146617a5fc | 247 | * @param[in] myMAX7219Digit: Digit to be written. |
mcm | 0:e4146617a5fc | 248 | * @param[in] myCharacter: The current value. |
mcm | 0:e4146617a5fc | 249 | * @param[in] myDP_status: DP enabled/disabled. |
mcm | 0:e4146617a5fc | 250 | * |
mcm | 0:e4146617a5fc | 251 | * @param[out] NaN. |
mcm | 0:e4146617a5fc | 252 | * |
mcm | 0:e4146617a5fc | 253 | * |
mcm | 0:e4146617a5fc | 254 | * @return Status of MAX7219_SetDigit. |
mcm | 0:e4146617a5fc | 255 | * |
mcm | 0:e4146617a5fc | 256 | * |
mcm | 0:e4146617a5fc | 257 | * @author Manuel Caballero |
mcm | 0:e4146617a5fc | 258 | * @date 9/October/2017 |
mcm | 0:e4146617a5fc | 259 | * @version 9/October/2017 The ORIGIN |
mcm | 0:e4146617a5fc | 260 | * @pre NaN |
mcm | 0:e4146617a5fc | 261 | * @warning NaN. |
mcm | 0:e4146617a5fc | 262 | */ |
mcm | 0:e4146617a5fc | 263 | MAX7219::MAX7219_status_t MAX7219::MAX7219_SetDigit ( MAX7219_digit_t myMAX7219Digit, MAX7219_code_b_font_reg_t myCharacter, MAX7219_code_b_dp_t myDP_status ) |
mcm | 0:e4146617a5fc | 264 | { |
mcm | 0:e4146617a5fc | 265 | char cmd[] = { 0, 0 }; |
mcm | 0:e4146617a5fc | 266 | int mySPI_status = 0; |
mcm | 0:e4146617a5fc | 267 | |
mcm | 0:e4146617a5fc | 268 | |
mcm | 0:e4146617a5fc | 269 | switch ( myMAX7219Digit ) { |
mcm | 0:e4146617a5fc | 270 | default: |
mcm | 0:e4146617a5fc | 271 | case SET_DIGIT_0: |
mcm | 0:e4146617a5fc | 272 | cmd[ 0 ] = DIGIT_0; |
mcm | 0:e4146617a5fc | 273 | break; |
mcm | 0:e4146617a5fc | 274 | |
mcm | 0:e4146617a5fc | 275 | case SET_DIGIT_1: |
mcm | 0:e4146617a5fc | 276 | cmd[ 0 ] = DIGIT_1; |
mcm | 0:e4146617a5fc | 277 | break; |
mcm | 0:e4146617a5fc | 278 | |
mcm | 0:e4146617a5fc | 279 | case SET_DIGIT_2: |
mcm | 0:e4146617a5fc | 280 | cmd[ 0 ] = DIGIT_2; |
mcm | 0:e4146617a5fc | 281 | break; |
mcm | 0:e4146617a5fc | 282 | |
mcm | 0:e4146617a5fc | 283 | case SET_DIGIT_3: |
mcm | 0:e4146617a5fc | 284 | cmd[ 0 ] = DIGIT_3; |
mcm | 0:e4146617a5fc | 285 | break; |
mcm | 0:e4146617a5fc | 286 | |
mcm | 0:e4146617a5fc | 287 | case SET_DIGIT_4: |
mcm | 0:e4146617a5fc | 288 | cmd[ 0 ] = DIGIT_4; |
mcm | 0:e4146617a5fc | 289 | break; |
mcm | 0:e4146617a5fc | 290 | |
mcm | 0:e4146617a5fc | 291 | case SET_DIGIT_5: |
mcm | 0:e4146617a5fc | 292 | cmd[ 0 ] = DIGIT_5; |
mcm | 0:e4146617a5fc | 293 | break; |
mcm | 0:e4146617a5fc | 294 | |
mcm | 0:e4146617a5fc | 295 | case SET_DIGIT_6: |
mcm | 0:e4146617a5fc | 296 | cmd[ 0 ] = DIGIT_6; |
mcm | 0:e4146617a5fc | 297 | break; |
mcm | 0:e4146617a5fc | 298 | |
mcm | 0:e4146617a5fc | 299 | case SET_DIGIT_7: |
mcm | 0:e4146617a5fc | 300 | cmd[ 0 ] = DIGIT_7; |
mcm | 0:e4146617a5fc | 301 | break; |
mcm | 0:e4146617a5fc | 302 | } |
mcm | 0:e4146617a5fc | 303 | |
mcm | 0:e4146617a5fc | 304 | |
mcm | 0:e4146617a5fc | 305 | if ( myDP_status == DP_ENABLED ) |
mcm | 0:e4146617a5fc | 306 | cmd[ 1 ] = ( myCharacter | 0x80 ); |
mcm | 0:e4146617a5fc | 307 | else |
mcm | 0:e4146617a5fc | 308 | cmd[ 1 ] = myCharacter; |
mcm | 0:e4146617a5fc | 309 | |
mcm | 0:e4146617a5fc | 310 | |
mcm | 0:e4146617a5fc | 311 | _cs = 0; |
mcm | 0:e4146617a5fc | 312 | mySPI_status = _spi.write ( &cmd[0], sizeof( cmd )/sizeof( cmd[0] ), &cmd[0], 0 ); |
mcm | 0:e4146617a5fc | 313 | _cs = 1; |
mcm | 0:e4146617a5fc | 314 | |
mcm | 0:e4146617a5fc | 315 | |
mcm | 0:e4146617a5fc | 316 | |
mcm | 0:e4146617a5fc | 317 | if ( ( mySPI_status / ( sizeof( cmd )/sizeof( cmd[0] ) ) ) == SPI_SUCCESS ) |
mcm | 0:e4146617a5fc | 318 | return MAX7219_SUCCESS; |
mcm | 0:e4146617a5fc | 319 | else |
mcm | 0:e4146617a5fc | 320 | return MAX7219_FAILURE; |
mcm | 0:e4146617a5fc | 321 | } |