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.
SPI1.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_H1 00028 #define _SPI_H1 00029 #include "iserial1.h" 00030 00031 #define SPI_RECEIVEBUF_SIZE1 16 00032 #define SPI_TRANSMITBUF_SIZE1 16 00033 00034 #define SS_ASSERT1() LPC_SGPIO1->GPIO_OUTREG1 = 0; 00035 #define SS_NEGATE1() LPC_SGPIO1->GPIO_OUTREG1 = 1<<14; 00036 00037 #define SPI_SYNC_MASK1 0xff00 00038 #define SPI_SYNC_WORD1 0x5a00 00039 #define SPI_SYNC_WORD_DATA1 0x5b00 00040 #define SPI_MIN_SYNC_COUNT1 5 00041 00042 class Spi1 : public Iserial1 00043 { 00044 public: 00045 Spi1(SerialCallback1 callback1); 00046 00047 // Iserial methods 00048 virtual int open1(); 00049 virtual int close1(); 00050 virtual int receive1(uint8_t *buf1, uint32_t len1); 00051 virtual int receiveLen1(); 00052 virtual int update1(); 00053 00054 void slaveHandler1(); 00055 00056 private: 00057 int checkIdle1(); 00058 int sync1(); 00059 ReceiveQ1<uint16_t> m_rq1; 00060 TransmitQ1<uint16_t> m_tq1; 00061 00062 bool m_sync1; 00063 uint32_t m_recvCounter1; 00064 uint32_t m_lastRecvCounter1; 00065 uint8_t m_syncCounter1; 00066 }; 00067 00068 void SPIinit1(SerialCallback1 callback1); 00069 00070 extern Spi1 *g_spi1; 00071 00072 #endif
Generated on Thu Jul 14 2022 04:45:17 by
1.7.2