Skip to content

Commit 778004b

Browse files
first commit
0 parents  commit 778004b

File tree

237 files changed

+143173
-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.

237 files changed

+143173
-0
lines changed

COMPATIBILITY

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Ringbuffer.h
2+
3+
SERIAL_BUFFER_SIZE is 256 instead of 64 to account for the CDCSerial class requirements
4+
5+
6+
hooks.h
7+
hooks.c
8+
9+
sysTickHook(), svcHook() and pendSVHook() are not implemented as they are part of libstm32l4_dragonfly.a
10+
11+
12+
Uart.h
13+
14+
availableForWrite() has been added as UART output is buffered
15+
write(buffer, size) has been added as UART output is buffered (more efficient to write a numbers if bytes)
16+
17+
18+
CDC.h
19+
20+
based upon HardwareSerial
21+
22+
23+
Reset.h
24+
25+
tickReset() not available; code aequivalent implemented in libstm32l4_dragonfly.a
26+
27+
28+
wiring_analog.h
29+
30+
analogReference() not available do to hardware
31+
32+
wiring_digital.c
33+
34+
digitalWrite() is documented pre 1.0.1 to set the pullup on a INPUT pin; this is not supported.
35+
36+
WInterrupts.c
37+
38+
LOW & HIGH are ignored ... pointless ...
39+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# arduino-STM32L4

boards.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
3+
##############################################################
4+
5+
# Tlera Dragonfly
6+
# ---------------------------------------
7+
dragonfly.name=Dragonfly
8+
dragonfly.vid.0=0x1209
9+
dragonfly.pid.0=0x6667
10+
11+
dragonfly.upload.tool=stm32l4_upload
12+
dragonfly.upload.protocol=dfu
13+
dragonfly.upload.maximum_size=524288
14+
dragonfly.upload.use_1200bps_touch=true
15+
dragonfly.upload.wait_for_upload_port=false
16+
dragonfly.upload.native_usb=false
17+
18+
dragonfly.bootloader.tool=stm32l4_upload
19+
dragonfly.bootloader.protocol=dfu
20+
dragonfly.bootloader.file=dragonfly.bin
21+
22+
dragonfly.build.mcu=cortex-m4
23+
dragonfly.build.f_cpu=80000000L
24+
dragonfly.build.board=STM32L4_DRAGONFLY
25+
dragonfly.build.arch=STM32L4
26+
dragonfly.build.core=stm32l4
27+
dragonfly.build.extra_flags=-DSTM32L476xx -D__FPU_PRESENT=1 -march=armv7e-m -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mabi=aapcs -mslow-flash-data
28+
dragonfly.build.ldscript=linker_scripts/flash.ld
29+
dragonfly.build.variant=dragonfly
30+
dragonfly.build.variant_system_lib=stm32l4_dragonfly
31+
dragonfly.build.variant_system_include="-I{runtime.platform.path}/system/libstm32l4_dragonfly/CMSIS/Include" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/CMSIS/Device/ST/STM32L4xx/Include" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/USB/HAL/Inc" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/USB/Core/Inc" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/USB/Class/CDC/Inc" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/USB/Class/MSC/Inc" "-I{runtime.platform.path}/system/libstm32l4_dragonfly/USB" "-I{runtime.platform.path}/system/libstm32l4_dragonfly"
32+
dragonfly.build.vid=0x1209
33+
dragonfly.build.pid=0x6667

bootloaders/dragonfly.bin

36 KB
Binary file not shown.

