mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-26 20:38:45 +08:00
Create Arduino ZIP
This commit is contained in:
parent
7fd73fe96d
commit
168483335e
80
arduino/etl.h
Normal file
80
arduino/etl.h
Normal file
@ -0,0 +1,80 @@
|
||||
#if defined(TEENSYDUINO)
|
||||
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
#define BOARD "Teensy 2.0"
|
||||
#elif defined(__AVR_AT90USB1286__)
|
||||
#define BOARD "Teensy++ 2.0"
|
||||
#elif defined(__MK20DX128__)
|
||||
#define BOARD "Teensy 3.0"
|
||||
#elif defined(__MK20DX256__)
|
||||
#define BOARD "Teensy 3.2" // and Teensy 3.1 (obsolete)
|
||||
#elif defined(__MKL26Z64__)
|
||||
#define BOARD "Teensy LC"
|
||||
#elif defined(__MK64FX512__)
|
||||
#define BOARD "Teensy 3.5"
|
||||
#elif defined(__MK66FX1M0__)
|
||||
#define BOARD "Teensy 3.6"
|
||||
#else
|
||||
#error "Unknown board"
|
||||
#endif
|
||||
|
||||
#else // --------------- Arduino ------------------
|
||||
|
||||
#if defined(ARDUINO_AVR_ADK)
|
||||
#define BOARD "Mega Adk"
|
||||
#elif defined(ARDUINO_AVR_BT) // Bluetooth
|
||||
#define BOARD "Bt"
|
||||
#elif defined(ARDUINO_AVR_DUEMILANOVE)
|
||||
#define BOARD "Duemilanove"
|
||||
#elif defined(ARDUINO_AVR_ESPLORA)
|
||||
#define BOARD "Esplora"
|
||||
#elif defined(ARDUINO_AVR_ETHERNET)
|
||||
#define BOARD "Ethernet"
|
||||
#elif defined(ARDUINO_AVR_FIO)
|
||||
#define BOARD "Fio"
|
||||
#elif defined(ARDUINO_AVR_GEMMA)
|
||||
#define BOARD "Gemma"
|
||||
#elif defined(ARDUINO_AVR_LEONARDO)
|
||||
#define BOARD "Leonardo"
|
||||
#elif defined(ARDUINO_AVR_LILYPAD)
|
||||
#define BOARD "Lilypad"
|
||||
#elif defined(ARDUINO_AVR_LILYPAD_USB)
|
||||
#define BOARD "Lilypad Usb"
|
||||
#elif defined(ARDUINO_AVR_MEGA)
|
||||
#define BOARD "Mega"
|
||||
#elif defined(ARDUINO_AVR_MEGA2560)
|
||||
#define BOARD "Mega 2560"
|
||||
#elif defined(ARDUINO_AVR_MICRO)
|
||||
#define BOARD "Micro"
|
||||
#elif defined(ARDUINO_AVR_MINI)
|
||||
#define BOARD "Mini"
|
||||
#elif defined(ARDUINO_AVR_NANO)
|
||||
#define BOARD "Nano"
|
||||
#elif defined(ARDUINO_AVR_NG)
|
||||
#define BOARD "NG"
|
||||
#elif defined(ARDUINO_AVR_PRO)
|
||||
#define BOARD "Pro"
|
||||
#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
|
||||
#define BOARD "Robot Ctrl"
|
||||
#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
|
||||
#define BOARD "Robot Motor"
|
||||
#elif defined(ARDUINO_AVR_UNO)
|
||||
#define BOARD "Uno"
|
||||
#elif defined(ARDUINO_AVR_YUN)
|
||||
#define BOARD "Yun"
|
||||
|
||||
// These boards must be installed separately:
|
||||
#elif defined(ARDUINO_SAM_DUE)
|
||||
#define BOARD "Due"
|
||||
#elif defined(ARDUINO_SAMD_ZERO)
|
||||
#define BOARD "Zero"
|
||||
#elif defined(ARDUINO_ARC32_TOOLS)
|
||||
#define BOARD "101"
|
||||
#else
|
||||
#error "Unknown board"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <etl/array.h>
|
||||
#include <etl/array_view.h>
|
||||
48
create_arduino_library.py
Normal file
48
create_arduino_library.py
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
import shutil
|
||||
import os
|
||||
|
||||
# https://arduino.github.io/arduino-cli/latest/library-specification/
|
||||
|
||||
#
|
||||
# Some Constants
|
||||
library_name = 'Embedded_Template_Library'
|
||||
|
||||
#
|
||||
# Get the current Path of the script
|
||||
dirname = os.path.dirname(__file__)
|
||||
dest = os.path.join(dirname, library_name)
|
||||
print('The destination folder is ', dest)
|
||||
|
||||
#
|
||||
# Copy the ETL to the Arduino-Library Folder
|
||||
src = os.path.join(dirname, 'include')
|
||||
print('The source folder is ', src)
|
||||
print('The destination folder is ', dest)
|
||||
shutil.copytree(src, os.path.join(dest, 'src'), dirs_exist_ok=True)
|
||||
print('Done adding ETL...')
|
||||
|
||||
#
|
||||
# Add files from the arduino folder
|
||||
filename = 'etl.h'
|
||||
src = os.path.join(os.path.join(dirname, 'arduino'), filename)
|
||||
print('The source is ', src)
|
||||
print('The destination is ', os.path.join(os.path.join(dest, 'src'), filename))
|
||||
shutil.copyfile(src, os.path.join(os.path.join(dest, 'src'), filename))
|
||||
print('Done adding Arduino...')
|
||||
|
||||
#
|
||||
# Add any additional file (library.properties)
|
||||
filename = 'library.properties'
|
||||
shutil.copyfile(os.path.join(dirname, filename), os.path.join(dest, filename))
|
||||
print('Done adding additional files...')
|
||||
|
||||
#
|
||||
# Zip the Folder to be Arduino-Compatible
|
||||
print('Make archive...')
|
||||
shutil.make_archive(os.path.join(os.path.join(dirname, 'arduino'), library_name), 'zip', dest)
|
||||
|
||||
#
|
||||
# Remove temporary directory
|
||||
print('Removing temporary files...')
|
||||
shutil.rmtree(dest)
|
||||
Loading…
x
Reference in New Issue
Block a user