1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Updating wiring firmware to version 0006.

This commit is contained in:
David A. Mellis 2006-04-14 11:09:32 +00:00
parent fb34821d84
commit e751b61d4d
35 changed files with 1136 additions and 342 deletions

516
targets/wiring/Binary.h Normal file
View File

@ -0,0 +1,516 @@
#ifndef Binary_h
#define Binary_h
#define B0 0
#define B00 0
#define B000 0
#define B0000 0
#define B00000 0
#define B000000 0
#define B0000000 0
#define B00000000 0
#define B1 1
#define B01 1
#define B001 1
#define B0001 1
#define B00001 1
#define B000001 1
#define B0000001 1
#define B00000001 1
#define B10 2
#define B010 2
#define B0010 2
#define B00010 2
#define B000010 2
#define B0000010 2
#define B00000010 2
#define B11 3
#define B011 3
#define B0011 3
#define B00011 3
#define B000011 3
#define B0000011 3
#define B00000011 3
#define B100 4
#define B0100 4
#define B00100 4
#define B000100 4
#define B0000100 4
#define B00000100 4
#define B101 5
#define B0101 5
#define B00101 5
#define B000101 5
#define B0000101 5
#define B00000101 5
#define B110 6
#define B0110 6
#define B00110 6
#define B000110 6
#define B0000110 6
#define B00000110 6
#define B111 7
#define B0111 7
#define B00111 7
#define B000111 7
#define B0000111 7
#define B00000111 7
#define B1000 8
#define B01000 8
#define B001000 8
#define B0001000 8
#define B00001000 8
#define B1001 9
#define B01001 9
#define B001001 9
#define B0001001 9
#define B00001001 9
#define B1010 10
#define B01010 10
#define B001010 10
#define B0001010 10
#define B00001010 10
#define B1011 11
#define B01011 11
#define B001011 11
#define B0001011 11
#define B00001011 11
#define B1100 12
#define B01100 12
#define B001100 12
#define B0001100 12
#define B00001100 12
#define B1101 13
#define B01101 13
#define B001101 13
#define B0001101 13
#define B00001101 13
#define B1110 14
#define B01110 14
#define B001110 14
#define B0001110 14
#define B00001110 14
#define B1111 15
#define B01111 15
#define B001111 15
#define B0001111 15
#define B00001111 15
#define B10000 16
#define B010000 16
#define B0010000 16
#define B00010000 16
#define B10001 17
#define B010001 17
#define B0010001 17
#define B00010001 17
#define B10010 18
#define B010010 18
#define B0010010 18
#define B00010010 18
#define B10011 19
#define B010011 19
#define B0010011 19
#define B00010011 19
#define B10100 20
#define B010100 20
#define B0010100 20
#define B00010100 20
#define B10101 21
#define B010101 21
#define B0010101 21
#define B00010101 21
#define B10110 22
#define B010110 22
#define B0010110 22
#define B00010110 22
#define B10111 23
#define B010111 23
#define B0010111 23
#define B00010111 23
#define B11000 24
#define B011000 24
#define B0011000 24
#define B00011000 24
#define B11001 25
#define B011001 25
#define B0011001 25
#define B00011001 25
#define B11010 26
#define B011010 26
#define B0011010 26
#define B00011010 26
#define B11011 27
#define B011011 27
#define B0011011 27
#define B00011011 27
#define B11100 28
#define B011100 28
#define B0011100 28
#define B00011100 28
#define B11101 29
#define B011101 29
#define B0011101 29
#define B00011101 29
#define B11110 30
#define B011110 30
#define B0011110 30
#define B00011110 30
#define B11111 31
#define B011111 31
#define B0011111 31
#define B00011111 31
#define B100000 32
#define B0100000 32
#define B00100000 32
#define B100001 33
#define B0100001 33
#define B00100001 33
#define B100010 34
#define B0100010 34
#define B00100010 34
#define B100011 35
#define B0100011 35
#define B00100011 35
#define B100100 36
#define B0100100 36
#define B00100100 36
#define B100101 37
#define B0100101 37
#define B00100101 37
#define B100110 38
#define B0100110 38
#define B00100110 38
#define B100111 39
#define B0100111 39
#define B00100111 39
#define B101000 40
#define B0101000 40
#define B00101000 40
#define B101001 41
#define B0101001 41
#define B00101001 41
#define B101010 42
#define B0101010 42
#define B00101010 42
#define B101011 43
#define B0101011 43
#define B00101011 43
#define B101100 44
#define B0101100 44
#define B00101100 44
#define B101101 45
#define B0101101 45
#define B00101101 45
#define B101110 46
#define B0101110 46
#define B00101110 46
#define B101111 47
#define B0101111 47
#define B00101111 47
#define B110000 48
#define B0110000 48
#define B00110000 48
#define B110001 49
#define B0110001 49
#define B00110001 49
#define B110010 50
#define B0110010 50
#define B00110010 50
#define B110011 51
#define B0110011 51
#define B00110011 51
#define B110100 52
#define B0110100 52
#define B00110100 52
#define B110101 53
#define B0110101 53
#define B00110101 53
#define B110110 54
#define B0110110 54
#define B00110110 54
#define B110111 55
#define B0110111 55
#define B00110111 55
#define B111000 56
#define B0111000 56
#define B00111000 56
#define B111001 57
#define B0111001 57
#define B00111001 57
#define B111010 58
#define B0111010 58
#define B00111010 58
#define B111011 59
#define B0111011 59
#define B00111011 59
#define B111100 60
#define B0111100 60
#define B00111100 60
#define B111101 61
#define B0111101 61
#define B00111101 61
#define B111110 62
#define B0111110 62
#define B00111110 62
#define B111111 63
#define B0111111 63
#define B00111111 63
#define B1000000 64
#define B01000000 64
#define B1000001 65
#define B01000001 65
#define B1000010 66
#define B01000010 66
#define B1000011 67
#define B01000011 67
#define B1000100 68
#define B01000100 68
#define B1000101 69
#define B01000101 69
#define B1000110 70
#define B01000110 70
#define B1000111 71
#define B01000111 71
#define B1001000 72
#define B01001000 72
#define B1001001 73
#define B01001001 73
#define B1001010 74
#define B01001010 74
#define B1001011 75
#define B01001011 75
#define B1001100 76
#define B01001100 76
#define B1001101 77
#define B01001101 77
#define B1001110 78
#define B01001110 78
#define B1001111 79
#define B01001111 79
#define B1010000 80
#define B01010000 80
#define B1010001 81
#define B01010001 81
#define B1010010 82
#define B01010010 82
#define B1010011 83
#define B01010011 83
#define B1010100 84
#define B01010100 84
#define B1010101 85
#define B01010101 85
#define B1010110 86
#define B01010110 86
#define B1010111 87
#define B01010111 87
#define B1011000 88
#define B01011000 88
#define B1011001 89
#define B01011001 89
#define B1011010 90
#define B01011010 90
#define B1011011 91
#define B01011011 91
#define B1011100 92
#define B01011100 92
#define B1011101 93
#define B01011101 93
#define B1011110 94
#define B01011110 94
#define B1011111 95
#define B01011111 95
#define B1100000 96
#define B01100000 96
#define B1100001 97
#define B01100001 97
#define B1100010 98
#define B01100010 98
#define B1100011 99
#define B01100011 99
#define B1100100 100
#define B01100100 100
#define B1100101 101
#define B01100101 101
#define B1100110 102
#define B01100110 102
#define B1100111 103
#define B01100111 103
#define B1101000 104
#define B01101000 104
#define B1101001 105
#define B01101001 105
#define B1101010 106
#define B01101010 106
#define B1101011 107
#define B01101011 107
#define B1101100 108
#define B01101100 108
#define B1101101 109
#define B01101101 109
#define B1101110 110
#define B01101110 110
#define B1101111 111
#define B01101111 111
#define B1110000 112
#define B01110000 112
#define B1110001 113
#define B01110001 113
#define B1110010 114
#define B01110010 114
#define B1110011 115
#define B01110011 115
#define B1110100 116
#define B01110100 116
#define B1110101 117
#define B01110101 117
#define B1110110 118
#define B01110110 118
#define B1110111 119
#define B01110111 119
#define B1111000 120
#define B01111000 120
#define B1111001 121
#define B01111001 121
#define B1111010 122
#define B01111010 122
#define B1111011 123
#define B01111011 123
#define B1111100 124
#define B01111100 124
#define B1111101 125
#define B01111101 125
#define B1111110 126
#define B01111110 126
#define B1111111 127
#define B01111111 127
#define B10000000 128
#define B10000001 129
#define B10000010 130
#define B10000011 131
#define B10000100 132
#define B10000101 133
#define B10000110 134
#define B10000111 135
#define B10001000 136
#define B10001001 137
#define B10001010 138
#define B10001011 139
#define B10001100 140
#define B10001101 141
#define B10001110 142
#define B10001111 143
#define B10010000 144
#define B10010001 145
#define B10010010 146
#define B10010011 147
#define B10010100 148
#define B10010101 149
#define B10010110 150
#define B10010111 151
#define B10011000 152
#define B10011001 153
#define B10011010 154
#define B10011011 155
#define B10011100 156
#define B10011101 157
#define B10011110 158
#define B10011111 159
#define B10100000 160
#define B10100001 161
#define B10100010 162
#define B10100011 163
#define B10100100 164
#define B10100101 165
#define B10100110 166
#define B10100111 167
#define B10101000 168
#define B10101001 169
#define B10101010 170
#define B10101011 171
#define B10101100 172
#define B10101101 173
#define B10101110 174
#define B10101111 175
#define B10110000 176
#define B10110001 177
#define B10110010 178
#define B10110011 179
#define B10110100 180
#define B10110101 181
#define B10110110 182
#define B10110111 183
#define B10111000 184
#define B10111001 185
#define B10111010 186
#define B10111011 187
#define B10111100 188
#define B10111101 189
#define B10111110 190
#define B10111111 191
#define B11000000 192
#define B11000001 193
#define B11000010 194
#define B11000011 195
#define B11000100 196
#define B11000101 197
#define B11000110 198
#define B11000111 199
#define B11001000 200
#define B11001001 201
#define B11001010 202
#define B11001011 203
#define B11001100 204
#define B11001101 205
#define B11001110 206
#define B11001111 207
#define B11010000 208
#define B11010001 209
#define B11010010 210
#define B11010011 211
#define B11010100 212
#define B11010101 213
#define B11010110 214
#define B11010111 215
#define B11011000 216
#define B11011001 217
#define B11011010 218
#define B11011011 219
#define B11011100 220
#define B11011101 221
#define B11011110 222
#define B11011111 223
#define B11100000 224
#define B11100001 225
#define B11100010 226
#define B11100011 227
#define B11100100 228
#define B11100101 229
#define B11100110 230
#define B11100111 231
#define B11101000 232
#define B11101001 233
#define B11101010 234
#define B11101011 235
#define B11101100 236
#define B11101101 237
#define B11101110 238
#define B11101111 239
#define B11110000 240
#define B11110001 241
#define B11110010 242
#define B11110011 243
#define B11110100 244
#define B11110101 245
#define B11110110 246
#define B11110111 247
#define B11111000 248
#define B11111001 249
#define B11111010 250
#define B11111011 251
#define B11111100 252
#define B11111101 253
#define B11111110 254
#define B11111111 255
#endif

