source: rtos_arduino/trunk/arduino_lib/libraries/Robot_Control/src/EasyTransfer2.h@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 2.3 KB
Line 
1/******************************************************************
2* EasyTransfer Arduino Library
3* details and example sketch:
4* http://www.billporter.info/easytransfer-arduino-library/
5*
6* Brought to you by:
7* Bill Porter
8* www.billporter.info
9*
10* See Readme for other info and version history
11*
12*
13*This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or(at your option) any later version.
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18<http://www.gnu.org/licenses/>
19*
20*This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
21*To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or
22*send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
23******************************************************************/
24#ifndef EasyTransfer2_h
25#define EasyTransfer2_h
26
27
28//make it a little prettier on the front end.
29#define details(name) (byte*)&name,sizeof(name)
30
31//Not neccessary, but just in case.
32#if ARDUINO > 22
33#include "Arduino.h"
34#else
35#include "WProgram.h"
36#endif
37#include "HardwareSerial.h"
38//#include <NewSoftSerial.h>
39#include <math.h>
40#include <stdio.h>
41#include <stdint.h>
42#include <avr/io.h>
43
44class EasyTransfer2 {
45public:
46void begin(HardwareSerial *theSerial);
47//void begin(uint8_t *, uint8_t, NewSoftSerial *theSerial);
48void sendData();
49boolean receiveData();
50
51void writeByte(uint8_t dat);
52void writeInt(int dat);
53uint8_t readByte();
54int readInt();
55
56
57private:
58HardwareSerial *_serial;
59
60void resetData();
61
62uint8_t data[20]; //data storage, for both read and send
63uint8_t position;
64uint8_t size; //size of data in bytes. Both for read and send
65//uint8_t * address; //address of struct
66//uint8_t size; //size of struct
67//uint8_t * rx_buffer; //address for temporary storage and parsing buffer
68//uint8_t rx_buffer[20];
69uint8_t rx_array_inx; //index for RX parsing buffer
70uint8_t rx_len; //RX packet length according to the packet
71uint8_t calc_CS; //calculated Chacksum
72};
73
74
75
76#endif
Note: See TracBrowser for help on using the repository browser.