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
00001 /* 00002 * NeuroShield.cpp - Driver for NeuroShield 00003 * Copyright (c) 2016, General Vision Inc, All rights reserved 00004 * Copyright (c) 2017, nepes inc, All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * 00009 * 1. Redistributions of source code must retain the above copyright notice, 00010 * this list of conditions and the following disclaimer. 00011 * 00012 * 2. Redistributions in binary form must reproduce the above copyright notice, 00013 * this list of conditions and the following disclaimer in the documentation 00014 * and/or other materials provided with the distribution. 00015 * 00016 * 3. Neither the name of the copyright holder nor the names of its contributors 00017 * may be used to endorse or promote products derived from this software without 00018 * specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00022 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00023 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00024 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00025 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00026 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00029 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00030 * POSSIBILITY OF SUCH DAMAGE. 00031 * 00032 */ 00033 00034 /* 00035 * Revision History (v1.1.5) 00036 * 2020/02/04 v1.1.5 Add dummy for switching between sd-card and nm spi 00037 * 2018/06/22 v1.1.4 Minor changes 00038 * 2018/01/03 v1.1.3 Add burst-mode read 00039 * 2017/12/20 v1.1.2 Modify the structure of neurondata 00040 * 2017/12/11 v1.1.1 Add Powersave command and Minor changes to the library 00041 * 2017/08/17 v1.0.0 First Release 00042 */ 00043 00044 #ifndef _NEUROSHIELDSPI_H 00045 #define _NEUROSHIELDSPI_H 00046 00047 #include "mbed.h" 00048 00049 #define HIGH 1 00050 #define LOW 0 00051 00052 class NeuroShieldSPI 00053 { 00054 public: 00055 00056 NeuroShieldSPI(); 00057 uint8_t shield_ss; // = 7; 00058 bool connect(); 00059 00060 uint16_t read(uint8_t reg); 00061 void readVector16(uint16_t* data, uint16_t size); 00062 void write(uint8_t reg, uint16_t data); 00063 uint16_t writeVector(uint8_t* data, uint16_t size); 00064 uint16_t writeVector16(uint16_t* data, uint16_t size); 00065 00066 uint16_t version(); 00067 void reset(); 00068 void ledSelect(uint8_t data); 00069 00070 static const uint8_t module_nm500 = 0x01; // addr[24:31] to access NM500 chip 00071 static const uint8_t module_fpga = 0x02; 00072 static const uint8_t module_led = 0x03; 00073 }; 00074 00075 #endif // _NEUROSHIELDSPI_H
Generated on Sun Jul 17 2022 17:52:25 by
1.7.2