Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NeuroShield_SimpleScript NeuroShield_andIMU NeuroShield_Gesture_Recognition
NeuroShieldSPI.h@1:0c6bf23f2fc8, 2018-01-25 (annotated)
- Committer:
- nepes_ai
- Date:
- Thu Jan 25 02:20:37 2018 +0000
- Revision:
- 1:0c6bf23f2fc8
- Parent:
- 0:529602524696
- Child:
- 2:2812bcbcaaea
Release version 1.1.3; ; Add burst-mode read function; Modify HW/FPGA version information; Modify the structure of neurondata; Add POWERSAVE command
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| nepes_ai | 0:529602524696 | 1 | /* |
| nepes_ai | 0:529602524696 | 2 | * NeuroShield.cpp - Driver for NeuroShield |
| nepes_ai | 0:529602524696 | 3 | * Copyright (c) 2016, General Vision Inc, All rights reserved |
| nepes_ai | 0:529602524696 | 4 | * Copyright (c) 2017, nepes inc, All rights reserved. |
| nepes_ai | 0:529602524696 | 5 | * |
| nepes_ai | 0:529602524696 | 6 | * Redistribution and use in source and binary forms, with or without |
| nepes_ai | 0:529602524696 | 7 | * modification, are permitted provided that the following conditions are met: |
| nepes_ai | 0:529602524696 | 8 | * |
| nepes_ai | 0:529602524696 | 9 | * 1. Redistributions of source code must retain the above copyright notice, |
| nepes_ai | 0:529602524696 | 10 | * this list of conditions and the following disclaimer. |
| nepes_ai | 0:529602524696 | 11 | * |
| nepes_ai | 0:529602524696 | 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| nepes_ai | 0:529602524696 | 13 | * this list of conditions and the following disclaimer in the documentation |
| nepes_ai | 0:529602524696 | 14 | * and/or other materials provided with the distribution. |
| nepes_ai | 0:529602524696 | 15 | * |
| nepes_ai | 0:529602524696 | 16 | * 3. Neither the name of the copyright holder nor the names of its contributors |
| nepes_ai | 0:529602524696 | 17 | * may be used to endorse or promote products derived from this software without |
| nepes_ai | 0:529602524696 | 18 | * specific prior written permission. |
| nepes_ai | 0:529602524696 | 19 | * |
| nepes_ai | 0:529602524696 | 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| nepes_ai | 0:529602524696 | 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| nepes_ai | 0:529602524696 | 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| nepes_ai | 0:529602524696 | 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| nepes_ai | 0:529602524696 | 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| nepes_ai | 0:529602524696 | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| nepes_ai | 0:529602524696 | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| nepes_ai | 0:529602524696 | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| nepes_ai | 0:529602524696 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| nepes_ai | 0:529602524696 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| nepes_ai | 0:529602524696 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| nepes_ai | 0:529602524696 | 31 | * |
| nepes_ai | 0:529602524696 | 32 | */ |
| nepes_ai | 0:529602524696 | 33 | |
| nepes_ai | 1:0c6bf23f2fc8 | 34 | /* |
| nepes_ai | 1:0c6bf23f2fc8 | 35 | * Revision History (v1.1.3) |
| nepes_ai | 1:0c6bf23f2fc8 | 36 | * 2018/01/03 v1.1.3 Add burst-mode read |
| nepes_ai | 1:0c6bf23f2fc8 | 37 | * 2017/12/20 v1.1.2 Modify the structure of neurondata |
| nepes_ai | 1:0c6bf23f2fc8 | 38 | * 2017/12/11 v1.1.1 Add Powersave command and Minor changes to the library |
| nepes_ai | 1:0c6bf23f2fc8 | 39 | * 2017/08/17 v1.0.0 First Release |
| nepes_ai | 1:0c6bf23f2fc8 | 40 | */ |
| nepes_ai | 1:0c6bf23f2fc8 | 41 | |
| nepes_ai | 0:529602524696 | 42 | #ifndef _NEUROSHIELDSPI_H |
| nepes_ai | 0:529602524696 | 43 | #define _NEUROSHIELDSPI_H |
| nepes_ai | 0:529602524696 | 44 | |
| nepes_ai | 0:529602524696 | 45 | #include "mbed.h" |
| nepes_ai | 0:529602524696 | 46 | |
| nepes_ai | 0:529602524696 | 47 | #define HIGH 1 |
| nepes_ai | 0:529602524696 | 48 | #define LOW 0 |
| nepes_ai | 0:529602524696 | 49 | |
| nepes_ai | 0:529602524696 | 50 | class NeuroShieldSPI |
| nepes_ai | 0:529602524696 | 51 | { |
| nepes_ai | 0:529602524696 | 52 | public: |
| nepes_ai | 0:529602524696 | 53 | |
| nepes_ai | 0:529602524696 | 54 | NeuroShieldSPI(); |
| nepes_ai | 0:529602524696 | 55 | uint8_t shield_ss; // = 7; |
| nepes_ai | 0:529602524696 | 56 | bool connect(); |
| nepes_ai | 0:529602524696 | 57 | |
| nepes_ai | 0:529602524696 | 58 | uint16_t read(uint8_t reg); |
| nepes_ai | 1:0c6bf23f2fc8 | 59 | void readVector16(uint16_t* data, uint16_t size); |
| nepes_ai | 0:529602524696 | 60 | void write(uint8_t reg, uint16_t data); |
| nepes_ai | 1:0c6bf23f2fc8 | 61 | uint16_t writeVector(uint8_t* data, uint16_t size); |
| nepes_ai | 1:0c6bf23f2fc8 | 62 | uint16_t writeVector16(uint16_t* data, uint16_t size); |
| nepes_ai | 0:529602524696 | 63 | |
| nepes_ai | 0:529602524696 | 64 | uint16_t version(); |
| nepes_ai | 0:529602524696 | 65 | void reset(); |
| nepes_ai | 0:529602524696 | 66 | void ledSelect(uint8_t data); |
| nepes_ai | 0:529602524696 | 67 | |
| nepes_ai | 0:529602524696 | 68 | static const uint8_t module_nm500 = 0x01; // addr[24:31] to access NM500 chip |
| nepes_ai | 0:529602524696 | 69 | static const uint8_t module_fpga = 0x02; |
| nepes_ai | 0:529602524696 | 70 | static const uint8_t module_led = 0x03; |
| nepes_ai | 0:529602524696 | 71 | }; |
| nepes_ai | 0:529602524696 | 72 | |
| nepes_ai | 0:529602524696 | 73 | #endif // _NEUROSHIELDSPI_H |