mirror of
https://github.com/digistump/DigistumpArduino.git
synced 2025-09-18 01:42:26 -07:00
Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
822a2e4f55 | ||
![]() |
2c40bcdd6f | ||
![]() |
af7c58d1e5 | ||
![]() |
ab01715320 | ||
![]() |
c16eb3cf70 | ||
![]() |
40be695f81 | ||
![]() |
fbd4d79324 | ||
![]() |
92260e2acd | ||
![]() |
badec8f822 | ||
![]() |
0d4830288d | ||
![]() |
3577e4a637 | ||
![]() |
eed2ff45ba | ||
![]() |
6844d32b06 | ||
![]() |
bd916e2eea | ||
![]() |
4a1f9c7ac5 | ||
![]() |
836e363726 | ||
![]() |
2de159b44d | ||
![]() |
7533853c57 | ||
![]() |
7d52a0cfb9 | ||
![]() |
60edebc52b | ||
![]() |
008b95382b | ||
![]() |
528559488d | ||
![]() |
487b621a89 | ||
![]() |
2f8eec51b4 | ||
![]() |
aeb7af566f | ||
![]() |
8810516130 |
@@ -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
|
||||
|
@@ -43,6 +43,7 @@ extern "C"{
|
||||
|
||||
#define INPUT 0x0
|
||||
#define OUTPUT 0x1
|
||||
#define INPUT_PULLUP 0x2
|
||||
|
||||
#define true 0x1
|
||||
#define false 0x0
|
||||
|
@@ -35,18 +35,25 @@ 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();
|
||||
*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();
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -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+
|
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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();
|
||||
}
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -27,6 +27,10 @@
|
||||
|
||||
#define ATTINYX7 1
|
||||
|
||||
#ifndef __AVR_ATtiny167__
|
||||
#define __AVR_ATtiny167__
|
||||
#endif
|
||||
|
||||
#define SERIAL_BUFFER_SIZE 16
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
@@ -27,6 +27,10 @@
|
||||
|
||||
#define ATTINYX7 1
|
||||
|
||||
#ifndef __AVR_ATtiny167__
|
||||
#define __AVR_ATtiny167__
|
||||
#endif
|
||||
|
||||
#define SERIAL_BUFFER_SIZE 32
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
@@ -27,6 +27,10 @@
|
||||
|
||||
#define ATTINYX7 1
|
||||
|
||||
#ifndef __AVR_ATtiny167__
|
||||
#define __AVR_ATtiny167__
|
||||
#endif
|
||||
|
||||
#define SERIAL_BUFFER_SIZE 64
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
@@ -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
|
||||
|
1
digistump-sam/libraries/DigiXBetaBonus/DigiXBetaBonus.h
Normal file
1
digistump-sam/libraries/DigiXBetaBonus/DigiXBetaBonus.h
Normal 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.
BIN
tools/micronucleus-2.0a4-win.zip
Normal file
BIN
tools/micronucleus-2.0a4-win.zip
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user