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.
SPI2.h
00001 //-------------------------------------------------------------------------------------------- 00002 //Original Property of: charmedlabs.com/pixystart -> arduino_pixy-x.y.z.zip 00003 // 00004 //Modifications made by: Mathieu Malone 00005 //Modifications: Modified Arduino code to function with mbed development platform 00006 //Output Method: This program uses "Serial pc(USBTX, USBRX)" in order to allow communication 00007 // between the mbed platform and putty terminal through USB 00008 // 00009 //Latest update by: Mathieu Malone 00010 //Date of last update: July 24th, 2014 00011 //-------------------------------------------------------------------------------------------- 00012 // 00013 // begin license header 00014 // 00015 // This file is part of Pixy CMUcam5 or "Pixy" for short 00016 // 00017 // All Pixy source code is provided under the terms of the 00018 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html). 00019 // Those wishing to use Pixy source code, software and/or 00020 // technologies under different licensing terms should contact us at 00021 // cmucam@cs.cmu.edu. Such licensing terms are available for 00022 // all portions of the Pixy codebase presented here. 00023 // 00024 // end license header 00025 // 00026 00027 #ifndef _SPI_H2 00028 #define _SPI_H2 00029 #include "iserial2.h" 00030 00031 #define SPI_RECEIVEBUF_SIZE2 16 00032 #define SPI_TRANSMITBUF_SIZE2 16 00033 00034 #define SS_ASSERT2() LPC_SGPIO->GPIO_OUTREG2 = 0; 00035 #define SS_NEGATE2() LPC_SGPIO->GPIO_OUTREG2 = 1<<14; 00036 00037 #define SPI_SYNC_MASK2 0xff00 00038 #define SPI_SYNC_WORD2 0x5a00 00039 #define SPI_SYNC_WORD_DATA2 0x5b00 00040 #define SPI_MIN_SYNC_COUNT2 5 00041 00042 class Spi2 : public Iserial2 00043 { 00044 public: 00045 Spi2(SerialCallback2 callback2); 00046 00047 // Iserial methods 00048 virtual int open2(); 00049 virtual int close2(); 00050 virtual int receive2(uint8_t *buf2, uint32_t len2); 00051 virtual int receiveLen2(); 00052 virtual int update2(); 00053 00054 void slaveHandler2(); 00055 00056 private: 00057 int checkIdle2(); 00058 int sync2(); 00059 ReceiveQ2<uint16_t> m_rq2; 00060 TransmitQ2<uint16_t> m_tq2; 00061 00062 bool m_sync2; 00063 uint32_t m_recvCounter2; 00064 uint32_t m_lastRecvCounter2; 00065 uint8_t m_syncCounter2; 00066 }; 00067 00068 void SPIinit2(SerialCallback2 callback2); 00069 00070 extern Spi2 *g_spi2; 00071 00072 #endif
Generated on Thu Jul 14 2022 04:45:17 by
1.7.2