Added SPDX to 30 more files - spdx-49
This commit is contained in:
parent
bfe5427a4a
commit
39e532211a
30 changed files with 429 additions and 307 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
### Adafruit logo
|
### Adafruit logo
|
||||||
|
|
||||||
"""Adafruit logo created from bitmap,
|
"""Adafruit logo created from bitmap,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Kevin J. Walters for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
### scope-xy-adafruitlogo v1.0
|
### scope-xy-adafruitlogo v1.0
|
||||||
|
|
||||||
"""Output a logo to an oscilloscope in X-Y mode on an Adafruit M4
|
"""Output a logo to an oscilloscope in X-Y mode on an Adafruit M4
|
||||||
|
|
|
||||||
|
|
@ -1,173 +1,177 @@
|
||||||
#!/usr/bin/python3
|
# SPDX-FileCopyrightText: 2019 Kevin J. Walters for Adafruit Industries
|
||||||
|
#
|
||||||
### pngtowav v1.0
|
# SPDX-License-Identifier: MIT
|
||||||
"""Convert a list of png images to pseudo composite video in wav file form.
|
|
||||||
|
#!/usr/bin/python3
|
||||||
This is Python code not intended for running on a microcontroller board.
|
|
||||||
"""
|
### pngtowav v1.0
|
||||||
|
"""Convert a list of png images to pseudo composite video in wav file form.
|
||||||
### MIT License
|
|
||||||
|
This is Python code not intended for running on a microcontroller board.
|
||||||
### Copyright (c) 2019 Kevin J. Walters
|
"""
|
||||||
|
|
||||||
### Permission is hereby granted, free of charge, to any person obtaining a copy
|
### MIT License
|
||||||
### of this software and associated documentation files (the "Software"), to deal
|
|
||||||
### in the Software without restriction, including without limitation the rights
|
### Copyright (c) 2019 Kevin J. Walters
|
||||||
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
### copies of the Software, and to permit persons to whom the Software is
|
### Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
### furnished to do so, subject to the following conditions:
|
### of this software and associated documentation files (the "Software"), to deal
|
||||||
|
### in the Software without restriction, including without limitation the rights
|
||||||
### The above copyright notice and this permission notice shall be included in all
|
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
### copies or substantial portions of the Software.
|
### copies of the Software, and to permit persons to whom the Software is
|
||||||
|
### furnished to do so, subject to the following conditions:
|
||||||
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
### The above copyright notice and this permission notice shall be included in all
|
||||||
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
### copies or substantial portions of the Software.
|
||||||
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
### SOFTWARE.
|
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
import getopt
|
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
import sys
|
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
import array
|
### SOFTWARE.
|
||||||
import wave
|
|
||||||
|
import getopt
|
||||||
import imageio
|
import sys
|
||||||
|
import array
|
||||||
|
import wave
|
||||||
### globals
|
|
||||||
### pylint: disable=invalid-name
|
import imageio
|
||||||
### start_offset of 1 can help if triggering on oscilloscope
|
|
||||||
### is missing alternate lines
|
|
||||||
debug = 0
|
### globals
|
||||||
verbose = False
|
### pylint: disable=invalid-name
|
||||||
movie_file = False
|
### start_offset of 1 can help if triggering on oscilloscope
|
||||||
output_filename = "dacanim.wav"
|
### is missing alternate lines
|
||||||
fps = 50
|
debug = 0
|
||||||
threshold = 128 ### pixel level
|
verbose = False
|
||||||
replaceforsync = False
|
movie_file = False
|
||||||
start_offset = 1
|
output_filename = "dacanim.wav"
|
||||||
|
fps = 50
|
||||||
max_dac_v = 3.3
|
threshold = 128 ### pixel level
|
||||||
### 16 bit wav files always use signed representation for data
|
replaceforsync = False
|
||||||
dac_offtop = 2**15-1 ### 3.30V
|
start_offset = 1
|
||||||
dac_sync = -2**15 ### 0.00V
|
|
||||||
### image from 3.00V to 0.30V
|
max_dac_v = 3.3
|
||||||
dac_top = round(3.00 / max_dac_v * (2**16-1)) - 2**15
|
### 16 bit wav files always use signed representation for data
|
||||||
dac_bottom = round(0.30 / max_dac_v * (2**16-1)) - 2**15
|
dac_offtop = 2**15-1 ### 3.30V
|
||||||
|
dac_sync = -2**15 ### 0.00V
|
||||||
|
### image from 3.00V to 0.30V
|
||||||
def usage(exit_code): ### pylint: disable=missing-docstring
|
dac_top = round(3.00 / max_dac_v * (2**16-1)) - 2**15
|
||||||
print("pngtowav: "
|
dac_bottom = round(0.30 / max_dac_v * (2**16-1)) - 2**15
|
||||||
+ "[-d] [-f fps] [-h] [-m] [-o outputfilename] [-r] [-s lineoffset] [-t threshold] [-v]",
|
|
||||||
file=sys.stderr)
|
|
||||||
if exit_code is not None:
|
def usage(exit_code): ### pylint: disable=missing-docstring
|
||||||
sys.exit(exit_code)
|
print("pngtowav: "
|
||||||
|
+ "[-d] [-f fps] [-h] [-m] [-o outputfilename] [-r] [-s lineoffset] [-t threshold] [-v]",
|
||||||
|
file=sys.stderr)
|
||||||
def image_to_dac(img, row_offset, first_pix, dac_y_range):
|
if exit_code is not None:
|
||||||
"""Convert a single image to DAC output."""
|
sys.exit(exit_code)
|
||||||
dac_out = array.array("h", [])
|
|
||||||
|
|
||||||
img_height, img_width = img.shape
|
def image_to_dac(img, row_offset, first_pix, dac_y_range):
|
||||||
if verbose:
|
"""Convert a single image to DAC output."""
|
||||||
print("W,H", img_width, img_height)
|
dac_out = array.array("h", [])
|
||||||
|
|
||||||
for row_o in range(img_height):
|
img_height, img_width = img.shape
|
||||||
row = (row_o + row_offset) % img_height
|
if verbose:
|
||||||
### Currently using 0 to (n-1)/n range
|
print("W,H", img_width, img_height)
|
||||||
y_pos = round(dac_top - row / (img_height - 1) * dac_y_range)
|
|
||||||
if verbose:
|
for row_o in range(img_height):
|
||||||
print("Adding row", row, "at y_pos", y_pos)
|
row = (row_o + row_offset) % img_height
|
||||||
dac_out.extend(array.array("h",
|
### Currently using 0 to (n-1)/n range
|
||||||
[dac_sync]
|
y_pos = round(dac_top - row / (img_height - 1) * dac_y_range)
|
||||||
+ [y_pos if x >= threshold else dac_offtop
|
if verbose:
|
||||||
for x in img[row, first_pix:]]))
|
print("Adding row", row, "at y_pos", y_pos)
|
||||||
return dac_out, img_width, img_height
|
dac_out.extend(array.array("h",
|
||||||
|
[dac_sync]
|
||||||
|
+ [y_pos if x >= threshold else dac_offtop
|
||||||
def write_wav(filename, data, framerate):
|
for x in img[row, first_pix:]]))
|
||||||
"""Create one channel 16bit wav file."""
|
return dac_out, img_width, img_height
|
||||||
wav_file = wave.open(filename, "w")
|
|
||||||
nchannels = 1
|
|
||||||
sampwidth = 2
|
def write_wav(filename, data, framerate):
|
||||||
nframes = len(data)
|
"""Create one channel 16bit wav file."""
|
||||||
comptype = "NONE"
|
wav_file = wave.open(filename, "w")
|
||||||
compname = "not compressed"
|
nchannels = 1
|
||||||
if verbose:
|
sampwidth = 2
|
||||||
print("Writing wav file", filename, "at rate", framerate,
|
nframes = len(data)
|
||||||
"with", nframes, "samples")
|
comptype = "NONE"
|
||||||
wav_file.setparams((nchannels, sampwidth, framerate, nframes,
|
compname = "not compressed"
|
||||||
comptype, compname))
|
if verbose:
|
||||||
wav_file.writeframes(data)
|
print("Writing wav file", filename, "at rate", framerate,
|
||||||
wav_file.close()
|
"with", nframes, "samples")
|
||||||
|
wav_file.setparams((nchannels, sampwidth, framerate, nframes,
|
||||||
|
comptype, compname))
|
||||||
def main(cmdlineargs): ### pylint: disable=too-many-branches
|
wav_file.writeframes(data)
|
||||||
"""main(args)"""
|
wav_file.close()
|
||||||
global debug, fps, movie_file, output_filename, replaceforsync ### pylint: disable=global-statement
|
|
||||||
global threshold, start_offset, verbose ### pylint: disable=global-statement
|
|
||||||
|
def main(cmdlineargs): ### pylint: disable=too-many-branches
|
||||||
try:
|
"""main(args)"""
|
||||||
opts, args = getopt.getopt(cmdlineargs,
|
global debug, fps, movie_file, output_filename, replaceforsync ### pylint: disable=global-statement
|
||||||
"f:hmo:rs:t:v", ["help", "output="])
|
global threshold, start_offset, verbose ### pylint: disable=global-statement
|
||||||
except getopt.GetoptError as err:
|
|
||||||
print(err,
|
try:
|
||||||
file=sys.stderr)
|
opts, args = getopt.getopt(cmdlineargs,
|
||||||
usage(2)
|
"f:hmo:rs:t:v", ["help", "output="])
|
||||||
for opt, arg in opts:
|
except getopt.GetoptError as err:
|
||||||
if opt == "-d": ### pylint counts these towards too-many-branches :(
|
print(err,
|
||||||
debug = 1
|
file=sys.stderr)
|
||||||
elif opt == "-f":
|
usage(2)
|
||||||
fps = int(arg)
|
for opt, arg in opts:
|
||||||
elif opt in ("-h", "--help"):
|
if opt == "-d": ### pylint counts these towards too-many-branches :(
|
||||||
usage(0)
|
debug = 1
|
||||||
elif opt == "-m":
|
elif opt == "-f":
|
||||||
movie_file = True
|
fps = int(arg)
|
||||||
elif opt in ("-o", "--output"):
|
elif opt in ("-h", "--help"):
|
||||||
output_filename = arg
|
usage(0)
|
||||||
elif opt == "-r":
|
elif opt == "-m":
|
||||||
replaceforsync = True
|
movie_file = True
|
||||||
elif opt == "-s":
|
elif opt in ("-o", "--output"):
|
||||||
start_offset = int(arg)
|
output_filename = arg
|
||||||
elif opt == "-t":
|
elif opt == "-r":
|
||||||
threshold = int(arg)
|
replaceforsync = True
|
||||||
elif opt == "-v":
|
elif opt == "-s":
|
||||||
verbose = True
|
start_offset = int(arg)
|
||||||
else:
|
elif opt == "-t":
|
||||||
print("Internal error: unhandled option",
|
threshold = int(arg)
|
||||||
file=sys.stderr)
|
elif opt == "-v":
|
||||||
sys.exit(3)
|
verbose = True
|
||||||
|
else:
|
||||||
dac_samples = array.array("h", [])
|
print("Internal error: unhandled option",
|
||||||
|
file=sys.stderr)
|
||||||
### Decide whether to replace first column with sync pulse
|
sys.exit(3)
|
||||||
### or add it as an additional column
|
|
||||||
first_pix = 1 if replaceforsync else 0
|
dac_samples = array.array("h", [])
|
||||||
|
|
||||||
### Read each frame, either
|
### Decide whether to replace first column with sync pulse
|
||||||
### many single image filenames in args or
|
### or add it as an additional column
|
||||||
### one or more video (animated gifs) (needs -m on command line)
|
first_pix = 1 if replaceforsync else 0
|
||||||
dac_y_range = dac_top - dac_bottom
|
|
||||||
row_offset = 0
|
### Read each frame, either
|
||||||
for arg in args:
|
### many single image filenames in args or
|
||||||
if verbose:
|
### one or more video (animated gifs) (needs -m on command line)
|
||||||
print("PROCESSING", arg)
|
dac_y_range = dac_top - dac_bottom
|
||||||
if movie_file:
|
row_offset = 0
|
||||||
images = imageio.mimread(arg)
|
for arg in args:
|
||||||
else:
|
if verbose:
|
||||||
images = [imageio.imread(arg)]
|
print("PROCESSING", arg)
|
||||||
|
if movie_file:
|
||||||
for img in images:
|
images = imageio.mimread(arg)
|
||||||
img_output, width, height = image_to_dac(img, row_offset,
|
else:
|
||||||
first_pix, dac_y_range)
|
images = [imageio.imread(arg)]
|
||||||
dac_samples.extend(img_output)
|
|
||||||
row_offset += start_offset
|
for img in images:
|
||||||
|
img_output, width, height = image_to_dac(img, row_offset,
|
||||||
write_wav(output_filename, dac_samples,
|
first_pix, dac_y_range)
|
||||||
(width + (1 - first_pix)) * height * fps)
|
dac_samples.extend(img_output)
|
||||||
|
row_offset += start_offset
|
||||||
|
|
||||||
if __name__ == "__main__":
|
write_wav(output_filename, dac_samples,
|
||||||
main(sys.argv[1:])
|
(width + (1 - first_pix)) * height * fps)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
||||||
|
|
|
||||||
|
|
@ -1,134 +1,138 @@
|
||||||
#!/usr/bin/python3
|
# SPDX-FileCopyrightText: 2019 Kevin J. Walters for Adafruit Industries
|
||||||
|
#
|
||||||
### svgtopy v1.0
|
# SPDX-License-Identifier: MIT
|
||||||
"""Print vectors from an SVG input file in python list format
|
|
||||||
for easy pasting into a program.
|
#!/usr/bin/python3
|
||||||
|
|
||||||
This is Python code not intended for running on a microcontroller board.
|
### svgtopy v1.0
|
||||||
"""
|
"""Print vectors from an SVG input file in python list format
|
||||||
|
for easy pasting into a program.
|
||||||
### MIT License
|
|
||||||
|
This is Python code not intended for running on a microcontroller board.
|
||||||
### Copyright (c) 2019 Kevin J. Walters
|
"""
|
||||||
|
|
||||||
### Permission is hereby granted, free of charge, to any person obtaining a copy
|
### MIT License
|
||||||
### of this software and associated documentation files (the "Software"), to deal
|
|
||||||
### in the Software without restriction, including without limitation the rights
|
### Copyright (c) 2019 Kevin J. Walters
|
||||||
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
### copies of the Software, and to permit persons to whom the Software is
|
### Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
### furnished to do so, subject to the following conditions:
|
### of this software and associated documentation files (the "Software"), to deal
|
||||||
|
### in the Software without restriction, including without limitation the rights
|
||||||
### The above copyright notice and this permission notice shall be included in all
|
### to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
### copies or substantial portions of the Software.
|
### copies of the Software, and to permit persons to whom the Software is
|
||||||
|
### furnished to do so, subject to the following conditions:
|
||||||
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
### The above copyright notice and this permission notice shall be included in all
|
||||||
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
### copies or substantial portions of the Software.
|
||||||
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
### SOFTWARE.
|
### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
### AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
### LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
### it only understands M and L in SVG
|
### OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
### SOFTWARE.
|
||||||
### Worth looking at SVG libraries to see if they
|
|
||||||
### can parse/transform SVG data
|
|
||||||
|
### it only understands M and L in SVG
|
||||||
import getopt
|
|
||||||
import sys
|
### Worth looking at SVG libraries to see if they
|
||||||
import re
|
### can parse/transform SVG data
|
||||||
##import fileinput
|
|
||||||
import xml.etree.ElementTree as ET
|
import getopt
|
||||||
|
import sys
|
||||||
### globals
|
import re
|
||||||
### pylint: disable=invalid-name
|
##import fileinput
|
||||||
debug = 0
|
import xml.etree.ElementTree as ET
|
||||||
verbose = False
|
|
||||||
|
### globals
|
||||||
|
### pylint: disable=invalid-name
|
||||||
def usage(exit_code): ### pylint: disable=missing-docstring
|
debug = 0
|
||||||
print("""Usage: svgtopy [-d] [-h] [-v] [--help]
|
verbose = False
|
||||||
Convert an svg file from from standard input to comma-separated tuples
|
|
||||||
on standard output for inclusion as a list in a python program.""",
|
|
||||||
file=sys.stderr)
|
def usage(exit_code): ### pylint: disable=missing-docstring
|
||||||
if exit_code is not None:
|
print("""Usage: svgtopy [-d] [-h] [-v] [--help]
|
||||||
sys.exit(exit_code)
|
Convert an svg file from from standard input to comma-separated tuples
|
||||||
|
on standard output for inclusion as a list in a python program.""",
|
||||||
|
file=sys.stderr)
|
||||||
def search_path_d(svgdata, point_groups):
|
if exit_code is not None:
|
||||||
"""Look for M and L in the SVG d attribute of a path node"""
|
sys.exit(exit_code)
|
||||||
|
|
||||||
points = []
|
|
||||||
for match in re.finditer(r"([A-Za-z])([\d\.]+)\s+([\d\.]+)\s*", svgdata):
|
def search_path_d(svgdata, point_groups):
|
||||||
if match:
|
"""Look for M and L in the SVG d attribute of a path node"""
|
||||||
cmd = match.group(1)
|
|
||||||
if cmd == "M": ### Start of a new part
|
points = []
|
||||||
mx, my = match.group(2, 3)
|
for match in re.finditer(r"([A-Za-z])([\d\.]+)\s+([\d\.]+)\s*", svgdata):
|
||||||
if points:
|
if match:
|
||||||
point_groups.append(points)
|
cmd = match.group(1)
|
||||||
points = []
|
if cmd == "M": ### Start of a new part
|
||||||
points.append((float(mx), float(my)))
|
mx, my = match.group(2, 3)
|
||||||
if debug:
|
if points:
|
||||||
print("M pos", mx, my)
|
point_groups.append(points)
|
||||||
|
points = []
|
||||||
elif cmd == "L": ### Continuation of current part
|
points.append((float(mx), float(my)))
|
||||||
lx, ly = match.group(2, 3)
|
if debug:
|
||||||
points.append((float(lx), float(ly)))
|
print("M pos", mx, my)
|
||||||
if debug:
|
|
||||||
print("L pos", lx, ly)
|
elif cmd == "L": ### Continuation of current part
|
||||||
|
lx, ly = match.group(2, 3)
|
||||||
else:
|
points.append((float(lx), float(ly)))
|
||||||
print("SVG cmd not implemented:", cmd,
|
if debug:
|
||||||
file=sys.stderr)
|
print("L pos", lx, ly)
|
||||||
else:
|
|
||||||
print("some parsing issue",
|
else:
|
||||||
file=sys.stderr)
|
print("SVG cmd not implemented:", cmd,
|
||||||
|
file=sys.stderr)
|
||||||
# Add the last part to point_groups
|
else:
|
||||||
if points:
|
print("some parsing issue",
|
||||||
point_groups.append(points)
|
file=sys.stderr)
|
||||||
points = []
|
|
||||||
|
# Add the last part to point_groups
|
||||||
|
if points:
|
||||||
def main(cmdlineargs):
|
point_groups.append(points)
|
||||||
"""main(args)"""
|
points = []
|
||||||
global debug, verbose ### pylint: disable=global-statement
|
|
||||||
|
|
||||||
try:
|
def main(cmdlineargs):
|
||||||
opts, _ = getopt.getopt(cmdlineargs,
|
"""main(args)"""
|
||||||
"dhv", ["help"])
|
global debug, verbose ### pylint: disable=global-statement
|
||||||
except getopt.GetoptError as err:
|
|
||||||
print(err,
|
try:
|
||||||
file=sys.stderr)
|
opts, _ = getopt.getopt(cmdlineargs,
|
||||||
usage(2)
|
"dhv", ["help"])
|
||||||
for opt, _ in opts:
|
except getopt.GetoptError as err:
|
||||||
if opt == "-d":
|
print(err,
|
||||||
debug = True
|
file=sys.stderr)
|
||||||
elif opt == "-v":
|
usage(2)
|
||||||
verbose = True
|
for opt, _ in opts:
|
||||||
elif opt in ("-h", "--help"):
|
if opt == "-d":
|
||||||
usage(0)
|
debug = True
|
||||||
else:
|
elif opt == "-v":
|
||||||
print("Internal error: unhandled option",
|
verbose = True
|
||||||
file=sys.stderr)
|
elif opt in ("-h", "--help"):
|
||||||
sys.exit(3)
|
usage(0)
|
||||||
|
else:
|
||||||
xml_ns = {"svg": "http://www.w3.org/2000/svg"}
|
print("Internal error: unhandled option",
|
||||||
tree = ET.parse(sys.stdin)
|
file=sys.stderr)
|
||||||
point_groups = []
|
sys.exit(3)
|
||||||
for path in tree.findall("svg:path", xml_ns):
|
|
||||||
svgdata = path.attrib["d"]
|
xml_ns = {"svg": "http://www.w3.org/2000/svg"}
|
||||||
if verbose:
|
tree = ET.parse(sys.stdin)
|
||||||
print("Processing path with {0:d} length".format(len(svgdata)))
|
point_groups = []
|
||||||
search_path_d(svgdata, point_groups)
|
for path in tree.findall("svg:path", xml_ns):
|
||||||
|
svgdata = path.attrib["d"]
|
||||||
|
if verbose:
|
||||||
|
print("Processing path with {0:d} length".format(len(svgdata)))
|
||||||
for idx, points in enumerate(point_groups):
|
search_path_d(svgdata, point_groups)
|
||||||
print("# Group", idx + 1)
|
|
||||||
for point in points:
|
|
||||||
print(" ", point, ",", sep="")
|
|
||||||
|
for idx, points in enumerate(point_groups):
|
||||||
if __name__ == "__main__":
|
print("# Group", idx + 1)
|
||||||
main(sys.argv[1:])
|
for point in points:
|
||||||
|
print(" ", point, ",", sep="")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 Jeff Epler for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import board
|
import board
|
||||||
import displayio
|
import displayio
|
||||||
import keypad
|
import keypad
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# Gemma IO demo - analog inputs
|
# Gemma IO demo - analog inputs
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# CircuitPython IO demo - analog output
|
# CircuitPython IO demo - analog output
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# Gemma IO demo - captouch
|
# Gemma IO demo - captouch
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# CircuitPython IO demo #1 - General Purpose I/O
|
# CircuitPython IO demo #1 - General Purpose I/O
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# CircuitPython demo - Dotstar
|
# CircuitPython demo - Dotstar
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# CircuitPlayground demo - Keyboard emu
|
# CircuitPlayground demo - Keyboard emu
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# Gemma/Trinket IO demo - I2C scan
|
# Gemma/Trinket IO demo - I2C scan
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# I2C sensor demo
|
# I2C sensor demo
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import board
|
import board
|
||||||
import digitalio
|
import digitalio
|
||||||
import storage
|
import storage
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# CircuitPython demo - NeoPixel
|
# CircuitPython demo - NeoPixel
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# Gemma IO demo - captouch to dotstar
|
# Gemma IO demo - captouch to dotstar
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# Gemma IO demo - USB/Serial echo
|
# Gemma IO demo - USB/Serial echo
|
||||||
|
|
||||||
import busio
|
import busio
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import adafruit_dht
|
import adafruit_dht
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2020 Noe Ruiz for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import ssl
|
import ssl
|
||||||
import board
|
import board
|
||||||
import neopixel
|
import neopixel
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import board
|
import board
|
||||||
from analogio import AnalogIn
|
from analogio import AnalogIn
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Read analog potentiometer on Circuit Playground Express or other board with changes
|
// Read analog potentiometer on Circuit Playground Express or other board with changes
|
||||||
// Anne Barela for Adafruit Industries 9/2018 based on
|
// Anne Barela for Adafruit Industries 9/2018 based on
|
||||||
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
|
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import board
|
import board
|
||||||
from analogio import AnalogIn
|
from analogio import AnalogIn
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
// SPDX-FileCopyrightText: 2017 Dano Wall for Adafruit Industries
|
||||||
|
// SPDX-FileCopyrightText: 2017 Becky Stern for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
//Random Flash animation for Neopixel circuits
|
//Random Flash animation for Neopixel circuits
|
||||||
//by Dano Wall and Becky Stern for Adafruit Industries
|
//by Dano Wall and Becky Stern for Adafruit Industries
|
||||||
//based on the Sparkle Skirt, minus the accelerometer
|
//based on the Sparkle Skirt, minus the accelerometer
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2020 Liz Clark for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from random import randint
|
from random import randint
|
||||||
from micropython import const
|
from micropython import const
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
# SPDX-FileCopyrightText: 2021 Erin St Blaine for Adafruit Industries
|
||||||
|
# SPDX-FileCopyrightText: 2021 Dan Halbert for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
"""
|
"""
|
||||||
LED Sunflower Mobile with Circuit Playground Bluefruit
|
LED Sunflower Mobile with Circuit Playground Bluefruit
|
||||||
Full tutorial:
|
Full tutorial:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue