26 Commits

Author SHA1 Message Date
Erik Kettenburg
822a2e4f55 update spi, fix lcd error 2016-02-12 19:09:37 -08:00
Erik Tylek Kettenburg
2c40bcdd6f Merge pull request #18 from eelmasllari/master
added functionality to send keypresses, i.e. a press without release
2016-02-12 18:31:49 -08:00
Erik Tylek Kettenburg
af7c58d1e5 Update pins_arduino.h 2016-02-12 11:12:01 -08:00
Erik Tylek Kettenburg
ab01715320 Update pins_arduino.h 2016-02-12 11:11:35 -08:00
Erik Tylek Kettenburg
c16eb3cf70 Update pins_arduino.h 2016-02-12 11:11:03 -08:00
Erik Tylek Kettenburg
40be695f81 Add __AVR_ATtiny85__ to satisfy some libraries 2016-02-12 11:09:12 -08:00
Erik Tylek Kettenburg
fbd4d79324 Merge pull request #24 from e-moe/feature/platform.txt-update
{build.path}/{archive_file} is now {archive_file_path}
2016-02-12 11:03:44 -08:00
Erik Tylek Kettenburg
92260e2acd Merge pull request #25 from e-moe/fix/LiquidCrystal_I2C
fix #if defined checks - Thanks @e-moe - merging for todays release
2016-02-12 11:03:13 -08:00
Erik Tylek Kettenburg
badec8f822 Merge pull request #28 from per1234/dummy-example-headers
Add dummy .h files to Digispark_Examples and DigiXBetaBonus folders
2016-02-12 11:01:48 -08:00
per1234
0d4830288d Add dummy .h files to Digispark_Examples and DigiXBetaBonus folders
In Arduino IDE 1.6.6 and 1.6.7 these are considered invalid libraries
without a header file and this causes a warning whenever a Digispark
board is selected from the Tools > Board menu or Boards Manager or
Library Manager is opened with a Digispark board selected and the
sketches don't appear in the File > Example menu.
2016-02-04 02:35:46 -08:00
Nikolay Labinskiy
3577e4a637 fix #if defined checks 2016-01-31 21:54:05 +02:00
Nikolay Labinskiy
eed2ff45ba {build.path}/{archive_file} is now {archive_file_path} 2016-01-31 18:42:00 +02:00
Factor Sixty
6844d32b06 added functionality to send keypresses, i.e. just a press-and-hold, without release.
sendKeyStroke sends the release automatically, which creates a problem when you want to use the repeating key functionality of your OS.
2016-01-16 14:12:45 +01:00
Erik Tylek Kettenburg
bd916e2eea Merge pull request #11 from mpflaga/master
TCCR0B not initialized in DigisparkRGB example
2015-10-10 02:14:52 -07:00
Erik Tylek Kettenburg
4a1f9c7ac5 Merge pull request #8 from awenisko/patch-1
Update wiring.h
2015-10-10 02:14:31 -07:00
Erik Tylek Kettenburg
836e363726 Merge pull request #9 from awenisko/patch-2
Update wiring_digital.c
2015-10-10 02:13:12 -07:00
Michael P. Flaga
2de159b44d TCCR0B not initialized in DigisparkRGB example 2015-10-05 13:20:42 -04:00
awenisko
7533853c57 Update wiring_digital.c
Implemented INPUT_PULLUP digital pin mode.
2015-09-03 18:32:28 +02:00
awenisko
7d52a0cfb9 Update wiring.h
Defined INPUT_PULLUP mode.
2015-09-03 18:30:06 +02:00
Erik Tylek Kettenburg
60edebc52b Merge pull request #7 from SoundGuy/patch-1
fixed bug that prevented this from compiling
2015-08-13 22:20:08 -07:00
Oded Sharon
008b95382b fixed bug that prevented this from compiling
added const to line 273 to prescalers
2015-08-11 11:41:40 +03:00
Erik Tylek Kettenburg
528559488d updated with windows drivers and installer 2015-06-25 14:49:02 -07:00
Erik Tylek Kettenburg
487b621a89 add drivers to windows 2015-06-24 16:13:07 -07:00
Erik Tylek Kettenburg
2f8eec51b4 fix to stop warning in 1.6.5+ 2015-06-24 15:55:28 -07:00
Erik Tylek Kettenburg
aeb7af566f fixes for BM compat 2015-06-24 14:40:30 -07:00
Erik Tylek Kettenburg
8810516130 add avrdude dummy back in as launcher 2015-06-23 20:30:23 -07:00
24 changed files with 70 additions and 45 deletions

View File

@@ -78,7 +78,7 @@ digispark-tiny16.upload.wait_for_upload_port = false
digispark-tiny16.upload.use_1200bps_touch = false
digispark-tiny16.upload.disable_flushing = false
digispark-tiny8.name=Digispark (16mhz - No USB)
digispark-tiny8.name=Digispark (8mhz - No USB)
digispark-tiny8.upload.using=micronucleusprog
digispark-tiny8.upload.protocol=usb
digispark-tiny8.upload.tool=micronucleus
@@ -92,7 +92,7 @@ digispark-tiny8.upload.wait_for_upload_port = false
digispark-tiny8.upload.use_1200bps_touch = false
digispark-tiny8.upload.disable_flushing = false
digispark-tiny1.name=Digispark (16mhz - No USB)
digispark-tiny1.name=Digispark (1mhz - No USB)
digispark-tiny1.upload.using=micronucleusprog
digispark-tiny1.upload.protocol=usb
digispark-tiny1.upload.tool=micronucleus

View File

@@ -43,6 +43,7 @@ extern "C"{
#define INPUT 0x0
#define OUTPUT 0x1
#define INPUT_PULLUP 0x2
#define true 0x1
#define false 0x0

View File

@@ -35,21 +35,28 @@ void pinMode(uint8_t pin, uint8_t mode)
{
uint8_t bit = digitalPinToBitMask(pin);
uint8_t port = digitalPinToPort(pin);
volatile uint8_t *reg;
volatile uint8_t *reg, *out;
if (port == NOT_A_PIN) return;
// JWS: can I let the optimizer do this?
reg = portModeRegister(port);
out = portOutputRegister(port);
if (mode == INPUT) {
uint8_t oldSREG = SREG;
cli();
cli();
*reg &= ~bit;
SREG = oldSREG;
} else if (mode == INPUT_PULLUP) {
uint8_t oldSREG = SREG;
cli();
*reg &= ~bit;
*out |= bit;
SREG = oldSREG;
} else {
uint8_t oldSREG = SREG;
cli();
cli();
*reg |= bit;
SREG = oldSREG;
}

View File

@@ -163,14 +163,30 @@ class DigiKeyboardDevice : public Print {
}
}
//sendKeyStroke: sends a key press AND release
void sendKeyStroke(byte keyStroke) {
sendKeyStroke(keyStroke, 0);
}
//sendKeyStroke: sends a key press AND release with modifiers
void sendKeyStroke(byte keyStroke, byte modifiers) {
sendKeyPress(keyStroke, modifiers);
// This stops endlessly repeating keystrokes:
sendKeyPress(0,0);
}
//sendKeyPress: sends a key press only - no release
//to release the key, send again with keyPress=0
void sendKeyPress(byte keyPress) {
sendKeyPress(keyPress, 0);
}
//sendKeyPress: sends a key press only, with modifiers - no release
//to release the key, send again with keyPress=0
void sendKeyPress(byte keyPress, byte modifiers) {
while (!usbInterruptIsReady()) {
// Note: We wait until we can send keystroke
// so we know the previous keystroke was
// Note: We wait until we can send keyPress
// so we know the previous keyPress was
// sent.
usbPoll();
_delay_ms(5);
@@ -179,20 +195,8 @@ class DigiKeyboardDevice : public Print {
memset(reportBuffer, 0, sizeof(reportBuffer));
reportBuffer[0] = modifiers;
reportBuffer[1] = keyStroke;
reportBuffer[1] = keyPress;
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
while (!usbInterruptIsReady()) {
// Note: We wait until we can send keystroke
// so we know the previous keystroke was
// sent.
usbPoll();
_delay_ms(5);
}
// This stops endlessly repeating keystrokes:
memset(reportBuffer, 0, sizeof(reportBuffer));
usbSetInterrupt(reportBuffer, sizeof(reportBuffer));
}

View File

@@ -2,13 +2,10 @@
#include "LiquidCrystal_I2C.h"
#include <inttypes.h>
#if defined(__AVR_ATtiny85__) || (__AVR_ATtiny2313__) || (__AVR_ATtiny167__)
#include "TinyWireM.h" // include this if ATtiny85 or ATtiny2313
#else
#include <Wire.h> // original lib include
#endif
#include "Arduino.h"
#include "TinyWireM.h" // include this if ATtiny85 or ATtiny2313
// When the display powers up, it is configured as follows:
//
@@ -43,7 +40,7 @@ void LiquidCrystal_I2C::init(){
void LiquidCrystal_I2C::init_priv()
{
#if defined (__AVR_ATtiny85__) || (__AVR_ATtiny2313__) || (__AVR_ATtiny167__)
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny2313__) || defined(__AVR_ATtiny167__)
TinyWireM.begin(); // initialize I2C lib
#else // original call
Wire.begin();
@@ -250,7 +247,7 @@ void LiquidCrystal_I2C::write4bits(uint8_t value) {
}
void LiquidCrystal_I2C::expanderWrite(uint8_t _data){
#if defined(__AVR_ATtiny85__) || (__AVR_ATtiny2313__)|| (__AVR_ATtiny167__) // Replaced Wire calls with ATtiny TWI calls
#if defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny2313__) || defined(__AVR_ATtiny167__) // Replaced Wire calls with ATtiny TWI calls
TinyWireM.beginTransmission(_Addr);
TinyWireM.send(((int)(_data) | _backlightval));
TinyWireM.endTransmission();

View File

@@ -8,13 +8,6 @@
#include <inttypes.h>
#include "Print.h"
#if defined(__AVR_ATtiny85__) || (__AVR_ATtiny2313__) || (__AVR_ATtiny167__)
#include "TinyWireM.h" // include this if ATtiny85 or ATtiny2313
#else
#include <Wire.h> // original lib include
#endif
// commands
#define LCD_CLEARDISPLAY 0x01
#define LCD_RETURNHOME 0x02

View File

@@ -49,6 +49,9 @@ void DigisparkRGBBegin() {
#ifdef TIMSK0
TIMSK0 = (1 << TOV0); // enable overflow interrupt
#endif
#ifdef TCCR0B
TCCR0B = (1 << CS00); // start timer, no prescale
#endif
sei();

View File

@@ -0,0 +1 @@
//This file allows the Digispark_Examples to appear in the File > Examples menu and fixes the Invalid library warning in Arduino IDE 1.6.6+

View File

@@ -85,7 +85,7 @@ void loop() {
}
//Read from or write to register from the SCP1000:
unsigned int readRegister(byte thisRegister, int bytesToRead ) {
unsigned int readRegister(byte thisRegister, int bytesToRead) {
byte inByte = 0; // incoming byte from the SPI
unsigned int result = 0; // result to return
Serial.print(thisRegister, BIN);
@@ -117,7 +117,7 @@ unsigned int readRegister(byte thisRegister, int bytesToRead ) {
// take the chip select high to de-select:
digitalWrite(chipSelectPin, HIGH);
// return the result:
return(result);
return (result);
}

View File

@@ -36,7 +36,7 @@ const int slaveSelectPin = 10;
void setup() {
// set the slaveSelectPin as an output:
pinMode (slaveSelectPin, OUTPUT);
pinMode(slaveSelectPin, OUTPUT);
// initialize SPI:
SPI.begin();
}

View File

@@ -4,6 +4,7 @@ author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For all Arduino boards, BUT Arduino DUE.
paragraph=
category=Communication
url=http://www.arduino.cc/en/Reference/SPI
architectures=avr

View File

@@ -270,7 +270,7 @@ void vw_pll()
// Returns prescaler index into {0, 0, 3, 6, 8, 10, 12} array
// and sets nticks to compare-match value if lower than max_ticks
// returns 0 & nticks = 0 on fault
uint8_t prescalers[] PROGMEM = {0, 0, 3, 6, 8, 10, 12}; /* Must be outside the function */
const uint8_t prescalers[] PROGMEM = {0, 0, 3, 6, 8, 10, 12}; /* Must be outside the function */
uint8_t _timer_calc(uint16_t speed, uint16_t max_ticks, uint16_t *nticks)
{
// Clock divider (prescaler) values - 0/4096: error flag

View File

@@ -12,7 +12,7 @@ version=1.5.4
# ---------------------
# Default "compiler.path" is correct, change only if you want to overidde the initial value
#compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
compiler.c.elf.flags=-Os -Wl,--gc-sections
@@ -44,10 +44,10 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -m
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "{build.path}/{build.project_name}.elf" {object_files} "{archive_file_path}" "-L{build.path}" -lm
## Create eeprom
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
@@ -67,12 +67,12 @@ recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
#tools.micronucleus.cmd.path={runtime.ide.path}/hardware/digistump/avr/tools/avrdude
#tools.micronucleus.cmd.path.linux={runtime.ide.path}/hardware/digistump/avr/tools/avrdude
tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}/micronucleus
tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}/launcher
tools.micronucleus.upload.params.verbose=
tools.micronucleus.upload.params.quiet=
tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
#tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i
#tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 "{build.path}/{build.project_name}.hex"
tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i
# USB Default Flags
# Default blank usb manufacturer will be filled it at compile time

View File

@@ -47,6 +47,10 @@
#define PORT_B_ID 1
#endif
#ifndef __AVR_ATtiny85__
#define __AVR_ATtiny85__
#endif
#define NOT_A_PIN 0
#define NOT_A_PORT 0

View File

@@ -27,6 +27,10 @@
#define ATTINYX7 1
#ifndef __AVR_ATtiny167__
#define __AVR_ATtiny167__
#endif
#define SERIAL_BUFFER_SIZE 16
#include <avr/pgmspace.h>

View File

@@ -27,6 +27,10 @@
#define ATTINYX7 1
#ifndef __AVR_ATtiny167__
#define __AVR_ATtiny167__
#endif
#define SERIAL_BUFFER_SIZE 32
#include <avr/pgmspace.h>

View File

@@ -27,6 +27,10 @@
#define ATTINYX7 1
#ifndef __AVR_ATtiny167__
#define __AVR_ATtiny167__
#endif
#define SERIAL_BUFFER_SIZE 64
#include <avr/pgmspace.h>

View File

@@ -14,3 +14,4 @@ digix.build.variant=digix
digix.build.variant_system_lib=libsam_sam3x8e_gcc_rel.a
digix.build.vid=0x16D0
digix.build.pid=0x078A
digix.build.board=SAM_DIGIX

View File

@@ -0,0 +1 @@
//This file allows the DigiXBetaBonus sketches to appear in the File > Examples menu and fixes the Invalid library warning in Arduino IDE 1.6.6+

Binary file not shown.

Binary file not shown.

Binary file not shown.