cores/stm32l4/#wiring_digital.h#

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
Copyright (c) 2014 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#ifndef _WIRING_DIGITAL_
20+
#define _WIRING_DIGITAL_
21+
22+
#ifdef __cplusplus
23+
extern "C" {
24+
#endif
25+
26+
#include "WVariant.h"
27+
28+
29+
*
30+
* \param ulPin The number of the pin whose mode you wish to set
31+
* \param ulMode Can be INPUT, OUTPUT, INPUT_PULLUP or INPUT_PULLDOWN
32+
*/
33+
extern void pinMode( uint32_t dwPin, uint32_t dwMode ) ;
34+
35+
/**
36+
* \brief Write a HIGH or a LOW value to a digital pin.
37+
*
38+
* If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the
39+
* corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW.
40+
*
41+
* If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal
42+
* 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup
43+
* resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely
44+
* cause. The remedy is to set the pin to an output with the pinMode() function.
45+
*
46+
* \note Digital pin PIN_LED is harder to use as a digital input than the other digital pins because it has an LED
47+
* and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up
48+
* resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor
49+
* pull the voltage level down, meaning it always returns LOW. If you must use pin PIN_LED as a digital input, use an
50+
* external pull down resistor.
51+
*
52+
* \param dwPin the pin number
53+
* \param dwVal HIGH or LOW
54+
*/
55+
extern void digitalWrite( uint32_t dwPin, uint32_t dwVal ) ;
56+
57+
/**
58+
* \brief Reads the value from a specified digital pin, either HIGH or LOW.
59+
*
60+
* \param ulPin The number of the digital pin you want to read (int)
61+
*
62+
* \return HIGH or LOW
63+
*/
64+
extern int digitalRead( uint32_t ulPin ) ;
65+
66+
#ifdef __cplusplus
67+
}
68+
#endif
69+
70+
#endif /* _WIRING_DIGITAL_ */

cores/stm32l4/Arduino.h

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/*
2+
Arduino.h - Main include file for the Arduino SDK
3+
Copyright (c) 2014 Arduino LLC. 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 Arduino_h
21+
#define Arduino_h
22+
23+
#include <stdbool.h>
24+
#include <stdint.h>
25+
#include <stdlib.h>
26+
#include <string.h>
27+
#include <math.h>
28+
29+
typedef bool boolean;
30+
typedef uint8_t byte;
31+
typedef uint16_t word;
32+
33+
// some libraries and sketches depend on this AVR stuff,
34+
// assuming Arduino.h or WProgram.h automatically includes it...
35+
//
36+
#include "avr/pgmspace.h"
37+
#include "avr/interrupt.h"
38+
39+
#include "binary.h"
40+
#include "itoa.h"
41+
42+
#ifdef __cplusplus
43+
extern "C"{
44+
#endif // __cplusplus
45+
46+
// Include ST headers
47+
#include "stm32l4xx.h"
48+
#undef DAC1
49+
#undef SPI1
50+
#undef SPI2
51+
52+
#include "wiring_constants.h"
53+
54+
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
55+
#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) )
56+
#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) )
57+
58+
void yield( void ) ;
59+
60+
/* sketch */
61+
void setup( void ) ;
62+
void loop( void ) ;
63+
64+
#include "WVariant.h"
65+
66+
#ifdef __cplusplus
67+
} // extern "C"
68+
#endif
69+
70+
// The following headers are for C++ only compilation
71+
#ifdef __cplusplus
72+
#include "WCharacter.h"
73+
#include "WString.h"
74+
#include "Tone.h"
75+
#include "WMath.h"
76+
#include "HardwareSerial.h"
77+
#endif
78+
#ifdef __cplusplus
79+
#include "CDC.h"
80+
#include "Uart.h"
81+
#endif
82+
83+
// Include board variant
84+
#include "variant.h"
85+
86+
#include "wiring.h"
87+
#include "wiring_analog.h"
88+
#include "wiring_digital.h"
89+
#include "wiring_pulse.h"
90+
#include "wiring_shift.h"
91+
#include "WInterrupts.h"
92+
93+
// undefine stdlib's abs if encountered
94+
#ifdef abs
95+
#undef abs
96+
#endif // abs
97+
98+
#define min(a,b) ((a)<(b)?(a):(b))
99+
#define max(a,b) ((a)>(b)?(a):(b))
100+
#define abs(x) ((x)>0?(x):-(x))
101+
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
102+
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
103+
#define radians(deg) ((deg)*DEG_TO_RAD)
104+
#define degrees(rad) ((rad)*RAD_TO_DEG)
105+
#define sq(x) ((x)*(x))
106+
107+
#define interrupts() __enable_irq()
108+
#define noInterrupts() __disable_irq()
109+
110+
#define lowByte(w) ((uint8_t) ((w) & 0xff))
111+
#define highByte(w) ((uint8_t) ((w) >> 8))
112+
113+
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
114+
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
115+
#define bitClear(value, bit) ((value) &= ~(1UL << (bit)))
116+
#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit))
117+
118+
#define bit(b) (1UL << (b))
119+
120+
#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606)
121+
// Interrupts
122+
#define digitalPinToInterrupt(P) ( P )
123+
#endif
124+
125+
#endif // Arduino_h

0 commit comments

Comments
 (0)