Skip to content

Commit 7e7473a

Browse files
committed
Initial import of support files for all Digistump boards - Digispark, Pro, DigiX - including libraries, examples, tools, and other support files for the Arduino IDE
1 parent 97abdbf commit 7e7473a

File tree

3,567 files changed

+722870
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,567 files changed

+722870
-0
lines changed

hardware/digistump/avr/boards.txt

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
3+
menu.cpu=Processor
4+
5+
##############################################################
6+
7+
8+
9+
10+
digispark-tiny.name=Digispark (Default - 16.5mhz)
11+
digispark-tiny.upload.using=micronucleusprog
12+
digispark-tiny.upload.protocol=usb
13+
digispark-tiny.upload.tool=micronucleus
14+
digispark-tiny.upload.maximum_size=6012
15+
digispark-tiny.build.mcu=attiny85
16+
digispark-tiny.build.f_cpu=16500000L
17+
digispark-tiny.build.board=AVR_DIGISPARK
18+
digispark-tiny.build.core=tiny
19+
digispark-tiny.build.variant=digispark
20+
digispark-tiny.upload.wait_for_upload_port = false
21+
digispark-tiny.upload.use_1200bps_touch = false
22+
digispark-tiny.upload.disable_flushing = false
23+
24+
25+
digispark-pro.name=Digispark Pro (Default 16 Mhz)
26+
digispark-pro.upload.using=micronucleusprog
27+
digispark-pro.upload.protocol=usb
28+
digispark-pro.upload.tool=micronucleus
29+
digispark-pro.upload.maximum_size=14844
30+
digispark-pro.build.mcu=attiny167
31+
digispark-pro.build.f_cpu=16000000L
32+
digispark-pro.build.board=AVR_DIGISPARKPRO
33+
digispark-pro.build.core=pro
34+
digispark-pro.build.variant=pro
35+
digispark-pro.upload.wait_for_upload_port = false
36+
digispark-pro.upload.use_1200bps_touch = false
37+
digispark-pro.upload.disable_flushing = false
38+
39+
digispark-pro32.name=Digispark Pro (16 Mhz) (32 byte buffer)
40+
digispark-pro32.upload.using=micronucleusprog
41+
digispark-pro32.upload.protocol=usb
42+
digispark-pro32.upload.tool=micronucleus
43+
digispark-pro32.upload.maximum_size=14844
44+
digispark-pro32.build.mcu=attiny167
45+
digispark-pro32.build.f_cpu=16000000L
46+
digispark-pro32.build.board=AVR_DIGISPARKPRO
47+
digispark-pro32.build.core=pro
48+
digispark-pro32.build.variant=pro32buffer
49+
digispark-pro32.upload.wait_for_upload_port = false
50+
digispark-pro32.upload.use_1200bps_touch = false
51+
digispark-pro32.upload.disable_flushing = false
52+
53+
digispark-pro64.name=Digispark Pro (16 Mhz) (64 byte buffer)
54+
digispark-pro64.upload.using=micronucleusprog
55+
digispark-pro64.upload.protocol=usb
56+
digispark-pro64.upload.tool=micronucleus
57+
digispark-pro64.upload.maximum_size=14844
58+
digispark-pro64.build.mcu=attiny167
59+
digispark-pro64.build.f_cpu=16000000L
60+
digispark-pro64.build.board=AVR_DIGISPARKPRO
61+
digispark-pro64.build.core=pro
62+
digispark-pro64.build.variant=pro64buffer
63+
digispark-pro64.upload.wait_for_upload_port = false
64+
digispark-pro64.upload.use_1200bps_touch = false
65+
digispark-pro64.upload.disable_flushing = false

hardware/digistump/avr/cores/license.txt

