├── .gitignore ├── Arduino.mk ├── README.md ├── examples └── Digispark_Examples │ ├── CharliePlexMarquee │ └── charlieplex.ino │ ├── Charlieplex │ └── Charlieplex.ino │ ├── EEPROM │ └── EEPROM.ino │ ├── Expander │ └── Expander.ino │ ├── Infrared │ └── Infrared.ino │ ├── MotorShield │ └── MotorShield.ino │ ├── NoIDEBlink │ ├── Makefile │ ├── README.md │ └── main.cpp │ ├── Rfm12b │ └── Rfm12b.ino │ └── Start │ └── Start.ino ├── hardware └── digispark │ ├── boards.txt │ ├── bootloaders │ ├── empty │ │ ├── empty2313at1.hex │ │ ├── empty2313at8.hex │ │ ├── empty24at16.hex │ │ ├── empty25at1.hex │ │ ├── empty25at8.hex │ │ ├── empty4313at1.hex │ │ ├── empty4313at8.hex │ │ ├── empty44at1.hex │ │ ├── empty44at8.hex │ │ ├── empty45at1.hex │ │ ├── empty45at8.hex │ │ ├── empty84at1.hex │ │ ├── empty84at16.hex │ │ ├── empty84at8.hex │ │ ├── empty85at1.hex │ │ ├── empty85at16.hex │ │ └── empty85at8.hex │ └── micronucleus │ │ ├── micronucleus-1.05-jumper-upgrade.hex │ │ └── micronucleus-1.06-upgrade.hex │ ├── cores │ ├── empty │ │ ├── Arduino.h │ │ ├── WProgram.h │ │ └── main.cpp │ └── tiny │ │ ├── Arduino.h │ │ ├── HardwareSerial.cpp │ │ ├── HardwareSerial.h │ │ ├── Print.cpp │ │ ├── Print.h │ │ ├── PwmTimer.h │ │ ├── Stream.h │ │ ├── TinyDebugSerial.cpp │ │ ├── TinyDebugSerial.h │ │ ├── TinyDebugSerial115200.cpp │ │ ├── TinyDebugSerial38400.cpp │ │ ├── TinyDebugSerial9600.cpp │ │ ├── TinyDebugSerialErrors.cpp │ │ ├── Tone.cpp │ │ ├── ToneTimer.h │ │ ├── UserTimer.h │ │ ├── WCharacter.h │ │ ├── WConstants.h │ │ ├── WInterrupts.c │ │ ├── WMath.cpp │ │ ├── WProgram.h │ │ ├── WString.cpp │ │ ├── WString.h │ │ ├── binary.h │ │ ├── core_adc.h │ │ ├── core_build_options.h │ │ ├── core_macros.h │ │ ├── core_pins.h │ │ ├── core_timers.h │ │ ├── main.cpp │ │ ├── new.cpp │ │ ├── new.h │ │ ├── pins_arduino.c │ │ ├── pins_arduino.h │ │ ├── wiring.c │ │ ├── wiring.h │ │ ├── wiring_analog.c │ │ ├── wiring_digital.c │ │ ├── wiring_private.h │ │ ├── wiring_pulse.c │ │ └── wiring_shift.c │ ├── license.txt │ ├── programmers.txt │ └── readme.txt └── libraries ├── Arduino_SoftwareSerial ├── SoftwareSerial.cpp ├── SoftwareSerial.h ├── examples │ ├── SoftwareSerialExample │ │ └── SoftwareSerialExample.ino │ └── TwoPortReceive │ │ └── TwoPortReceive.ino └── keywords.txt ├── DigisparkJoystick ├── ArduinoNotes.txt ├── Changelog.txt ├── CommercialLicense.txt ├── DigiJoystick.h ├── DigiKeyboard.h.old ├── JoystickReadme.txt ├── License.txt ├── Readme.txt ├── USB-ID-FAQ.txt ├── USB-IDs-for-free.txt ├── USBID-License.txt ├── asmcommon.inc ├── examples │ └── Joystick │ │ └── Joystick.ino ├── keywords.txt ├── oddebug.c ├── oddebug.h ├── osccal.c ├── osccal.c.lst ├── osccal.h ├── osccal.o ├── osctune.h ├── usbconfig-prototype.h ├── usbconfig.h ├── usbdrv.c ├── usbdrv.h ├── usbdrvasm.S ├── usbdrvasm.asm ├── usbdrvasm12.inc ├── usbdrvasm128.inc ├── usbdrvasm15.inc ├── usbdrvasm16.inc ├── usbdrvasm165.inc ├── usbdrvasm18-crc.inc ├── usbdrvasm20.inc └── usbportability.h ├── DigisparkKeyboard ├── ArduinoNotes.txt ├── Changelog.txt ├── CommercialLicense.txt ├── DigiKeyboard.h ├── License.txt ├── Readme.txt ├── USB-ID-FAQ.txt ├── USB-IDs-for-free.txt ├── USBID-License.txt ├── asmcommon.inc ├── examples │ └── Keyboard │ │ └── Keyboard.ino ├── keywords.txt ├── oddebug.c ├── oddebug.h ├── osccal.c ├── osccal.c.lst ├── osccal.h ├── osccal.o ├── osctune.h ├── scancode-ascii-table.h ├── usbconfig-prototype.h ├── usbconfig.h ├── usbdrv.c ├── usbdrv.h ├── usbdrvasm.S ├── usbdrvasm.asm ├── usbdrvasm12.inc ├── usbdrvasm128.inc ├── usbdrvasm15.inc ├── usbdrvasm16.inc ├── usbdrvasm165.inc ├── usbdrvasm18-crc.inc ├── usbdrvasm20.inc └── usbportability.h ├── DigisparkLCD ├── LiquidCrystal_I2C.cpp ├── LiquidCrystal_I2C.h ├── examples │ └── BasicUsage │ │ └── BasicUsage.ino ├── info │ ├── BC557.pdf │ ├── Image.jpg │ ├── PCF8574P.pdf │ ├── Schematic_diagram.jpg │ ├── notes_for_pollin_interface.txt │ └── readme.txt └── keywords.txt ├── DigisparkLPD8806 ├── LPD8806.cpp ├── LPD8806.h ├── README.md └── examples │ ├── LEDbeltKit │ └── LEDbeltKit.pde │ ├── advancedLEDbeltKit │ └── advancedLEDbeltKit.pde │ ├── longstrandtest │ └── longstrandtest.pde │ └── strandtest │ └── strandtest.pde ├── DigisparkMouse ├── ArduinoNotes.txt ├── Changelog.txt ├── CommercialLicense.txt ├── DigiMouse.h ├── License.txt ├── MouseReadme.txt ├── Readme.txt ├── USB-ID-FAQ.txt ├── USB-IDs-for-free.txt ├── USBID-License.txt ├── asmcommon.inc ├── examples │ └── Mouse │ │ └── Mouse.ino ├── keywords.txt ├── oddebug.c ├── oddebug.h ├── osccal.c ├── osccal.c.lst ├── osccal.h ├── osccal.o ├── osctune.h ├── usbconfig-prototype.h ├── usbconfig.h ├── usbdrv.c ├── usbdrv.h ├── usbdrvasm.S ├── usbdrvasm.asm ├── usbdrvasm12.inc ├── usbdrvasm128.inc ├── usbdrvasm15.inc ├── usbdrvasm16.inc ├── usbdrvasm165.inc ├── usbdrvasm18-crc.inc ├── usbdrvasm20.inc └── usbportability.h ├── DigisparkNunchuk ├── ArduinoNunchuk.cpp ├── ArduinoNunchuk.h ├── LICENSE.txt ├── README.txt ├── examples │ ├── ArduinoNunchukDemo │ │ └── ArduinoNunchukDemo.ino │ ├── DigisparkJoystickDemo │ │ └── DigisparkJoystickDemo.ino │ └── DigisparkUSBDemo │ │ └── DigisparkUSBDemo.ino └── keywords.txt ├── DigisparkRGB ├── DigisparkRGB.cpp ├── DigisparkRGB.h ├── examples │ └── DigisparkRGB │ │ └── DigisparkRGB.ino └── keywords.txt ├── DigisparkRcSeq ├── Examples │ ├── DigiRcSeqZodiac │ │ └── DigiRcSeqZodiac.ino │ ├── OnePropTo5 │ │ └── OnePropTo5.ino │ ├── RcSeqDemo │ │ └── RcSeqDemo.ino │ ├── RcSeqZodiac │ │ └── RcSeqZodiac.ino │ └── UneVoieVers8 │ │ └── UneVoieVers8.ino ├── RcSeq.cpp ├── RcSeq.h └── keywords.txt ├── DigisparkSimpleServo ├── .DS_Store ├── README.txt ├── SimpleServo.cpp ├── SimpleServo.h ├── examples │ └── .DS_Store └── keywords.txt ├── DigisparkSoftRcPulseIn ├── SoftRcPulseIn.cpp ├── SoftRcPulseIn.h ├── examples │ ├── SoftRcPulseInDemo │ │ └── SoftRcPulseInDemo.ino │ └── SoftRcPulseInOutDemo │ │ └── SoftRcPulseInOutDemo.ino └── keywords.txt ├── DigisparkSoftRcPulseOut ├── SoftRcPulseOut.cpp ├── SoftRcPulseOut.h ├── examples │ ├── Knob │ │ └── Knob.ino │ ├── SerialServo │ │ └── SerialServo.ino │ ├── SoftRcPulseInOutDemo │ │ └── SoftRcPulseInOutDemo.ino │ ├── Sweep │ │ └── Sweep.ino │ ├── Usb2Servos │ │ └── Usb2Servos.ino │ └── knob_moyennee │ │ └── knob_moyennee.ino └── keywords.txt ├── DigisparkSoftSerial ├── SoftSerial.cpp ├── SoftSerial.h ├── examples │ ├── Digi_1io_SerialDbg │ │ └── Digi_1io_SerialDbg.ino │ ├── SoftSerialExample │ │ └── SoftSerialExample.ino │ └── TwoPortReceive │ │ └── TwoPortReceive.ino └── keywords.txt ├── DigisparkTinyPinChange ├── TinyPinChange.cpp ├── TinyPinChange.h ├── examples │ └── TinyPinChangeDemo │ │ └── TinyPinChangeDemo.ino └── keywords.txt ├── DigisparkTinyRTClib ├── README.md ├── TinyRTClib.cpp ├── TinyRTClib.h ├── examples │ ├── datecalc │ │ └── datecalc.pde │ ├── ds1307 │ │ └── ds1307.pde │ └── softrtc │ │ └── softrtc.pde └── keywords.txt ├── DigisparkTinySoftPwm ├── TinySoftPwm.cpp ├── TinySoftPwm.h ├── examples │ └── TinySoftPwmDemo │ │ └── TinySoftPwmDemo.ino └── keywords.txt ├── DigisparkUSB ├── ArduinoNotes.txt ├── Changelog.txt ├── CommercialLicense.txt ├── DigiUSB.cpp ├── DigiUSB.h ├── DigisparkReadme.txt ├── License.txt ├── Readme.txt ├── USB-ID-FAQ.txt ├── USB-IDs-for-free.txt ├── USBID-License.txt ├── asmcommon.inc ├── examples │ ├── DigiBlink │ │ └── DigiBlink.ino │ ├── DigiScope │ │ └── DigiScope.ino │ ├── DigiUSB2LCD │ │ └── DigiUSB2LCD.ino │ └── Echo │ │ └── Echo.ino ├── keywords.txt ├── libs-device │ ├── Readme.txt │ ├── osccal.c │ ├── osccal.c.lst │ ├── osccal.h │ ├── osccal.o │ └── osctune.h ├── oddebug.c ├── oddebug.h ├── osccal.c ├── osccal.c.lst ├── osccal.h ├── osccal.o ├── osctune.h ├── rx_buffer.h ├── usbconfig-prototype.h ├── usbconfig.h ├── usbdrv.c ├── usbdrv.h ├── usbdrvasm.S ├── usbdrvasm.asm ├── usbdrvasm12.inc ├── usbdrvasm128.inc ├── usbdrvasm15.inc ├── usbdrvasm16.inc ├── usbdrvasm165.inc ├── usbdrvasm18-crc.inc ├── usbdrvasm20.inc └── usbportability.h ├── DigisparkVirtualWire ├── CHANGES ├── LICENSE ├── MANIFEST ├── Makefile ├── README ├── VirtualWire.cpp ├── VirtualWire.h ├── examples │ ├── client │ │ └── client.pde │ ├── receiver │ │ └── receiver.pde │ ├── server │ │ └── server.pde │ └── transmitter │ │ └── transmitter.pde ├── keywords.txt └── util │ └── crc16.h ├── OneWire ├── OneWire.cpp ├── OneWire.h ├── examples │ ├── DS18x20_Temperature │ │ └── DS18x20_Temperature.pde │ ├── DS2408_Switch │ │ └── DS2408_Switch.pde │ ├── DS250x_PROM │ │ └── DS250x_PROM.pde │ └── Digispark_Example │ │ └── Digispark_Example.ino └── keywords.txt └── TinyWireM_Digispark ├── TinyWireM.cpp ├── TinyWireM.h ├── USI_TWI_Master.cpp ├── USI_TWI_Master.h ├── examples ├── Tiny85_Temp │ └── Tiny85_Temp.pde ├── Tiny85_Temp_LCD │ └── Tiny85_Temp_LCD.pde └── Tiny85_Temp_LCD_RTC │ └── Tiny85_Temp_LCD_RTC.pde └── keywords.txt /.gitignore: -------------------------------------------------------------------------------- 1 | /libraries/Wire 2 | /libraries/EEPROM 3 | /libraries/Esplora 4 | /libraries/Ethernet 5 | /libraries/Firmata 6 | /libraries/LiquidCrystal 7 | /libraries/SD 8 | /libraries/Servo 9 | /libraries/SoftwareSerial 10 | /libraries/SPI 11 | /libraries/Stepper 12 | /libraries/WiFi 13 | Digispark.app 14 | Digispark.zip 15 | install.rb 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DEPRECATED REPLACED BY: https://github.com/digistump/DigistumpArduino 2 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/Charlieplex/Charlieplex.ino: -------------------------------------------------------------------------------- 1 | void setup() { 2 | // initialize the digital pin as an output. 3 | 4 | 5 | } 6 | 7 | // the loop routine runs over and over again forever: 8 | void loop() { 9 | LEDon(0, 1); 10 | delay(1000); 11 | LEDon(0, 2); 12 | delay(1000); 13 | LEDon(0, 3); 14 | delay(1000); 15 | LEDon(0, 4); 16 | delay(1000); 17 | LEDon(1, 0); 18 | delay(1000); 19 | LEDon(1, 2); 20 | delay(1000); 21 | LEDon(1, 3); 22 | delay(1000); 23 | LEDon(1, 4); 24 | delay(1000); 25 | LEDon(2, 0); 26 | delay(1000); 27 | LEDon(2, 1); 28 | delay(1000); 29 | LEDon(2, 3); 30 | delay(1000); 31 | LEDon(2, 4); 32 | delay(1000); 33 | LEDon(3, 0); 34 | delay(1000); 35 | LEDon(3, 1); 36 | delay(1000); 37 | LEDon(3, 2); 38 | delay(1000); 39 | LEDon(3, 4); 40 | delay(1000); 41 | LEDon(4, 0); 42 | delay(1000); 43 | LEDon(4, 1); 44 | delay(1000); 45 | LEDon(4, 2); 46 | delay(1000); 47 | LEDon(4, 3); 48 | delay(1000); 49 | } 50 | 51 | void LEDon(int vin, int gnd) { 52 | pinMode(0, INPUT); 53 | pinMode(1, INPUT); 54 | pinMode(2, INPUT); 55 | pinMode(3, INPUT); 56 | pinMode(4, INPUT); 57 | pinMode(5, INPUT); 58 | 59 | pinMode(vin, OUTPUT); 60 | pinMode(gnd, OUTPUT); 61 | digitalWrite(vin, HIGH); 62 | digitalWrite(gnd, LOW); 63 | } 64 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/EEPROM/EEPROM.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define disk1 0x50 //Address of 24LC256 eeprom chip 4 | int returned = 0; 5 | void setup(void) 6 | { 7 | //Serial.begin(9600); 8 | TinyWireM.begin(); 9 | 10 | unsigned int address = 0; 11 | pinMode(5, OUTPUT); 12 | 13 | writeEEPROM(disk1, address, 5); 14 | returned = readEEPROM(disk1, address); 15 | 16 | while(returned>0){ 17 | digitalWrite(5,HIGH); 18 | delay(500); 19 | digitalWrite(5,LOW); 20 | delay(500); 21 | returned--; 22 | } 23 | 24 | } 25 | 26 | void loop(){} 27 | 28 | void writeEEPROM(int deviceaddress, unsigned int eeaddress, byte data ) 29 | { 30 | TinyWireM.beginTransmission(deviceaddress); 31 | TinyWireM.send((int)(eeaddress >> 8)); // MSB 32 | TinyWireM.send((int)(eeaddress & 0xFF)); // LSB 33 | TinyWireM.send(data); 34 | TinyWireM.endTransmission(); 35 | 36 | delay(5); 37 | } 38 | 39 | byte readEEPROM(int deviceaddress, unsigned int eeaddress ) 40 | { 41 | byte rdata = 0xFF; 42 | 43 | TinyWireM.beginTransmission(deviceaddress); 44 | TinyWireM.send((int)(eeaddress >> 8)); // MSB 45 | TinyWireM.send((int)(eeaddress & 0xFF)); // LSB 46 | TinyWireM.endTransmission(); 47 | 48 | TinyWireM.requestFrom(deviceaddress,1); 49 | 50 | if (TinyWireM.available()) rdata = TinyWireM.receive(); 51 | 52 | return rdata; 53 | } 54 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/Expander/Expander.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #define expander 0x20 3 | 4 | byte expanderStatus = B11111111; //all off 5 | 6 | void setup() 7 | { 8 | TinyWireM.begin(); 9 | } 10 | 11 | void loop() 12 | { 13 | expanderWrite(0,HIGH); 14 | delay(1000); 15 | expanderWrite(0,LOW); 16 | delay(1000); 17 | } 18 | 19 | 20 | void expanderWrite(byte pinNumber, boolean state){ 21 | if(state == HIGH) 22 | expanderStatus &= ~(1 << pinNumber); 23 | else 24 | expanderStatus |= (1 << pinNumber); 25 | 26 | expanderWrite(expanderStatus); 27 | } 28 | 29 | void expanderWrite(byte _data ) { 30 | TinyWireM.beginTransmission(expander); 31 | TinyWireM.send(_data); 32 | TinyWireM.endTransmission(); 33 | } 34 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/Infrared/Infrared.ino: -------------------------------------------------------------------------------- 1 | int irPin=2; 2 | 3 | void setup() 4 | { 5 | pinMode(irPin,INPUT); 6 | pinMode(0,OUTPUT); 7 | //Serial.begin(9600); 8 | digitalWrite(0,HIGH); 9 | //Serial.println("You pressed a button"); 10 | delay(1000); 11 | digitalWrite(0,LOW); 12 | } 13 | 14 | void loop() 15 | { 16 | 17 | if(pulseIn(irPin,LOW)) 18 | { 19 | //button pressed 20 | delay(100); 21 | digitalWrite(0,HIGH); 22 | //Serial.println("You pressed a button"); 23 | delay(1000); 24 | digitalWrite(0,LOW); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/MotorShield/MotorShield.ino: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This example code is in the public domain. 4 | */ 5 | 6 | int MotorADir = 2; 7 | int MotorASpeed = 0; 8 | int MotorBDir = 5; 9 | int MotorBSpeed = 1; 10 | 11 | // the setup routine runs once when you press reset: 12 | void setup() { 13 | // initialize the outputs. 14 | pinMode(MotorADir, OUTPUT); 15 | pinMode(MotorASpeed, OUTPUT); 16 | pinMode(MotorBDir, OUTPUT); 17 | pinMode(MotorBSpeed, OUTPUT); 18 | } 19 | 20 | // the loop routine runs over and over again forever: 21 | void loop() { 22 | //both motors forward full speed 23 | digitalWrite(MotorADir, HIGH); //forward 24 | digitalWrite(MotorBDir, HIGH); 25 | analogWrite(MotorASpeed, 255); //full speed 26 | analogWrite(MotorBSpeed, 255); 27 | delay(5000); // wait for 5 seconds 28 | //turn in place (if using a skid steer configuration) 29 | digitalWrite(MotorADir, HIGH); //forward 30 | digitalWrite(MotorBDir, HIGH); 31 | analogWrite(MotorASpeed, 255); 32 | analogWrite(MotorBSpeed, 0); //off 33 | delay(5000); // wait for 5 seconds 34 | //turn gradually - the other direction (if using a skid steer configuration) 35 | digitalWrite(MotorADir, HIGH); //forward 36 | digitalWrite(MotorBDir, HIGH); 37 | analogWrite(MotorASpeed, 100); 38 | analogWrite(MotorBSpeed, 255); 39 | delay(5000); // wait for 5 seconds 40 | //stop 41 | digitalWrite(MotorADir, HIGH); //forward 42 | digitalWrite(MotorBDir, HIGH); 43 | analogWrite(MotorASpeed, 0); 44 | analogWrite(MotorBSpeed, 0); //off 45 | //reverse slowly 46 | digitalWrite(MotorADir, LOW); //reverse 47 | digitalWrite(MotorBDir, LOW); 48 | analogWrite(MotorASpeed, 100); 49 | analogWrite(MotorBSpeed, 100); 50 | } 51 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/NoIDEBlink/Makefile: -------------------------------------------------------------------------------- 1 | # Digistpark development without the Arduino IDE 2 | # Christopher M Poole 3 | 4 | DIGISPARK_DIR = ../../../ 5 | 6 | TARGET = main 7 | #DIGISPARK_LIBS = 8 | MCU = attiny85 9 | F_CPU = 16000000L 10 | 11 | include $(DIGISPARK_DIR)/Arduino.mk 12 | 13 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/NoIDEBlink/README.md: -------------------------------------------------------------------------------- 1 | ## Digispark Development sans Arduino IDE 2 | 3 | In the top level directory, a slightly modified Arduino.mk has been added. 4 | Include this in the user Makefile and you can compile and upload for Digispark from the command line: 5 | 6 | $> git clone https://github.com/christopherpoole/DigisparkArduinoIntegration.git 7 | $> DigisparkArduinoIntegration/examples/Digispark_Examples/NoIDEBlink/ 8 | $> make 9 | $> sudo make dsupload 10 | micronucleus --run build-cli/main.hex 11 | > Please plug in the device ... 12 | > Press CTRL+C to terminate the program 13 | 14 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/NoIDEBlink/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ledPin = 1; // LED connected to digital pin 1 4 | 5 | void setup() { 6 | pinMode(ledPin, OUTPUT); 7 | } 8 | 9 | void loop() { 10 | digitalWrite(ledPin, HIGH); 11 | delay(50); 12 | digitalWrite(ledPin, LOW); 13 | delay(50); 14 | } 15 | 16 | int main(void) { 17 | init(); 18 | setup(); 19 | for (;;) { 20 | loop(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/Digispark_Examples/Start/Start.ino: -------------------------------------------------------------------------------- 1 | 2 | // the setup routine runs once when you press reset: 3 | void setup() { 4 | // initialize the digital pin as an output. 5 | pinMode(0, OUTPUT); //LED on Model B 6 | pinMode(1, OUTPUT); //LED on Model A 7 | } 8 | 9 | // the loop routine runs over and over again forever: 10 | void loop() { 11 | digitalWrite(0, HIGH); // turn the LED on (HIGH is the voltage level) 12 | digitalWrite(1, HIGH); 13 | delay(1000); // wait for a second 14 | digitalWrite(0, LOW); // turn the LED off by making the voltage LOW 15 | digitalWrite(1, LOW); 16 | delay(1000); // wait for a second 17 | } 18 | -------------------------------------------------------------------------------- /hardware/digispark/boards.txt: -------------------------------------------------------------------------------- 1 | digispark-tiny.name=Digispark (Tiny Core) 2 | digispark-tiny.upload.maximum_size=6012 3 | digispark-tiny.build.mcu=attiny85 4 | digispark-tiny.build.f_cpu=16500000L 5 | digispark-tiny.build.core=tiny 6 | digispark-tiny.upload.using=digispark 7 | digispark-tiny.bootloader.low_fuses=0xf1 8 | digispark-tiny.bootloader.high_fuses=0x5f 9 | digispark-tiny.bootloader.extended_fuses=0xfe 10 | digispark-tiny.bootloader.path=micronucleus 11 | digispark-tiny.bootloader.file=micronucleus-1.06-upgrade.hex 12 | 13 | digispark-tiny16mhz.name=Digispark 16.0mhz - NO USB (Tiny Core) 14 | digispark-tiny16mhz.upload.maximum_size=6012 15 | digispark-tiny16mhz.build.mcu=attiny85 16 | digispark-tiny16mhz.build.f_cpu=16000000L 17 | digispark-tiny16mhz.build.core=tiny 18 | digispark-tiny16mhz.upload.using=digispark 19 | digispark-tiny16mhz.bootloader.low_fuses=0xf1 20 | digispark-tiny16mhz.bootloader.high_fuses=0x5f 21 | digispark-tiny16mhz.bootloader.extended_fuses=0xfe 22 | digispark-tiny16mhz.bootloader.path=micronucleus 23 | digispark-tiny16mhz.bootloader.file=micronucleus-1.06-upgrade.hex 24 | 25 | digispark-tiny8mhz.name=Digispark 8mhz - NO USB (Tiny Core) 26 | digispark-tiny8mhz.upload.maximum_size=6012 27 | digispark-tiny8mhz.build.mcu=attiny85 28 | digispark-tiny8mhz.build.f_cpu=8000000L 29 | digispark-tiny8mhz.build.core=tiny 30 | digispark-tiny8mhz.upload.using=digispark 31 | digispark-tiny8mhz.bootloader.low_fuses=0xf1 32 | digispark-tiny8mhz.bootloader.high_fuses=0x5f 33 | digispark-tiny8mhz.bootloader.extended_fuses=0xfe 34 | digispark-tiny8mhz.bootloader.path=micronucleus 35 | digispark-tiny8mhz.bootloader.file=micronucleus-1.06-upgrade.hex 36 | 37 | digispark-tiny1mhz.name=Digispark 1mhz - NO USB (Tiny Core) 38 | digispark-tiny1mhz.upload.maximum_size=6012 39 | digispark-tiny1mhz.build.mcu=attiny85 40 | digispark-tiny1mhz.build.f_cpu=1000000L 41 | digispark-tiny1mhz.build.core=tiny 42 | digispark-tiny1mhz.upload.using=digispark 43 | digispark-tiny1mhz.bootloader.low_fuses=0xf1 44 | digispark-tiny1mhz.bootloader.high_fuses=0x5f 45 | digispark-tiny1mhz.bootloader.extended_fuses=0xfe 46 | digispark-tiny1mhz.bootloader.path=micronucleus 47 | digispark-tiny1mhz.bootloader.file=micronucleus-1.06-upgrade.hex 48 | 49 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty2313at1.hex: -------------------------------------------------------------------------------- 1 | :1000000012C02AC029C028C027C026C02CC024C0C6 2 | :1000100023C022C021C020C01FC01EC01DC01CC0E4 3 | :100020001BC01AC019C011241FBECFEDCDBF10E0F8 4 | :10003000A0E6B0E0ECE4F1E002C005900D92A0363D 5 | :10004000B107D9F710E0A0E6B0E001C01D92A936D3 6 | :10005000B107E1F704D078C0D3CF0895089557D001 7 | :10006000FCDFFCDFFECF1F920F920FB60F92112420 8 | :100070002F933F934F935F936F937F938F939F93B0 9 | :10008000AF93BF932091640030916500409166006A 10 | :100090005091670070916800DA01C9010296A11DB4 11 | :1000A000B11D672F6A5F6D3730F06D57DA01C901F6 12 | :1000B0000396A11DB11D6093680080936400909326 13 | :1000C0006500A0936600B0936700809160009091F6 14 | :1000D0006100A0916200B09163000196A11DB11D65 15 | :1000E0008093600090936100A0936200B0936300DE 16 | :1000F000BF91AF919F918F917F916F915F914F9140 17 | :100100003F912F910F900FBE0F901F9018957894EC 18 | :1001100080B7836080BF83B7877F83BF83B7887FC3 19 | :10012000826083BF89B7826089BF8EB5887F8EBDAC 20 | :100130008FB58C7F81608FBD8EB5877E8EBD8EB56D 21 | :0C014000887F82608EBD0895F894FFCF88 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty2313at8.hex: -------------------------------------------------------------------------------- 1 | :1000000012C02AC029C028C027C026C02CC024C0C6 2 | :1000100023C022C021C020C01FC01EC01DC01CC0E4 3 | :100020001BC01AC019C011241FBECFEDCDBF10E0F8 4 | :10003000A0E6B0E0ECE4F1E002C005900D92A0363D 5 | :10004000B107D9F710E0A0E6B0E001C01D92A936D3 6 | :10005000B107E1F704D078C0D3CF0895089557D001 7 | :10006000FCDFFCDFFECF1F920F920FB60F92112420 8 | :100070002F933F934F935F936F937F938F939F93B0 9 | :10008000AF93BF932091640030916500409166006A 10 | :100090005091670070916800DA01C9010296A11DB4 11 | :1000A000B11D672F6A5F6D3730F06D57DA01C901F6 12 | :1000B0000396A11DB11D6093680080936400909326 13 | :1000C0006500A0936600B0936700809160009091F6 14 | :1000D0006100A0916200B09163000196A11DB11D65 15 | :1000E0008093600090936100A0936200B0936300DE 16 | :1000F000BF91AF919F918F917F916F915F914F9140 17 | :100100003F912F910F900FBE0F901F9018957894EC 18 | :1001100080B7836080BF83B7877F83BF83B7887FC3 19 | :10012000836083BF89B7826089BF8EB5887F8EBDAB 20 | :100130008FB58C7F81608FBD8EB5877E8EBD8EB56D 21 | :0C014000887F83608EBD0895F894FFCF87 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty24at16.hex: -------------------------------------------------------------------------------- 1 | :1000000010C015C014C013C012C011C010C00FC062 2 | :100010000EC00DC00CC00BC00AC009C008C007C08C 3 | :1000200006C011241FBECFEDCDBF02D002C0E8CF65 4 | :06003000FFCFF894FFCFA2 5 | :00000001FF 6 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty25at1.hex: -------------------------------------------------------------------------------- 1 | :100000000EC026C025C024C02AC022C021C020C0E6 2 | :100010001FC01EC01DC01CC01BC01AC019C01124A7 3 | :100020001FBECFEDCDBF10E0A0E6B0E0E8E5F1E007 4 | :1000300002C005900D92A036B107D9F710E0A0E6F6 5 | :10004000B0E001C01D92A936B107E1F704D082C02B 6 | :10005000D7CF0895089557D0FCDFFCDFFECF1F9265 7 | :100060000F920FB60F9211242F933F934F935F93EC 8 | :100070006F937F938F939F93AF93BF93209164006F 9 | :100080003091650040916600509167007091680062 10 | :10009000DA01C9010296A11DB11D672F6A5F6D3794 11 | :1000A00030F06D57DA01C9010396A11DB11D6093AF 12 | :1000B00068008093640090936500A0936600B093FD 13 | :1000C00067008091600090916100A0916200B09102 14 | :1000D00063000196A11DB11D8093600090936100A3 15 | :1000E000A0936200B0936300BF91AF919F918F91F5 16 | :1000F0007F916F915F914F913F912F910F900FBE24 17 | :100100000F901F901895789480B7806880BF80B753 18 | :10011000806480BF8CB580648CBD8FEF8DBD80B74F 19 | :10012000807F846080BF89B7846089BF83B7887F00 20 | :1001300083BF8AB58C7F81608ABD83B7877F83BF89 21 | :1001400083B7887F826083BF86B1887F836086B9EA 22 | :08015000379A0895F894FFCFDF 23 | :00000001FF 24 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty25at8.hex: -------------------------------------------------------------------------------- 1 | :100000000EC026C025C024C02AC022C021C020C0E6 2 | :100010001FC01EC01DC01CC01BC01AC019C01124A7 3 | :100020001FBECFEDCDBF10E0A0E6B0E0E8E5F1E007 4 | :1000300002C005900D92A036B107D9F710E0A0E6F6 5 | :10004000B0E001C01D92A936B107E1F704D082C02B 6 | :10005000D7CF0895089557D0FCDFFCDFFECF1F9265 7 | :100060000F920FB60F9211242F933F934F935F93EC 8 | :100070006F937F938F939F93AF93BF93209164006F 9 | :100080003091650040916600509167007091680062 10 | :10009000DA01C9010296A11DB11D672F6A5F6D3794 11 | :1000A00030F06D57DA01C9010396A11DB11D6093AF 12 | :1000B00068008093640090936500A0936600B093FD 13 | :1000C00067008091600090916100A0916200B09102 14 | :1000D00063000196A11DB11D8093600090936100A3 15 | :1000E000A0936200B0936300BF91AF919F918F91F5 16 | :1000F0007F916F915F914F913F912F910F900FBE24 17 | :100100000F901F901895789480B7806880BF80B753 18 | :10011000806480BF8CB580648CBD8FEF8DBD80B74F 19 | :10012000807F876080BF89B7846089BF83B7887FFD 20 | :1001300083BF8AB58C7F81608ABD83B7877F83BF89 21 | :1001400083B7887F836083BF86B1887F866086B9E6 22 | :08015000379A0895F894FFCFDF 23 | :00000001FF 24 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty4313at1.hex: -------------------------------------------------------------------------------- 1 | :1000000014C01BC01AC019C018C017C016C015C034 2 | :1000100014C013C012C011C010C00FC00EC00DC05C 3 | :100020000CC00BC00AC009C008C011241FBECFE518 4 | :10003000D1E0DEBFCDBF02D002C0E2CFFFCFF89447 5 | :02004000FFCFF0 6 | :00000001FF 7 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty4313at8.hex: -------------------------------------------------------------------------------- 1 | :1000000014C01BC01AC019C018C017C016C015C034 2 | :1000100014C013C012C011C010C00FC00EC00DC05C 3 | :100020000CC00BC00AC009C008C011241FBECFE518 4 | :10003000D1E0DEBFCDBF02D002C0E2CFFFCFF89447 5 | :02004000FFCFF0 6 | :00000001FF 7 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty44at1.hex: -------------------------------------------------------------------------------- 1 | :1000000010C017C016C015C014C013C012C011C054 2 | :1000100010C00FC00EC00DC00CC00BC00AC009C07C 3 | :1000200008C011241FBECFE5D1E0DEBFCDBF02D096 4 | :0A00300002C0E6CFFFCFF894FFCF27 5 | :00000001FF 6 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty44at8.hex: -------------------------------------------------------------------------------- 1 | :1000000010C017C016C015C014C013C012C011C054 2 | :1000100010C00FC00EC00DC00CC00BC00AC009C07C 3 | :1000200008C011241FBECFE5D1E0DEBFCDBF02D096 4 | :0A00300002C0E6CFFFCFF894FFCF27 5 | :00000001FF 6 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty45at1.hex: -------------------------------------------------------------------------------- 1 | :100000000EC028C027C026C02CC024C023C022C0D8 2 | :1000100021C020C01FC01EC01DC01CC01BC0112499 3 | :100020001FBECFE5D1E0DEBFCDBF10E0A0E6B0E05F 4 | :10003000E2E5F1E002C005900D92A036B107D9F7D4 5 | :1000400010E0A0E6B0E001C01D92A936B107E1F7CB 6 | :1000500004D07DC0D5CF0895089557D0FCDFFCDFD4 7 | :10006000FECF1F920F920FB60F9211242F933F9342 8 | :100070004F935F936F937F938F939F93AF93BF93B0 9 | :1000800020916400309165004091660050916700B6 10 | :1000900070916800DA01C9010296A11DB11D672F98 11 | :1000A0006A5F6D3730F06D57DA01C9010396A11D03 12 | :1000B000B11D609368008093640090936500A093E5 13 | :1000C0006600B09367008091600090916100A091FC 14 | :1000D0006200B09163000196A11DB11D8093600084 15 | :1000E00090936100A0936200B0936300BF91AF91C1 16 | :1000F0009F918F917F916F915F914F913F912F9140 17 | :100100000F900FBE0F901F901895789480B780685D 18 | :1001100080BF80B7806480BF8CB580648CBD8FEF5A 19 | :100120008DBD80B7807F846080BF89B7846089BFC0 20 | :1001300083B7887F83BF8AB58C7F81608ABD83B790 21 | :10014000877F83BF83B7887F826083BF0895F894D9 22 | :02015000FFCFDF 23 | :00000001FF 24 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty45at8.hex: -------------------------------------------------------------------------------- 1 | :100000000EC028C027C026C02CC024C023C022C0D8 2 | :1000100021C020C01FC01EC01DC01CC01BC0112499 3 | :100020001FBECFE5D1E0DEBFCDBF10E0A0E6B0E05F 4 | :10003000E2E5F1E002C005900D92A036B107D9F7D4 5 | :1000400010E0A0E6B0E001C01D92A936B107E1F7CB 6 | :1000500004D07DC0D5CF0895089557D0FCDFFCDFD4 7 | :10006000FECF1F920F920FB60F9211242F933F9342 8 | :100070004F935F936F937F938F939F93AF93BF93B0 9 | :1000800020916400309165004091660050916700B6 10 | :1000900070916800DA01C9010296A11DB11D672F98 11 | :1000A0006A5F6D3730F06D57DA01C9010396A11D03 12 | :1000B000B11D609368008093640090936500A093E5 13 | :1000C0006600B09367008091600090916100A091FC 14 | :1000D0006200B09163000196A11DB11D8093600084 15 | :1000E00090936100A0936200B0936300BF91AF91C1 16 | :1000F0009F918F917F916F915F914F913F912F9140 17 | :100100000F900FBE0F901F901895789480B780685D 18 | :1001100080BF80B7806480BF8CB580648CBD8FEF5A 19 | :100120008DBD80B7807F876080BF89B7846089BFBD 20 | :1001300083B7887F83BF8AB58C7F81608ABD83B790 21 | :10014000877F83BF83B7887F836083BF0895F894D8 22 | :02015000FFCFDF 23 | :00000001FF 24 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty84at1.hex: -------------------------------------------------------------------------------- 1 | :1000000010C02AC029C028C027C026C025C024C0CF 2 | :1000100023C022C021C027C01FC01EC01DC01CC0DD 3 | :100020001BC011241FBECFE5D2E0DEBFCDBF10E064 4 | :10003000A0E6B0E0ECE4F1E002C005900D92A0363D 5 | :10004000B107D9F710E0A0E6B0E001C01D92A936D3 6 | :10005000B107E1F704D078C0D3CF0895089557D001 7 | :10006000FCDFFCDFFECF1F920F920FB60F92112420 8 | :100070002F933F934F935F936F937F938F939F93B0 9 | :10008000AF93BF932091640030916500409166006A 10 | :100090005091670070916800DA01C9014096A11D76 11 | :1000A000B11D672F605D6D3730F06D57DA01C90102 12 | :1000B0004196A11DB11D60936800809364009093E8 13 | :1000C0006500A0936600B0936700809160009091F6 14 | :1000D0006100A0916200B09163000196A11DB11D65 15 | :1000E0008093600090936100A0936200B0936300DE 16 | :1000F000BF91AF919F918F917F916F915F914F9140 17 | :100100003F912F910F900FBE0F901F9018957894EC 18 | :1001100080B7826080BF80B7816080BF83B7826014 19 | :1001200083BF83B7816083BF89B7816089BF8EB584 20 | :1001300082608EBD8EB581608EBD8FB581608FBDB2 21 | :0C014000319A309A379A0895F894FFCF56 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty84at16.hex: -------------------------------------------------------------------------------- 1 | :1000000010C01FC01EC01DC01CC01BC01AC019C01C 2 | :1000100018C017C016C01CC014C013C012C011C035 3 | :1000200010C011241FBECFE5D2E0DEBFCDBF10E06F 4 | :10003000A0E6B0E001C01D92A936B107E1F704D0F7 5 | :1000400063C0DECF089508954CD0FCDFFCDFFECF07 6 | :100050001F920F920FB60F9211242F933F938F93FD 7 | :100060009F93AF93BF938091640090916500A0919E 8 | :100070006600B091670030916800232F2D5F2D3707 9 | :1000800028F02D570296A11DB11D03C00196A11D98 10 | :10009000B11D209368008093640090936500A09345 11 | :1000A0006600B09367008091600090916100A0911C 12 | :1000B0006200B09163000196A11DB11D80936000A4 13 | :1000C00090936100A0936200B0936300BF91AF91E1 14 | :1000D0009F918F913F912F910F900FBE0F901F9086 15 | :1000E0001895789480B7836080BF83B7877F83BF7C 16 | :1000F00083B7887F836083BF89B7816089BF86B1FA 17 | :0C010000876086B9379A0895F894FFCF05 18 | :00000001FF 19 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty84at8.hex: -------------------------------------------------------------------------------- 1 | :1000000010C02AC029C028C027C026C025C024C0CF 2 | :1000100023C022C021C027C01FC01EC01DC01CC0DD 3 | :100020001BC011241FBECFE5D2E0DEBFCDBF10E064 4 | :10003000A0E6B0E0ECE4F1E002C005900D92A0363D 5 | :10004000B107D9F710E0A0E6B0E001C01D92A936D3 6 | :10005000B107E1F704D078C0D3CF0895089557D001 7 | :10006000FCDFFCDFFECF1F920F920FB60F92112420 8 | :100070002F933F934F935F936F937F938F939F93B0 9 | :10008000AF93BF932091640030916500409166006A 10 | :100090005091670070916800DA01C9010296A11DB4 11 | :1000A000B11D672F6A5F6D3730F06D57DA01C901F6 12 | :1000B0000396A11DB11D6093680080936400909326 13 | :1000C0006500A0936600B0936700809160009091F6 14 | :1000D0006100A0916200B09163000196A11DB11D65 15 | :1000E0008093600090936100A0936200B0936300DE 16 | :1000F000BF91AF919F918F917F916F915F914F9140 17 | :100100003F912F910F900FBE0F901F9018957894EC 18 | :1001100080B7826080BF80B7816080BF83B7826014 19 | :1001200083BF83B7816083BF89B7816089BF8EB584 20 | :1001300082608EBD8EB581608EBD8FB581608FBDB2 21 | :0C014000329A319A379A0895F894FFCF54 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty85at1.hex: -------------------------------------------------------------------------------- 1 | :100000000EC028C027C026C025C02BC023C022C0D8 2 | :1000100021C020C01FC01EC01DC01CC01BC0112499 3 | :100020001FBECFE5D2E0DEBFCDBF10E0A0E6B0E05E 4 | :10003000E8E4F1E002C005900D92A036B107D9F7CF 5 | :1000400010E0A0E6B0E001C01D92A936B107E1F7CB 6 | :1000500004D078C0D5CF0895089557D0FCDFFCDFD9 7 | :10006000FECF1F920F920FB60F9211242F933F9342 8 | :100070004F935F936F937F938F939F93AF93BF93B0 9 | :1000800020916400309165004091660050916700B6 10 | :1000900070916800DA01C9014096A11DB11D672F5A 11 | :1000A000605D6D3730F06D57DA01C9014196A11DD1 12 | :1000B000B11D609368008093640090936500A093E5 13 | :1000C0006600B09367008091600090916100A091FC 14 | :1000D0006200B09163000196A11DB11D8093600084 15 | :1000E00090936100A0936200B0936300BF91AF91C1 16 | :1000F0009F918F917F916F915F914F913F912F9140 17 | :100100000F900FBE0F901F90189578948AB582605B 18 | :100110008ABD8AB581608ABD83B7826083BF83B799 19 | :10012000816083BF89B7826089BF80B7826080BFEA 20 | :1001300080B7816080BF80B7806480BF319A309A79 21 | :08014000379A0895F894FFCFEF 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty85at16.hex: -------------------------------------------------------------------------------- 1 | :100000000EC01DC01CC01BC021C019C018C017C025 2 | :1000100016C015C014C013C012C011C010C01124E6 3 | :100020001FBECFE5D2E0DEBFCDBF10E0A0E6B0E05E 4 | :1000300001C01D92A936B107E1F704D064C0E0CF3A 5 | :10004000089508954CD0FCDFFCDFFECF1F920F9285 6 | :100050000FB60F9211242F933F938F939F93AF93DB 7 | :10006000BF938091640090916500A0916600B0916B 8 | :10007000670030916800232F2D5F2D3728F02D5712 9 | :100080000296A11DB11D03C00196A11DB11D2093B3 10 | :1000900068008093640090936500A0936600B0931D 11 | :1000A00067008091600090916100A0916200B09122 12 | :1000B00063000196A11DB11D8093600090936100C3 13 | :1000C000A0936200B0936300BF91AF919F918F9115 14 | :1000D0003F912F910F900FBE0F901F90189578941D 15 | :1000E00080B7806880BF80B7806480BF8CB5806433 16 | :1000F0008CBD8FEF8DBD80B7807F876080BF89B753 17 | :0A010000846089BF0895F894FFCFD2 18 | :00000001FF 19 | -------------------------------------------------------------------------------- /hardware/digispark/bootloaders/empty/empty85at8.hex: -------------------------------------------------------------------------------- 1 | :100000000EC028C027C026C025C02BC023C022C0D8 2 | :1000100021C020C01FC01EC01DC01CC01BC0112499 3 | :100020001FBECFE5D2E0DEBFCDBF10E0A0E6B0E05E 4 | :10003000E8E4F1E002C005900D92A036B107D9F7CF 5 | :1000400010E0A0E6B0E001C01D92A936B107E1F7CB 6 | :1000500004D078C0D5CF0895089557D0FCDFFCDFD9 7 | :10006000FECF1F920F920FB60F9211242F933F9342 8 | :100070004F935F936F937F938F939F93AF93BF93B0 9 | :1000800020916400309165004091660050916700B6 10 | :1000900070916800DA01C9010296A11DB11D672F98 11 | :1000A0006A5F6D3730F06D57DA01C9010396A11D03 12 | :1000B000B11D609368008093640090936500A093E5 13 | :1000C0006600B09367008091600090916100A091FC 14 | :1000D0006200B09163000196A11DB11D8093600084 15 | :1000E00090936100A0936200B0936300BF91AF91C1 16 | :1000F0009F918F917F916F915F914F913F912F9140 17 | :100100000F900FBE0F901F90189578948AB582605B 18 | :100110008ABD8AB581608ABD83B7826083BF83B799 19 | :10012000816083BF89B7826089BF80B7826080BFEA 20 | :1001300080B7816080BF80B7806480BF329A319A77 21 | :08014000379A0895F894FFCFEF 22 | :00000001FF 23 | -------------------------------------------------------------------------------- /hardware/digispark/cores/empty/Arduino.h: -------------------------------------------------------------------------------- 1 | #ifndef Arduino_h 2 | #define Arduino_h 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /hardware/digispark/cores/empty/WProgram.h: -------------------------------------------------------------------------------- 1 | #ifndef WProgram_h 2 | #define WProgram_h 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /hardware/digispark/cores/empty/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | set PATH=%PATH%;C:\Arduino\arduino-1.0\hardware\tools\avr\bin 3 | set PATH=%PATH%;C:\arduino\arduino-1.0\hardware\tools\avr\etc 4 | 5 | cd %TEMP% 6 | dir *.hex /s 7 | 8 | cd C:\Users\BRIANC~1.001\AppData\Local\Temp\build5703187254703185841.tmp 9 | 10 | avr-objdump.exe -S sketch_sep22a.cpp.elf > C:\Temp\dump.cpp & C:\Temp\dump.cpp 11 | */ 12 | 13 | int main(void) 14 | { 15 | for (;;); 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/Arduino.h: -------------------------------------------------------------------------------- 1 | #ifndef Arduino_h 2 | #define Arduino_h 3 | 4 | #include 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/HardwareSerial.h: -------------------------------------------------------------------------------- 1 | /* 2 | HardwareSerial.h - Hardware serial library for Wiring 3 | Copyright (c) 2006 Nicholas Zambetti. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Modified 28 September 2010 by Mark Sproul 20 | */ 21 | 22 | #ifndef HardwareSerial_h 23 | #define HardwareSerial_h 24 | 25 | #include 26 | 27 | #include "core_build_options.h" 28 | #include "Stream.h" 29 | 30 | struct ring_buffer; 31 | 32 | class HardwareSerial : public Stream 33 | { 34 | private: 35 | ring_buffer *_rx_buffer; 36 | volatile uint8_t *_ubrrh; 37 | volatile uint8_t *_ubrrl; 38 | volatile uint8_t *_ucsra; 39 | volatile uint8_t *_ucsrb; 40 | volatile uint8_t *_udr; 41 | uint8_t _rxen; 42 | uint8_t _txen; 43 | uint8_t _rxcie; 44 | uint8_t _udre; 45 | uint8_t _u2x; 46 | public: 47 | HardwareSerial(ring_buffer *rx_buffer, 48 | volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, 49 | volatile uint8_t *ucsra, volatile uint8_t *ucsrb, 50 | volatile uint8_t *udr, 51 | uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); 52 | void begin(long); 53 | void end(); 54 | virtual int available(void); 55 | virtual int peek(void); 56 | virtual int read(void); 57 | virtual void flush(void); 58 | virtual size_t write(uint8_t); 59 | using Print::write; // pull in write(str) and write(buf, size) from Print 60 | }; 61 | 62 | #if (defined(UBRRH) || defined(UBRR0H)) && ! DEFAULT_TO_TINY_DEBUG_SERIAL 63 | extern HardwareSerial Serial; 64 | #elif defined(USBCON) 65 | #include "usb_api.h" 66 | #endif 67 | #if defined(UBRR1H) 68 | extern HardwareSerial Serial1; 69 | #endif 70 | #if defined(UBRR2H) 71 | extern HardwareSerial Serial2; 72 | #endif 73 | #if defined(UBRR3H) 74 | extern HardwareSerial Serial3; 75 | #endif 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/Stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | Stream.h - base class for character-based streams. 3 | Copyright (c) 2010 David A. Mellis. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Stream_h 21 | #define Stream_h 22 | 23 | #include 24 | #include "Print.h" 25 | 26 | class Stream : public Print 27 | { 28 | public: 29 | virtual int available() = 0; 30 | virtual int read() = 0; 31 | virtual int peek() = 0; 32 | virtual void flush() = 0; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/TinyDebugSerial.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | TinyDebugSerial.cpp - Tiny write-only software serial. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #include "core_build_options.h" 25 | #include "TinyDebugSerial.h" 26 | 27 | static TinyDebugSerialWriter stub; 28 | 29 | void TinyDebugSerial::useStub( void ) 30 | { 31 | _writer = &stub; 32 | _writer->init(); 33 | } 34 | 35 | TinyDebugSerial::TinyDebugSerial( void ) 36 | { 37 | useStub(); 38 | } 39 | 40 | #if defined( DEFAULT_TO_TINY_DEBUG_SERIAL ) && DEFAULT_TO_TINY_DEBUG_SERIAL 41 | TinyDebugSerial Serial; 42 | #endif 43 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/TinyDebugSerial115200.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | TinyDebugSerial.cpp - Tiny write-only software serial. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #include "TinyDebugSerial.h" 25 | 26 | TinyDebugSerialWriter_115200 tdsw115200; 27 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/TinyDebugSerial38400.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | TinyDebugSerial.cpp - Tiny write-only software serial. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #include "TinyDebugSerial.h" 25 | 26 | TinyDebugSerialWriter_38400 tdsw38400; 27 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/TinyDebugSerial9600.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | TinyDebugSerial.cpp - Tiny write-only software serial. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #include "TinyDebugSerial.h" 25 | 26 | TinyDebugSerialWriter_9600 tdsw9600; 27 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/TinyDebugSerialErrors.cpp: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | TinyDebugSerial.cpp - Tiny write-only software serial. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #include "TinyDebugSerial.h" 25 | 26 | void TinyDebugSerialWriterInternalBug( void ) { } 27 | void TinyDebugSerialBadBaud( void ) { } 28 | void TinyDebugSerialBaudMustBeConstant( void ) { } 29 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/ToneTimer.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | ToneTimer.h - Veneer for the Tone Timer. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #ifndef ToneTimer_h 25 | #define ToneTimer_h 26 | 27 | #include "core_build_options.h" 28 | #include "core_timers.h" 29 | 30 | #define tonetimer_(t) TIMER_PASTE_A( timer, TIMER_TO_USE_FOR_TONE, t ) 31 | #define ToneTimer_(f) TIMER_PASTE_A( Timer, TIMER_TO_USE_FOR_TONE, f ) 32 | #define TONETIMER_(c) TIMER_PASTE_A( TIMER, TIMER_TO_USE_FOR_TONE, c ) 33 | 34 | #define ToneTimer_SetToPowerup ToneTimer_(SetToPowerup) 35 | #define ToneTimer_SetWaveformGenerationMode ToneTimer_(SetWaveformGenerationMode) 36 | #define ToneTimer_OutputComparePinA ToneTimer_(OutputComparePinA) 37 | #define ToneTimer_OutputComparePinB ToneTimer_(OutputComparePinB) 38 | #define ToneTimer_SetCompareOutputModeA ToneTimer_(SetCompareOutputModeA) 39 | #define ToneTimer_SetCompareOutputModeB ToneTimer_(SetCompareOutputModeB) 40 | #define ToneTimer_DisconnectOutputs ToneTimer_(DisconnectOutputs) 41 | #define ToneTimer_ClockSelect ToneTimer_(ClockSelect) 42 | #define ToneTimer_SetCount ToneTimer_(SetCount) 43 | #define TONETIMER_NUMBER_PRESCALERS TONETIMER_(NUMBER_PRESCALERS) 44 | #define ToneTimer_SetOutputCompareMatchAndClear ToneTimer_(SetOutputCompareMatchAndClear) 45 | #define ToneTimer_InterruptsOff ToneTimer_(InterruptsOff) 46 | #define ToneTimer_EnableOutputCompareInterruptA ToneTimer_(EnableOutputCompareInterruptA) 47 | #define TONETIMER_COMPA_vect TONETIMER_(COMPA_vect) 48 | #define TONETIMER_SUPPORTS_PHASE_CORRECT_PWM TONETIMER_(SUPPORTS_PHASE_CORRECT_PWM) 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/WConstants.h: -------------------------------------------------------------------------------- 1 | #include "wiring.h" 2 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ 2 | 3 | /* 4 | Part of the Wiring project - http://wiring.org.co 5 | Copyright (c) 2004-06 Hernando Barragan 6 | Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General 19 | Public License along with this library; if not, write to the 20 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 21 | Boston, MA 02111-1307 USA 22 | 23 | $Id$ 24 | */ 25 | 26 | extern "C" { 27 | #include "stdlib.h" 28 | } 29 | 30 | void randomSeed(unsigned int seed) 31 | { 32 | if (seed != 0) { 33 | srandom(seed); 34 | } 35 | } 36 | 37 | long random(long howbig) 38 | { 39 | if (howbig == 0) { 40 | return 0; 41 | } 42 | return random() % howbig; 43 | } 44 | 45 | long random(long howsmall, long howbig) 46 | { 47 | if (howsmall >= howbig) { 48 | return howsmall; 49 | } 50 | long diff = howbig - howsmall; 51 | return random(diff) + howsmall; 52 | } 53 | 54 | long map(long x, long in_min, long in_max, long out_min, long out_max) 55 | { 56 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 57 | } 58 | 59 | unsigned int makeWord(unsigned int w) { return w; } 60 | unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/WProgram.h: -------------------------------------------------------------------------------- 1 | #ifndef WProgram_h 2 | #define WProgram_h 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "core_build_options.h" 11 | #include "core_pins.h" 12 | #include "wiring.h" 13 | #include "pins_arduino.h" 14 | 15 | #ifdef __cplusplus 16 | #include "WCharacter.h" 17 | #include "WString.h" 18 | #include "TinyDebugSerial.h" 19 | #include "HardwareSerial.h" 20 | 21 | uint16_t makeWord(uint16_t w); 22 | uint16_t makeWord(byte h, byte l); 23 | 24 | #define word(...) makeWord(__VA_ARGS__) 25 | 26 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); 27 | 28 | void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); 29 | void noTone(uint8_t _pin = 255); 30 | 31 | // WMath prototypes 32 | long random(long); 33 | long random(long, long); 34 | void randomSeed(unsigned int); 35 | long map(long, long, long, long, long); 36 | 37 | /* 38 | fix? On the Mega processors, the analogs are also "extended" digital pins. 39 | To (sort of) work the same way with this core, the following constants 40 | would have to be valid arguments to digitalRead, digitalWrite, and pinMode 41 | ("the digitals"). Which means the digitals would have to check for pins 42 | over A0 and then subtract A0. The current plan is to wait until someone 43 | wants this feature. 44 | */ 45 | #if CORE_ANALOG_COUNT >= 1 46 | const static uint8_t A0 = CORE_ANALOG_FIRST + 0; 47 | #endif 48 | 49 | #if CORE_ANALOG_COUNT >= 2 50 | const static uint8_t A1 = CORE_ANALOG_FIRST + 1; 51 | #endif 52 | 53 | #if CORE_ANALOG_COUNT >= 3 54 | const static uint8_t A2 = CORE_ANALOG_FIRST + 2; 55 | #endif 56 | 57 | #if CORE_ANALOG_COUNT >= 4 58 | const static uint8_t A3 = CORE_ANALOG_FIRST + 3; 59 | #endif 60 | 61 | #if CORE_ANALOG_COUNT >= 5 62 | const static uint8_t A4 = CORE_ANALOG_FIRST + 4; 63 | #endif 64 | 65 | #if CORE_ANALOG_COUNT >= 6 66 | const static uint8_t A5 = CORE_ANALOG_FIRST + 5; 67 | #endif 68 | 69 | #if CORE_ANALOG_COUNT >= 7 70 | const static uint8_t A6 = CORE_ANALOG_FIRST + 6; 71 | #endif 72 | 73 | #if CORE_ANALOG_COUNT >= 8 74 | const static uint8_t A7 = CORE_ANALOG_FIRST + 7; 75 | #endif 76 | 77 | #if CORE_ANALOG_COUNT >= 9 78 | #error Update the A* definitions for the selected processor. 79 | #endif 80 | 81 | #endif 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/core_macros.h: -------------------------------------------------------------------------------- 1 | /*============================================================================== 2 | 3 | core_macros.h - Simple but handy macros. 4 | 5 | Copyright 2010 Rowdy Dog Software. 6 | 7 | This file is part of Arduino-Tiny. 8 | 9 | Arduino-Tiny is free software: you can redistribute it and/or modify it 10 | under the terms of the GNU Lesser General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or (at your 12 | option) any later version. 13 | 14 | Arduino-Tiny is distributed in the hope that it will be useful, but 15 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17 | License for more details. 18 | 19 | You should have received a copy of the GNU Lesser General Public License 20 | along with Arduino-Tiny. If not, see . 21 | 22 | ==============================================================================*/ 23 | 24 | #ifndef core_macros_h 25 | #define core_macros_h 26 | 27 | 28 | /*============================================================================= 29 | Bitmask macros 30 | =============================================================================*/ 31 | 32 | #define MASK1(b1) ( (1< 2 | 3 | int main(void) 4 | { 5 | init(); 6 | 7 | setup(); 8 | 9 | for (;;) 10 | loop(); 11 | 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/new.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * operator new(size_t size) 4 | { 5 | return malloc(size); 6 | } 7 | 8 | void operator delete(void * ptr) 9 | { 10 | free(ptr); 11 | } 12 | 13 | int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}; 14 | void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; 15 | void __cxa_guard_abort (__guard *) {}; 16 | 17 | void __cxa_pure_virtual(void) {}; 18 | 19 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/new.h: -------------------------------------------------------------------------------- 1 | /* Header to define new/delete operators as they aren't provided by avr-gcc by default 2 | Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 3 | */ 4 | 5 | #ifndef NEW_H 6 | #define NEW_H 7 | 8 | #include 9 | 10 | void * operator new(size_t size); 11 | void operator delete(void * ptr); 12 | 13 | __extension__ typedef int __guard __attribute__((mode (__DI__))); 14 | 15 | extern "C" int __cxa_guard_acquire(__guard *); 16 | extern "C" void __cxa_guard_release (__guard *); 17 | extern "C" void __cxa_guard_abort (__guard *); 18 | 19 | extern "C" void __cxa_pure_virtual(void); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/pins_arduino.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/hardware/digispark/cores/tiny/pins_arduino.c -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/wiring_pulse.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_pulse.c - pulseIn() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | #include "pins_arduino.h" 27 | 28 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 29 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 30 | * to 3 minutes in length, but must be called at least a few dozen microseconds 31 | * before the start of the pulse. */ 32 | unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) 33 | { 34 | // cache the port and bit of the pin in order to speed up the 35 | // pulse width measuring loop and achieve finer resolution. calling 36 | // digitalRead() instead yields much coarser resolution. 37 | uint8_t bit = digitalPinToBitMask(pin); 38 | uint8_t port = digitalPinToPort(pin); 39 | uint8_t stateMask = (state ? bit : 0); 40 | unsigned long width = 0; // keep initialization out of time critical area 41 | 42 | // convert the timeout from microseconds to a number of times through 43 | // the initial loop; it takes 16 clock cycles per iteration. 44 | unsigned long numloops = 0; 45 | unsigned long maxloops = microsecondsToClockCycles(timeout) / 16; 46 | 47 | // wait for any previous pulse to end 48 | while ((*portInputRegister(port) & bit) == stateMask) 49 | if (numloops++ == maxloops) 50 | return 0; 51 | 52 | // wait for the pulse to start 53 | while ((*portInputRegister(port) & bit) != stateMask) 54 | if (numloops++ == maxloops) 55 | return 0; 56 | 57 | // wait for the pulse to stop 58 | while ((*portInputRegister(port) & bit) == stateMask) { 59 | if (numloops++ == maxloops) 60 | return 0; 61 | width++; 62 | } 63 | 64 | // convert the reading to microseconds. The loop has been determined 65 | // to be 20 clock cycles long and have about 16 clocks between the edge 66 | // and the start of the loop. There will be some error introduced by 67 | // the interrupt handlers. 68 | return clockCyclesToMicroseconds(width * 21 + 16); 69 | } 70 | -------------------------------------------------------------------------------- /hardware/digispark/cores/tiny/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | wiring_shift.c - shiftOut() function 3 | Part of Arduino - http://www.arduino.cc/ 4 | 5 | Copyright (c) 2005-2006 David A. Mellis 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General 18 | Public License along with this library; if not, write to the 19 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20 | Boston, MA 02111-1307 USA 21 | 22 | $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ 23 | */ 24 | 25 | #include "wiring_private.h" 26 | 27 | uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { 28 | uint8_t value = 0; 29 | uint8_t i; 30 | 31 | for (i = 0; i < 8; ++i) { 32 | digitalWrite(clockPin, HIGH); 33 | if (bitOrder == LSBFIRST) 34 | value |= digitalRead(dataPin) << i; 35 | else 36 | value |= digitalRead(dataPin) << (7 - i); 37 | digitalWrite(clockPin, LOW); 38 | } 39 | return value; 40 | } 41 | 42 | void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) 43 | { 44 | uint8_t i; 45 | 46 | for (i = 0; i < 8; i++) { 47 | if (bitOrder == LSBFIRST) 48 | digitalWrite(dataPin, !!(val & (1 << i))); 49 | else 50 | digitalWrite(dataPin, !!(val & (1 << (7 - i)))); 51 | 52 | digitalWrite(clockPin, HIGH); 53 | digitalWrite(clockPin, LOW); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /hardware/digispark/programmers.txt: -------------------------------------------------------------------------------- 1 | digispark.name=Digispark 2 | digispark.communication=usb 3 | digispark.protocol=digispark -------------------------------------------------------------------------------- /hardware/digispark/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/hardware/digispark/readme.txt -------------------------------------------------------------------------------- /libraries/Arduino_SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple serial test 3 | 4 | Receives from the hardware serial, sends to software serial. 5 | Receives from software serial, sends to hardware serial. 6 | 7 | The circuit: 8 | * RX is digital pin 10 (connect to TX of other device) 9 | * TX is digital pin 11 (connect to RX of other device) 10 | 11 | Note: 12 | Not all pins on the Mega and Mega 2560 support change interrupts, 13 | so only the following can be used for RX: 14 | 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 15 | 16 | Not all pins on the Leonardo support change interrupts, 17 | so only the following can be used for RX: 18 | 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). 19 | 20 | created back in the mists of time 21 | modified 25 May 2012 22 | by Tom Igoe 23 | based on Mikal Hart's example 24 | 25 | This example code is in the public domain. 26 | 27 | */ 28 | #include 29 | 30 | SoftwareSerial mySerial(10, 11); // RX, TX 31 | 32 | void setup() 33 | { 34 | // Open serial communications and wait for port to open: 35 | Serial.begin(57600); 36 | while (!Serial) { 37 | ; // wait for serial port to connect. Needed for Leonardo only 38 | } 39 | 40 | 41 | Serial.println("Goodnight moon!"); 42 | 43 | // set the data rate for the SoftwareSerial port 44 | mySerial.begin(4800); 45 | mySerial.println("Hello, world?"); 46 | } 47 | 48 | void loop() // run over and over 49 | { 50 | if (mySerial.available()) 51 | Serial.write(mySerial.read()); 52 | if (Serial.available()) 53 | mySerial.write(Serial.read()); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /libraries/Arduino_SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple serial test 3 | 4 | Receives from the two software serial ports, 5 | sends to the hardware serial port. 6 | 7 | In order to listen on a software port, you call port.listen(). 8 | When using two software serial ports, you have to switch ports 9 | by listen()ing on each one in turn. Pick a logical time to switch 10 | ports, like the end of an expected transmission, or when the 11 | buffer is empty. This example switches ports when there is nothing 12 | more to read from a port 13 | 14 | The circuit: 15 | Two devices which communicate serially are needed. 16 | * First serial device's TX attached to digital pin 2, RX to pin 3 17 | * Second serial device's TX attached to digital pin 4, RX to pin 5 18 | 19 | Note: 20 | Not all pins on the Mega and Mega 2560 support change interrupts, 21 | so only the following can be used for RX: 22 | 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69 23 | 24 | Not all pins on the Leonardo support change interrupts, 25 | so only the following can be used for RX: 26 | 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI). 27 | 28 | created 18 Apr. 2011 29 | modified 25 May 2012 30 | by Tom Igoe 31 | based on Mikal Hart's twoPortRXExample 32 | 33 | This example code is in the public domain. 34 | 35 | */ 36 | 37 | #include 38 | // software serial #1: TX = digital pin 10, RX = digital pin 11 39 | SoftwareSerial portOne(10,11); 40 | 41 | // software serial #2: TX = digital pin 8, RX = digital pin 9 42 | // on the Mega, use other pins instead, since 8 and 9 don't work on the Mega 43 | SoftwareSerial portTwo(8,9); 44 | 45 | void setup() 46 | { 47 | // Open serial communications and wait for port to open: 48 | Serial.begin(9600); 49 | while (!Serial) { 50 | ; // wait for serial port to connect. Needed for Leonardo only 51 | } 52 | 53 | 54 | // Start each software serial port 55 | portOne.begin(9600); 56 | portTwo.begin(9600); 57 | } 58 | 59 | void loop() 60 | { 61 | // By default, the last intialized port is listening. 62 | // when you want to listen on a port, explicitly select it: 63 | portOne.listen(); 64 | Serial.println("Data from port one:"); 65 | // while there is data coming in, read it 66 | // and send to the hardware serial port: 67 | while (portOne.available() > 0) { 68 | char inByte = portOne.read(); 69 | Serial.write(inByte); 70 | } 71 | 72 | // blank line to separate data from the two ports: 73 | Serial.println(); 74 | 75 | // Now listen on the second port 76 | portTwo.listen(); 77 | // while there is data coming in, read it 78 | // and send to the hardware serial port: 79 | Serial.println("Data from port two:"); 80 | while (portTwo.available() > 0) { 81 | char inByte = portTwo.read(); 82 | Serial.write(inByte); 83 | } 84 | 85 | // blank line to separate data from the two ports: 86 | Serial.println(); 87 | } 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /libraries/Arduino_SoftwareSerial/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for NewSoftSerial 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | NewSoftSerial KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | read KEYWORD2 18 | available KEYWORD2 19 | isListening KEYWORD2 20 | overflow KEYWORD2 21 | flush KEYWORD2 22 | listen KEYWORD2 23 | 24 | ####################################### 25 | # Constants (LITERAL1) 26 | ####################################### 27 | 28 | -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/ArduinoNotes.txt: -------------------------------------------------------------------------------- 1 | Notes On Integrating AVRUSB with Arduino 2 | ======================================== 3 | 4 | * Note the license(s) under which AVRUSB is distributed. 5 | 6 | * See also: http://code.rancidbacon.com/ProjectLogArduinoUSB 7 | 8 | * Note: The pins we use on the PCB (not protoboard) hardware shield are: 9 | 10 | INT0 == PD2 == IC Pin 4 == Arduino Digital Pin 2 == D+ 11 | 12 | ---- == PD4 == -------- == Arduino Digital Pin 4 == D- 13 | 14 | ---- == PD5 == -------- == Arduino Digital Pin 5 == pull-up 15 | 16 | (DONE: Change to not use PD3 so INT1 is left free?) 17 | 18 | * In order to compile a valid 'usbconfig.h' file must exit. The content of this 19 | file will vary depending on whether the device is a generic USB device, 20 | generic HID device or specific class of HID device for example. 21 | 22 | The file 'usbconfig-prototype.h' can be used as a starting point, however 23 | it might be easier to use the 'usbconfig.h' from one of the example projects. 24 | 25 | TODO: Specify the settings that need to be changed to match the shield 26 | design we use. 27 | 28 | * (NOTE: Initial 'usbconfig.h' used will be based on the file from 29 | 'HIDKeys.2007-03-29'.) (Note: Have now upgraded to V-USB 2009-08-22.) 30 | 31 | * Versions of the Arduino IDE prior to 0018 won't compile our library 32 | so it needs to be pre-compiled with: 33 | 34 | avr-g++ -Wall -Os -I. -DF_CPU=16000000 -mmcu=atmega168 -c usbdrvasm.S -c usbdrv.c 35 | -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/DigiJoystick.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkJoystick/DigiJoystick.h -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/JoystickReadme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkJoystick/JoystickReadme.txt -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/examples/Joystick/Joystick.ino: -------------------------------------------------------------------------------- 1 | //DigiJoystick test and usage documentation 2 | 3 | #include "DigiJoystick.h" 4 | 5 | void setup() { 6 | // Do nothing? It seems as if the USB hardware is ready to go on reset 7 | } 8 | 9 | 10 | void loop() { 11 | // If not using plentiful DigiJoystick.delay() calls, make sure to 12 | //DigiJoystick.update(); // call this at least every 50ms 13 | // calling more often than that is fine 14 | // this will actually only send the data every once in a while unless the data is different 15 | 16 | // you can set the values from a raw byte array with: 17 | // char myBuf[8] = { 18 | // x, y, xrot, yrot, zrot, slider, 19 | // buttonLowByte, buttonHighByte 20 | // }; 21 | // DigiJoystick.setValues(myBuf); 22 | 23 | // Or we can also set values like this: 24 | DigiJoystick.setX((byte) (millis() / 100)); // scroll X left to right repeatedly 25 | DigiJoystick.setY((byte) 0x30); 26 | DigiJoystick.setXROT((byte) 0x60); 27 | DigiJoystick.setYROT((byte) 0x90); 28 | DigiJoystick.setZROT((byte) 0xB0); 29 | DigiJoystick.setSLIDER((byte) 0xF0); 30 | 31 | // it's best to use DigiJoystick.delay() because it knows how to talk to 32 | // the connected computer - otherwise the USB link can crash with the 33 | // regular arduino delay() function 34 | DigiJoystick.delay(50); // wait 50 milliseconds 35 | 36 | // we can also set buttons like this (lowByte, highByte) 37 | //DigiJoystick.setButtons(0x00, 0x00); 38 | } -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/keywords.txt: -------------------------------------------------------------------------------- 1 | DigiKeyboard KEYWORD1 2 | update KEYWORD2 3 | sendKeyStroke KEYWORD2 -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/oddebug.c: -------------------------------------------------------------------------------- 1 | /* Name: oddebug.c 2 | * Project: AVR library 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2005-01-16 5 | * Tabsize: 4 6 | * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $ 9 | */ 10 | 11 | #include "oddebug.h" 12 | 13 | #if DEBUG_LEVEL > 0 14 | 15 | #warning "Never compile production devices with debugging enabled" 16 | 17 | static void uartPutc(char c) 18 | { 19 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ 20 | ODDBG_UDR = c; 21 | } 22 | 23 | static uchar hexAscii(uchar h) 24 | { 25 | h &= 0xf; 26 | if(h >= 10) 27 | h += 'a' - (uchar)10 - '0'; 28 | h += '0'; 29 | return h; 30 | } 31 | 32 | static void printHex(uchar c) 33 | { 34 | uartPutc(hexAscii(c >> 4)); 35 | uartPutc(hexAscii(c)); 36 | } 37 | 38 | void odDebug(uchar prefix, uchar *data, uchar len) 39 | { 40 | printHex(prefix); 41 | uartPutc(':'); 42 | while(len--){ 43 | uartPutc(' '); 44 | printHex(*data++); 45 | } 46 | uartPutc('\r'); 47 | uartPutc('\n'); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/osccal.c: -------------------------------------------------------------------------------- 1 | /* Name: osccal.c 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.c 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | #include 11 | 12 | #ifndef uchar 13 | #define uchar unsigned char 14 | #endif 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | /* ------------------------ Oscillator Calibration ------------------------- */ 18 | /* ------------------------------------------------------------------------- */ 19 | 20 | /* Calibrate the RC oscillator. Our timing reference is the Start Of Frame 21 | * signal (a single SE0 bit) repeating every millisecond immediately after 22 | * a USB RESET. We first do a binary search for the OSCCAL value and then 23 | * optimize this value with a neighboorhod search. 24 | */ 25 | void calibrateOscillator(void) 26 | { 27 | uchar step = 128; 28 | uchar trialValue = 0, optimumValue; 29 | int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 30 | 31 | /* do a binary search: */ 32 | do{ 33 | OSCCAL = trialValue + step; 34 | x = usbMeasureFrameLength(); /* proportional to current real frequency */ 35 | if(x < targetValue) /* frequency still too low */ 36 | trialValue += step; 37 | step >>= 1; 38 | }while(step > 0); 39 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 40 | /* now do a neighborhood search for optimum value */ 41 | optimumValue = trialValue; 42 | optimumDev = x; /* this is certainly far away from optimum */ 43 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ 44 | x = usbMeasureFrameLength() - targetValue; 45 | if(x < 0) 46 | x = -x; 47 | if(x < optimumDev){ 48 | optimumDev = x; 49 | optimumValue = OSCCAL; 50 | } 51 | } 52 | OSCCAL = optimumValue; 53 | } 54 | /* 55 | Note: This calibration algorithm may try OSCCAL values of up to 192 even if 56 | the optimum value is far below 192. It may therefore exceed the allowed clock 57 | frequency of the CPU in low voltage designs! 58 | You may replace this search algorithm with any other algorithm you like if 59 | you have additional constraints such as a maximum CPU clock. 60 | For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. 61 | ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in 62 | both regions. 63 | */ 64 | -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/osccal.h: -------------------------------------------------------------------------------- 1 | /* Name: osccal.h 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.h 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | /* 11 | General Description: 12 | This module contains a function which calibrates the AVR's internal RC 13 | oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be 14 | defined when the module is compiled, best passed in the compiler command 15 | line). The time reference is the USB frame clock of 1 kHz available 16 | immediately after a USB RESET condition. Timing is done by counting CPU 17 | cycles, so all interrupts must be disabled while the calibration runs. For 18 | low level timing measurements, usbMeasureFrameLength() is called. This 19 | function must be enabled in usbconfig.h by defining 20 | USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is recommended to call 21 | calibrateOscillator() from the reset hook in usbconfig.h: 22 | */ 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include // for sei() 26 | extern void calibrateOscillator(void); 27 | #endif 28 | #define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} 29 | 30 | /* 31 | This routine is an alternative to the continuous synchronization described 32 | in osctune.h. 33 | 34 | Algorithm used: 35 | calibrateOscillator() first does a binary search in the OSCCAL register for 36 | the best matching oscillator frequency. Then it does a next neighbor search 37 | to find the value with the lowest clock rate deviation. It is guaranteed to 38 | find the best match among neighboring values, but for version 5 oscillators 39 | (which have a discontinuous relationship between OSCCAL and frequency) a 40 | better match might be available in another OSCCAL region. 41 | 42 | Limitations: 43 | This calibration algorithm may try OSCCAL values of up to 192 even if the 44 | optimum value is far below 192. It may therefore exceed the allowed clock 45 | frequency of the CPU in low voltage designs! 46 | Precision depends on the OSCCAL vs. frequency dependency of the oscillator. 47 | Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram 48 | in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and 49 | 16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this 50 | deviation! All other frequency modules require at least 0.2% precision. 51 | */ 52 | 53 | #ifndef __OSCCAL_H_INCLUDED__ 54 | #define __OSCCAL_H_INCLUDED__ 55 | 56 | //void calibrateOscillator(void); 57 | /* This function calibrates the RC oscillator so that the CPU runs at F_CPU. 58 | * It MUST be called immediately after the end of a USB RESET condition! 59 | * Disable all interrupts during the call! 60 | * It is recommended that you store the resulting value in EEPROM so that a 61 | * good guess value is available after the next reset. 62 | */ 63 | 64 | 65 | #endif /* __OSCCAL_H_INCLUDED__ */ 66 | -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/osccal.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkJoystick/osccal.o -------------------------------------------------------------------------------- /libraries/DigisparkJoystick/usbdrvasm.asm: -------------------------------------------------------------------------------- 1 | /* Name: usbdrvasm.asm 2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2006-03-01 5 | * Tabsize: 4 6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id$ 9 | */ 10 | 11 | /* 12 | General Description: 13 | The IAR compiler/assembler system prefers assembler files with file extension 14 | ".asm". We simply provide this file as an alias for usbdrvasm.S. 15 | 16 | Thanks to Oleg Semyonov for his help with the IAR tools port! 17 | */ 18 | 19 | #include "usbdrvasm.S" 20 | 21 | end 22 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/ArduinoNotes.txt: -------------------------------------------------------------------------------- 1 | Notes On Integrating AVRUSB with Arduino 2 | ======================================== 3 | 4 | * Note the license(s) under which AVRUSB is distributed. 5 | 6 | * See also: http://code.rancidbacon.com/ProjectLogArduinoUSB 7 | 8 | * Note: The pins we use on the PCB (not protoboard) hardware shield are: 9 | 10 | INT0 == PD2 == IC Pin 4 == Arduino Digital Pin 2 == D+ 11 | 12 | ---- == PD4 == -------- == Arduino Digital Pin 4 == D- 13 | 14 | ---- == PD5 == -------- == Arduino Digital Pin 5 == pull-up 15 | 16 | (DONE: Change to not use PD3 so INT1 is left free?) 17 | 18 | * In order to compile a valid 'usbconfig.h' file must exit. The content of this 19 | file will vary depending on whether the device is a generic USB device, 20 | generic HID device or specific class of HID device for example. 21 | 22 | The file 'usbconfig-prototype.h' can be used as a starting point, however 23 | it might be easier to use the 'usbconfig.h' from one of the example projects. 24 | 25 | TODO: Specify the settings that need to be changed to match the shield 26 | design we use. 27 | 28 | * (NOTE: Initial 'usbconfig.h' used will be based on the file from 29 | 'HIDKeys.2007-03-29'.) (Note: Have now upgraded to V-USB 2009-08-22.) 30 | 31 | * Versions of the Arduino IDE prior to 0018 won't compile our library 32 | so it needs to be pre-compiled with: 33 | 34 | avr-g++ -Wall -Os -I. -DF_CPU=16000000 -mmcu=atmega168 -c usbdrvasm.S -c usbdrv.c 35 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/examples/Keyboard/Keyboard.ino: -------------------------------------------------------------------------------- 1 | #include "DigiKeyboard.h" 2 | 3 | void setup() { 4 | // don't need to set anything up to use DigiKeyboard 5 | } 6 | 7 | 8 | void loop() { 9 | // this is generally not necessary but with some older systems it seems to 10 | // prevent missing the first character after a delay: 11 | DigiKeyboard.sendKeyStroke(0); 12 | 13 | // Type out this string letter by letter on the computer (assumes US-style 14 | // keyboard) 15 | DigiKeyboard.println("Hello Digispark!"); 16 | 17 | // It's better to use DigiKeyboard.delay() over the regular Arduino delay() 18 | // if doing keyboard stuff because it keeps talking to the computer to make 19 | // sure the computer knows the keyboard is alive and connected 20 | DigiKeyboard.delay(5000); 21 | } 22 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/keywords.txt: -------------------------------------------------------------------------------- 1 | DigiKeyboard KEYWORD1 2 | update KEYWORD2 3 | sendKeyStroke KEYWORD2 -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/oddebug.c: -------------------------------------------------------------------------------- 1 | /* Name: oddebug.c 2 | * Project: AVR library 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2005-01-16 5 | * Tabsize: 4 6 | * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $ 9 | */ 10 | 11 | #include "oddebug.h" 12 | 13 | #if DEBUG_LEVEL > 0 14 | 15 | #warning "Never compile production devices with debugging enabled" 16 | 17 | static void uartPutc(char c) 18 | { 19 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ 20 | ODDBG_UDR = c; 21 | } 22 | 23 | static uchar hexAscii(uchar h) 24 | { 25 | h &= 0xf; 26 | if(h >= 10) 27 | h += 'a' - (uchar)10 - '0'; 28 | h += '0'; 29 | return h; 30 | } 31 | 32 | static void printHex(uchar c) 33 | { 34 | uartPutc(hexAscii(c >> 4)); 35 | uartPutc(hexAscii(c)); 36 | } 37 | 38 | void odDebug(uchar prefix, uchar *data, uchar len) 39 | { 40 | printHex(prefix); 41 | uartPutc(':'); 42 | while(len--){ 43 | uartPutc(' '); 44 | printHex(*data++); 45 | } 46 | uartPutc('\r'); 47 | uartPutc('\n'); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/osccal.c: -------------------------------------------------------------------------------- 1 | /* Name: osccal.c 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.c 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | #include 11 | 12 | #ifndef uchar 13 | #define uchar unsigned char 14 | #endif 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | /* ------------------------ Oscillator Calibration ------------------------- */ 18 | /* ------------------------------------------------------------------------- */ 19 | 20 | /* Calibrate the RC oscillator. Our timing reference is the Start Of Frame 21 | * signal (a single SE0 bit) repeating every millisecond immediately after 22 | * a USB RESET. We first do a binary search for the OSCCAL value and then 23 | * optimize this value with a neighboorhod search. 24 | */ 25 | void calibrateOscillator(void) 26 | { 27 | uchar step = 128; 28 | uchar trialValue = 0, optimumValue; 29 | int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 30 | 31 | /* do a binary search: */ 32 | do{ 33 | OSCCAL = trialValue + step; 34 | x = usbMeasureFrameLength(); /* proportional to current real frequency */ 35 | if(x < targetValue) /* frequency still too low */ 36 | trialValue += step; 37 | step >>= 1; 38 | }while(step > 0); 39 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 40 | /* now do a neighborhood search for optimum value */ 41 | optimumValue = trialValue; 42 | optimumDev = x; /* this is certainly far away from optimum */ 43 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ 44 | x = usbMeasureFrameLength() - targetValue; 45 | if(x < 0) 46 | x = -x; 47 | if(x < optimumDev){ 48 | optimumDev = x; 49 | optimumValue = OSCCAL; 50 | } 51 | } 52 | OSCCAL = optimumValue; 53 | } 54 | /* 55 | Note: This calibration algorithm may try OSCCAL values of up to 192 even if 56 | the optimum value is far below 192. It may therefore exceed the allowed clock 57 | frequency of the CPU in low voltage designs! 58 | You may replace this search algorithm with any other algorithm you like if 59 | you have additional constraints such as a maximum CPU clock. 60 | For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. 61 | ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in 62 | both regions. 63 | */ 64 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/osccal.h: -------------------------------------------------------------------------------- 1 | /* Name: osccal.h 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.h 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | /* 11 | General Description: 12 | This module contains a function which calibrates the AVR's internal RC 13 | oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be 14 | defined when the module is compiled, best passed in the compiler command 15 | line). The time reference is the USB frame clock of 1 kHz available 16 | immediately after a USB RESET condition. Timing is done by counting CPU 17 | cycles, so all interrupts must be disabled while the calibration runs. For 18 | low level timing measurements, usbMeasureFrameLength() is called. This 19 | function must be enabled in usbconfig.h by defining 20 | USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is recommended to call 21 | calibrateOscillator() from the reset hook in usbconfig.h: 22 | */ 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include // for sei() 26 | extern void calibrateOscillator(void); 27 | #endif 28 | #define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} 29 | 30 | /* 31 | This routine is an alternative to the continuous synchronization described 32 | in osctune.h. 33 | 34 | Algorithm used: 35 | calibrateOscillator() first does a binary search in the OSCCAL register for 36 | the best matching oscillator frequency. Then it does a next neighbor search 37 | to find the value with the lowest clock rate deviation. It is guaranteed to 38 | find the best match among neighboring values, but for version 5 oscillators 39 | (which have a discontinuous relationship between OSCCAL and frequency) a 40 | better match might be available in another OSCCAL region. 41 | 42 | Limitations: 43 | This calibration algorithm may try OSCCAL values of up to 192 even if the 44 | optimum value is far below 192. It may therefore exceed the allowed clock 45 | frequency of the CPU in low voltage designs! 46 | Precision depends on the OSCCAL vs. frequency dependency of the oscillator. 47 | Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram 48 | in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and 49 | 16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this 50 | deviation! All other frequency modules require at least 0.2% precision. 51 | */ 52 | 53 | #ifndef __OSCCAL_H_INCLUDED__ 54 | #define __OSCCAL_H_INCLUDED__ 55 | 56 | //void calibrateOscillator(void); 57 | /* This function calibrates the RC oscillator so that the CPU runs at F_CPU. 58 | * It MUST be called immediately after the end of a USB RESET condition! 59 | * Disable all interrupts during the call! 60 | * It is recommended that you store the resulting value in EEPROM so that a 61 | * good guess value is available after the next reset. 62 | */ 63 | 64 | 65 | #endif /* __OSCCAL_H_INCLUDED__ */ 66 | -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/osccal.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkKeyboard/osccal.o -------------------------------------------------------------------------------- /libraries/DigisparkKeyboard/usbdrvasm.asm: -------------------------------------------------------------------------------- 1 | /* Name: usbdrvasm.asm 2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2006-03-01 5 | * Tabsize: 4 6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id$ 9 | */ 10 | 11 | /* 12 | General Description: 13 | The IAR compiler/assembler system prefers assembler files with file extension 14 | ".asm". We simply provide this file as an alias for usbdrvasm.S. 15 | 16 | Thanks to Oleg Semyonov for his help with the IAR tools port! 17 | */ 18 | 19 | #include "usbdrvasm.S" 20 | 21 | end 22 | -------------------------------------------------------------------------------- /libraries/DigisparkLCD/examples/BasicUsage/BasicUsage.ino: -------------------------------------------------------------------------------- 1 | /* ATtiny85 as an I2C Master Ex2 BroHogan 1/21/11 2 | * Modified for Digistump - Digispark LCD Shield by Erik Kettenburg 11/2012 3 | * SETUP: 4 | * ATtiny Pin 1 = (RESET) N/U ATtiny Pin 2 = (D3) N/U 5 | * ATtiny Pin 3 = (D4) to LED1 ATtiny Pin 4 = GND 6 | * ATtiny Pin 5 = SDA on DS1621 & GPIO ATtiny Pin 6 = (D1) to LED2 7 | * ATtiny Pin 7 = SCK on DS1621 & GPIO ATtiny Pin 8 = VCC (2.7-5.5V) 8 | * NOTE! - It's very important to use pullups on the SDA & SCL lines! 9 | * PCA8574A GPIO was used wired per instructions in "info" folder in the LiquidCrystal_I2C lib. 10 | * This ex assumes A0-A2 are set HIGH for an addeess of 0x3F 11 | * LiquidCrystal_I2C lib was modified for ATtiny - on Playground with TinyWireM lib. 12 | * TinyWireM USAGE & CREDITS: - see TinyWireM.h 13 | */ 14 | 15 | //#define DEBUG 16 | #include // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos 17 | #include // for LCD w/ GPIO MODIFIED for the ATtiny85 18 | 19 | #define GPIO_ADDR 0x27 // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules. 20 | 21 | 22 | LiquidCrystal_I2C lcd(GPIO_ADDR,16,2); // set address & 16 chars / 2 lines 23 | 24 | 25 | void setup(){ 26 | TinyWireM.begin(); // initialize I2C lib - comment this out to use with standard arduinos 27 | lcd.init(); // initialize the lcd 28 | lcd.backlight(); // Print a message to the LCD. 29 | lcd.print("Digispark!"); 30 | } 31 | 32 | 33 | void loop(){ 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/BC557.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkLCD/info/BC557.pdf -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/Image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkLCD/info/Image.jpg -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/PCF8574P.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkLCD/info/PCF8574P.pdf -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/Schematic_diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkLCD/info/Schematic_diagram.jpg -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/notes_for_pollin_interface.txt: -------------------------------------------------------------------------------- 1 | Notes for users with a Pollin.de interface board 2 | http://www.pollin.de/shop/dt/NDU4OTgxOTk-/Bausaetze_Module/Bausaetze/LCD_I2C_Modul.html 3 | 4 | The pollin interface board will not work with de default library. 5 | To get it working two control lines to the LCD need to be changed. 6 | 7 | Open file "LiquidCrystal_I2C.h" with a text editor like Notepad (not WordPad !) 8 | 9 | In that file look for: 10 | #define En B00010000 // Enable bit 11 | #define Rw B00100000 // Read/Write bit 12 | #define Rs B01000000 // Register select bit 13 | 14 | Replace these lines by: 15 | #define En B01000000 // Enable bit 16 | #define Rw B00100000 // Read/Write bit 17 | #define Rs B00010000 // Register select bit 18 | 19 | 20 | 21 | People at Pollin also have misunderstood the PCF8574 Datasheet and list the wrong addresses on their PCB 22 | For PCF8574A the addressing is: 23 | 24 | Jp3 Jp2 Jp1 25 | A2 A1 A0 Dec Hex 26 | L L L 56 0x38 27 | L L H 57 0x39 28 | L H L 64 0x40 29 | L H H 74 0x4A 30 | H L L 75 0x4B 31 | H L H 76 0x4C 32 | H H L 77 0x4D 33 | H H H 78 0x4E 34 | 35 | They also seem to ship boards with a PCF8574 36 | For PCF8574 the addressing is: 37 | 38 | Jp3 Jp2 Jp1 39 | A2 A1 A0 Dec Hex 40 | L L L 32 0x20 41 | L L H 33 0x21 42 | L H L 34 0x22 43 | L H H 35 0x23 44 | H L L 36 0x24 45 | H L H 37 0x25 46 | H H L 38 0x26 47 | H H H 39 0x27 48 | 49 | 50 | They have also chosen two rather high pull-up resistors (10K) for the I2C lines. Usually two 4K7 resistors should do the job. 51 | Please note that on a I2C bus only one device should have the pull-up resistors installed! 52 | 53 | I hope this helps in getting your LCD working. 54 | 55 | Mario -------------------------------------------------------------------------------- /libraries/DigisparkLCD/info/readme.txt: -------------------------------------------------------------------------------- 1 | LiquidCrystal_I2C V2.0 2 | 3 | The LiquidCrystal_I2C library is a modified version of the standard LiquidCrystal library as found on 4 | the Arduino website. 5 | This library is intended to be used when a parallel HD44780 compatible LCD is controlled over I2C using 6 | a PCF8574 extender (see datasheet for details). 7 | 4 of the 8 outputs are used for LDC data lines 4 to 7. 8 | 3 outputs are used for the Enable, register-select and Read/Write lines. 9 | The one output left can be used to control the backlight of the LCD (if available). 10 | For backlight control some extra resistors and a pnp-type transistor are required (for details see 11 | schematic diagram). 12 | 13 | The PCF8574 extender is available in two versions, the PCF8574 and the PCF8574A. 14 | The only difference between the two is the I2C base address. 15 | The base address for the PCF8574 is 0x20 and the base address for the PCF8574A is 0x38. 16 | The examples included in this zip file assume the use of an PCF8574 set for address 0x20 17 | (A0, A1 and A3 grounded). 18 | 19 | For compatibility reasons this library contains some aliases for functions that are known under different 20 | names in other libraries. This should make it fairly easy to implement the library in existing sketches 21 | without changing to much code. 22 | Functions not supported by this library will return nothing at all and in case a return value is expected 23 | the function will return 0. 24 | 25 | Update 8-12-2011: 26 | Due to the relaese of Arduino IDE 1.0 some changes were made to the library to get it working under the new IDE. 27 | Because of these changes this version of the LiquidCrystal_I2C library can not be used for older IDE versions. 28 | The old version of the LiquidCrystal_I2Clibrary can be downloaded form http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/V1.0/LiquidCrystal_I2C_V1.0.zip 29 | 30 | Download the latest version from: 31 | http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/LiquidCrystal_I2C.zip 32 | (Thanks to Ailton F. for beta testing.) 33 | 34 | 35 | Mario H. 36 | atmega@xs4all.nl -------------------------------------------------------------------------------- /libraries/DigisparkLCD/keywords.txt: -------------------------------------------------------------------------------- 1 | ########################################### 2 | # Syntax Coloring Map For LiquidCrystal_I2C 3 | # Version 2.0 4 | ########################################### 5 | 6 | ########################################### 7 | # Datatypes (KEYWORD1) 8 | ########################################### 9 | 10 | LiquidCrystal_I2C KEYWORD1 11 | 12 | ########################################### 13 | # Methods and Functions (KEYWORD2) 14 | ########################################### 15 | init KEYWORD2 16 | begin KEYWORD2 17 | clear KEYWORD2 18 | home KEYWORD2 19 | noDisplay KEYWORD2 20 | display KEYWORD2 21 | noBlink KEYWORD2 22 | blink KEYWORD2 23 | noCursor KEYWORD2 24 | cursor KEYWORD2 25 | scrollDisplayLeft KEYWORD2 26 | scrollDisplayRight KEYWORD2 27 | leftToRight KEYWORD2 28 | rightToLeft KEYWORD2 29 | shiftIncrement KEYWORD2 30 | shiftDecrement KEYWORD2 31 | noBacklight KEYWORD2 32 | backlight KEYWORD2 33 | autoscroll KEYWORD2 34 | noAutoscroll KEYWORD2 35 | createChar KEYWORD2 36 | setCursor KEYWORD2 37 | print KEYWORD2 38 | blink_on KEYWORD2 39 | blink_off KEYWORD2 40 | cursor_on KEYWORD2 41 | cursor_off KEYWORD2 42 | setBacklight KEYWORD2 43 | load_custom_character KEYWORD2 44 | printstr KEYWORD2 45 | ########################################### 46 | # Constants (LITERAL1) 47 | ########################################### 48 | -------------------------------------------------------------------------------- /libraries/DigisparkLPD8806/LPD8806.h: -------------------------------------------------------------------------------- 1 | #if (ARDUINO >= 100) 2 | #include 3 | #else 4 | #include 5 | #include 6 | #endif 7 | 8 | class LPD8806 { 9 | 10 | public: 11 | 12 | LPD8806(uint16_t n, uint8_t dpin, uint8_t cpin); // Configurable pins 13 | void 14 | begin(void), 15 | show(void), 16 | setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b), 17 | setPixelColor(uint16_t n, uint32_t c), 18 | updatePins(uint8_t dpin, uint8_t cpin), // Change pins, configurable 19 | updateLength(uint16_t n); // Change strip length 20 | uint16_t 21 | numPixels(void); 22 | uint32_t 23 | Color(byte, byte, byte), 24 | getPixelColor(uint16_t n); 25 | 26 | private: 27 | 28 | uint16_t 29 | numLEDs; // Number of RGB LEDs in strip 30 | uint8_t 31 | *pixels, // Holds LED color values (3 bytes each) 32 | clkpin , datapin, // Clock & data pin numbers 33 | clkpinmask, datapinmask; // Clock & data PORT bitmasks 34 | volatile uint8_t 35 | *clkport , *dataport; // Clock & data PORT registers 36 | void 37 | startBitbang(void); 38 | boolean 39 | hardwareSPI, // If 'true', using hardware SPI 40 | begun; // If 'true', begin() method was previously invoked 41 | }; 42 | -------------------------------------------------------------------------------- /libraries/DigisparkLPD8806/README.md: -------------------------------------------------------------------------------- 1 | # Arduino library for LPD8806 # 2 | This Library was written for the LPD8806 PWM LED driver chips, strips and pixels. 3 | But the LPD8803/LPD8809 will probably work too. 4 | 5 | ## Where to Buy? ## 6 | Pick some up at [Adafruit Industries](http://www.adafruit.com/products/306) 7 | 8 | ## Download ## 9 | Click the Downloads Tab in the Tabbar above. 10 | Or follow [this](https://github.com/adafruit/LPD8806/zipball/master) link 11 | 12 | ## Installation ## 13 | * Uncompress the Downloaded Library 14 | * Rename the uncompressed folder to LPD8806 15 | * Check that the LPD8806 folder contains LPD8806.cpp and LPD8806.h 16 | * Place the LPD8806 library folder your /libraries/ folder, 17 | if the libraries folder does not exist - create it first! 18 | * Restart the IDE -------------------------------------------------------------------------------- /libraries/DigisparkLPD8806/examples/longstrandtest/longstrandtest.pde: -------------------------------------------------------------------------------- 1 | #include "LPD8806.h" 2 | #include "SPI.h" 3 | 4 | // Simple test for 160 (5 meters) of LPD8806-based RGB LED strip 5 | 6 | /*****************************************************************************/ 7 | 8 | // Number of RGB LEDs in strand: 9 | int nLEDs = 160; 10 | 11 | // Chose 2 pins for output; can be any valid output pins: 12 | int dataPin = 2; 13 | int clockPin = 3; 14 | 15 | // First parameter is the number of LEDs in the strand. The LED strips 16 | // are 32 LEDs per meter but you can extend or cut the strip. Next two 17 | // parameters are SPI data and clock pins: 18 | LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin); 19 | 20 | // You can optionally use hardware SPI for faster writes, just leave out 21 | // the data and clock pin parameters. But this does limit use to very 22 | // specific pins on the Arduino. For "classic" Arduinos (Uno, Duemilanove, 23 | // etc.), data = pin 11, clock = pin 13. For Arduino Mega, data = pin 51, 24 | // clock = pin 52. For 32u4 Breakout Board+ and Teensy, data = pin B2, 25 | // clock = pin B1. For Leonardo, this can ONLY be done on the ICSP pins. 26 | //LPD8806 strip = LPD8806(nLEDs); 27 | 28 | void setup() { 29 | // Start up the LED strip 30 | strip.begin(); 31 | 32 | // Update the strip, to start they are all 'off' 33 | strip.show(); 34 | } 35 | 36 | void loop() { 37 | colorChase(strip.Color(127, 0, 0), 100); // Red 38 | colorChase(strip.Color( 0,127, 0), 100); // Green 39 | colorChase(strip.Color( 0, 0,127), 100); // Blue 40 | colorChase(strip.Color(127,127,127), 100); // White 41 | } 42 | 43 | // Chase one dot down the full strip. Good for testing purposes. 44 | void colorChase(uint32_t c, uint8_t wait) { 45 | int i; 46 | 47 | // Start by turning all pixels off: 48 | for(i=0; i 0 14 | 15 | #warning "Never compile production devices with debugging enabled" 16 | 17 | static void uartPutc(char c) 18 | { 19 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ 20 | ODDBG_UDR = c; 21 | } 22 | 23 | static uchar hexAscii(uchar h) 24 | { 25 | h &= 0xf; 26 | if(h >= 10) 27 | h += 'a' - (uchar)10 - '0'; 28 | h += '0'; 29 | return h; 30 | } 31 | 32 | static void printHex(uchar c) 33 | { 34 | uartPutc(hexAscii(c >> 4)); 35 | uartPutc(hexAscii(c)); 36 | } 37 | 38 | void odDebug(uchar prefix, uchar *data, uchar len) 39 | { 40 | printHex(prefix); 41 | uartPutc(':'); 42 | while(len--){ 43 | uartPutc(' '); 44 | printHex(*data++); 45 | } 46 | uartPutc('\r'); 47 | uartPutc('\n'); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/DigisparkMouse/osccal.c: -------------------------------------------------------------------------------- 1 | /* Name: osccal.c 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.c 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | #include 11 | 12 | #ifndef uchar 13 | #define uchar unsigned char 14 | #endif 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | /* ------------------------ Oscillator Calibration ------------------------- */ 18 | /* ------------------------------------------------------------------------- */ 19 | 20 | /* Calibrate the RC oscillator. Our timing reference is the Start Of Frame 21 | * signal (a single SE0 bit) repeating every millisecond immediately after 22 | * a USB RESET. We first do a binary search for the OSCCAL value and then 23 | * optimize this value with a neighboorhod search. 24 | */ 25 | void calibrateOscillator(void) 26 | { 27 | uchar step = 128; 28 | uchar trialValue = 0, optimumValue; 29 | int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 30 | 31 | /* do a binary search: */ 32 | do{ 33 | OSCCAL = trialValue + step; 34 | x = usbMeasureFrameLength(); /* proportional to current real frequency */ 35 | if(x < targetValue) /* frequency still too low */ 36 | trialValue += step; 37 | step >>= 1; 38 | }while(step > 0); 39 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 40 | /* now do a neighborhood search for optimum value */ 41 | optimumValue = trialValue; 42 | optimumDev = x; /* this is certainly far away from optimum */ 43 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ 44 | x = usbMeasureFrameLength() - targetValue; 45 | if(x < 0) 46 | x = -x; 47 | if(x < optimumDev){ 48 | optimumDev = x; 49 | optimumValue = OSCCAL; 50 | } 51 | } 52 | OSCCAL = optimumValue; 53 | } 54 | /* 55 | Note: This calibration algorithm may try OSCCAL values of up to 192 even if 56 | the optimum value is far below 192. It may therefore exceed the allowed clock 57 | frequency of the CPU in low voltage designs! 58 | You may replace this search algorithm with any other algorithm you like if 59 | you have additional constraints such as a maximum CPU clock. 60 | For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. 61 | ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in 62 | both regions. 63 | */ 64 | -------------------------------------------------------------------------------- /libraries/DigisparkMouse/osccal.h: -------------------------------------------------------------------------------- 1 | /* Name: osccal.h 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.h 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | /* 11 | General Description: 12 | This module contains a function which calibrates the AVR's internal RC 13 | oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be 14 | defined when the module is compiled, best passed in the compiler command 15 | line). The time reference is the USB frame clock of 1 kHz available 16 | immediately after a USB RESET condition. Timing is done by counting CPU 17 | cycles, so all interrupts must be disabled while the calibration runs. For 18 | low level timing measurements, usbMeasureFrameLength() is called. This 19 | function must be enabled in usbconfig.h by defining 20 | USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is recommended to call 21 | calibrateOscillator() from the reset hook in usbconfig.h: 22 | */ 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include // for sei() 26 | extern void calibrateOscillator(void); 27 | #endif 28 | #define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} 29 | 30 | /* 31 | This routine is an alternative to the continuous synchronization described 32 | in osctune.h. 33 | 34 | Algorithm used: 35 | calibrateOscillator() first does a binary search in the OSCCAL register for 36 | the best matching oscillator frequency. Then it does a next neighbor search 37 | to find the value with the lowest clock rate deviation. It is guaranteed to 38 | find the best match among neighboring values, but for version 5 oscillators 39 | (which have a discontinuous relationship between OSCCAL and frequency) a 40 | better match might be available in another OSCCAL region. 41 | 42 | Limitations: 43 | This calibration algorithm may try OSCCAL values of up to 192 even if the 44 | optimum value is far below 192. It may therefore exceed the allowed clock 45 | frequency of the CPU in low voltage designs! 46 | Precision depends on the OSCCAL vs. frequency dependency of the oscillator. 47 | Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram 48 | in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and 49 | 16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this 50 | deviation! All other frequency modules require at least 0.2% precision. 51 | */ 52 | 53 | #ifndef __OSCCAL_H_INCLUDED__ 54 | #define __OSCCAL_H_INCLUDED__ 55 | 56 | //void calibrateOscillator(void); 57 | /* This function calibrates the RC oscillator so that the CPU runs at F_CPU. 58 | * It MUST be called immediately after the end of a USB RESET condition! 59 | * Disable all interrupts during the call! 60 | * It is recommended that you store the resulting value in EEPROM so that a 61 | * good guess value is available after the next reset. 62 | */ 63 | 64 | 65 | #endif /* __OSCCAL_H_INCLUDED__ */ 66 | -------------------------------------------------------------------------------- /libraries/DigisparkMouse/osccal.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkMouse/osccal.o -------------------------------------------------------------------------------- /libraries/DigisparkMouse/usbdrvasm.asm: -------------------------------------------------------------------------------- 1 | /* Name: usbdrvasm.asm 2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2006-03-01 5 | * Tabsize: 4 6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id$ 9 | */ 10 | 11 | /* 12 | General Description: 13 | The IAR compiler/assembler system prefers assembler files with file extension 14 | ".asm". We simply provide this file as an alias for usbdrvasm.S. 15 | 16 | Thanks to Oleg Semyonov for his help with the IAR tools port! 17 | */ 18 | 19 | #include "usbdrvasm.S" 20 | 21 | end 22 | -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/ArduinoNunchuk.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ArduinoNunchuk.cpp - Improved Wii Nunchuk library for Arduino 3 | * 4 | * Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ 5 | * 6 | * Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/ 7 | * 8 | * Based on the following resources: 9 | * http://www.windmeadow.com/node/42 10 | * http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/ 11 | * http://wiibrew.org/wiki/Wiimote/Extension_Controllers 12 | * 13 | */ 14 | 15 | #include 16 | #include 17 | #include "ArduinoNunchuk.h" 18 | 19 | #define ADDRESS 0x52 20 | 21 | void ArduinoNunchuk::init() 22 | { 23 | TinyWireM.begin(); 24 | 25 | ArduinoNunchuk::_sendByte(0x55, 0xF0); 26 | ArduinoNunchuk::_sendByte(0x00, 0xFB); 27 | 28 | ArduinoNunchuk::update(); 29 | } 30 | 31 | void ArduinoNunchuk::update() 32 | { 33 | int count = 0; 34 | int values[6]; 35 | 36 | TinyWireM.requestFrom(ADDRESS, 6); 37 | 38 | while(TinyWireM.available()) 39 | { 40 | values[count] = TinyWireM.receive(); 41 | count++; 42 | } 43 | 44 | ArduinoNunchuk::analogX = values[0]; 45 | ArduinoNunchuk::analogY = values[1]; 46 | ArduinoNunchuk::accelX = (values[2] << 2) | ((values[5] >> 2) & 3); 47 | ArduinoNunchuk::accelY = (values[3] << 2) | ((values[5] >> 4) & 3); 48 | ArduinoNunchuk::accelZ = (values[4] << 2) | ((values[5] >> 6) & 3); 49 | ArduinoNunchuk::zButton = !((values[5] >> 0) & 1); 50 | ArduinoNunchuk::cButton = !((values[5] >> 1) & 1); 51 | 52 | ArduinoNunchuk::_sendByte(0x00, 0x00); 53 | } 54 | 55 | void ArduinoNunchuk::_sendByte(byte data, byte location) 56 | { 57 | TinyWireM.beginTransmission(ADDRESS); 58 | 59 | TinyWireM.send(location); 60 | TinyWireM.send(data); 61 | 62 | TinyWireM.endTransmission(); 63 | 64 | delay(10); 65 | } -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/ArduinoNunchuk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ArduinoNunchuk.h - Improved Wii Nunchuk library for Arduino 3 | * 4 | * Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ 5 | * 6 | * Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/ 7 | * 8 | * Based on the following resources: 9 | * http://www.windmeadow.com/node/42 10 | * http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/ 11 | * http://wiibrew.org/wiki/Wiimote/Extension_Controllers 12 | * 13 | */ 14 | 15 | #ifndef ArduinoNunchuk_H 16 | #define ArduinoNunchuk_H 17 | 18 | #include 19 | 20 | class ArduinoNunchuk 21 | { 22 | public: 23 | int analogX; 24 | int analogY; 25 | int accelX; 26 | int accelY; 27 | int accelZ; 28 | int zButton; 29 | int cButton; 30 | 31 | void init(); 32 | void update(); 33 | 34 | private: 35 | void _sendByte(byte data, byte location); 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/LICENSE.txt: -------------------------------------------------------------------------------- 1 | LICENSE 2 | 3 | This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/README.txt: -------------------------------------------------------------------------------- 1 | ArduinoNunchuk - Improved Wii Nunchuk library for Arduino 2 | 3 | Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ 4 | 5 | Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/ 6 | 7 | Based on the following resources: 8 | - http://www.windmeadow.com/node/42 9 | - http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/ 10 | - http://wiibrew.org/wiki/Wiimote/Extension_Controllers 11 | 12 | 13 | INSTALLATION: 14 | 15 | Copy the 'ArduinoNunchuk' folder, located in the same folder as this 'README' file, to the Arduino libraries folder (Arduino/libraries). -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/examples/ArduinoNunchukDemo/ArduinoNunchukDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * ArduinoNunchukDemo.ino 3 | * 4 | * Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ 5 | * 6 | * Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/ 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | 13 | #define BAUDRATE 19200 14 | 15 | ArduinoNunchuk nunchuk = ArduinoNunchuk(); 16 | 17 | void setup() 18 | { 19 | Serial.begin(BAUDRATE); 20 | nunchuk.init(); 21 | } 22 | 23 | void loop() 24 | { 25 | nunchuk.update(); 26 | 27 | Serial.print(nunchuk.analogX, DEC); 28 | Serial.print(' '); 29 | Serial.print(nunchuk.analogY, DEC); 30 | Serial.print(' '); 31 | Serial.print(nunchuk.accelX, DEC); 32 | Serial.print(' '); 33 | Serial.print(nunchuk.accelY, DEC); 34 | Serial.print(' '); 35 | Serial.print(nunchuk.accelZ, DEC); 36 | Serial.print(' '); 37 | Serial.print(nunchuk.zButton, DEC); 38 | Serial.print(' '); 39 | Serial.println(nunchuk.cButton, DEC); 40 | } -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/examples/DigisparkJoystickDemo/DigisparkJoystickDemo.ino: -------------------------------------------------------------------------------- 1 | //DigiJoystick Nunchuck Demo 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | ArduinoNunchuk nunchuk = ArduinoNunchuk(); 8 | 9 | void setup() { 10 | nunchuk.init(); 11 | } 12 | 13 | 14 | void loop() { 15 | nunchuk.update(); 16 | DigiJoystick.setX((byte) nunchuk.analogX); // scroll X left to right repeatedly 17 | DigiJoystick.setY((byte) nunchuk.analogY); 18 | DigiJoystick.setXROT((byte) map(nunchuk.accelX,255,700,0,255)); 19 | DigiJoystick.setYROT((byte) map(nunchuk.accelY,255,850,0,255)); 20 | DigiJoystick.setZROT((byte) map(nunchuk.accelZ,255,750,0,255)); 21 | int buttonByte = 0; 22 | bitWrite(buttonByte, 0, nunchuk.zButton); 23 | bitWrite(buttonByte, 1, nunchuk.cButton); 24 | DigiJoystick.setButtons((byte) buttonByte, (byte) 0); 25 | DigiJoystick.delay(10); 26 | 27 | 28 | } -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/examples/DigisparkUSBDemo/DigisparkUSBDemo.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Digispark Nunchuck shield demo 3 | * 4 | * Uses arduinonunchuk - Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/ - http://www.gabrielbianconi.com/projects/arduinonunchuk/ 5 | * 6 | */ 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | ArduinoNunchuk nunchuk = ArduinoNunchuk(); 14 | 15 | void setup() 16 | { 17 | DigiUSB.begin(); 18 | nunchuk.init(); 19 | } 20 | 21 | void loop() 22 | { 23 | nunchuk.update(); 24 | 25 | DigiUSB.println(nunchuk.analogX, DEC); 26 | 27 | DigiUSB.println(nunchuk.analogY, DEC); 28 | 29 | DigiUSB.println(nunchuk.accelX, DEC); 30 | 31 | DigiUSB.println(nunchuk.accelY, DEC); 32 | 33 | DigiUSB.println(nunchuk.accelZ, DEC); 34 | 35 | DigiUSB.println(nunchuk.zButton, DEC); 36 | 37 | DigiUSB.println(nunchuk.cButton, DEC); 38 | 39 | DigiUSB.delay(250); 40 | } -------------------------------------------------------------------------------- /libraries/DigisparkNunchuk/keywords.txt: -------------------------------------------------------------------------------- 1 | ArduinoNunchuk KEYWORD1 2 | init KEYWORD2 3 | update KEYWORD2 -------------------------------------------------------------------------------- /libraries/DigisparkRGB/DigisparkRGB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "DigisparkRGB.h" 6 | #include "Arduino.h" 7 | 8 | #define set(x) |= (1< 2 | /* 3 | Digispark RGB 4 | 5 | This example shows how to use soft PWM to fade 3 colors. 6 | Note: This is only necessary for PB2 (pin 2) - Blue, as Red (pin 0) and Green (pin 1) as well as pin 4 support the standard Arduino analogWrite() function. 7 | 8 | This example code is in the public domain. 9 | */ 10 | byte RED = 0; 11 | byte BLUE = 2; 12 | byte GREEN = 1; 13 | byte COLORS[] = {RED, BLUE, GREEN}; 14 | 15 | // the setup routine runs once when you press reset: 16 | void setup() { 17 | DigisparkRGBBegin(); 18 | } 19 | 20 | 21 | void loop () 22 | { 23 | //direction: up = true, down = false 24 | boolean dir = true; 25 | int i = 0; 26 | 27 | while(1) 28 | { 29 | fade(COLORS[i%3], dir); 30 | i++; 31 | dir = !dir; 32 | } 33 | } 34 | void fade(byte Led, boolean dir) 35 | { 36 | int i; 37 | 38 | //if fading up 39 | if (dir) 40 | { 41 | for (i = 0; i < 256; i++) 42 | { 43 | DigisparkRGB(Led, i); 44 | DigisparkRGBDelay(25);//1); 45 | } 46 | } 47 | else 48 | { 49 | for (i = 255; i >= 0; i--) 50 | { 51 | DigisparkRGB(Led, i); 52 | DigisparkRGBDelay(25);//1); 53 | } 54 | } 55 | } 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /libraries/DigisparkRGB/keywords.txt: -------------------------------------------------------------------------------- 1 | DigisparkRGBBegin KEYWORD2 2 | DigisparkRGB KEYWORD2 3 | DigisparkRGBDelay KEYWORD2 -------------------------------------------------------------------------------- /libraries/DigisparkRcSeq/keywords.txt: -------------------------------------------------------------------------------- 1 | ############################################ 2 | # Syntax Coloring Map RcSeq 3 | ############################################ 4 | 5 | ############################################ 6 | # Datatypes (KEYWORD1) 7 | ############################################ 8 | RcSeq KEYWORD1 9 | 10 | ############################################ 11 | # Methods and Functions (KEYWORD2) 12 | ############################################ 13 | RcSeq_LibVersion KEYWORD2 14 | RcSeq_LibRevision KEYWORD2 15 | RcSeq_LibTextVersionRevision KEYWORD2 16 | RcSeq_Init KEYWORD2 17 | RcSeq_DeclareSignal KEYWORD2 18 | RcSeq_DeclareKeyboard KEYWORD2 19 | RcSeq_DeclareClavier KEYWORD2 20 | RcSeq_DeclareStick KEYWORD2 21 | RcSeq_DeclareManche KEYWORD2 22 | RcSeq_DeclareServo KEYWORD2 23 | RcSeq_DeclareCustomKeyboard KEYWORD2 24 | RcSeq_DeclareClavierMaison KEYWORD2 25 | RcSeq_DeclareCommandAndSequence KEYWORD2 26 | RcSeq_DeclareCommandeEtSequence KEYWORD2 27 | RcSeq_DeclareCommandAndShortAction KEYWORD2 28 | RcSeq_DeclareCommandeEtActionCourte KEYWORD2 29 | RcSeq_LaunchSequence KEYWORD2 30 | RcSeq_LanceSequence KEYWORD2 31 | RcSeq_LaunchShortAction KEYWORD2 32 | RcSeq_LanceActionCourte KEYWORD2 33 | RcSeq_Refresh KEYWORD2 34 | RcSeq_Rafraichit KEYWORD2 35 | 36 | ############################################ 37 | # Constants (LITERAL1) 38 | ############################################ 39 | SequenceSt_t LITERAL1 40 | KeyMap_t LITERAL1 41 | SHORT_ACTION_TO_PERFORM LITERAL1 42 | ACTION_COURTE_A_EFFECTUER LITERAL1 43 | MOTION_WITH_SOFT_START_AND_STOP LITERAL1 44 | MOTION_WITHOUT_SOFT_START_AND_STOP LITERAL1 45 | MVT_AVEC_DEBUT_ET_FIN_MVT_LENTS LITERAL1 46 | MVT_SANS_DEBUT_ET_FIN_MVT_LENTS LITERAL1 47 | RC_CUSTOM_KEYBOARD LITERAL1 48 | RC_CLAVIER_MAISON LITERAL1 49 | RC_SEQUENCE LITERAL1 50 | CENTER_VALUE_US LITERAL1 51 | VALEUR_CENTRALE_US LITERAL1 52 | -------------------------------------------------------------------------------- /libraries/DigisparkSimpleServo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkSimpleServo/.DS_Store -------------------------------------------------------------------------------- /libraries/DigisparkSimpleServo/README.txt: -------------------------------------------------------------------------------- 1 | ================== 2 | SimpleServo - v0.8 3 | ================== 4 | 5 | "Shh, ya hear that? Me neither… It's simple… Maybe *too* simple…" 6 | 7 | This is a simplistic library to bundle up and generalize bit-banging servo PWM. It has some good points and trade-offs and is primarily being developed for the Digispark. 8 | 9 | First the good: 10 | - Can control any number of servos 11 | - All software, no fancy hardware required 12 | - Produces a relatively clean signal 13 | - Allows (or will) tuning pulse parameters to suit the widely varied tastes of different servos 14 | - A single instance can be used with multiple similar servos 15 | 16 | Now some limitations: 17 | - It can only control one servo at a time 18 | - The program can't do anything else while the servo is being signaled 19 | - Documentation is incomplete (at the moment) 20 | 21 | When typical servos stop receiving a control signal, they stay where they are; while they won't actively hold their position, most require some force to backdrive. So if that's enough for your project, you can move each servo in turn, and sample inputs, set LEDs and such in between. 22 | 23 | ======= 24 | Methods 25 | ======= 26 | 27 | See comments in SimpleServo.h (and SimpleServo.m) for now. 28 | 29 | *(( TODO: Document the additional methods in detail, add an example ))* 30 | 31 | ======= 32 | License 33 | ======= 34 | 35 | The MIT License (MIT) 36 | Copyright (c) 2013 Benjamin Holt 37 | 38 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 39 | 40 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 41 | 42 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | -------------------------------------------------------------------------------- /libraries/DigisparkSimpleServo/SimpleServo.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2013 Benjamin Holt 3 | 4 | The MIT License (MIT) - See README for complete license 5 | */ 6 | 7 | #ifndef _SimpleServo_h_ 8 | #define _SimpleServo_h_ 9 | 10 | #include 11 | #include 12 | 13 | class SimpleServo { 14 | private: 15 | // Movement 16 | uint8_t _pin; 17 | uint8_t _degrees; 18 | uint16_t _microseconds; 19 | 20 | // Servo Parameters 21 | // REM: nasty bit about when to constrain vs. not... more below... 22 | uint8_t _maxDegrees; 23 | uint16_t _millisPer60degrees; 24 | uint16_t _minWriteMillis; 25 | uint16_t _maxWriteMillis; 26 | uint16_t _minPulse; 27 | uint16_t _maxPulse; 28 | uint8_t _pulseMillis; 29 | 30 | void _pulse(uint16_t); 31 | 32 | public: 33 | // TODO: update keywords file 34 | // Setup 35 | SimpleServo(); 36 | uint8_t attach(uint8_t); // Note: resets position, but not servo parameters, doesn't signal servo 37 | void detach(); 38 | uint8_t attached(); 39 | 40 | // Movement 41 | void write(uint8_t); 42 | void writeMicroseconds(uint16_t); 43 | uint32_t millisToTarget(uint8_t); // Estimates time from current (expected) position to a target; if millisPer60Degrees is too small, this will come up short and the servo may not reach the target, too large and the write methods may signal longer than needed 44 | void writeMillis(uint8_t, uint16_t); // Allows unconstrained millis 45 | void writeMicrosecondsMillis(uint16_t, uint16_t); // Allows unconstrained microseconds and millis, full manual control 46 | uint8_t read(); 47 | uint16_t readMicroseconds(); 48 | 49 | 50 | // Servo Parameters 51 | void setMaximumDegrees(uint8_t); // A lot of servos move a bit more than 180 52 | void setMillisPer60Degrees(uint16_t); // For estimating time from last set position to newly requested position; different for every servo, http://www.servodatabase.com has many specs, default is 230 from Futaba S3003 53 | void setMinimumMillis(uint16_t); // The smallest time to signal the servo; some write methods do not enforce this 54 | void setMaximumMillis(uint16_t); // This longest time to signal the servo, even if it probably has not yet reached the requested position; some write methods do not enforce this 55 | void setMinimumPulse(uint16_t); // The shortest pulse (in microseconds) to send to the servo, maps to 0deg; only writeMicrosecondsMillis does not enforce this 56 | void setMaximumPulse(uint16_t); // The shortest pulse (in microseconds) to send to the servo, maps to 0deg; only writeMicrosecondsMillis does not enforce this 57 | void setPulseMillis(uint8_t); // Delay between pulses; defaults to 16 which is a bit quicker than spec. Experiment, different servos may react differently 58 | }; 59 | #endif // _SimpleServo_h_ 60 | -------------------------------------------------------------------------------- /libraries/DigisparkSimpleServo/examples/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkSimpleServo/examples/.DS_Store -------------------------------------------------------------------------------- /libraries/DigisparkSimpleServo/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SimpleServo 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SimpleServo KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | attach KEYWORD2 16 | attached KEYWORD2 17 | detach KEYWORD2 18 | read KEYWORD2 19 | setMaximumPulse KEYWORD2 20 | setMinimumPulse KEYWORD2 21 | write KEYWORD2 22 | writeMillis KEYWORD2 23 | writeMicrosecondsMillis KEYWORD2 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseIn/SoftRcPulseIn.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | English: by RC Navy (2012) 3 | ======= 4 | : an asynchronous library to read Input Pulse Width from standard Hobby Radio-Control. This library is a non-blocking version of pulseIn(). 5 | http://p.loussouarn.free.fr 6 | 7 | Francais: par RC Navy (2012) 8 | ======== 9 | : une librairie asynchrone pour lire les largeur d'impulsions des Radio-Commandes standards. Cette librairie est une version non bloquante de pulsIn(). 10 | http://p.loussouarn.free.fr 11 | */ 12 | 13 | #include "SoftRcPulseIn.h" 14 | 15 | #define LIB_VERSION 1 16 | #define LIB_REVISION 0 17 | 18 | #define STR(s) #s 19 | #define MAKE_TEXT_VER_REV(Ver,Rev) STR(Ver)"."STR(Rev) 20 | 21 | #define LIB_TEXT_VERSION_REVISION MAKE_TEXT_VER_REV(LIB_VERSION,LIB_REVISION) /* Make Full version as a string "Ver.Rev" */ 22 | 23 | SoftRcPulseIn *SoftRcPulseIn::first; 24 | 25 | SoftRcPulseIn::SoftRcPulseIn(void) 26 | { 27 | } 28 | 29 | uint8_t SoftRcPulseIn::attach(uint8_t Pin, uint16_t PulseMin_us/*=600*/, uint16_t PulseMax_us/*=2400*/) 30 | { 31 | uint8_t Ret=0; 32 | 33 | _Pin=Pin; 34 | _PinMask=TinyPinChange_PinToMsk(Pin); 35 | _Min_us=PulseMin_us; 36 | _Max_us=PulseMax_us; 37 | next = first; 38 | first = this; 39 | pinMode(_Pin,INPUT); 40 | _VirtualPortIdx=TinyPinChange_RegisterIsr(_Pin,SoftRcPulseIn::SoftRcPulseInInterrupt); 41 | if(_VirtualPortIdx>=0) 42 | { 43 | TinyPinChange_EnablePin(_Pin); 44 | Ret=1; 45 | } 46 | return(Ret); 47 | } 48 | 49 | int SoftRcPulseIn::LibVersion(void) 50 | { 51 | return(LIB_VERSION); 52 | } 53 | 54 | int SoftRcPulseIn::LibRevision(void) 55 | { 56 | return(LIB_REVISION); 57 | } 58 | 59 | char *SoftRcPulseIn::LibTextVersionRevision(void) 60 | { 61 | return(LIB_TEXT_VERSION_REVISION); 62 | } 63 | 64 | uint8_t SoftRcPulseIn::available(void) 65 | { 66 | boolean Ret=0; 67 | uint16_t PulseWidth_us; 68 | 69 | if(_Available) 70 | { 71 | noInterrupts(); 72 | PulseWidth_us=_Width_us; 73 | interrupts(); 74 | Ret=_Available && (PulseWidth_us>=_Min_us) && (PulseWidth_us<=_Max_us); 75 | _Available=0; 76 | } 77 | return(Ret); 78 | } 79 | 80 | uint16_t SoftRcPulseIn::width_us(void) 81 | { 82 | uint16_t PulseWidth_us; 83 | noInterrupts(); 84 | PulseWidth_us=_Width_us; 85 | interrupts(); 86 | return(PulseWidth_us); 87 | } 88 | 89 | void SoftRcPulseIn::SoftRcPulseInInterrupt(void) 90 | { 91 | SoftRcPulseIn *RcPulseIn; 92 | 93 | for ( RcPulseIn = first; RcPulseIn != 0; RcPulseIn = RcPulseIn->next ) 94 | { 95 | if(TinyPinChange_GetPinEvent(RcPulseIn->_VirtualPortIdx)&RcPulseIn->_PinMask) 96 | { 97 | if(digitalRead(RcPulseIn->_Pin)) 98 | { 99 | /* High level, rising edge: start chrono */ 100 | RcPulseIn->_Start_us=micros(); 101 | } 102 | else 103 | { 104 | /* Low level, falling edge: stop chrono */ 105 | RcPulseIn->_Width_us=micros()-RcPulseIn->_Start_us; 106 | RcPulseIn->_Available=1; 107 | } 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseIn/SoftRcPulseIn.h: -------------------------------------------------------------------------------- 1 | /* 2 | English: by RC Navy (2012) 3 | ======= 4 | : an asynchronous library to read Input Pulse Width from standard Hobby Radio-Control. This library is a non-blocking version of pulseIn(). 5 | http://p.loussouarn.free.fr 6 | 7 | Francais: par RC Navy (2012) 8 | ======== 9 | : une librairie asynchrone pour lire les largeur d'impulsions des Radio-Commandes standards. Cette librairie est une version non bloquante de pulsIn(). 10 | http://p.loussouarn.free.fr 11 | */ 12 | 13 | #ifndef SOFT_RC_PULSE_IN_H 14 | #define SOFT_RC_PULSE_IN_H 15 | 16 | #if defined(ARDUINO) && ARDUINO >= 100 17 | #include "Arduino.h" 18 | #else 19 | #include "WProgram.h" 20 | #endif 21 | 22 | #include 23 | 24 | #include 25 | 26 | class SoftRcPulseIn 27 | { 28 | public: 29 | SoftRcPulseIn(); 30 | static int LibVersion(void); 31 | static int LibRevision(void); 32 | static char *LibTextVersionRevision(void); 33 | static void SoftRcPulseInInterrupt(void); 34 | uint8_t attach(uint8_t Pin, uint16_t PulseMin_us=600, uint16_t PulseMax_us=2400); 35 | boolean available(); 36 | uint16_t width_us(); 37 | private: 38 | class SoftRcPulseIn *next; 39 | static SoftRcPulseIn *first; 40 | uint8_t _Pin; 41 | uint8_t _PinMask; 42 | uint8_t _VirtualPortIdx; 43 | uint16_t _Min_us; 44 | uint16_t _Max_us; 45 | uint32_t _Start_us; 46 | uint32_t _Width_us; 47 | boolean _Available; 48 | }; 49 | /*******************************************************/ 50 | /* Application Programming Interface (API) en Francais */ 51 | /*******************************************************/ 52 | 53 | /* Methodes en Francais English native methods */ 54 | #define attache attach 55 | #define disponible available 56 | #define largeur_us width_us 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseIn/examples/SoftRcPulseInDemo/SoftRcPulseInDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define BROCHE_VOIE1 2 5 | 6 | SoftRcPulseIn ImpulsionVoie1; 7 | 8 | 9 | void setup() 10 | { 11 | #if !defined(__AVR_ATtiny24__) && !defined(__AVR_ATtiny44__) && !defined(__AVR_ATtiny84__) && !defined(__AVR_ATtiny25__) && !defined(__AVR_ATtiny45__) && !defined(__AVR_ATtiny85__) 12 | Serial.begin(9600); 13 | Serial.print("SoftRcPulseIn library V");Serial.print(SoftRcPulseIn::LibTextVersionRevision());Serial.print(" demo"); 14 | #endif 15 | ImpulsionVoie1.attache(BROCHE_VOIE1); 16 | } 17 | 18 | void loop() 19 | { 20 | if(ImpulsionVoie1.disponible()) 21 | { 22 | #if !defined(__AVR_ATtiny24__) && !defined(__AVR_ATtiny44__) && !defined(__AVR_ATtiny84__) && !defined(__AVR_ATtiny25__) && !defined(__AVR_ATtiny45__) && !defined(__AVR_ATtiny85__) 23 | Serial.print("Pulse=");Serial.println(ImpulsionVoie1.largeur_us()); 24 | #endif 25 | } 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseIn/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SoftRcPulseIn 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SoftRcPulseIn KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | LibVersion KEYWORD2 15 | LibRevision KEYWORD2 16 | LibTextVersionRevision KEYWORD2 17 | attach KEYWORD2 18 | attache KEYWORD2 19 | available KEYWORD2 20 | disponible KEYWORD2 21 | width_us KEYWORD2 22 | largeur_us KEYWORD2 23 | 24 | ####################################### 25 | # Constants (LITERAL1) 26 | ####################################### 27 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/SoftRcPulseOut.h: -------------------------------------------------------------------------------- 1 | #ifndef SoftRcPulseOut_h 2 | #define SoftRcPulseOut_h 3 | 4 | /* 5 | Update 01/03/2013: add support for DigiSpark (http://digistump.com): automatic Timer selection (RC Navy: p.loussouarn.free.fr) 6 | 7 | English: by RC Navy (2012) 8 | ======= 9 | : a library mainly based on the library, but with a better pulse generation to limit jitter. 10 | It supports the same methods as . 11 | It also support Pulse Width order given in microseconds. The current Pulse Width can also be read in microseconds. 12 | The refresh method can admit an optionnal argument (force). If SoftRcPulseOut::refresh(1) is called, the refresh is forced even if 20 ms are not elapsed. 13 | http://p.loussouarn.free.fr 14 | 15 | Francais: par RC Navy (2012) 16 | ======== 17 | : une librairie majoritairement basee sur la librairie , mais avec une meilleure generation des impulsions pour limiter la gigue. 18 | Elle supporte les memes methodes que . 19 | Elle supporte egalement une consigne de largeur d'impulsion passee en microseconde. La largeur de l'impulsion courante peut egalement etre lue en microseconde. 20 | La methode refresh peut admettre un parametre optionnel (force). Si SoftRcPulseOut::resfresh(1) est appelee, le refresh est force meme si 20 ms ne se sont pas ecoulee. 21 | http://p.loussouarn.free.fr 22 | */ 23 | 24 | #if defined(ARDUINO) && ARDUINO >= 100 25 | #include "Arduino.h" 26 | #else 27 | #include "WProgram.h" 28 | #endif 29 | 30 | #include 31 | 32 | class SoftRcPulseOut 33 | { 34 | private: 35 | boolean ItMasked; 36 | uint8_t pin; 37 | uint8_t angle; // in degrees 38 | uint16_t pulse0; // pulse width in TCNT0 counts 39 | uint8_t min16; // minimum pulse, 16uS units (default is 34) 40 | uint8_t max16; // maximum pulse, 16uS units, 0-4ms range (default is 150) 41 | class SoftRcPulseOut *next; 42 | static SoftRcPulseOut* first; 43 | public: 44 | SoftRcPulseOut(); 45 | uint8_t attach(int); // attach to a pin, sets pinMode, returns 0 on failure, won't 46 | // position the servo until a subsequent write() happens 47 | void detach(); 48 | void write(int); // specify the angle in degrees, 0 to 180 49 | void write_us(int); // specify the angle in microseconds, 500 to 2500 50 | uint8_t read(); // return the current angle 51 | uint8_t read_us(); // return the current pulse with in microseconds 52 | uint8_t attached(); 53 | void setMinimumPulse(uint16_t); // pulse length for 0 degrees in microseconds, 540uS default 54 | void setMaximumPulse(uint16_t); // pulse length for 180 degrees in microseconds, 2400uS default 55 | static uint8_t refresh(bool force = false); // must be called at least every 50ms or so to keep servo alive 56 | // you can call more often, it won't happen more than once every 20ms 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/examples/Knob/Knob.ino: -------------------------------------------------------------------------------- 1 | // Controlling a servo position using a potentiometer (variable resistor) 2 | // by Michal Rinott 3 | // Adapted to SoftRcPulseOut library by RC Navy (http://p.loussouarn.free.fr) 4 | // This sketch can work with ATtiny and Arduino UNO, MEGA, etc... 5 | 6 | #include 7 | 8 | SoftRcPulseOut myservo; // create servo object to control a servo 9 | 10 | #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 11 | //Here is the POT_PIN definition for ATtiny, they do NOT need a 'A' prefix for Analogic definition 12 | #define POT_PIN 2 // --analog pin-- (not digital) used to connect the potentiometer 13 | #else 14 | //Here is the POT_PIN definition for Arduino UNO, MEGA, they do need a 'A' prefix for Analogic definition 15 | #define POT_PIN A2 // --analog pin-- (not digital) used to connect the potentiometer 16 | #endif 17 | 18 | #define SERVO_PIN 3 // --digital pin-- (not analog) used to connect the servo 19 | 20 | #define REFRESH_PERIOD_MS 20 21 | 22 | int val; // variable to read the value from the analog pin 23 | 24 | void setup() 25 | { 26 | myservo.attach(SERVO_PIN); // attaches the servo on pin defined by SERVO_PIN to the servo object 27 | } 28 | 29 | void loop() 30 | { 31 | val = analogRead(POT_PIN); // reads the value of the potentiometer (value between 0 and 1023) 32 | val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 33 | myservo.write(val); // sets the servo position according to the scaled value 34 | delay(REFRESH_PERIOD_MS); // waits for the servo to get there 35 | SoftRcPulseOut::refresh(); // generates the servo pulse 36 | } 37 | 38 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/examples/SerialServo/SerialServo.ino: -------------------------------------------------------------------------------- 1 | // This SoftwareServo library example sketch was initially delivered without any comments. 2 | // Below my own comments for SoftRcPulseOut library: by RC Navy (http://p.loussouarn.free.fr) 3 | // Controlling the position of 2 servos using the Arduino built-in hardware UART (Arduino Serial object). 4 | // This sketch do NOT work with an ATtinyX4 and ATtinyX5 since they do not have a built-in harware UART (no Arduino Serial object). 5 | 6 | // The command (issued in the Arduino Serial Console or in a Terminal) is: 7 | // S=P with: 8 | // S=A for Servo1 and S=B for Servo2 9 | // P=Position number x 20° (Possible positions are from 0 to 9 which correspond to from 0° to 180°) 10 | // Ex: 11 | // A=7 sets Servo1 at 7 x 20 =140° 12 | // B=3 sets Servo2 at 3 x 20 =60° 13 | 14 | #include 15 | 16 | SoftRcPulseOut servo1; 17 | SoftRcPulseOut servo2; 18 | 19 | void setup() 20 | { 21 | pinMode(13,OUTPUT); 22 | servo1.attach(2); 23 | servo1.setMaximumPulse(2200); 24 | servo2.attach(4); 25 | servo2.setMaximumPulse(2200); 26 | Serial.begin(9600); 27 | Serial.print("Ready"); 28 | } 29 | 30 | void loop() 31 | { 32 | static int value = 0; 33 | static char CurrentServo = 0; 34 | 35 | if ( Serial.available()) { 36 | char ch = Serial.read(); 37 | switch(ch) { 38 | case 'A': 39 | CurrentServo='A'; 40 | digitalWrite(13,LOW); 41 | break; 42 | case 'B': 43 | CurrentServo='B'; 44 | digitalWrite(13,HIGH); 45 | break; 46 | case '0' ... '9': 47 | value=(ch-'0')*20; 48 | if (CurrentServo=='A') 49 | { 50 | servo1.write(value); 51 | } 52 | else if (CurrentServo=='B') 53 | { 54 | servo2.write(value); 55 | } 56 | break; 57 | } 58 | } 59 | SoftRcPulseOut::refresh(); 60 | } 61 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/examples/Sweep/Sweep.ino: -------------------------------------------------------------------------------- 1 | // Sweep 2 | // by BARRAGAN 3 | // Adapted to SoftRcPulseOut library by RC Navy (http://p.loussouarn.free.fr) 4 | // This sketch can work with ATtiny and Arduino UNO, MEGA, etc... 5 | // This example code is in the public domain. 6 | 7 | #include 8 | 9 | SoftRcPulseOut myservo; // create servo object to control a servo 10 | // a maximum of eight servo objects can be created 11 | #define SERVO_PIN 3 12 | 13 | #define REFRESH_PERIOD_MS 20 14 | 15 | int pos = 0; // variable to store the servo position 16 | 17 | void setup() 18 | { 19 | myservo.attach(SERVO_PIN); // attaches the servo on pin defined by SERVO_PIN to the servo object 20 | } 21 | 22 | 23 | void loop() 24 | { 25 | for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees 26 | { // in steps of 1 degree 27 | myservo.write(pos); // tell servo to go to position in variable 'pos' 28 | delay(REFRESH_PERIOD_MS); // waits 20ms for refresh period 29 | SoftRcPulseOut::refresh(1); // generates the servo pulse 30 | } 31 | for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees 32 | { 33 | myservo.write(pos); // tell servo to go to position in variable 'pos' 34 | delay(REFRESH_PERIOD_MS); // waits 20ms for for refresh period 35 | SoftRcPulseOut::refresh(1); // generates the servo pulse 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/examples/Usb2Servos/Usb2Servos.ino: -------------------------------------------------------------------------------- 1 | // This sketch demonstrates how to command 2 servos through the USB of the Digispark. 2 | // It uses: 3 | // - library to easily generates the RC pulses for the servos. 4 | // - library to communicate with the PC 5 | // By RC Navy (http://p.loussouarn.free.fr) 6 | 7 | // The command (issued in the DigiUSB Monitor or the digiterm) is: 8 | // S=P with: 9 | // S=A for ServoA and S=B for ServoB 10 | // P=Position number x 20° (Possible positions are from 0 to 9 which correspond to from 0° to 180°) 11 | // Ex: 12 | // A=7 sets Servo1 at 7 x 20 =140° 13 | // B=3 sets Servo2 at 3 x 20 =60° 14 | // Once the servo selected, just type the value between 0 and 9 15 | // Please, note this sketch is derived from the SerialServo example of library. 16 | 17 | #include 18 | #include 19 | 20 | #define LED_PIN 1 /* Builtin Led on Rev2 ModelA Digispark */ 21 | #define SERVO_A_PIN 2 22 | /* /!\ Do not use Pin 3 (used by USB) /!\ */ 23 | /* /!\ Do not use Pin 4 (used by USB) /!\ */ 24 | #define SERVO_B_PIN 5 25 | 26 | SoftRcPulseOut ServoA; 27 | SoftRcPulseOut ServoB; 28 | 29 | 30 | void setup() 31 | { 32 | pinMode(LED_PIN,OUTPUT); 33 | ServoA.attach(SERVO_A_PIN); 34 | ServoB.attach(SERVO_B_PIN); 35 | DigiUSB.begin(); 36 | DigiUSB.println(" Ready"); 37 | } 38 | 39 | void loop() 40 | { 41 | static int value = 0; 42 | static char CurrentServo = 0; 43 | 44 | if ( DigiUSB.available()) { 45 | char ch = DigiUSB.read(); 46 | switch(ch) { 47 | case 'A': 48 | CurrentServo='A'; 49 | digitalWrite(LED_PIN,LOW); 50 | break; 51 | case 'B': 52 | CurrentServo='B'; 53 | digitalWrite(LED_PIN,HIGH); 54 | break; 55 | case '0' ... '9': 56 | value=(ch-'0')*20; 57 | if (CurrentServo=='A') 58 | { 59 | ServoA.write(value); 60 | } 61 | else if (CurrentServo=='B') 62 | { 63 | ServoB.write(value); 64 | } 65 | break; 66 | } 67 | } 68 | DigiUSB.refresh(); 69 | SoftRcPulseOut::refresh(); 70 | /* 71 | Put here your non-blocking code 72 | */ 73 | } 74 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/examples/knob_moyennee/knob_moyennee.ino: -------------------------------------------------------------------------------- 1 | // Controlling a servo position using a potentiometer (variable resistor) 2 | // by Michal Rinott 3 | // Adapted to SoftRcPulseOut library by RC Navy (http://p.loussouarn.free.fr) 4 | // This sketch can work with ATtiny and Arduino UNO, MEGA, etc... 5 | 6 | #include 7 | 8 | SoftRcPulseOut myservo; // create servo object to control a servo 9 | 10 | #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 11 | //Here is the POT_PIN definition for ATtiny, they do NOT need a 'A' prefix for Analogic definition 12 | #define POT_PIN 2 // --analog pin-- (not digital) used to connect the potentiometer 13 | #else 14 | //Here is the POT_PIN definition for Arduino UNO, MEGA, they do need a 'A' prefix for Analogic definition 15 | #define POT_PIN A2 // --analog pin-- (not digital) used to connect the potentiometer 16 | #endif 17 | 18 | #define SERVO_PIN 3 // --digital pin-- (not analog) used to connect the servo 19 | 20 | #define REFRESH_PERIOD_MS 20 21 | 22 | 23 | #define MOY_SUR_1_VALEUR 0 24 | #define MOY_SUR_2_VALEURS 1 25 | #define MOY_SUR_4_VALEURS 2 26 | #define MOY_SUR_8_VALEURS 3 27 | #define MOY_SUR_16_VALEURS 4 28 | #define MOY_SUR_32_VALEURS 5 29 | 30 | #define TAUX_DE_MOYENNAGE MOY_SUR_4_VALEURS /* Choisir ici le taux de moyennage parmi les valeurs precedentes possibles listees ci-dessus */ 31 | /* Plus le taux est élevé, plus le système est stable (diminution de la gigue), mais moins il est réactif */ 32 | 33 | #define MOYENNE(Valeur_A_Moyenner,DerniereValeurRecue,TauxDeMoyEnPuissanceDeDeux) Valeur_A_Moyenner=((((Valeur_A_Moyenner)*((1<<(TauxDeMoyEnPuissanceDeDeux))-1)+(DerniereValeurRecue))/(1<<(TauxDeMoyEnPuissanceDeDeux)))+(TauxDeMoyEnPuissanceDeDeux-1)) 34 | 35 | int val; // variable to read the value from the analog pin 36 | 37 | void setup() 38 | { 39 | 40 | myservo.attach(SERVO_PIN); // attaches the servo on pin defined by SERVO_PIN to the servo object 41 | } 42 | 43 | void loop() 44 | { 45 | static int ValMoyennee; 46 | val = analogRead(POT_PIN); // reads the value of the potentiometer (value between 0 and 1023) 47 | val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 48 | MOYENNE(ValMoyennee,val,TAUX_DE_MOYENNAGE);//If there is lots of noise: average with TAUX_DE_MOYENNAGE 49 | myservo.write(ValMoyennee); // sets the servo position according to the scaled value 50 | delay(REFRESH_PERIOD_MS); // waits for the servo to get there 51 | SoftRcPulseOut::refresh(); // generates the servo pulse 52 | } 53 | 54 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftRcPulseOut/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SoftRcPulseOut 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SoftRcPulseOut KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | attach KEYWORD2 15 | detach KEYWORD2 16 | write KEYWORD2 17 | write_us KEYWORD2 18 | read KEYWORD2 19 | read_us KEYWORD2 20 | attached KEYWORD2 21 | setMinimumPulse KEYWORD2 22 | setMaximumPulse KEYWORD2 23 | refresh KEYWORD2 24 | 25 | ####################################### 26 | # Constants (LITERAL1) 27 | ####################################### 28 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftSerial/examples/Digi_1io_SerialDbg/Digi_1io_SerialDbg.ino: -------------------------------------------------------------------------------- 1 | /* 2 | _____ ____ __ _ ____ _ _ _ _ 3 | | __ \ / __ \ | \ | | / __ \ | | | | | | | | 4 | | |__| | | / \_| | . \ | | / / \ \ | | | | \ \ / / 5 | | _ / | | _ | |\ \| | | |__| | | | | | \ ' / 6 | | | \ \ | \__/ | | | \ ' | | __ | \ \/ / | | 7 | |_| |_| \____/ |_| \__| |_| |_| \__/ |_| 2013 8 | 9 | http://p.loussouarn.free.fr 10 | 11 | **************************************** 12 | * Digispark Debug Demo with 1 I/O * 13 | **************************************** 14 | 15 | This sketch demonstrates how to debug a Digispark using a bi-directional serial port using a single I/O. 16 | This approach allows to use the built-in Serial Console of the arduino IDE. 17 | Please, note this solution requires a native RS232 port (rare today) or a RS232/USB adapter on the development PC. 18 | 19 | Hardware Wiring: 20 | =============== 21 | SERIAL SINGLE I/O 22 | DEBUGGING CABLE 23 | ___________________/\__________________ 24 | / \ 25 | ____ 26 | .--------. | \ 27 | | GND |--------------------------------+---o5 \ 28 | | | 47K | | 9o | 29 | | | .--###--' | o4 | 30 | | DEBUG | 4.7K | | 8o | 31 | | TX_RX |-------------------###--+--|<|------o3 | ---> To regular RS232 SubD 9 pins Male of PC 32 | | PIN | ^ | 1N4148 | 7o | or to RS232/USB adapter 33 | | | | '-----------o2 | 34 | '--------' | | 6o | 35 | ATtiny85 Single | o1 / 36 | (Digispark) I/O |____/ 37 | SubD 9 pins 38 | Female 39 | */ 40 | #include 41 | #include 42 | 43 | #define DEBUG_TX_RX_PIN 2 //Adjust here your Tx/Rx debug pin 44 | 45 | SoftSerial MyDbgSerial(DEBUG_TX_RX_PIN, DEBUG_TX_RX_PIN, true); //true allows to connect to a regular RS232 without RS232 line driver 46 | 47 | void setup() 48 | { 49 | MyDbgSerial.begin(38400); //After MyDbgSerial.begin(), the serial port is in rxMode by default 50 | MyDbgSerial.txMode(); //Before sending a message, switch to txMode 51 | MyDbgSerial.println(F("\nDebug enabled")); 52 | MyDbgSerial.rxMode(); //switch to rxMode to be ready to receive some commands 53 | } 54 | 55 | void loop() 56 | { 57 | if(MyDbgSerial.available()) 58 | { 59 | MyDbgSerial.txMode(); 60 | MyDbgSerial.print(F("\nReceived: "));MyDbgSerial.write(MyDbgSerial.read());MyDbgSerial.print(F("\n")); 61 | MyDbgSerial.rxMode(); 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftSerial/examples/SoftSerialExample/SoftSerialExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multiple serial test 3 | 4 | Receives from the hardware serial, sends to software serial. 5 | Receives from software serial, sends to hardware serial. 6 | 7 | The circuit: 8 | * RX is digital pin 2 (connect to TX of other device) 9 | * TX is digital pin 3 (connect to RX of other device) 10 | 11 | created back in the mists of time 12 | modified 9 Apr 2012 13 | by Tom Igoe 14 | based on Mikal Hart's example 15 | 16 | This example code is in the public domain. 17 | 18 | adapted from for library which allows sharing the Pin Change Interrupt Vector. 19 | Single difference with : add #include at the top of your sketch. 20 | RC Navy (2012): http://p.loussouarn.free.fr 21 | 22 | */ 23 | #include /* Allows Pin Change Interrupt Vector Sharing */ 24 | #include /* Ne pas oublier d'inclure la librairie qui est utilisee par la librairie */ 25 | 26 | SoftSerial mySerial(2, 3); // RX, TX 27 | 28 | void setup() 29 | { 30 | // Open serial communications and wait for port to open: 31 | Serial.begin(57600); 32 | while (!Serial) { 33 | ; // wait for serial port to connect. Needed for Leonardo only 34 | } 35 | 36 | 37 | Serial.println("Goodnight moon!"); 38 | 39 | // set the data rate for the SoftwareSerial port 40 | mySerial.begin(4800); 41 | mySerial.println("Hello, world?"); 42 | } 43 | 44 | void loop() // run over and over 45 | { 46 | if (mySerial.available()) 47 | Serial.write(mySerial.read()); 48 | if (Serial.available()) 49 | mySerial.write(Serial.read()); 50 | } 51 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftSerial/examples/TwoPortReceive/TwoPortReceive.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple serial test 3 | 4 | Receives from the two software serial ports, 5 | sends to the hardware serial port. 6 | 7 | In order to listen on a software port, you call port.listen(). 8 | When using two software serial ports, you have to switch ports 9 | by listen()ing on each one in turn. Pick a logical time to switch 10 | ports, like the end of an expected transmission, or when the 11 | buffer is empty. This example switches ports when there is nothing 12 | more to read from a port 13 | 14 | The circuit: 15 | Two devices which communicate serially are needed. 16 | * First serial device's TX attached to digital pin 2, RX to pin 3 17 | * Second serial device's TX attached to digital pin 4, RX to pin 5 18 | 19 | created 18 Apr. 2011 20 | modified 9 Apr 2012 21 | by Tom Igoe 22 | based on Mikal Hart's twoPortRXExample 23 | 24 | This example code is in the public domain. 25 | 26 | */ 27 | 28 | #include 29 | #include /* Ne pas oublier d'inclure la librairie qui est utilisee par la librairie */ 30 | 31 | // software serial #1: TX = digital pin 2, RX = digital pin 3 32 | SoftSerial portOne(2, 3); 33 | 34 | // software serial #2: TX = digital pin 4, RX = digital pin 5 35 | SoftSerial portTwo(4, 5); 36 | 37 | void setup() 38 | { 39 | // Open serial communications and wait for port to open: 40 | Serial.begin(9600); 41 | while (!Serial) { 42 | ; // wait for serial port to connect. Needed for Leonardo only 43 | } 44 | 45 | 46 | // Start each software serial port 47 | portOne.begin(9600); 48 | portTwo.begin(9600); 49 | } 50 | 51 | void loop() 52 | { 53 | // By default, the last intialized port is listening. 54 | // when you want to listen on a port, explicitly select it: 55 | portOne.listen(); 56 | Serial.println("Data from port one:"); 57 | // while there is data coming in, read it 58 | // and send to the hardware serial port: 59 | while (portOne.available() > 0) { 60 | char inByte = portOne.read(); 61 | Serial.write(inByte); 62 | } 63 | 64 | // blank line to separate data from the two ports: 65 | Serial.println(); 66 | 67 | // Now listen on the second port 68 | portTwo.listen(); 69 | // while there is data coming in, read it 70 | // and send to the hardware serial port: 71 | Serial.println("Data from port two:"); 72 | while (portTwo.available() > 0) { 73 | char inByte = portTwo.read(); 74 | Serial.write(inByte); 75 | } 76 | 77 | // blank line to separate data from the two ports: 78 | Serial.println(); 79 | } 80 | 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /libraries/DigisparkSoftSerial/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map for SoftSerial 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SoftSerial KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | end KEYWORD2 17 | read KEYWORD2 18 | available KEYWORD2 19 | isListening KEYWORD2 20 | overflow KEYWORD2 21 | flush KEYWORD2 22 | listen KEYWORD2 23 | txMode KEYWORD2 24 | rxMode KEYWORD2 25 | 26 | ####################################### 27 | # Constants (LITERAL1) 28 | ####################################### 29 | 30 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyPinChange/TinyPinChange.h: -------------------------------------------------------------------------------- 1 | #ifndef TINY_PIN_CHANGE_H 2 | #define TINY_PIN_CHANGE_H 1 3 | 4 | /* 5 | * , a library for Pin Change Interrupt by RC Navy (2012) 6 | * Supported device ATmega238P (UNO), ATtiny84, ATtiny85 7 | * 8 | * http://p.loussouarn.free.fr 9 | */ 10 | 11 | #if defined(ARDUINO) && ARDUINO >= 100 12 | #include "Arduino.h" 13 | #else 14 | #include "WProgram.h" 15 | #endif 16 | 17 | #include 18 | 19 | #if defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) 20 | /* ATtinyX5 */ 21 | #define PIN_CHG_PORT_NB 1 22 | #define DigitalPinToPortIdx(p) 0 23 | #define PC_PIN0 PINB 24 | #define PC_PCMSK0 PCMSK 25 | #else 26 | #if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) 27 | /* ATtinyX4 */ 28 | #define PIN_CHG_PORT_NB 2 29 | #define DigitalPinToPortIdx(p) (((p) <= 7) ? (0) : (((p) <= 10) ? (1) : (0))) 30 | #define PC_PIN0 PINA 31 | #define PC_PCMSK0 PCMSK0 32 | #define PC_PIN1 PINB 33 | #define PC_PCMSK1 PCMSK1 34 | #else 35 | /* UNO */ 36 | #define PIN_CHG_PORT_NB 3 37 | #define DigitalPinToPortIdx(p) (((p) <= 7) ? (2) : (((p) <= 13) ? (0) : (((p) <= 21) ? (1) : (0)))) 38 | #define PC_PIN0 PINB 39 | #define PC_PCMSK0 PCMSK0 40 | #define PC_PIN1 PINC 41 | #define PC_PCMSK1 PCMSK1 42 | #define PC_PIN2 PIND 43 | #define PC_PCMSK2 PCMSK2 44 | #endif 45 | #endif 46 | 47 | void TinyPinChange_Init(void); 48 | int8_t TinyPinChange_RegisterIsr(uint8_t Pin, void(*Isr)(void)); 49 | void TinyPinChange_EnablePin(uint8_t Pin); 50 | void TinyPinChange_DisablePin(uint8_t Pin); 51 | uint8_t TinyPinChange_GetPinEvent(uint8_t VirtualPortIdx); 52 | uint8_t TinyPinChange_GetPinCurSt(uint8_t VirtualPortIdx); 53 | #define TinyPinChange_PinToMsk(Pin) _BV(digitalPinToPCMSKbit(Pin)) 54 | 55 | /*******************************************************/ 56 | /* Application Programming Interface (API) en Francais */ 57 | /*******************************************************/ 58 | 59 | /* Methodes en Francais English native methods */ 60 | #define TinyPinChange_EnregistreFonctionInterruption TinyPinChange_RegisterIsr 61 | #define TinyPinChange_ActiveBroche TinyPinChange_EnablePin 62 | #define TinyPinChange_DesactiveBroche TinyPinChange_DisablePin 63 | #define TinyPinChange_RetourneEvenemenPort TinyPinChange_GetPinEvent 64 | #define TinyPinChange_RetourneEtatCourantPort TinyPinChange_GetPinCurSt 65 | #define TinyPinChange_MasqueDeBroche TinyPinChange_PinToMsk 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyPinChange/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map TinyPinChange 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | TinyPinChange KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | TinyPinChange_Init KEYWORD2 14 | TinyPinChange_RegisterIsr KEYWORD2 15 | TinyPinChange_EnregistreFonctionInterruption KEYWORD2 16 | TinyPinChange_EnablePin KEYWORD2 17 | TinyPinChange_ActiveBroche KEYWORD2 18 | TinyPinChange_DisablePin KEYWORD2 19 | TinyPinChange_DesactiveBroche KEYWORD2 20 | TinyPinChange_GetPinEvent KEYWORD2 21 | TinyPinChange_RetourneEvenemenPort KEYWORD2 22 | TinyPinChange_GetPinCurSt KEYWORD2 23 | TinyPinChange_RetourneEtatCourantPort KEYWORD2 24 | TinyPinChange_PinToMsk KEYWORD2 25 | TinyPinChange_MasqueDeBroche KEYWORD2 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/README.md: -------------------------------------------------------------------------------- 1 | TinyRTClib 2 | ========== 3 | 4 | DS1307's Arduino Adafruit library modified to run on Digispark's attiny85. 5 | 6 | I've searched everywhere for a DS1307 library that could work on my Digispark but found none. 7 | 8 | This is the Adafruit version (https://github.com/adafruit/RTClib) with their examples modified to work on Digispark's attiny85. 9 | 10 | **I'm unable to push the files into the right folders by now. That's why I've them renamed to the folders name and slashs... 11 | **Will try to add to the right place later. 12 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/TinyRTClib.h: -------------------------------------------------------------------------------- 1 | // Code by JeeLabs http://news.jeelabs.org/code/ 2 | // Released to the public domain! Enjoy! 3 | 4 | // --Refactored by nGoline http://arduino.ngoline.com 5 | // --to fit Digispark and the attiny85 6 | 7 | // Simple general-purpose date/time class (no TZ / DST / leap second handling!) 8 | class DateTime { 9 | public: 10 | DateTime (uint32_t t =0); 11 | DateTime (uint16_t year, uint8_t month, uint8_t day, 12 | uint8_t hour =0, uint8_t min =0, uint8_t sec =0); 13 | DateTime (const char* date, const char* time); 14 | uint16_t year() const { return 2000 + yOff; } 15 | uint8_t month() const { return m; } 16 | uint8_t day() const { return d; } 17 | uint8_t hour() const { return hh; } 18 | uint8_t minute() const { return mm; } 19 | uint8_t second() const { return ss; } 20 | uint8_t dayOfWeek() const; 21 | 22 | // 32-bit times as seconds since 1/1/2000 23 | long secondstime() const; 24 | // 32-bit times as seconds since 1/1/1970 25 | uint32_t unixtime(void) const; 26 | 27 | protected: 28 | uint8_t yOff, m, d, hh, mm, ss; 29 | }; 30 | 31 | // RTC based on the DS1307 chip connected via I2C and the Wire library 32 | // -- Now using the TinyWireM library 33 | class RTC_DS1307 { 34 | public: 35 | static uint8_t begin(void); 36 | static void adjust(const DateTime& dt); 37 | uint8_t isrunning(void); 38 | static DateTime now(); 39 | }; 40 | 41 | // RTC using the internal millis() clock, has to be initialized before use 42 | // NOTE: this clock won't be correct once the millis() timer rolls over (>49d?) 43 | class RTC_Millis { 44 | public: 45 | static void begin(const DateTime& dt) { adjust(dt); } 46 | static void adjust(const DateTime& dt); 47 | static DateTime now(); 48 | 49 | protected: 50 | static long offset; 51 | }; 52 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/examples/datecalc/datecalc.pde: -------------------------------------------------------------------------------- 1 | // Simple date conversions and calculations 2 | 3 | #include 4 | #include "TinyRTClib.h" 5 | 6 | void showDate(const char* txt, const DateTime& dt) { 7 | Serial.print(txt); 8 | Serial.print(' '); 9 | Serial.print(dt.year(), DEC); 10 | Serial.print('/'); 11 | Serial.print(dt.month(), DEC); 12 | Serial.print('/'); 13 | Serial.print(dt.day(), DEC); 14 | Serial.print(' '); 15 | Serial.print(dt.hour(), DEC); 16 | Serial.print(':'); 17 | Serial.print(dt.minute(), DEC); 18 | Serial.print(':'); 19 | Serial.print(dt.second(), DEC); 20 | 21 | Serial.print(" = "); 22 | Serial.print(dt.unixtime()); 23 | Serial.print("s / "); 24 | Serial.print(dt.unixtime() / 86400L); 25 | Serial.print("d since 1970"); 26 | 27 | Serial.println(); 28 | } 29 | 30 | void setup () { 31 | Serial.begin(115200); 32 | 33 | DateTime dt0 (0, 1, 1, 0, 0, 0); 34 | showDate("dt0", dt0); 35 | 36 | DateTime dt1 (1, 1, 1, 0, 0, 0); 37 | showDate("dt1", dt1); 38 | 39 | DateTime dt2 (2009, 1, 1, 0, 0, 0); 40 | showDate("dt2", dt2); 41 | 42 | DateTime dt3 (2009, 1, 2, 0, 0, 0); 43 | showDate("dt3", dt3); 44 | 45 | DateTime dt4 (2009, 1, 27, 0, 0, 0); 46 | showDate("dt4", dt4); 47 | 48 | DateTime dt5 (2009, 2, 27, 0, 0, 0); 49 | showDate("dt5", dt5); 50 | 51 | DateTime dt6 (2009, 12, 27, 0, 0, 0); 52 | showDate("dt6", dt6); 53 | 54 | DateTime dt7 (dt6.unixtime() + 3600); // one hour later 55 | showDate("dt7", dt7); 56 | 57 | DateTime dt8 (dt6.unixtime() + 86400L); // one day later 58 | showDate("dt8", dt8); 59 | 60 | DateTime dt9 (dt6.unixtime() + 7 * 86400L); // one week later 61 | showDate("dt9", dt9); 62 | } 63 | 64 | void loop () { 65 | } 66 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/examples/ds1307/ds1307.pde: -------------------------------------------------------------------------------- 1 | // Date and time functions using a DS1307 RTC connected via I2C and Wire lib 2 | 3 | #include 4 | #include "TinyRTClib.h" 5 | 6 | RTC_DS1307 RTC; 7 | 8 | void setup () { 9 | Serial.begin(115200); 10 | TinyWireM.begin(); 11 | RTC.begin(); 12 | 13 | if (! RTC.isrunning()) { 14 | Serial.println("RTC is NOT running!"); 15 | // following line sets the RTC to the date & time this sketch was compiled 16 | RTC.adjust(DateTime(__DATE__, __TIME__)); 17 | } 18 | } 19 | 20 | void loop () { 21 | DateTime now = RTC.now(); 22 | 23 | Serial.print(now.year(), DEC); 24 | Serial.print('/'); 25 | Serial.print(now.month(), DEC); 26 | Serial.print('/'); 27 | Serial.print(now.day(), DEC); 28 | Serial.print(' '); 29 | Serial.print(now.hour(), DEC); 30 | Serial.print(':'); 31 | Serial.print(now.minute(), DEC); 32 | Serial.print(':'); 33 | Serial.print(now.second(), DEC); 34 | Serial.println(); 35 | 36 | Serial.print(" since midnight 1/1/1970 = "); 37 | Serial.print(now.unixtime()); 38 | Serial.print("s = "); 39 | Serial.print(now.unixtime() / 86400L); 40 | Serial.println("d"); 41 | 42 | // calculate a date which is 7 days and 30 seconds into the future 43 | DateTime future (now.unixtime() + 7 * 86400L + 30); 44 | 45 | Serial.print(" now + 7d + 30s: "); 46 | Serial.print(future.year(), DEC); 47 | Serial.print('/'); 48 | Serial.print(future.month(), DEC); 49 | Serial.print('/'); 50 | Serial.print(future.day(), DEC); 51 | Serial.print(' '); 52 | Serial.print(future.hour(), DEC); 53 | Serial.print(':'); 54 | Serial.print(future.minute(), DEC); 55 | Serial.print(':'); 56 | Serial.print(future.second(), DEC); 57 | Serial.println(); 58 | 59 | Serial.println(); 60 | delay(3000); 61 | } 62 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/examples/softrtc/softrtc.pde: -------------------------------------------------------------------------------- 1 | // Date and time functions using just software, based on millis() & timer 2 | 3 | #include 4 | #include "TinyRTClib.h" 5 | 6 | RTC_Millis RTC; 7 | 8 | void setup () { 9 | Serial.begin(115200); 10 | // following line sets the RTC to the date & time this sketch was compiled 11 | RTC.begin(DateTime(__DATE__, __TIME__)); 12 | } 13 | 14 | void loop () { 15 | DateTime now = RTC.now(); 16 | 17 | Serial.print(now.year(), DEC); 18 | Serial.print('/'); 19 | Serial.print(now.month(), DEC); 20 | Serial.print('/'); 21 | Serial.print(now.day(), DEC); 22 | Serial.print(' '); 23 | Serial.print(now.hour(), DEC); 24 | Serial.print(':'); 25 | Serial.print(now.minute(), DEC); 26 | Serial.print(':'); 27 | Serial.print(now.second(), DEC); 28 | Serial.println(); 29 | 30 | Serial.print(" seconds since 1970: "); 31 | Serial.println(now.unixtime()); 32 | 33 | // calculate a date which is 7 days and 30 seconds into the future 34 | DateTime future (now.unixtime() + 7 * 86400L + 30); 35 | 36 | Serial.print(" now + 7d + 30s: "); 37 | Serial.print(future.year(), DEC); 38 | Serial.print('/'); 39 | Serial.print(future.month(), DEC); 40 | Serial.print('/'); 41 | Serial.print(future.day(), DEC); 42 | Serial.print(' '); 43 | Serial.print(future.hour(), DEC); 44 | Serial.print(':'); 45 | Serial.print(future.minute(), DEC); 46 | Serial.print(':'); 47 | Serial.print(future.second(), DEC); 48 | Serial.println(); 49 | 50 | Serial.println(); 51 | delay(3000); 52 | } 53 | -------------------------------------------------------------------------------- /libraries/DigisparkTinyRTClib/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | DateTime KEYWORD1 10 | RTC_DS1307 KEYWORD1 11 | RTC_Millis KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | year KEYWORD2 18 | month KEYWORD2 19 | day KEYWORD2 20 | hour KEYWORD2 21 | minute KEYWORD2 22 | second KEYWORD2 23 | dayOfWeek KEYWORD2 24 | secondstime KEYWORD2 25 | unixtime KEYWORD2 26 | begin KEYWORD2 27 | adjust KEYWORD2 28 | isrunning KEYWORD2 29 | now KEYWORD2 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### 34 | 35 | -------------------------------------------------------------------------------- /libraries/DigisparkTinySoftPwm/TinySoftPwm.h: -------------------------------------------------------------------------------- 1 | #ifndef TinySoftPwm_h 2 | #define TinySoftPwm_h 3 | 4 | // a Tiny optimized Software PWM Manager (all pins must be part of the same port) 5 | // Only resources RAM/Program Memory of used pins are declared in the code at compilation time. 6 | // based largely on Atmel's AVR136: Low-Jitter Multi-Channel Software PWM Application Note: 7 | // http://www.atmel.com/dyn/resources/prod_documents/doc8020.pdf 8 | // RC Navy 2013 9 | // http://p.loussouarn.free.fr 10 | 11 | #if defined(ARDUINO) && ARDUINO >= 100 12 | #include "Arduino.h" 13 | #else 14 | #include "WProgram.h" 15 | #endif 16 | 17 | #include 18 | 19 | /*************************************************/ 20 | /* Define here the PIN to use with Tiny Soft PWM */ 21 | /* Unused Pin(s) SHALL be commented */ 22 | /*************************************************/ 23 | //#define TINY_SOFT_PWM_USES_P0 24 | #define TINY_SOFT_PWM_USES_P1 25 | #define TINY_SOFT_PWM_USES_P2 26 | //#define TINY_SOFT_PWM_USES_P3 /* /!\ used for USB on DigiSpark: do not use it for PWM if DigiUSB is also used /!\ */ 27 | //#define TINY_SOFT_PWM_USES_P4 /* /!\ used for USB on DigiSpark: do not use it for PWM if DigiUSB is also used /!\ */ 28 | #define TINY_SOFT_PWM_USES_P5 29 | 30 | 31 | 32 | 33 | 34 | /*******************************************************************/ 35 | /* Do NOT modify below: it's used to optimize RAM and Program size */ 36 | /*******************************************************************/ 37 | #ifdef TINY_SOFT_PWM_USES_P0 38 | #undef TINY_SOFT_PWM_USES_P0 39 | #define TINY_SOFT_PWM_USES_P0 1 40 | #else 41 | #define TINY_SOFT_PWM_USES_P0 0 42 | #endif 43 | 44 | #ifdef TINY_SOFT_PWM_USES_P1 45 | #undef TINY_SOFT_PWM_USES_P1 46 | #define TINY_SOFT_PWM_USES_P1 1 47 | #else 48 | #define TINY_SOFT_PWM_USES_P1 0 49 | #endif 50 | 51 | #ifdef TINY_SOFT_PWM_USES_P2 52 | #undef TINY_SOFT_PWM_USES_P2 53 | #define TINY_SOFT_PWM_USES_P2 1 54 | #else 55 | #define TINY_SOFT_PWM_USES_P2 0 56 | #endif 57 | 58 | #ifdef TINY_SOFT_PWM_USES_P3 59 | #undef TINY_SOFT_PWM_USES_P3 60 | #define TINY_SOFT_PWM_USES_P3 1 61 | #else 62 | #define TINY_SOFT_PWM_USES_P3 0 63 | #endif 64 | 65 | #ifdef TINY_SOFT_PWM_USES_P4 66 | #undef TINY_SOFT_PWM_USES_P4 67 | #define TINY_SOFT_PWM_USES_P4 1 68 | #else 69 | #define TINY_SOFT_PWM_USES_P4 0 70 | #endif 71 | 72 | #ifdef TINY_SOFT_PWM_USES_P5 73 | #undef TINY_SOFT_PWM_USES_P5 74 | #define TINY_SOFT_PWM_USES_P5 1 75 | #else 76 | #define TINY_SOFT_PWM_USES_P5 0 77 | #endif 78 | 79 | #define TINY_SOFT_PWM_CH_MAX (TINY_SOFT_PWM_USES_P0 + TINY_SOFT_PWM_USES_P1 + TINY_SOFT_PWM_USES_P2 + TINY_SOFT_PWM_USES_P3 + TINY_SOFT_PWM_USES_P4 + TINY_SOFT_PWM_USES_P5) 80 | 81 | 82 | void TinySoftPwm_begin(uint8_t TickMax, uint8_t PwmInit); 83 | void TinySoftPwm_analogWrite(uint8_t PinIdx, uint8_t Pwm); 84 | void TinySoftPwm_process(void); 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /libraries/DigisparkTinySoftPwm/examples/TinySoftPwmDemo/TinySoftPwmDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | _____ ____ __ _ ____ _ _ _ _ 5 | | __ \ / __ \ | \ | | / __ \ | | | | | | | | 6 | | |__| | | / \_| | . \ | | / / \ \ | | | | \ \ / / 7 | | _ / | | _ | |\ \| | | |__| | | | | | \ ' / 8 | | | \ \ | \__/ | | | \ ' | | __ | \ \/ / | | 9 | |_| \_\ \____/ |_| \__| |_| |_| \__/ |_| 2013 10 | 11 | http://p.loussouarn.free.fr 12 | 13 | **************************************** 14 | * library Demo * 15 | **************************************** 16 | 17 | This sketch increases the luminosity of the built-in LED of the Digispark. 18 | When the luminosity reaches its maximum, the luminosity decreases. 19 | When the luminosity reaches its minimum, the luminosity increases, and so on... 20 | 21 | Note: 22 | ==== 23 | Declare the Pin(s) used in "librarie/TinySoftPwm/TinySoftPwm.h" 24 | In this sketch, #define TINY_SOFT_PWM_USES_P1 must be enabled (not commented) since it uses the DigiSpark built-in LED wired on P1. 25 | 26 | In this basic example, TinySoftPwm_process() is called periodically using micros(), but it is recommanded to call it from a timer ISR 27 | to ensure a better periodicity. 28 | 29 | */ 30 | 31 | #define BUILT_IN_LED_PIN 1 /* Digispark Model A (Rev2) built-in LED pin number (Change it to 2 for Model B) */ 32 | 33 | void setup() 34 | { 35 | TinySoftPwm_begin(128, 0); /* 128 x TinySoftPwm_process() calls before overlap (Frequency tuning), 0 = PWM init for all declared pins */ 36 | } 37 | 38 | void loop() 39 | { 40 | static uint32_t StartUs=micros(); 41 | static uint32_t StartMs=millis(); 42 | static uint8_t Pwm=0; 43 | static int8_t Dir=1; 44 | 45 | /***********************************************************/ 46 | /* Call TinySoftPwm_process() with a period of 60 us */ 47 | /* The PWM frequency = 128 x 60 # 7.7 ms -> F # 130Hz */ 48 | /* 128 is the first argument passed to TinySoftPwm_begin() */ 49 | /***********************************************************/ 50 | if((micros() - StartUs) >= 60) 51 | { 52 | /* We arrived here every 60 microseconds */ 53 | StartUs=micros(); 54 | TinySoftPwm_process(); /* This function shall be called periodically (like here, based on micros(), or in a timer ISR) */ 55 | } 56 | 57 | /*************************************************************/ 58 | /* Increment/decrement PWM on LED Pin with a period of 10 ms */ 59 | /*************************************************************/ 60 | if((millis()-StartMs) >= 10) 61 | { 62 | /* We arrived here every 10 milliseconds */ 63 | StartMs=millis(); 64 | Pwm+=Dir; /* increment or decrement PWM depending of sign of Dir */ 65 | TinySoftPwm_analogWrite(BUILT_IN_LED_PIN, Pwm); /* Update built-in LED for Digispark */ 66 | if(Pwm==255) Dir=-1; /* if PWM reaches the maximum: change direction */ 67 | if(Pwm==0) Dir=+1; /* if PWM reaches the minimum: change direction */ 68 | } 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /libraries/DigisparkTinySoftPwm/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map TinySoftPwm 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | TinySoftPwm KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | TinySoftPwm_begin KEYWORD2 14 | TinySoftPwm_analogWrite KEYWORD2 15 | TinySoftPwm_process KEYWORD2 16 | 17 | ####################################### 18 | # Constants (LITERAL1) 19 | ####################################### 20 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/ArduinoNotes.txt: -------------------------------------------------------------------------------- 1 | Notes On Integrating AVRUSB with Arduino 2 | ======================================== 3 | 4 | * Note the license(s) under which AVRUSB is distributed. 5 | 6 | * See also: http://code.rancidbacon.com/ProjectLogArduinoUSB 7 | 8 | * Note: The pins we use on the PCB (not protoboard) hardware shield are: 9 | 10 | INT0 == PD2 == IC Pin 4 == Arduino Digital Pin 2 == D+ 11 | 12 | ---- == PD4 == -------- == Arduino Digital Pin 4 == D- 13 | 14 | ---- == PD5 == -------- == Arduino Digital Pin 5 == pull-up 15 | 16 | (DONE: Change to not use PD3 so INT1 is left free?) 17 | 18 | * In order to compile a valid 'usbconfig.h' file must exit. The content of this 19 | file will vary depending on whether the device is a generic USB device, 20 | generic HID device or specific class of HID device for example. 21 | 22 | The file 'usbconfig-prototype.h' can be used as a starting point, however 23 | it might be easier to use the 'usbconfig.h' from one of the example projects. 24 | 25 | TODO: Specify the settings that need to be changed to match the shield 26 | design we use. 27 | 28 | * (NOTE: Initial 'usbconfig.h' used will be based on the file from 29 | 'HIDKeys.2007-03-29'.) (Note: Have now upgraded to V-USB 2009-08-22.) 30 | 31 | * At present the IDE won't compile our library so it needs to be pre-compiled 32 | with: 33 | 34 | avr-g++ -Wall -Os -I. -DF_CPU=16000000 -mmcu=atmega168 -c usbdrvasm.S -c usbdrv.c 35 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/DigiUSB.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Based on Obdev's AVRUSB code and under the same license. 3 | * 4 | * TODO: Make a proper file header. :-) 5 | */ 6 | #ifndef __DigiUSB_h__ 7 | #define __DigiUSB_h__ 8 | 9 | #include 10 | #include 11 | #include 12 | #include "usbdrv.h" 13 | #include "Print.h" 14 | 15 | 16 | typedef uint8_t byte; 17 | 18 | #include /* for _delay_ms() */ 19 | 20 | #define RING_BUFFER_SIZE 128 21 | 22 | 23 | struct ring_buffer { 24 | unsigned char buffer[RING_BUFFER_SIZE]; 25 | int head; 26 | int tail; 27 | }; 28 | 29 | 30 | 31 | 32 | 33 | class DigiUSBDevice : public Print { 34 | private: 35 | ring_buffer *_rx_buffer; 36 | ring_buffer *_tx_buffer; 37 | 38 | public: 39 | DigiUSBDevice (ring_buffer *rx_buffer, ring_buffer *tx_buffer); 40 | 41 | void begin(); 42 | 43 | // TODO: Deprecate update 44 | void update(); 45 | 46 | void refresh(); 47 | void delay(long milliseconds); 48 | 49 | int available(); 50 | int tx_remaining(); 51 | 52 | int read(); 53 | virtual size_t write(byte c); 54 | using Print::write; 55 | 56 | }; 57 | 58 | extern DigiUSBDevice DigiUSB; 59 | 60 | #endif // __DigiUSB_h__ 61 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/DigisparkReadme.txt: -------------------------------------------------------------------------------- 1 | Modified for use with an Attiny85 running at 16.5Mhz by Digistump for the Digispark MCU -------------------------------------------------------------------------------- /libraries/DigisparkUSB/examples/DigiBlink/DigiBlink.ino: -------------------------------------------------------------------------------- 1 | #define USB_CFG_DEVICE_NAME 'D','i','g','i','B','l','i','n','k' 2 | #define USB_CFG_DEVICE_NAME_LEN 9 3 | #include 4 | byte in = 0; 5 | int Blue = 0; 6 | int Red = 0; 7 | int Green = 0; 8 | 9 | int next = 0; 10 | 11 | void setup() { 12 | DigiUSB.begin(); 13 | pinMode(0,OUTPUT); 14 | pinMode(1,OUTPUT); 15 | pinMode(2,OUTPUT); 16 | } 17 | 18 | 19 | void loop() { 20 | setBlue(); 21 | DigiUSB.refresh(); 22 | setBlue(); 23 | if (DigiUSB.available() > 0) { 24 | in = 0; 25 | 26 | in = DigiUSB.read(); 27 | if (next == 0){ 28 | if(in == 115){ 29 | next = 1; 30 | DigiUSB.println("Start"); 31 | } 32 | } 33 | else if (next == 1){ 34 | Red = in; 35 | DigiUSB.print("Red "); 36 | DigiUSB.println(in,DEC); 37 | next = 2; 38 | } 39 | else if (next == 2){ 40 | Green = in; 41 | DigiUSB.print("Green "); 42 | DigiUSB.println(in,DEC); 43 | next = 3; 44 | } 45 | else if (next == 3){ 46 | Blue = in; 47 | DigiUSB.print("Blue "); 48 | DigiUSB.println(in,DEC); 49 | next = 0; 50 | } 51 | 52 | 53 | 54 | 55 | } 56 | 57 | 58 | analogWrite(0,Red); 59 | analogWrite(1,Green); 60 | setBlue(); 61 | 62 | 63 | 64 | } 65 | 66 | void setBlue(){ 67 | if(Blue == 0){ 68 | digitalWrite(2,LOW); 69 | return; 70 | } 71 | else if(Blue == 255){ 72 | digitalWrite(2,HIGH); 73 | return; 74 | } 75 | // On period 76 | for (int x=0;x 2 | 3 | void setup() { 4 | DigiUSB.begin(); 5 | } 6 | 7 | void get_input() { 8 | // when there are no characters to read 9 | while (1==1) { 10 | if(DigiUSB.available()){ 11 | //something to read 12 | DigiUSB.read(); 13 | break; 14 | } 15 | // refresh the usb port 16 | DigiUSB.refresh(); 17 | delay(10); 18 | 19 | } 20 | 21 | } 22 | 23 | 24 | void loop() { 25 | DigiUSB.refresh(); 26 | //print output 27 | float value = analogRead(1); //This is Pin3 28 | if(value>1020) 29 | value = 255; 30 | else if(value<2) 31 | value = 0; 32 | else 33 | value = value/4; 34 | //send value 35 | 36 | value = round(byte(value)); 37 | DigiUSB.write(value); 38 | 39 | //wait for response 40 | get_input(); 41 | 42 | } -------------------------------------------------------------------------------- /libraries/DigisparkUSB/examples/DigiUSB2LCD/DigiUSB2LCD.ino: -------------------------------------------------------------------------------- 1 | /* USB LCD */ 2 | 3 | //#define DEBUG 4 | #include // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos 5 | #include // for LCD w/ GPIO MODIFIED for the ATtiny85 6 | #include 7 | 8 | #define GPIO_ADDR 0x27 // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules. 9 | int currentLine = 0; 10 | boolean clearOnNext = 0; 11 | boolean backlight = 1; 12 | 13 | LiquidCrystal_I2C lcd(GPIO_ADDR,16,2); // set address & 16 chars / 2 lines 14 | 15 | 16 | void setup(){ 17 | DigiUSB.begin(); 18 | TinyWireM.begin(); // initialize I2C lib - comment this out to use with standard arduinos 19 | lcd.init(); // initialize the lcd 20 | lcd.backlight(); // Print a message to the LCD. 21 | lcd.setCursor(0, currentLine); 22 | } 23 | 24 | 25 | void get_input() { 26 | 27 | int lastRead; 28 | // when there are no characters to read, or the character isn't a newline 29 | while (1==1) { 30 | if(DigiUSB.available()){ 31 | //something to read 32 | lastRead = DigiUSB.read(); 33 | if(lastRead == '\n'){ 34 | 35 | 36 | if(currentLine > 0) 37 | currentLine = 0; 38 | else 39 | currentLine = 1; 40 | 41 | clearOnNext = 1; 42 | 43 | lcd.setCursor(0, currentLine); 44 | 45 | } 46 | else if(lastRead == 172){ //not sign "¬" send it with the send program to toggle the backlight 47 | if(backlight){ 48 | lcd.noBacklight(); 49 | backlight = 0; 50 | } 51 | else{ 52 | lcd.backlight(); 53 | backlight = 1; 54 | } 55 | DigiUSB.read(); //read to nothing to get rid of newline that should come after it 56 | 57 | } 58 | else{ 59 | if(clearOnNext){ 60 | lcd.print(" "); //clear a single line 61 | lcd.setCursor(0, currentLine); 62 | clearOnNext=0; 63 | } 64 | lcd.print(char(lastRead)); 65 | } 66 | 67 | 68 | 69 | } 70 | // refresh the usb port 71 | DigiUSB.refresh(); 72 | delay(10); 73 | 74 | } 75 | 76 | } 77 | 78 | 79 | void loop(){ 80 | get_input(); 81 | } -------------------------------------------------------------------------------- /libraries/DigisparkUSB/examples/Echo/Echo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | DigiUSB.begin(); 5 | } 6 | 7 | void get_input() { 8 | int lastRead; 9 | // when there are no characters to read, or the character isn't a newline 10 | while (true) { // loop forever 11 | if (DigiUSB.available()) { 12 | // something to read 13 | lastRead = DigiUSB.read(); 14 | DigiUSB.write(lastRead); 15 | 16 | if (lastRead == '\n') { 17 | break; // when we get a newline, break out of loop 18 | } 19 | } 20 | 21 | // refresh the usb port for 10 milliseconds 22 | DigiUSB.delay(10); 23 | } 24 | } 25 | 26 | void loop() { 27 | // print output 28 | DigiUSB.println("Waiting for input..."); 29 | // get input 30 | get_input(); 31 | } -------------------------------------------------------------------------------- /libraries/DigisparkUSB/keywords.txt: -------------------------------------------------------------------------------- 1 | DigiUSB KEYWORD1 2 | refresh KEYWORD2 -------------------------------------------------------------------------------- /libraries/DigisparkUSB/libs-device/Readme.txt: -------------------------------------------------------------------------------- 1 | This is the Readme file for the libs-device directory. This directory contains 2 | code snippets which may be useful for USB device firmware. 3 | 4 | 5 | WHAT IS INCLUDED IN THIS DIRECTORY? 6 | =================================== 7 | 8 | osccal.c and osccal.h 9 | This module contains a function which calibrates the AVR's built-in RC 10 | oscillator based on the USB frame clock. See osccal.h for a documentation 11 | of the API. 12 | 13 | osctune.h 14 | This header file contains a code snippet for usbconfig.h. With this code, 15 | you can keep the AVR's internal RC oscillator in sync with the USB frame 16 | clock. This is a continuous synchronization, not a single calibration at 17 | USB reset as with osccal.c above. Please note that this code works only 18 | if D- is wired to the interrupt, not D+. 19 | 20 | ---------------------------------------------------------------------------- 21 | (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH. 22 | http://www.obdev.at/ 23 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/libs-device/osccal.c: -------------------------------------------------------------------------------- 1 | /* Name: osccal.c 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.c 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | #include 11 | 12 | #ifndef uchar 13 | #define uchar unsigned char 14 | #endif 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | /* ------------------------ Oscillator Calibration ------------------------- */ 18 | /* ------------------------------------------------------------------------- */ 19 | 20 | /* Calibrate the RC oscillator. Our timing reference is the Start Of Frame 21 | * signal (a single SE0 bit) repeating every millisecond immediately after 22 | * a USB RESET. We first do a binary search for the OSCCAL value and then 23 | * optimize this value with a neighboorhod search. 24 | */ 25 | void calibrateOscillator(void) 26 | { 27 | uchar step = 128; 28 | uchar trialValue = 0, optimumValue; 29 | int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 30 | 31 | /* do a binary search: */ 32 | do{ 33 | OSCCAL = trialValue + step; 34 | x = usbMeasureFrameLength(); /* proportional to current real frequency */ 35 | if(x < targetValue) /* frequency still too low */ 36 | trialValue += step; 37 | step >>= 1; 38 | }while(step > 0); 39 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 40 | /* now do a neighborhood search for optimum value */ 41 | optimumValue = trialValue; 42 | optimumDev = x; /* this is certainly far away from optimum */ 43 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ 44 | x = usbMeasureFrameLength() - targetValue; 45 | if(x < 0) 46 | x = -x; 47 | if(x < optimumDev){ 48 | optimumDev = x; 49 | optimumValue = OSCCAL; 50 | } 51 | } 52 | OSCCAL = optimumValue; 53 | } 54 | /* 55 | Note: This calibration algorithm may try OSCCAL values of up to 192 even if 56 | the optimum value is far below 192. It may therefore exceed the allowed clock 57 | frequency of the CPU in low voltage designs! 58 | You may replace this search algorithm with any other algorithm you like if 59 | you have additional constraints such as a maximum CPU clock. 60 | For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. 61 | ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in 62 | both regions. 63 | */ 64 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/libs-device/osccal.h: -------------------------------------------------------------------------------- 1 | /* Name: osccal.h 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.h 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | /* 11 | General Description: 12 | This module contains a function which calibrates the AVR's internal RC 13 | oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be 14 | defined when the module is compiled, best passed in the compiler command 15 | line). The time reference is the USB frame clock of 1 kHz available 16 | immediately after a USB RESET condition. Timing is done by counting CPU 17 | cycles, so all interrupts must be disabled while the calibration runs. For 18 | low level timing measurements, usbMeasureFrameLength() is called. This 19 | function must be enabled in usbconfig.h by defining 20 | USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is recommended to call 21 | calibrateOscillator() from the reset hook in usbconfig.h: 22 | */ 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include // for sei() 26 | extern void calibrateOscillator(void); 27 | #endif 28 | #define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} 29 | 30 | /* 31 | This routine is an alternative to the continuous synchronization described 32 | in osctune.h. 33 | 34 | Algorithm used: 35 | calibrateOscillator() first does a binary search in the OSCCAL register for 36 | the best matching oscillator frequency. Then it does a next neighbor search 37 | to find the value with the lowest clock rate deviation. It is guaranteed to 38 | find the best match among neighboring values, but for version 5 oscillators 39 | (which have a discontinuous relationship between OSCCAL and frequency) a 40 | better match might be available in another OSCCAL region. 41 | 42 | Limitations: 43 | This calibration algorithm may try OSCCAL values of up to 192 even if the 44 | optimum value is far below 192. It may therefore exceed the allowed clock 45 | frequency of the CPU in low voltage designs! 46 | Precision depends on the OSCCAL vs. frequency dependency of the oscillator. 47 | Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram 48 | in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and 49 | 16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this 50 | deviation! All other frequency modules require at least 0.2% precision. 51 | */ 52 | 53 | #ifndef __OSCCAL_H_INCLUDED__ 54 | #define __OSCCAL_H_INCLUDED__ 55 | 56 | //void calibrateOscillator(void); 57 | /* This function calibrates the RC oscillator so that the CPU runs at F_CPU. 58 | * It MUST be called immediately after the end of a USB RESET condition! 59 | * Disable all interrupts during the call! 60 | * It is recommended that you store the resulting value in EEPROM so that a 61 | * good guess value is available after the next reset. 62 | */ 63 | 64 | 65 | #endif /* __OSCCAL_H_INCLUDED__ */ 66 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/libs-device/osccal.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkUSB/libs-device/osccal.o -------------------------------------------------------------------------------- /libraries/DigisparkUSB/oddebug.c: -------------------------------------------------------------------------------- 1 | /* Name: oddebug.c 2 | * Project: AVR library 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2005-01-16 5 | * Tabsize: 4 6 | * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id: oddebug.c 692 2008-11-07 15:07:40Z cs $ 9 | */ 10 | 11 | #include "oddebug.h" 12 | 13 | #if DEBUG_LEVEL > 0 14 | 15 | #warning "Never compile production devices with debugging enabled" 16 | 17 | static void uartPutc(char c) 18 | { 19 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ 20 | ODDBG_UDR = c; 21 | } 22 | 23 | static uchar hexAscii(uchar h) 24 | { 25 | h &= 0xf; 26 | if(h >= 10) 27 | h += 'a' - (uchar)10 - '0'; 28 | h += '0'; 29 | return h; 30 | } 31 | 32 | static void printHex(uchar c) 33 | { 34 | uartPutc(hexAscii(c >> 4)); 35 | uartPutc(hexAscii(c)); 36 | } 37 | 38 | void odDebug(uchar prefix, uchar *data, uchar len) 39 | { 40 | printHex(prefix); 41 | uartPutc(':'); 42 | while(len--){ 43 | uartPutc(' '); 44 | printHex(*data++); 45 | } 46 | uartPutc('\r'); 47 | uartPutc('\n'); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/osccal.c: -------------------------------------------------------------------------------- 1 | /* Name: osccal.c 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.c 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | #include 11 | 12 | #ifndef uchar 13 | #define uchar unsigned char 14 | #endif 15 | 16 | /* ------------------------------------------------------------------------- */ 17 | /* ------------------------ Oscillator Calibration ------------------------- */ 18 | /* ------------------------------------------------------------------------- */ 19 | 20 | /* Calibrate the RC oscillator. Our timing reference is the Start Of Frame 21 | * signal (a single SE0 bit) repeating every millisecond immediately after 22 | * a USB RESET. We first do a binary search for the OSCCAL value and then 23 | * optimize this value with a neighboorhod search. 24 | */ 25 | void calibrateOscillator(void) 26 | { 27 | uchar step = 128; 28 | uchar trialValue = 0, optimumValue; 29 | int x, optimumDev, targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 30 | 31 | /* do a binary search: */ 32 | do{ 33 | OSCCAL = trialValue + step; 34 | x = usbMeasureFrameLength(); /* proportional to current real frequency */ 35 | if(x < targetValue) /* frequency still too low */ 36 | trialValue += step; 37 | step >>= 1; 38 | }while(step > 0); 39 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 40 | /* now do a neighborhood search for optimum value */ 41 | optimumValue = trialValue; 42 | optimumDev = x; /* this is certainly far away from optimum */ 43 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++){ 44 | x = usbMeasureFrameLength() - targetValue; 45 | if(x < 0) 46 | x = -x; 47 | if(x < optimumDev){ 48 | optimumDev = x; 49 | optimumValue = OSCCAL; 50 | } 51 | } 52 | OSCCAL = optimumValue; 53 | } 54 | /* 55 | Note: This calibration algorithm may try OSCCAL values of up to 192 even if 56 | the optimum value is far below 192. It may therefore exceed the allowed clock 57 | frequency of the CPU in low voltage designs! 58 | You may replace this search algorithm with any other algorithm you like if 59 | you have additional constraints such as a maximum CPU clock. 60 | For version 5.x RC oscillators (those with a split range of 2x128 steps, e.g. 61 | ATTiny25, ATTiny45, ATTiny85), it may be useful to search for the optimum in 62 | both regions. 63 | */ 64 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/osccal.h: -------------------------------------------------------------------------------- 1 | /* Name: osccal.h 2 | * Author: Christian Starkjohann 3 | * Creation Date: 2008-04-10 4 | * Tabsize: 4 5 | * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 6 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 7 | * This Revision: $Id: osccal.h 762 2009-08-12 17:10:30Z cs $ 8 | */ 9 | 10 | /* 11 | General Description: 12 | This module contains a function which calibrates the AVR's internal RC 13 | oscillator so that the CPU runs at F_CPU (F_CPU is a macro which must be 14 | defined when the module is compiled, best passed in the compiler command 15 | line). The time reference is the USB frame clock of 1 kHz available 16 | immediately after a USB RESET condition. Timing is done by counting CPU 17 | cycles, so all interrupts must be disabled while the calibration runs. For 18 | low level timing measurements, usbMeasureFrameLength() is called. This 19 | function must be enabled in usbconfig.h by defining 20 | USB_CFG_HAVE_MEASURE_FRAME_LENGTH to 1. It is recommended to call 21 | calibrateOscillator() from the reset hook in usbconfig.h: 22 | */ 23 | 24 | #ifndef __ASSEMBLER__ 25 | #include // for sei() 26 | extern void calibrateOscillator(void); 27 | #endif 28 | #define USB_RESET_HOOK(resetStarts) if(!resetStarts){cli(); calibrateOscillator(); sei();} 29 | 30 | /* 31 | This routine is an alternative to the continuous synchronization described 32 | in osctune.h. 33 | 34 | Algorithm used: 35 | calibrateOscillator() first does a binary search in the OSCCAL register for 36 | the best matching oscillator frequency. Then it does a next neighbor search 37 | to find the value with the lowest clock rate deviation. It is guaranteed to 38 | find the best match among neighboring values, but for version 5 oscillators 39 | (which have a discontinuous relationship between OSCCAL and frequency) a 40 | better match might be available in another OSCCAL region. 41 | 42 | Limitations: 43 | This calibration algorithm may try OSCCAL values of up to 192 even if the 44 | optimum value is far below 192. It may therefore exceed the allowed clock 45 | frequency of the CPU in low voltage designs! 46 | Precision depends on the OSCCAL vs. frequency dependency of the oscillator. 47 | Typical precision for an ATMega168 (derived from the OSCCAL vs. F_RC diagram 48 | in the data sheet) should be in the range of 0.4%. Only the 12.8 MHz and 49 | 16.5 MHz versions of V-USB (with built-in receiver PLL) can tolerate this 50 | deviation! All other frequency modules require at least 0.2% precision. 51 | */ 52 | 53 | #ifndef __OSCCAL_H_INCLUDED__ 54 | #define __OSCCAL_H_INCLUDED__ 55 | 56 | //void calibrateOscillator(void); 57 | /* This function calibrates the RC oscillator so that the CPU runs at F_CPU. 58 | * It MUST be called immediately after the end of a USB RESET condition! 59 | * Disable all interrupts during the call! 60 | * It is recommended that you store the resulting value in EEPROM so that a 61 | * good guess value is available after the next reset. 62 | */ 63 | 64 | 65 | #endif /* __OSCCAL_H_INCLUDED__ */ 66 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/osccal.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digistump/DigisparkArduinoIntegration/8d0b0de6d208c55c77d88c09409d619309e85201/libraries/DigisparkUSB/osccal.o -------------------------------------------------------------------------------- /libraries/DigisparkUSB/rx_buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef __rx_buffer_h__ 2 | #define __rx_buffer_h__ 3 | 4 | #ifdef __cplusplus 5 | extern "C"{ 6 | #endif 7 | uchar rx_buffer[8]; // Buffer 8 bytes 8 | extern int rx_read_offset; // = -1; 9 | extern int rx_write_offset; // = 0; 10 | #ifdef __cplusplus 11 | } // extern "C" 12 | #endif 13 | 14 | #endif // __rx_buffer_h__ 15 | -------------------------------------------------------------------------------- /libraries/DigisparkUSB/usbdrvasm.asm: -------------------------------------------------------------------------------- 1 | /* Name: usbdrvasm.asm 2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2006-03-01 5 | * Tabsize: 4 6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | * This Revision: $Id$ 9 | */ 10 | 11 | /* 12 | General Description: 13 | The IAR compiler/assembler system prefers assembler files with file extension 14 | ".asm". We simply provide this file as an alias for usbdrvasm.S. 15 | 16 | Thanks to Oleg Semyonov for his help with the IAR tools port! 17 | */ 18 | 19 | #include "usbdrvasm.S" 20 | 21 | end 22 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/CHANGES: -------------------------------------------------------------------------------- 1 | See VirtulWire.h for latest change log 2 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/LICENSE: -------------------------------------------------------------------------------- 1 | This software is Copyright (C) 2008 Mike McCauley. Use is subject to license 2 | conditions. The main licensing options available are GPL V2 or Commercial: 3 | 4 | Open Source Licensing GPL V2 5 | 6 | This is the appropriate option if you want to share the source code of your 7 | application with everyone you distribute it to, and you also want to give them 8 | the right to share who uses it. If you wish to use this software under Open 9 | Source Licensing, you must contribute all your source code to the open source 10 | community in accordance with the GPL Version 2 when your application is 11 | distributed. See http://www.gnu.org/copyleft/gpl.html 12 | 13 | Commercial Licensing 14 | 15 | This is the appropriate option if you are creating proprietary applications 16 | and you are not prepared to distribute and share the source code of your 17 | application. Contact info@open.com.au for details. 18 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/MANIFEST: -------------------------------------------------------------------------------- 1 | VirtualWire/doc 2 | VirtualWire/LICENSE 3 | VirtualWire/README 4 | VirtualWire/Makefile 5 | VirtualWire/VirtualWire.cpp 6 | VirtualWire/VirtualWire.h 7 | VirtualWire/CHANGES 8 | VirtualWire/MANIFEST 9 | VirtualWire/keywords.txt 10 | VirtualWire/util/crc16.h 11 | VirtualWire/examples/client/client.pde 12 | VirtualWire/examples/transmitter/transmitter.pde 13 | VirtualWire/examples/receiver/receiver.pde 14 | VirtualWire/examples/server/server.pde 15 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile 2 | # 3 | # Makefile for the Arduino VirtualWire project 4 | # 5 | # Author: Mike McCauley (mikem@airspayce.com) 6 | # Copyright (C) 2011 Mike McCauley 7 | # $Id: Makefile,v 1.1 2013/01/14 06:49:29 mikem Exp mikem $ 8 | 9 | PROJNAME = VirtualWire 10 | # Dont forget to also change the version at the top of RF22.h: 11 | DISTFILE = $(PROJNAME)-1.15.zip 12 | 13 | all: doxygen dist upload 14 | 15 | doxygen: 16 | doxygen project.cfg 17 | 18 | ci: 19 | (cd ..;ci -l `cat $(PROJNAME)/MANIFEST`) 20 | 21 | dist: 22 | (cd ..; zip $(PROJNAME)/$(DISTFILE) `cat $(PROJNAME)/MANIFEST`) 23 | 24 | upload: 25 | rsync -avz $(DISTFILE) doc/ www.airspayce.com:public_html/mikem/arduino/$(PROJNAME) 26 | rsync -avz ../../doc/VirtualWire.pdf doc/ www.airspayce.com:public_html/mikem/arduino/ 27 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/README: -------------------------------------------------------------------------------- 1 | Virtual Wire 2 | 3 | This is the VirtualWire library for Arduino 4 | It provides a simple message passing protocol for a range of inexpensive 5 | transmitter and receiver modules. 6 | 7 | See http://www.open.com.au/mikem/arduino/VirtualWire.pdf for full documentation. 8 | 9 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/examples/client/client.pde: -------------------------------------------------------------------------------- 1 | // client.pde 2 | // 3 | // Simple example of how to use VirtualWire to send and receive messages 4 | // with a DR3100 module. 5 | // Send a message to another arduino running the 'server' example, which 6 | // should send a reply, which we will check 7 | // 8 | // See VirtualWire.h for detailed API docs 9 | // Author: Mike McCauley (mikem@airspayce.com) 10 | // Copyright (C) 2008 Mike McCauley 11 | // $Id: client.pde,v 1.1 2008/04/20 09:24:17 mikem Exp $ 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Serial.begin(9600); // Debugging only 18 | Serial.println("setup"); 19 | 20 | // Initialise the IO and ISR 21 | vw_set_ptt_inverted(true); // Required for DR3100 22 | vw_setup(2000); // Bits per sec 23 | vw_rx_start(); // Start the receiver PLL running 24 | } 25 | 26 | void loop() 27 | { 28 | const char *msg = "hello"; 29 | uint8_t buf[VW_MAX_MESSAGE_LEN]; 30 | uint8_t buflen = VW_MAX_MESSAGE_LEN; 31 | 32 | digitalWrite(13, true); // Flash a light to show transmitting 33 | vw_send((uint8_t *)msg, strlen(msg)); 34 | vw_wait_tx(); // Wait until the whole message is gone 35 | Serial.println("Sent"); 36 | digitalWrite(13, false); 37 | 38 | // Wait at most 200ms for a reply 39 | if (vw_wait_rx_max(200)) 40 | { 41 | if (vw_get_message(buf, &buflen)) // Non-blocking 42 | { 43 | int i; 44 | 45 | // Message with a good checksum received, dump it. 46 | Serial.print("Got: "); 47 | 48 | for (i = 0; i < buflen; i++) 49 | { 50 | Serial.print(buf[i], HEX); 51 | Serial.print(" "); 52 | } 53 | Serial.println(""); 54 | } 55 | } 56 | else 57 | Serial.println("Timout"); 58 | 59 | } 60 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/examples/receiver/receiver.pde: -------------------------------------------------------------------------------- 1 | // receiver.pde 2 | // 3 | // Simple example of how to use VirtualWire to receive messages 4 | // Implements a simplex (one-way) receiver with an Rx-B1 module 5 | // 6 | // See VirtualWire.h for detailed API docs 7 | // Author: Mike McCauley (mikem@airspayce.com) 8 | // Copyright (C) 2008 Mike McCauley 9 | // $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $ 10 | 11 | #include 12 | 13 | void setup() 14 | { 15 | Serial.begin(9600); // Debugging only 16 | Serial.println("setup"); 17 | 18 | // Initialise the IO and ISR 19 | vw_set_ptt_inverted(true); // Required for DR3100 20 | vw_setup(2000); // Bits per sec 21 | 22 | vw_rx_start(); // Start the receiver PLL running 23 | } 24 | 25 | void loop() 26 | { 27 | uint8_t buf[VW_MAX_MESSAGE_LEN]; 28 | uint8_t buflen = VW_MAX_MESSAGE_LEN; 29 | 30 | if (vw_get_message(buf, &buflen)) // Non-blocking 31 | { 32 | int i; 33 | 34 | digitalWrite(13, true); // Flash a light to show received good message 35 | // Message with a good checksum received, dump it. 36 | Serial.print("Got: "); 37 | 38 | for (i = 0; i < buflen; i++) 39 | { 40 | Serial.print(buf[i], HEX); 41 | Serial.print(" "); 42 | } 43 | Serial.println(""); 44 | digitalWrite(13, false); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/examples/server/server.pde: -------------------------------------------------------------------------------- 1 | // server.pde 2 | // 3 | // Simple example of how to use VirtualWire to send and receive messages 4 | // with a DR3100 module. 5 | // Wait for a message from another arduino running the 'client' example, 6 | // and send a reply. 7 | // You can use this as the basis of a remote control/remote sensing system 8 | // 9 | // See VirtualWire.h for detailed API docs 10 | // Author: Mike McCauley (mikem@airspayce.com) 11 | // Copyright (C) 2008 Mike McCauley 12 | // $Id: server.pde,v 1.1 2008/04/20 09:24:17 mikem Exp $ 13 | 14 | #include 15 | 16 | void setup() 17 | { 18 | Serial.begin(9600); // Debugging only 19 | Serial.println("setup"); 20 | 21 | // Initialise the IO and ISR 22 | vw_set_ptt_inverted(true); // Required for DR3100 23 | vw_setup(2000); // Bits per sec 24 | vw_rx_start(); // Start the receiver PLL running 25 | } 26 | 27 | void loop() 28 | { 29 | const char *msg = "hello"; 30 | uint8_t buf[VW_MAX_MESSAGE_LEN]; 31 | uint8_t buflen = VW_MAX_MESSAGE_LEN; 32 | 33 | // Wait for a message 34 | vw_wait_rx(); 35 | if (vw_get_message(buf, &buflen)) // Non-blocking 36 | { 37 | int i; 38 | const char *msg = "goodbye"; 39 | 40 | digitalWrite(13, true); // Flash a light to show received good message 41 | // Message with a good checksum received, dump it. 42 | Serial.print("Got: "); 43 | 44 | for (i = 0; i < buflen; i++) 45 | { 46 | Serial.print(buf[i], HEX); 47 | Serial.print(" "); 48 | } 49 | Serial.println(""); 50 | 51 | // Send a reply 52 | vw_send((uint8_t *)msg, strlen(msg)); 53 | digitalWrite(13, false); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/examples/transmitter/transmitter.pde: -------------------------------------------------------------------------------- 1 | // transmitter.pde 2 | // 3 | // Simple example of how to use VirtualWire to transmit messages 4 | // Implements a simplex (one-way) transmitter with an TX-C1 module 5 | // 6 | // See VirtualWire.h for detailed API docs 7 | // Author: Mike McCauley (mikem@airspayce.com) 8 | // Copyright (C) 2008 Mike McCauley 9 | // $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $ 10 | 11 | #include 12 | 13 | void setup() 14 | { 15 | Serial.begin(9600); // Debugging only 16 | Serial.println("setup"); 17 | 18 | // Initialise the IO and ISR 19 | vw_set_ptt_inverted(true); // Required for DR3100 20 | vw_setup(2000); // Bits per sec 21 | } 22 | 23 | void loop() 24 | { 25 | const char *msg = "hello"; 26 | 27 | digitalWrite(13, true); // Flash a light to show transmitting 28 | vw_send((uint8_t *)msg, strlen(msg)); 29 | vw_wait_tx(); // Wait until the whole message is gone 30 | digitalWrite(13, false); 31 | delay(200); 32 | } 33 | -------------------------------------------------------------------------------- /libraries/DigisparkVirtualWire/keywords.txt: -------------------------------------------------------------------------------- 1 | VirtualWire KEYWORD1 2 | 3 | -------------------------------------------------------------------------------- /libraries/OneWire/examples/DS2408_Switch/DS2408_Switch.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * DS2408 8-Channel Addressable Switch 5 | * 6 | * Writte by Glenn Trewitt, glenn at trewitt dot org 7 | * 8 | * Some notes about the DS2408: 9 | * - Unlike most input/output ports, the DS2408 doesn't have mode bits to 10 | * set whether the pins are input or output. If you issue a read command, 11 | * they're inputs. If you write to them, they're outputs. 12 | * - For reading from a switch, you should use 10K pull-up resisters. 13 | */ 14 | 15 | void PrintBytes(uint8_t* addr, uint8_t count, bool newline=0) { 16 | for (uint8_t i = 0; i < count; i++) { 17 | Serial.print(addr[i]>>4, HEX); 18 | Serial.print(addr[i]&0x0f, HEX); 19 | } 20 | if (newline) 21 | Serial.println(); 22 | } 23 | 24 | void ReadAndReport(OneWire* net, uint8_t* addr) { 25 | Serial.print(" Reading DS2408 "); 26 | PrintBytes(addr, 8); 27 | Serial.println(); 28 | 29 | uint8_t buf[13]; // Put everything in the buffer so we can compute CRC easily. 30 | buf[0] = 0xF0; // Read PIO Registers 31 | buf[1] = 0x88; // LSB address 32 | buf[2] = 0x00; // MSB address 33 | net->write_bytes(buf, 3); 34 | net->read_bytes(buf+3, 10); // 3 cmd bytes, 6 data bytes, 2 0xFF, 2 CRC16 35 | net->reset(); 36 | 37 | if (!OneWire::check_crc16(buf, 11, &buf[11])) { 38 | Serial.print("CRC failure in DS2408 at "); 39 | PrintBytes(addr, 8, true); 40 | return; 41 | } 42 | Serial.print(" DS2408 data = "); 43 | // First 3 bytes contain command, register address. 44 | Serial.println(buf[3], BIN); 45 | } 46 | 47 | OneWire net(10); // on pin 10 48 | 49 | void setup(void) { 50 | Serial.begin(9600); 51 | } 52 | 53 | void loop(void) { 54 | byte i; 55 | byte present = 0; 56 | byte addr[8]; 57 | 58 | if (!net.search(addr)) { 59 | Serial.print("No more addresses.\n"); 60 | net.reset_search(); 61 | delay(1000); 62 | return; 63 | } 64 | 65 | if (OneWire::crc8(addr, 7) != addr[7]) { 66 | Serial.print("CRC is not valid!\n"); 67 | return; 68 | } 69 | 70 | if (addr[0] != 0x29) { 71 | PrintBytes(addr, 8); 72 | Serial.print(" is not a DS2408.\n"); 73 | return; 74 | } 75 | 76 | ReadAndReport(&net, addr); 77 | } 78 | -------------------------------------------------------------------------------- /libraries/OneWire/examples/Digispark_Example/Digispark_Example.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #define DS18S20_ID 0x10 5 | #define DS18B20_ID 0x28 6 | int temp; 7 | 8 | 9 | OneWire ds(5); 10 | 11 | byte data[12]; 12 | byte addr[8]; 13 | 14 | boolean readTemperature(){ 15 | 16 | 17 | 18 | //find a device 19 | 20 | 21 | if (!ds.search(addr)) { 22 | ds.reset_search(); 23 | return false; 24 | } 25 | if (OneWire::crc8( addr, 7) != addr[7]) { 26 | return false; 27 | } 28 | if (addr[0] != DS18S20_ID && addr[0] != DS18B20_ID) { 29 | return false; 30 | } 31 | 32 | ds.reset(); 33 | ds.select(addr); 34 | // Start conversion 35 | ds.write(0x44, 1); 36 | // Wait some time... 37 | } 38 | 39 | boolean getTemperature(){ 40 | byte i; 41 | byte present = 0; 42 | present = ds.reset(); 43 | ds.select(addr); 44 | // Issue Read scratchpad command 45 | ds.write(0xBE); 46 | // Receive 9 bytes 47 | for ( i = 0; i < 9; i++) { 48 | data[i] = ds.read(); 49 | } 50 | // Calculate temperature value 51 | temp = ((( (data[1] << 8) + data[0] )*0.0625)*1.8)+32; 52 | return true; 53 | 54 | } 55 | 56 | void setup(){ 57 | DigiUSB.begin(); 58 | DigiUSB.print("Start"); 59 | } 60 | 61 | 62 | void loop(){ 63 | 64 | 65 | readTemperature(); 66 | DigiUSB.delay(1000); 67 | getTemperature(); 68 | DigiUSB.println(temp); 69 | 70 | DigiUSB.delay(1000); 71 | 72 | 73 | 74 | } 75 | 76 | 77 | -------------------------------------------------------------------------------- /libraries/OneWire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For OneWire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | OneWire KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | reset KEYWORD2 16 | write_bit KEYWORD2 17 | read_bit KEYWORD2 18 | write KEYWORD2 19 | write_bytes KEYWORD2 20 | read KEYWORD2 21 | read_bytes KEYWORD2 22 | select KEYWORD2 23 | skip KEYWORD2 24 | depower KEYWORD2 25 | reset_search KEYWORD2 26 | search KEYWORD2 27 | crc8 KEYWORD2 28 | crc16 KEYWORD2 29 | check_crc16 KEYWORD2 30 | 31 | ####################################### 32 | # Instances (KEYWORD2) 33 | ####################################### 34 | 35 | 36 | ####################################### 37 | # Constants (LITERAL1) 38 | ####################################### 39 | -------------------------------------------------------------------------------- /libraries/TinyWireM_Digispark/TinyWireM.h: -------------------------------------------------------------------------------- 1 | /* 2 | TinyWireM.h - a wrapper(+) class for TWI/I2C Master library for the ATtiny on Arduino 3 | 1/21/2011 BroHogan - brohoganx10 at gmail dot com 4 | 5 | Thanks to 'jkl' for the gcc version of Atmel's USI_TWI_Master code 6 | http://www.cs.cmu.edu/~dst/ARTSI/Create/PC%20Comm/ 7 | I added Atmel's original Device dependant defines section back into USI_TWI_Master.h 8 | 9 | 10 | NOTE! - It's very important to use pullups on the SDA & SCL lines! More so than with the Wire lib. 11 | 12 | USAGE is modeled after the standard Wire library . . . 13 | Put in setup(): 14 | TinyWireM.begin(){ // initialize I2C lib 15 | To Send: 16 | TinyWireM.beginTransmission(uint8_t slaveAddr){ // setup slave's address (7 bit address - same as Wire) 17 | TinyWireM.send(uint8_t data){ // buffer up bytes to send - can be called multiple times 18 | someByte = TinyWireM.endTransmission(){ // actually send the bytes in the buffer 19 | // returns (optional) 0 = sucess or see USI_TWI_Master.h for error codes 20 | To Receive: 21 | someByte = TinyWireM.requestFrom(uint8_t slaveAddr, uint8_t numBytes){ // reads 'numBytes' from slave's address 22 | // (usage optional) returns 0= success or see USI_TWI_Master.h for error codes 23 | someByte = TinyWireM.receive(){ // returns the next byte in the received buffer - called multiple times 24 | someByte = TinyWireM.available(){ // returns the number of unread bytes in the received buffer 25 | 26 | TODO: (by others!) 27 | - merge this class with TinyWireS for master & slave support in one library 28 | 29 | This library is free software; you can redistribute it and/or modify it under the 30 | terms of the GNU General Public License as published by the Free Software 31 | Foundation; either version 2.1 of the License, or any later version. 32 | This program is distributed in the hope that it will be useful, but WITHOUT ANY 33 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 34 | PARTICULAR PURPOSE. See the GNU General Public License for more details. 35 | */ 36 | 37 | #ifndef TinyWireM_h 38 | #define TinyWireM_h 39 | 40 | #include 41 | #define USI_SEND 0 // indicates sending to TWI 42 | #define USI_RCVE 1 // indicates receiving from TWI 43 | #define USI_BUF_SIZE 16 // bytes in message buffer 44 | 45 | class USI_TWI 46 | { 47 | private: 48 | static uint8_t USI_Buf[]; // holds I2C send and receive data 49 | static uint8_t USI_BufIdx; // current number of bytes in the send buff 50 | static uint8_t USI_LastRead; // number of bytes read so far 51 | static uint8_t USI_BytesAvail; // number of bytes requested but not read 52 | 53 | public: 54 | USI_TWI(); 55 | void begin(); 56 | void beginTransmission(uint8_t); 57 | void send(uint8_t); 58 | uint8_t endTransmission(); 59 | uint8_t requestFrom(uint8_t, uint8_t); 60 | uint8_t receive(); 61 | uint8_t available(); 62 | }; 63 | 64 | extern USI_TWI TinyWireM; 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /libraries/TinyWireM_Digispark/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For TinyWireM 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | begin KEYWORD2 14 | beginTransmission KEYWORD2 15 | endTransmission KEYWORD2 16 | requestFrom KEYWORD2 17 | send KEYWORD2 18 | receive KEYWORD2 19 | 20 | ####################################### 21 | # Instances (KEYWORD2) 22 | ####################################### 23 | 24 | TinyWireM KEYWORD2 25 | 26 | ####################################### 27 | # Constants (LITERAL1) 28 | ####################################### 29 | 30 | --------------------------------------------------------------------------------