00001 /* 00002 Object Oriented Mobile Robot Model (OOMRM) C++ Library Copyright (C) 2002-2005 Derek Jones 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: ospi.h,v 1.2 2007/06/10 22:41:28 derek Exp $ 00019 */ 00020 #ifndef _OOMRM_OSPI 00021 #define _OOMRM_OSPI 00022 #include <hardware/oomrm.h> 00023 00025 enum EEPROM_COMMAND { NOOP=0, WRSR, WRITE, READ, WRDI, RDSR, WREN }; 00026 00028 00029 enum TX_COMMAND_OP { TX_CLEAR, TX_ADD }; 00030 typedef TX_COMMAND_OP TX_COMMAND_OP; 00036 00037 class oSPI : public virtual OOMRM 00038 { 00039 public: 00040 oSPI(int baud_rate, IOLINE cs); 00041 static bool havebyte(void); 00042 static bool sendingbyte(void); 00043 void inbyte(word address, word rxdata[]); 00044 void outbyte(word address, uint8 txbyte); 00045 // static void resync(int); ///< Recalibrates the baud rate. Must perform after System Clock change! 00046 // static void resync(void); ///< Default recalibration that uses current baud rate after clock change. 00047 private: 00048 void queue(int, int); 00049 void init(int baud_rate, IOLINE cs); 00050 // static bool _init; 00051 IOLINE _cs; 00052 int _tx_top; 00053 }; 00054 00055 #endif 00056
1.3