47
targets/wiring/Encoder.h Normal file
View File

@ -0,0 +1,47 @@
/*
Encoder.cpp - Encoder library for Wiring & Arduino
Copyright (c) 2006 Hernando Barragan and Nicholas Zambetti.
All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Encoder_h
#define Encoder_h
#include <inttypes.h>
class Encoder
{
private:
uint8_t _index;
uint8_t _pin_a;
static volatile uint8_t _pin_b;
static volatile int32_t _position;
static uint8_t _count;
static Encoder* _encoders[];
static void service(void);
public:
Encoder();
uint8_t attach(uint8_t, uint8_t);
void detach();
void write(int32_t);
int32_t read(void);
uint8_t attached(void);
};
#endif

BIN
targets/wiring/Encoder.o Normal file

Binary file not shown.

60
targets/wiring/HardwareSerial.h Executable file
View File

@ -0,0 +1,60 @@
/*
HardwareSerial.h - Hardware serial library for Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef HardwareSerial_h
#define HardwareSerial_h
#include <inttypes.h>
#define DEC 10
#define HEX 16
#define OCT 8
#define BIN 2
#define BYTE 0
class HardwareSerial
{
private:
uint8_t _uart;
void printNumber(unsigned long, uint8_t);
public:
HardwareSerial(uint8_t);
void begin(long);
uint8_t available(void);
int read(void);
void print(char);
void print(char[]);
void print(uint8_t);
void print(int);
void print(long);
void print(long, int);
void println(void);
void println(char);
void println(char[]);
void println(uint8_t);
void println(int);
void println(long);
void println(long, int);
};
extern HardwareSerial Serial;
extern HardwareSerial Serial1;
#endif

Binary file not shown.

View File

@ -0,0 +1,67 @@
/*
LiquidCrystal.cpp - Liquid Crystal Display library for Wiring & Arduino
Copyright (c) 2006 Hernando Barragan and Nicholas Zambetti.
All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LiquidCrystal_h
#define LiquidCrystal_h
#include <inttypes.h>
class LiquidCrystal
{
private:
uint8_t _control_rs;
uint8_t _control_rw;
uint8_t _control_e;
uint8_t _port;
void display_init(void);
void display_start(void);
void display_wait(void);
void display_control_write(uint8_t);
uint8_t display_control_read(void);
void display_data_write(uint8_t);
uint8_t display_data_read(void);
void display_write(char *, uint8_t);
void printNumber(unsigned long, uint8_t);
public:
//LiquidCrystal();
LiquidCrystal(uint8_t, uint8_t, uint8_t, uint8_t);
// uint8_t read(void);
void clear(void);
void home(void);
void setCursor(uint8_t, uint8_t);
void print(char);
void print(char[]);
void print(uint8_t);
void print(int);
void print(long);
void print(long, int);
void println(void);
void println(char);
void println(char[]);
void println(uint8_t);
void println(int);
void println(long);
void println(long, int);
};
#endif

Binary file not shown.

View File

@ -1,51 +1,55 @@
/*
Matrix.h - Max7219 LED Matrix library file for Wiring
Part of the Wiring project - http://wiring.org.co
Matrix.h - Max7219 LED Matrix library for Arduino & Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
Copyright (c) 2004-2005 Hernando Barragan
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Max7219 LED Matrix library by Nicholas Zambetti
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Matrix_h
#define Matrix_h
#include <inttypes.h>
// include core Wiring API
#include "WProgram.h"
// declare other libraries depended on (if any)
class Sprite;
class Matrix
{
private:
uint8_t _pinClock;
uint8_t _pinLoad;
uint8_t _pinData;
byte _pinData;
byte _pinClock;
byte _pinLoad;
uint8_t _screenBuffer[8];
byte* _buffer;
byte _screens;
byte _maximumX;
void putByte(uint8_t);
void putByte(byte);
void setRegister(byte, byte);
void syncRow(int);
void setScanLimit(byte);
void buffer(int, int, byte);
public:
Matrix(uint8_t, uint8_t, uint8_t);
void set(uint8_t, uint8_t);
void setAll(uint8_t);
void setScanLimit(uint8_t);
void setIntensity(uint8_t);
void storePixel(uint8_t, uint8_t, uint8_t);
void updatePixels(void);
Matrix(byte, byte, byte, byte = 1);
void setBrightness(byte);
void write(int, int, byte);
void write(int, int, Sprite);
void clear(void);
};
#endif

BIN
targets/wiring/Matrix.o Normal file

Binary file not shown.

50
targets/wiring/QSlide.h Executable file
View File

@ -0,0 +1,50 @@
/*
QSlide.h - QProx 401/501 library for Arduino & Wiring
Copyright (c) 2006 Nicholas Zambetti & Massimo Banzi. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef QSlide_h
#define QSlide_h
#include "WProgram.h"
class QSlide
{
private:
byte _drd;
byte _din;
byte _ss;
byte _clk;
byte _dout;
byte _det;
byte _prx;
byte _prevResult;
void calibrate(void);
void waitForReady(void);
byte transfer(byte);
byte driftCompensate(void);
public:
QSlide(byte, byte, byte, byte, byte, byte, byte);
void setProximityThreshold(byte);
void setTouchThreshold(byte);
byte isTouching(void);
byte isNear(void);
byte read(void);
};
#endif

BIN
targets/wiring/QSlide.o Normal file

Binary file not shown.

View File

@ -1,27 +1,23 @@
/*
Servo.h - Servo library file for Wiring
Part of the Wiring project - http://wiring.org.co
Servo.h - Servo library for Arduino & Wiring
Based on Hernando Barragan's original C implementation
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
Copyright (c) 2004-2005 Hernando Barragan
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Servo library by Nicholas Zambetti
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Servo_h
#define Servo_h

Binary file not shown.

49
targets/wiring/Sprite.h Normal file
View File

@ -0,0 +1,49 @@
/*
Sprite.cpp - 2D sprite buffers library for Arduino & Wiring
Copyright (c) 2006 David A. Mellis. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef Sprite_h
#define Sprite_h
#include <inttypes.h>
#include "Binary.h"
class Sprite
{
private:
uint8_t _width;
uint8_t _height;
uint8_t _depth;
uint8_t _ppb;
uint8_t _bpr;
uint8_t _mask;
uint8_t *_buffer;
void init(uint8_t width, uint8_t height);
public:
Sprite(uint8_t width, uint8_t height);
Sprite(uint8_t width, uint8_t height, uint8_t row, ...);
uint8_t width() const;
uint8_t height() const;
void write(int8_t x, int8_t y, uint8_t value);
uint8_t read(int8_t x, int8_t y) const;
};
#endif

BIN
targets/wiring/Sprite.o Normal file

Binary file not shown.

67
targets/wiring/TwoWire.h Executable file
View File

@ -0,0 +1,67 @@
/*
TwoWire.h - TWI/I2C library for Arduino & Wiring
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef TwoWire_h
#define TwoWire_h
#include <inttypes.h>
#define BUFFER_LENGTH 32
class TwoWire
{
private:
static uint8_t* rxBuffer;
static uint8_t rxBufferIndex;
static uint8_t rxBufferLength;
static uint8_t txAddress;
static uint8_t* txBuffer;
static uint8_t txBufferIndex;
static uint8_t txBufferLength;
static uint8_t transmitting;
static void (*user_onRequest)(void);
static void (*user_onReceive)(int);
static void onRequestService(void);
static void onReceiveService(uint8_t*, int);
public:
TwoWire();
void begin();
void begin(uint8_t);
void begin(int);
void beginTransmission(uint8_t);
void beginTransmission(int);
void endTransmission(void);
void requestFrom(uint8_t, uint8_t);
void requestFrom(int, int);
void send(uint8_t);
void send(uint8_t*, uint8_t);
void send(int);
void send(char*);
uint8_t available(void);
uint8_t receive(void);
void onReceive( void (*)(int) );
void onRequest( void (*)(void) );
};
extern TwoWire Wire;
#endif

BIN
targets/wiring/TwoWire.o Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
/*
WConstats.h - main definitions file for Wiring
WConstants.h - Main definitions file for Wiring
Part of the Wiring project - http://wiring.org.co
Copyright (c) 2004-2005 Hernando Barragan
@ -22,21 +22,67 @@
#ifndef WConstants_h
#define WConstants_h
#define PI (3.1415927)
#define HALF_PI (1.57079)
#define TWO_PI (6.2831854)
// Wiring API version for libraries
// this is also defined at compile-time
#ifndef WIRING
#define WIRING 6
#endif
// passed in at compile-time
#ifndef F_CPU
#define F_CPU 16000000L
#endif
// passed in at compile-time
#ifndef CPU_FREQ
#define CPU_FREQ 16000000L
#endif
#define LOW 0x0
#define HIGH 0x1
#define INPUT 0x0
#define OUTPUT 0x1
#define true 0x1
#define false 0x0
#define PI (3.1415927)
#define TWO_PI (6.2831854)
#define HALF_PI (1.57079)
#define EPSILON (0.0001)
#define DEG_TO_RAD (0.01745329)
#define RAD_TO_DEG (57.2957786)
#define EPSILON (0.0001)
#define WPIN0 (1<<0)
#define WPIN1 (1<<1)
#define WPIN2 (1<<2)
#define WPIN3 (1<<3)
#define WPIN4 (1<<4)
#define WPIN5 (1<<5)
#define WPIN6 (1<<6)
#define WPIN7 (1<<7)
#define int(x) ((int)(x))
#define char(x) ((char)(x))
#define long(x) ((long)(x))
#define byte(x) ((uint8_t)(x))
#define float(x) ((float)(x))
#define boolean(x) ((uint8_t)((x)==0?0:1))
// undefine stdlib's abs if encountered
#ifdef abs
#undef abs
#endif
#define sq(x) ((x)*(x))
#define abs(x) ((x)>0?(x):-(x))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define WPIN0 (1<<0)
#define WPIN1 (1<<1)
#define WPIN2 (1<<2)
#define WPIN3 (1<<3)
#define WPIN4 (1<<4)
#define WPIN5 (1<<5)
#define WPIN6 (1<<6)
#define WPIN7 (1<<7)
#define WPWMPIN5 (1<<5) // PINB5
#define WPWMPIN4 (1<<6) // PINB6
@ -69,18 +115,6 @@
#define WDDRF DDRF
#define WDDRG DDRG
#define HIGH 0x1
#define LOW 0x0
#define INPUT 0x0
#define OUTPUT 0x1
#define true 0x1
#define false 0x0
#define CPU_FREQ 16000000L
#define TIMER0OVERFLOW_INT 0
#define TIMER0OUTCOMPARE_INT 1
#define TIMER1OVERFLOW_INT 2
@ -98,135 +132,31 @@
#define TIMER_NUM_INTERRUPTS 14
#define TIMER_CLK_STOP 0x00
#define TIMER_CLK_DIV1 0x01
#define TIMER_CLK_DIV8 0x02
#define TIMER_CLK_DIV64 0x03
#define TIMER_CLK_DIV256 0x04
#define TIMER_CLK_DIV1024 0x05
#define TIMER_CLK_T_FALL 0x06
#define TIMER_CLK_T_RISE 0x07
#define TIMER_PRESCALE_MASK 0x07
#define TIMER_CLK_STOP 0x00
#define TIMER_CLK_DIV1 0x01
#define TIMER_CLK_DIV8 0x02
#define TIMER_CLK_DIV64 0x03
#define TIMER_CLK_DIV256 0x04
#define TIMER_CLK_DIV1024 0x05
#define TIMER_CLK_T_FALL 0x06
#define TIMER_CLK_T_RISE 0x07
#define TIMER_PRESCALE_MASK 0x07
#define TIMERRTC_CLK_STOP 0x00
#define TIMERRTC_CLK_DIV1 0x01
#define TIMERRTC_CLK_DIV8 0x02
#define TIMERRTC_CLK_DIV32 0x03
#define TIMERRTC_CLK_DIV64 0x04
#define TIMERRTC_CLK_DIV128 0x05
#define TIMERRTC_CLK_DIV256 0x06
#define TIMERRTC_CLK_DIV1024 0x07
#define TIMERRTC_PRESCALE_MASK 0x07
#define TIMERRTC_CLK_STOP 0x00
#define TIMERRTC_CLK_DIV1 0x01
#define TIMERRTC_CLK_DIV8 0x02
#define TIMERRTC_CLK_DIV32 0x03
#define TIMERRTC_CLK_DIV64 0x04
#define TIMERRTC_CLK_DIV128 0x05
#define TIMERRTC_CLK_DIV256 0x06
#define TIMERRTC_CLK_DIV1024 0x07
#define TIMERRTC_PRESCALE_MASK 0x07
#define TIMER0PRESCALE TIMERRTC_CLK_DIV64
#define TIMER1PRESCALE TIMER_CLK_DIV64
#define TIMER2PRESCALE TIMER_CLK_DIV8
#define TIMER0PRESCALE TIMERRTC_CLK_DIV64
#define TIMER1PRESCALE TIMER_CLK_DIV64
#define TIMER2PRESCALE TIMER_CLK_DIV8
#define TIMER3PRESCALE TIMER_CLK_DIV64
#ifndef __cplusplus
volatile struct {
uint8_t rxInt : 1;
uint8_t rx1Int : 1;
uint8_t uart0TxComplete : 1;
uint8_t uart1TxComplete : 1;
} event;
#endif
typedef struct wbuffer_t {
uint16_t buflen;
uint16_t bufcnt;
uint8_t * in;
uint8_t * out;
uint8_t * buf;
} WBuffer;
typedef struct {
void (*begin) (int);
uint8_t (*available) ();
int (*read) ();
void (*write) (int);
void (*writeBytes) (char[]);
} WSerial;
extern WSerial Serial1;
extern WSerial Serial;
typedef uint8_t boolean;
typedef uint8_t byte;
//int serial;
#define DEF_UART 0
#define AUX_UART 1
#define SERIAL0 0
#define SERIAL1 1
#define UART_BUF_LEN 32
#define min(a,b) ((a<b)?(a):(b))
#define max(a,b) ((a>b)?(a):(b))
#define abs(x) ((x>0)?(x):(-x))
#define constrain(amt,low,high) ((amt<low)?(low):((amt>high)?(high):(amt)))
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x))
#define SERVO_NUM_CHANNELS 8
#define SERVO_MAX 142
#define SERVO_MIN 34
#define POSITION_MAX 255
#define SERVO_DEFAULT_PORT PORTA
//static char uartBuffer[UART_BUF_LEN];
//WBuffer uartbuf;
typedef void (*voidFuncPtru08)(void);
volatile static voidFuncPtru08 uartRxFunc;
typedef void (*voidFuncPtr)(void);
#define WD_CTRL_PORT PORTC
#define WD_CTRL_DDR DDRC
#define WD_CTRL_RS 0
#define WD_CTRL_RW 1
#define WD_CTRL_E 2
#define WD_DATA_POUT PORTA
#define WD_DATA_PIN PINA
#define WD_DATA_DDR DDRA
#define WD_LINE0_DDRAMADDR 0x00
#define WD_LINE1_DDRAMADDR 0x40
#define WD_LINE2_DDRAMADDR 0x14
#define WD_LINE3_DDRAMADDR 0x54
#define WD_CLR 0
#define WD_HOME 1
#define WD_ENTRY_MODE 2
#define WD_ENTRY_INC 1
#define WD_ENTRY_SHIFT 0
#define WD_ON_CTRL 3
#define WD_ON_DISPLAY 2
#define WD_ON_CURSOR 1
#define WD_ON_BLINK 0
#define WD_MOVE 4
#define WD_MOVE_DISP 3
#define WD_MOVE_RIGHT 2
#define WD_FUNCTION 5
#define WD_FUNCTION_8BIT 4
#define WD_FUNCTION_2LINES 3
#define WD_FUNCTION_10DOTS 2
#define WD_CGRAM 6
#define WD_DDRAM 7
#define WD_BUSY 7
#define DATA_8_BITS 0x0
#define DATA_4_BITS 0x1
#define SERIAL 0x0
#define DISPLAY 0x1
#define EXTERNAL_NUM_INTERRUPTS 8
#define NUM_ENCODERS 4
#define EXTERNAL_INT_0 0
#define EXTERNAL_INT_1 1
#define EXTERNAL_INT_2 2
@ -236,11 +166,11 @@ typedef void (*voidFuncPtr)(void);
#define EXTERNAL_INT_6 6
#define EXTERNAL_INT_7 7
#ifndef __cplusplus
void print(const char *template, ...);
void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
void delay(int);
#endif
#define EXTERNAL_NUM_INTERRUPTS 8
typedef uint8_t byte;
typedef uint8_t boolean;
typedef void (*voidFuncPtr)(void);
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,7 @@
extern "C" {
#include <inttypes.h>
#include <math.h>
#include <stdio.h>
#include <avr/io.h>
#include <avr/delay.h>
#include "WConstants.h"
@ -12,8 +10,9 @@ extern "C" {
void loop(void);
// timing prototypes
void delay(int);
int millis(void);
void delay(long);
void delayMicroseconds(unsigned int);
long millis(void);
// pin prototypes
void pinMode(uint8_t, uint8_t);
@ -26,61 +25,15 @@ extern "C" {
void analogWrite(int, int);
// pulse prototypes
void beginPulse(void);
void endPulse(void);
void pulseFrequency(int, int);
void pulseRun(int, int);
void pulseStop(int);
int pulseRunning(int);
uint16_t pulseIn(uint8_t, uint8_t);
unsigned long pulseIn(int, int);
// interrupt management prototypes
void attachInterrupt(uint8_t, void *(void) );
void attachInterrupt(uint8_t, void (*)(void) );
void detachInterrupt(uint8_t);
// serial prototypes
void beginSerial(int);
void endSerial(void);
int serialRead(void);
void serialWrite(int);
void serialWriteBytes(char[]);
uint8_t serialAvailable(void);
void beginSerial1(int);
void endSerial1(void);
int serial1Read(void);
void serial1Write(int);
void serial1WriteBytes(char[]);
uint8_t serial1Available(void);
void printMode(int);
void print(const char *, ...);
/*
// servo prototypes
void beginServo(void);
void endServo(void);
void attachServo(int, int);
uint8_t servoRead(int);
void servoWrite(int, int);
*/
// lcd prototypes
void beginDisplay(void);
void endDisplay(void);
void displayWrite(int);
void displayClear(void);
void cursorHome(void);
void cursorMoveTo(uint8_t, uint8_t);
// encoder prototypes
void beginEncoder(void);
void endEncoder(void);
void attachEncoder(int, int, int);
int32_t encoderRead(uint8_t);
void encoderWrite(uint8_t, uint32_t);
}
// library includes
#include "Servo.h"
//#include "Wire.h"
//#include "Matrix.h"
// random prototypes
float random(float);
float random(float, float);
void randomSeed(unsigned int);