+465
Large diffs are not rendered by default.
+274
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
#ifndef Arduino_h
2+
#define Arduino_h
3+
4+
#include <stdlib.h>
5+
#include <string.h>
6+
#include <math.h>
7+
8+
#include <avr/pgmspace.h>
9+
#include <avr/io.h>
10+
#include <avr/interrupt.h>
11+
12+
#include "binary.h"
13+
14+
#ifdef __cplusplus
15+
extern "C"{
16+
#endif
17+
18+
#define ATTINY_CORE 1
19+
20+
#define HIGH 0x1
21+
#define LOW 0x0
22+
23+
#define INPUT 0x0
24+
#define OUTPUT 0x1
25+
#define INPUT_PULLUP 0x2
26+
27+
#define true 0x1
28+
#define false 0x0
29+
30+
#define PI 3.1415926535897932384626433832795
31+
#define HALF_PI 1.5707963267948966192313216916398
32+
#define TWO_PI 6.283185307179586476925286766559
33+
#define DEG_TO_RAD 0.017453292519943295769236907684886
34+
#define RAD_TO_DEG 57.295779513082320876798154814105
35+
36+
#define SERIAL 0x0
37+
#define DISPLAY 0x1
38+
39+
#define LSBFIRST 0
40+
#define MSBFIRST 1
41+
42+
#define CHANGE 1
43+
#define FALLING 2
44+
#define RISING 3
45+
46+
// undefine stdlib's abs if encountered
47+
#ifdef abs
48+
#undef abs
49+
#endif
50+
51+
#define min(a,b) ((a)<(b)?(a):(b))
52+
#define max(a,b) ((a)>(b)?(a):(b))
53+
#define abs(x) ((x)>0?(x):-(x))
54+
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
55+
#if __AVR_LIBC_VERSION__ < 10701UL
56+
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
57+
#endif
58+
#define radians(deg) ((deg)*DEG_TO_RAD)
59+
#define degrees(rad) ((rad)*RAD_TO_DEG)
60+
#define sq(x) ((x)*(x))
61+
62+
#define interrupts() sei()
63+
#define noInterrupts() cli()
64+
65+
#if F_CPU < 1000000L
66+
//Prevent a divide by 0 is
67+
#warning Clocks per microsecond < 1. To prevent divide by 0, it is rounded up to 1.
68+
static inline unsigned long clockCyclesPerMicrosecond() __attribute__ ((always_inline));
69+
static inline unsigned long clockCyclesPerMicrosecond()
70+
{
71+
//Inline function will be optimised out.
72+
return 1;
73+
}
74+
#else
75+
#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L )
76+
#endif
77+
78+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (F_CPU / 1000L) )
79+
#define microsecondsToClockCycles(a) ( ((a) * (F_CPU / 1000L)) / 1000L )
80+
81+
#define lowByte(w) ((uint8_t) ((w) & 0xff))
82+
#define highByte(w) ((uint8_t) ((w) >> 8))
83+
84+
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
85+
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
86+
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
87+
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
88+
89+
90+
typedef unsigned int word;
91+
92+
#define bit(b) (1UL << (b))
93+
94+
typedef uint8_t boolean;
95+
typedef uint8_t byte;
96+
97+
void initToneTimer(void);
98+
void init(void);
99+
100+
void pinMode(uint8_t, uint8_t);
101+
void digitalWrite(uint8_t, uint8_t);
102+
int digitalRead(uint8_t);
103+
int analogRead(uint8_t);
104+
void analogReference(uint8_t mode);
105+
void analogWrite(uint8_t, int);
106+
107+
unsigned long millis(void);
108+
unsigned long micros(void);
109+
void delay(unsigned long);
110+
void delayMicroseconds(unsigned int us);
111+
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
112+
113+
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
114+
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
115+
116+
void attachInterrupt(uint8_t, void (*)(void), int mode);
117+
void detachInterrupt(uint8_t);
118+
119+
void setup(void);
120+
void loop(void);
121+
122+
// Get the bit location within the hardware port of the given virtual pin.
123+
// This comes from the pins_*.c file for the active board configuration.
124+
125+
#define analogInPinToBit(P) (P)
126+
127+
extern const uint16_t PROGMEM port_to_mode_PGM[];
128+
extern const uint16_t PROGMEM port_to_input_PGM[];
129+
extern const uint16_t PROGMEM port_to_output_PGM[];
130+
131+
extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
132+
extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
133+
extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
134+
135+
// Get the bit location within the hardware port of the given virtual pin.
136+
// This comes from the pins_*.c file for the active board configuration.
137+
//
138+
// These perform slightly better as macros compared to inline functions
139+
//
140+
#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) )
141+
#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) )
142+
#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) )
143+
#define analogInPinToBit(P) (P)
144+
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) )
145+
#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) )
146+
#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )
147+
148+
#define NOT_A_PIN 0
149+
#define NOT_A_PORT 0
150+
151+
#define PA 1
152+
#define PB 2
153+
#define PC 3
154+
#define PD 4
155+
156+
#define NOT_ON_TIMER 0
157+
#define TIMER0A 1
158+
#define TIMER0B 2
159+
#define TIMER1A 3
160+
#define TIMER1B 4
161+
#define TIMER1D 5
162+
163+
#include "pins_arduino.h"
164+
165+
#ifndef USE_SOFTWARE_SERIAL
166+
//Default to hardware serial.
167+
#define USE_SOFTWARE_SERIAL 0
168+
#endif
169+
170+
/*=============================================================================
171+
Allow the ADC to be optional for low-power applications
172+
=============================================================================*/
173+
174+
#ifndef TIMER_TO_USE_FOR_MILLIS
175+
#define TIMER_TO_USE_FOR_MILLIS 0
176+
#endif
177+
/*
178+
Tone goes on whichever timer was not used for millis.
179+
*/
180+
#if TIMER_TO_USE_FOR_MILLIS == 1
181+
#define TIMER_TO_USE_FOR_TONE 0
182+
#else
183+
#define TIMER_TO_USE_FOR_TONE 1
184+
#endif
185+
186+
#if NUM_ANALOG_INPUTS > 0
187+
#define HAVE_ADC 1
188+
#ifndef INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER
189+
#define INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER 1
190+
#endif
191+
#else
192+
#define HAVE_ADC 0
193+
#if defined(INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER)
194+
#undef INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER
195+
#endif
196+
#define INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER 0
197+
#endif
198+
199+
#if !HAVE_ADC
200+
#undef INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER
201+
#define INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER 0
202+
#else
203+
#ifndef INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER
204+
#define INITIALIZE_ANALOG_TO_DIGITAL_CONVERTER 1
205+
#endif
206+
#endif
207+
208+
/*=============================================================================
209+
Allow the "secondary timers" to be optional for low-power applications
210+
=============================================================================*/
211+
212+
#ifndef INITIALIZE_SECONDARY_TIMERS
213+
#define INITIALIZE_SECONDARY_TIMERS 1
214+
#endif
215+
216+
217+
#ifdef __cplusplus
218+
} // extern "C"
219+
#endif
220+
221+
#ifdef __cplusplus
222+
#include "WCharacter.h"
223+
#include "WString.h"
224+
#include "HardwareSerial.h"
225+
#include "TinySoftwareSerial.h"
226+
227+
uint16_t makeWord(uint16_t w);
228+
uint16_t makeWord(byte h, byte l);
229+
230+
#define word(...) makeWord(__VA_ARGS__)
231+
232+
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
233+
234+
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);
235+
void noTone(uint8_t _pin = 255);
236+
237+
// WMath prototypes
238+
long random(long);
239+
long random(long, long);
240+
void randomSeed(unsigned int);
241+
long map(long, long, long, long, long);
242+
243+
#endif
244+
245+
/*=============================================================================
246+
Aliases for the interrupt service routine vector numbers so the code
247+
doesn't have to be riddled with #ifdefs.
248+
=============================================================================*/
249+
250+
#if defined( TIM0_COMPA_vect ) && ! defined( TIMER0_COMPA_vect )
251+
#define TIMER0_COMPA_vect TIM0_COMPA_vect
252+
#endif
253+
254+
#if defined( TIM0_COMPB_vect ) && ! defined( TIMER0_COMPB_vect )
255+
#define TIMER0_COMPB_vect TIM0_COMPB_vect
256+
#endif
257+
258+
#if defined( TIM0_OVF_vect ) && ! defined( TIMER0_OVF_vect )
259+
#define TIMER0_OVF_vect TIM0_OVF_vect
260+
#endif
261+
262+
#if defined( TIM1_COMPA_vect ) && ! defined( TIMER1_COMPA_vect )
263+
#define TIMER1_COMPA_vect TIM1_COMPA_vect
264+
#endif
265+
266+
#if defined( TIM1_COMPB_vect ) && ! defined( TIMER1_COMPB_vect )
267+
#define TIMER1_COMPB_vect TIM1_COMPB_vect
268+
#endif
269+
270+
#if defined( TIM1_OVF_vect ) && ! defined( TIMER1_OVF_vect )
271+
#define TIMER1_OVF_vect TIM1_OVF_vect
272+
#endif
273+
274+
#endif

0 commit comments

Comments
 (0)