Skip to content

Commit ec37c4d

Browse files
committed
Merge pull request arduino#97 from tbowmo/master
Mysensor HW definitions for mysensors micro board
2 parents d4d5463 + ff0644a commit ec37c4d

File tree

3 files changed

+364
-0
lines changed

3 files changed

+364
-0
lines changed

Diff for: hardware/MySensors/avr/boards.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
MysensorsMicro.name=Mysensors Micro
3+
4+
MysensorsMicro.upload.tool=arduino:avrdude
5+
MysensorsMicro.upload.protocol=arduino
6+
MysensorsMicro.upload.maximum_size=30720
7+
MysensorsMicro.upload.maximum_data_size=2048
8+
MysensorsMicro.upload.speed=57600
9+
10+
MysensorsMicro.bootloader.tool=arduino:avrdude
11+
MysensorsMicro.bootloader.unlock_bits=0x3F
12+
MysensorsMicro.bootloader.lock_bits=0x0F
13+
MysensorsMicro.bootloader.low_fuses=0xFF
14+
MysensorsMicro.bootloader.high_fuses=0xDA
15+
MysensorsMicro.bootloader.extended_fuses=0x05
16+
MysensorsMicro.bootloader.file=DualOptiboot/optiboot_atmega328p-pro8.hex
17+
18+
MysensorsMicro.build.board=AVR_MICRO8
19+
MysensorsMicro.build.core=arduino:arduino
20+
MysensorsMicro.build.variant=micro
21+
MysensorsMicro.build.mcu=atmega328p
22+
MysensorsMicro.build.f_cpu=8000000L

Diff for: hardware/MySensors/avr/platform.txt

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
2+
# Arduino AVR Core and platform.
3+
# ------------------------------
4+
5+
# For more info:
6+
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
7+
8+
name=MySensors Boards
9+
version=1.6.0
10+
11+
# AVR compile variables
12+
# ---------------------
13+
14+
# Default "compiler.path" is correct, change only if you want to overidde the initial value
15+
compiler.path={runtime.tools.avr-gcc.path}/bin/
16+
compiler.c.cmd=avr-gcc
17+
compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD
18+
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
19+
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
20+
compiler.c.elf.flags=-w -Os -Wl,--gc-sections
21+
compiler.c.elf.cmd=avr-gcc
22+
compiler.S.flags=-c -g -x assembler-with-cpp
23+
compiler.cpp.cmd=avr-g++
24+
compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
25+
compiler.ar.cmd=avr-ar
26+
compiler.ar.flags=rcs
27+
compiler.objcopy.cmd=avr-objcopy
28+
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
29+
compiler.elf2hex.flags=-O ihex -R .eeprom
30+
compiler.elf2hex.cmd=avr-objcopy
31+
compiler.ldflags=
32+
compiler.size.cmd=avr-size
33+
34+
# This can be overriden in boards.txt
35+
build.extra_flags=
36+
37+
# These can be overridden in platform.local.txt
38+
compiler.c.extra_flags=
39+
compiler.c.elf.extra_flags=
40+
compiler.S.extra_flags=
41+
compiler.cpp.extra_flags=
42+
compiler.ar.extra_flags=
43+
compiler.objcopy.eep.extra_flags=
44+
compiler.elf2hex.extra_flags=
45+
46+
# AVR compile patterns
47+
# --------------------
48+
49+
## Compile c files
50+
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
51+
52+
## Compile c++ files
53+
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
54+
55+
## Compile S files
56+
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} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
57+
58+
## Create archives
59+
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
60+
61+
## Combine gc-sections, archives, and objects
62+
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
63+
64+
## Create eeprom
65+
recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
66+
67+
## Create hex
68+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
69+
70+
## Compute size
71+
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
72+
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
73+
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
74+
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
75+
76+
77+
# AVR Uploader/Programmers tools
78+
# ------------------------------
79+
80+
tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
81+
tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
82+
83+
tools.avrdude.upload.params.verbose=-v
84+
tools.avrdude.upload.params.quiet=-q -q
85+
tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"
86+
87+
tools.avrdude.program.params.verbose=-v
88+
tools.avrdude.program.params.quiet=-q -q
89+
tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
90+
91+
tools.avrdude.erase.params.verbose=-v
92+
tools.avrdude.erase.params.quiet=-q -q
93+
tools.avrdude.erase.pattern="{cmd.path}" "-C{config.path}" {erase.verbose} -p{build.mcu} -c{protocol} {program.extra_params} -e -Ulock:w:{bootloader.unlock_bits}:m -Uefuse:w:{bootloader.extended_fuses}:m -Uhfuse:w:{bootloader.high_fuses}:m -Ulfuse:w:{bootloader.low_fuses}:m
94+
95+
tools.avrdude.bootloader.params.verbose=-v
96+
tools.avrdude.bootloader.params.quiet=-q -q
97+
tools.avrdude.bootloader.pattern="{cmd.path}" "-C{config.path}" {bootloader.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{runtime.platform.path}/bootloaders/{bootloader.file}:i" -Ulock:w:{bootloader.lock_bits}:m
98+
99+
100+
# USB Default Flags
101+
# Default blank usb manufacturer will be filled it at compile time
102+
# - from numeric vendor ID, set to Unknown otherwise
103+
build.usb_manufacturer=
104+
build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}'