BIN
targets/wiring/WRandom.o Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,83 +0,0 @@
/*
Wire.h - TWI/I2C library file for Wiring
Part of the Wiring project - http://wiring.org.co
Copyright (c) 2004-2005 Hernando Barragan
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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Wire TWI/I2C library by Nicholas Zambetti
*/
#ifndef Wire_h
#define Wire_h
#include <inttypes.h>
#ifndef TWI_FREQ
#define TWI_FREQ 100000L
#endif
#ifndef TWI_BUFFERSIZE
#define TWI_BUFFERSIZE 32
#endif
class Wire
{
private:
static volatile uint8_t _state;
static uint8_t _slarw;
static uint8_t _masterBuffer[TWI_BUFFERSIZE];
static uint8_t _masterBufferLength;
static volatile uint8_t _masterBufferIndex;
static void (*Wire::_onSlaveTransmit)(void);
static void (*Wire::_onSlaveReceive)(int);
static uint8_t _txBuffer[TWI_BUFFERSIZE];
static volatile uint8_t _txBufferIndex;
static volatile uint8_t _txBufferLength;
static uint8_t _rxBuffer[TWI_BUFFERSIZE];
static volatile uint8_t _rxBufferIndex;
uint8_t readFrom(uint8_t, uint8_t*, uint8_t);
uint8_t writeTo(uint8_t, uint8_t*, uint8_t, uint8_t);
static void reply(uint8_t);
static void stop(void);
static void releaseBus(void);
static void interruptLogic(void);
public:
Wire(uint8_t);
uint8_t read(int);
void readBytes(int, uint8_t*, int);
void readBytes(int, char*, int);
void write(int, int);
void writeBytes(int, uint8_t*, int);
void writeBytes(int, char*);
void transmit(uint8_t);
void transmitBytes(uint8_t*, uint8_t);
void transmitBytes(char*);
uint8_t receive(void);
void receiveBytes(uint8_t*);
void receiveBytes(char*);
void onDataIn( void (*)(int) );
void onDataOut( void (*)(void) );
};
#endif

