GP3/Arduino
|
00001 /* © Copyright 2012 by Al Williams (al.williams@awce.com) 00002 Distributed under the terms of the GNU Lesser General Public License */ 00003 00031 #ifndef __GP3_H 00032 #define __GP3_H 00033 #include <Arduino.h> 00034 #include <SoftwareSerial.h> 00035 00037 class GP3 00038 { 00039 private: 00040 SoftwareSerial *sport; 00041 Stream *port; 00042 void setarg(unsigned int arg); 00043 int timeout; 00044 int err; 00045 int achannel; 00046 public: 00047 GP3(int rx, int tx); 00048 GP3(Stream &port); 00049 ~GP3(); 00050 int getError(void); 00051 void clearError(void); 00052 int readByte(void); 00053 unsigned int readWord(void); 00054 void setLED(boolean onoff); 00055 unsigned int a2d(); 00056 void a2dChan(int chan); 00057 void a2dConf(bool rightjustify,int cselect); 00058 void high(int pin); 00059 void low(int pin); 00060 void toggle(int pin); 00061 int input(int pin); 00062 void setTris(int tris); 00063 int getTris(void); 00064 void setPins(int byte); 00065 int getPins(void); 00066 void writeEE(int address, int byte); 00067 int readEE(int address); 00068 void pwm(int chan, int dc, int dfreq); 00069 unsigned int count(int pin, unsigned int ms); 00070 unsigned int rcTime(int pin, int state); 00071 unsigned int pulseIn(int pin, int state); 00072 void pulseOut(int pin, int duration); 00073 void freq(int pin, int ms, int frq); 00074 void setCounter(int prescale, int ext); 00075 unsigned int count(); 00076 void resetAll(void); 00077 void reset(void); 00078 void repeat(int count); 00079 void argInc(void); 00080 void argDec(void); 00081 unsigned int check(void); 00082 void setTimeout(int _timeout); 00083 int getTimeout(void); 00084 bool listen(void); 00085 bool isListening(); 00086 }; 00087 00088 00089 00090 00091 #endif