Diff for: hardware/MySensors/avr/variants/micro/pins_arduino.h

+238
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
/*
2+
pins_arduino.h - Pin definition functions for Arduino
3+
Part of Arduino - http://www.arduino.cc/
4+
5+
Copyright (c) 2007 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.h 249 2007-02-03 16:52:51Z mellis $
23+
*/
24+
25+
#ifndef Pins_Arduino_h
26+
#define Pins_Arduino_h
27+
28+
#include <avr/pgmspace.h>
29+
30+
#define NUM_DIGITAL_PINS 20
31+
#define NUM_ANALOG_INPUTS 6
32+
#define analogInputToDigitalPin(p) ((p < 6) ? (p) + 14 : -1)
33+
34+
#if defined(__AVR_ATmega8__)
35+
#define digitalPinHasPWM(p) ((p) == 9 || (p) == 10 || (p) == 11)
36+
#else
37+
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)
38+
#endif
39+
40+
static const uint8_t SS = 10;
41+
static const uint8_t MOSI = 11;
42+
static const uint8_t MISO = 12;
43+
static const uint8_t SCK = 13;
44+
45+
static const uint8_t SDA = 18;
46+
static const uint8_t SCL = 19;
47+
#define LED_BUILTIN 13
48+
49+
static const uint8_t A0 = 14;
50+
static const uint8_t A1 = 15;
51+
static const uint8_t A2 = 16;
52+
static const uint8_t A3 = 17;
53+
static const uint8_t A4 = 18;
54+
static const uint8_t A5 = 19;
55+
static const uint8_t A6 = 20;
56+
static const uint8_t A7 = 21;
57+
58+
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
59+
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
60+
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
61+
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))
62+
63+
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
64+
65+
#ifdef ARDUINO_MAIN
66+
67+
// On the Arduino board, digital pins are also used
68+
// for the analog output (software PWM). Analog input
69+
// pins are a separate set.
70+
71+
// ATMEL ATMEGA8 & 168 / ARDUINO
72+
//
73+
// +-\/-+
74+
// PC6 1| |28 PC5 (AI 5)
75+
// (D 0) PD0 2| |27 PC4 (AI 4)
76+
// (D 1) PD1 3| |26 PC3 (AI 3)
77+
// (D 2) PD2 4| |25 PC2 (AI 2)
78+
// PWM+ (D 3) PD3 5| |24 PC1 (AI 1)
79+
// (D 4) PD4 6| |23 PC0 (AI 0)
80+
// VCC 7| |22 GND
81+
// GND 8| |21 AREF
82+
// PB6 9| |20 AVCC
83+
// PB7 10| |19 PB5 (D 13)
84+
// PWM+ (D 5) PD5 11| |18 PB4 (D 12)
85+
// PWM+ (D 6) PD6 12| |17 PB3 (D 11) PWM
86+
// (D 7) PD7 13| |16 PB2 (D 10) PWM
87+
// (D 8) PB0 14| |15 PB1 (D 9) PWM
88+
// +----+
89+
//
90+
// (PWM+ indicates the additional PWM pins on the ATmega168.)
91+
92+
// ATMEL ATMEGA1280 / ARDUINO
93+
//
94+
// 0-7 PE0-PE7 works
95+
// 8-13 PB0-PB5 works
96+
// 14-21 PA0-PA7 works
97+
// 22-29 PH0-PH7 works
98+
// 30-35 PG5-PG0 works
99+
// 36-43 PC7-PC0 works
100+
// 44-51 PJ7-PJ0 works
101+
// 52-59 PL7-PL0 works
102+
// 60-67 PD7-PD0 works
103+
// A0-A7 PF0-PF7
104+
// A8-A15 PK0-PK7
105+
106+
107+
// these arrays map port names (e.g. port B) to the
108+
// appropriate addresses for various functions (e.g. reading
109+
// and writing)
110+
const uint16_t PROGMEM port_to_mode_PGM[] = {
111+
NOT_A_PORT,
112+
NOT_A_PORT,
113+
(uint16_t) &DDRB,
114+
(uint16_t) &DDRC,
115+
(uint16_t) &DDRD,
116+
};
117+
118+
const uint16_t PROGMEM port_to_output_PGM[] = {
119+
NOT_A_PORT,
120+
NOT_A_PORT,
121+
(uint16_t) &PORTB,
122+
(uint16_t) &PORTC,
123+
(uint16_t) &PORTD,
124+
};
125+
126+
const uint16_t PROGMEM port_to_input_PGM[] = {
127+
NOT_A_PORT,
128+
NOT_A_PORT,
129+
(uint16_t) &PINB,
130+
(uint16_t) &PINC,
131+
(uint16_t) &PIND,
132+
};
133+
134+
const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
135+
PD, /* 0 */
136+
PD,
137+
PD,
138+
PD,
139+
PD,
140+
PD,
141+
PD,
142+
PD,
143+
PB, /* 8 */
144+
PB,
145+
PB,
146+
PB,
147+
PB,
148+
PB,
149+
PC, /* 14 */
150+
PC,
151+
PC,
152+
PC,
153+
PC,
154+
PC,
155+
};
156+
157+
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
158+
_BV(0), /* 0, port D */
159+
_BV(1),
160+
_BV(2),
161+
_BV(3),
162+
_BV(4),
163+
_BV(5),
164+
_BV(6),
165+
_BV(7),
166+
_BV(0), /* 8, port B */
167+
_BV(1),
168+
_BV(2),
169+
_BV(3),
170+
_BV(4),
171+
_BV(5),
172+
_BV(0), /* 14, port C */
173+
_BV(1),
174+
_BV(2),
175+
_BV(3),
176+
_BV(4),
177+
_BV(5),
178+
};
179+
180+
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
181+
NOT_ON_TIMER, /* 0 - port D */
182+
NOT_ON_TIMER,
183+
NOT_ON_TIMER,
184+
// on the ATmega168, digital pin 3 has hardware pwm
185+
#if defined(__AVR_ATmega8__)
186+
NOT_ON_TIMER,
187+
#else
188+
TIMER2B,
189+
#endif
190+
NOT_ON_TIMER,
191+
// on the ATmega168, digital pins 5 and 6 have hardware pwm
192+
#if defined(__AVR_ATmega8__)
193+
NOT_ON_TIMER,
194+
NOT_ON_TIMER,
195+
#else
196+
TIMER0B,
197+
TIMER0A,
198+
#endif
199+
NOT_ON_TIMER,
200+
NOT_ON_TIMER, /* 8 - port B */
201+
TIMER1A,
202+
TIMER1B,
203+
#if defined(__AVR_ATmega8__)
204+
TIMER2,
205+
#else
206+
TIMER2A,
207+
#endif
208+
NOT_ON_TIMER,
209+
NOT_ON_TIMER,
210+
NOT_ON_TIMER,
211+
NOT_ON_TIMER, /* 14 - port C */
212+
NOT_ON_TIMER,
213+
NOT_ON_TIMER,
214+
NOT_ON_TIMER,
215+
NOT_ON_TIMER,
216+
};
217+
218+
#endif
219+
220+
// These serial port names are intended to allow libraries and architecture-neutral
221+
// sketches to automatically default to the correct port name for a particular type
222+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
223+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
224+
//
225+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
226+
//
227+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
228+
//
229+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
230+
//
231+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
232+
//
233+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
234+
// pins are NOT connected to anything by default.
235+
#define SERIAL_PORT_MONITOR Serial
236+
#define SERIAL_PORT_HARDWARE Serial
237+
238+
#endif

0 commit comments

Comments
 (0)