Binary file not shown.

41
targets/wiring/buffer.h Executable file
View File

@ -0,0 +1,41 @@
/*
buffer.h - Buffer library for Wiring & Arduino
Based on Hernando Barragan's original C implementation
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef buffer_h
#define buffer_h
#include <inttypes.h>
typedef struct {
char* in;
char* out;
char* buf;
uint16_t len;
uint16_t cnt;
} buffer_t;
void buffer_init(buffer_t*, char*, uint16_t);
void buffer_put(buffer_t*, char);
uint16_t buffer_get(buffer_t*);
uint8_t buffer_look(buffer_t*);
uint8_t buffer_available(buffer_t*);
#endif

BIN
targets/wiring/buffer.o Normal file

Binary file not shown.

57
targets/wiring/twi.h Executable file
View File

@ -0,0 +1,57 @@
/*
twi.h - TWI/I2C library for Wiring & Arduino
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef twi_h
#define twi_h
#include <inttypes.h>
//#define ATMEGA8
#ifndef CPU_FREQ
#define CPU_FREQ 16000000L
#endif
#ifndef TWI_FREQ
#define TWI_FREQ 100000L
#endif
#ifndef TWI_BUFFER_LENGTH
#define TWI_BUFFER_LENGTH 32
#endif
#define TWI_READY 0
#define TWI_MRX 1
#define TWI_MTX 2
#define TWI_SRX 3
#define TWI_STX 4
void twi_init(void);
void twi_setAddress(uint8_t);
uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t);
uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t);
uint8_t twi_transmit(uint8_t*, uint8_t);
void twi_attachSlaveRxEvent( void (*)(uint8_t*, int) );
void twi_attachSlaveTxEvent( void (*)(void) );
void twi_reply(uint8_t);
void twi_stop(void);
void twi_releaseBus(void);
#endif

BIN
targets/wiring/twi.o Normal file

Binary file not shown.

40
targets/wiring/uart.h Executable file
View File

@ -0,0 +1,40 @@
/*
uart.h - UART Serial library for Wiring
Based on Hernando Barragan's original C implementation
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef uart_h
#define uart_h
#include <inttypes.h>
#ifndef CPU_FREQ
#define CPU_FREQ 16000000L
#endif
#ifndef UART_BUFFER_LENGTH
#define UART_BUFFER_LENGTH 32
#endif
void uart_init(uint8_t, long);
int uart_read(uint8_t);
uint8_t uart_available(uint8_t);
void uart_write(uint8_t, char*, uint8_t);
#endif

BIN
targets/wiring/uart.o Normal file

Binary file not shown.