diff options
Diffstat (limited to 'util')
| -rwxr-xr-x | util/audio_generate_dac_lut.py | 67 | ||||
| -rwxr-xr-x | util/chibios_conf_updater.sh (renamed from util/chibios-upgrader.sh) | 10 | ||||
| -rw-r--r-- | util/drivers.txt | 1 | ||||
| -rwxr-xr-x | util/install/gentoo.sh | 2 | ||||
| -rwxr-xr-x | util/install/opensuse.sh | 31 | ||||
| -rwxr-xr-x | util/install/sabayon.sh | 15 | ||||
| -rwxr-xr-x | util/qmk_install.sh | 8 | ||||
| -rwxr-xr-x | util/sample_parser.py | 39 | ||||
| -rw-r--r-- | util/udev/50-qmk.rules | 2 | ||||
| -rwxr-xr-x | util/wavetable_parser.py | 40 |
10 files changed, 161 insertions, 54 deletions
diff --git a/util/audio_generate_dac_lut.py b/util/audio_generate_dac_lut.py new file mode 100755 index 000000000..c31ba3d7e --- /dev/null +++ b/util/audio_generate_dac_lut.py | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | # | ||
| 3 | # Copyright 2020 JohSchneider | ||
| 4 | # | ||
| 5 | # This program is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation, either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program 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 | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | # | ||
| 18 | |||
| 19 | AUDIO_DAC_BUFFER_SIZE=256 | ||
| 20 | AUDIO_DAC_SAMPLE_MAX=4095 | ||
| 21 | |||
| 22 | def plot(values): | ||
| 23 | for v in values: | ||
| 24 | print('0'* int(v * 80/AUDIO_DAC_SAMPLE_MAX)) | ||
| 25 | |||
| 26 | def to_lut(values): | ||
| 27 | for v in values: | ||
| 28 | print(hex(int(v)), end=", ") | ||
| 29 | |||
| 30 | |||
| 31 | from math import sin, tau, pi | ||
| 32 | |||
| 33 | samples=[] | ||
| 34 | |||
| 35 | def sampleSine(): | ||
| 36 | for s in range(AUDIO_DAC_BUFFER_SIZE): | ||
| 37 | samples.append((sin((s/AUDIO_DAC_BUFFER_SIZE)*tau - pi/2) + 1 )/2* AUDIO_DAC_SAMPLE_MAX) | ||
| 38 | |||
| 39 | def sampleTriangle(): | ||
| 40 | for s in range(AUDIO_DAC_BUFFER_SIZE): | ||
| 41 | if s < AUDIO_DAC_BUFFER_SIZE/2: | ||
| 42 | samples.append(s/(AUDIO_DAC_BUFFER_SIZE/2) * AUDIO_DAC_SAMPLE_MAX) | ||
| 43 | else: | ||
| 44 | samples.append(AUDIO_DAC_SAMPLE_MAX - (s-AUDIO_DAC_BUFFER_SIZE/2)/(AUDIO_DAC_BUFFER_SIZE/2) * AUDIO_DAC_SAMPLE_MAX) | ||
| 45 | |||
| 46 | #compromise between square and triangle wave, | ||
| 47 | def sampleTrapezoidal(): | ||
| 48 | for i in range(AUDIO_DAC_BUFFER_SIZE): | ||
| 49 | a=3 #slope/inclination | ||
| 50 | if (i < AUDIO_DAC_BUFFER_SIZE/2): | ||
| 51 | s = a * (i * AUDIO_DAC_SAMPLE_MAX/(AUDIO_DAC_BUFFER_SIZE/2)) + (1-a)*AUDIO_DAC_SAMPLE_MAX/2 | ||
| 52 | else: | ||
| 53 | i = i - AUDIO_DAC_BUFFER_SIZE/2 | ||
| 54 | s = AUDIO_DAC_SAMPLE_MAX - a * (i * AUDIO_DAC_SAMPLE_MAX/(AUDIO_DAC_BUFFER_SIZE/2)) - (1-a)*AUDIO_DAC_SAMPLE_MAX/2 | ||
| 55 | |||
| 56 | if s < 0: | ||
| 57 | s=0 | ||
| 58 | if s> AUDIO_DAC_SAMPLE_MAX: | ||
| 59 | s=AUDIO_DAC_SAMPLE_MAX | ||
| 60 | samples.append(s) | ||
| 61 | |||
| 62 | |||
| 63 | #sampleSine() | ||
| 64 | sampleTrapezoidal() | ||
| 65 | #print(samples) | ||
| 66 | plot(samples) | ||
| 67 | to_lut(samples) | ||
diff --git a/util/chibios-upgrader.sh b/util/chibios_conf_updater.sh index ebc12abe7..70bd80da1 100755 --- a/util/chibios-upgrader.sh +++ b/util/chibios_conf_updater.sh | |||
| @@ -51,7 +51,7 @@ revert_chibi_files() { | |||
| 51 | for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h -or -name board.mk -or -name board.chcfg) ; do | 51 | for file in $(find_chibi_files "$search_path" -name chconf.h -or -name halconf.h -or -name mcuconf.h -or -name board.c -or -name board.h -or -name board.mk -or -name board.chcfg) ; do |
| 52 | pushd "$search_path" >/dev/null 2>&1 | 52 | pushd "$search_path" >/dev/null 2>&1 |
| 53 | local relpath=$(realpath --relative-to="$search_path" "$file") | 53 | local relpath=$(realpath --relative-to="$search_path" "$file") |
| 54 | git checkout upstream/master -- "$relpath" || git checkout origin/master -- "$relpath" || true | 54 | git checkout upstream/develop -- "$relpath" || git checkout origin/develop -- "$relpath" || true |
| 55 | popd >/dev/null 2>&1 | 55 | popd >/dev/null 2>&1 |
| 56 | done | 56 | done |
| 57 | } | 57 | } |
| @@ -132,6 +132,14 @@ upgrade_chconf_files() { | |||
| 132 | 132 | ||
| 133 | upgrade_halconf_files() { | 133 | upgrade_halconf_files() { |
| 134 | upgrade_conf_files_generic halconf.h update_halconf.sh | 134 | upgrade_conf_files_generic halconf.h update_halconf.sh |
| 135 | |||
| 136 | OIFS=$IFS | ||
| 137 | IFS=$'\n' | ||
| 138 | for file in $(find_chibi_files "$qmk_firmware_dir" -name halconf.h) ; do | ||
| 139 | echo $file | ||
| 140 | sed -i 's@#include "mcuconf.h"@#include <mcuconf.h>@g' "$file" | ||
| 141 | done | ||
| 142 | IFS=$OIFS | ||
| 135 | } | 143 | } |
| 136 | 144 | ||
| 137 | upgrade_mcuconf_files() { | 145 | upgrade_mcuconf_files() { |
diff --git a/util/drivers.txt b/util/drivers.txt index c3c5e286b..a41192571 100644 --- a/util/drivers.txt +++ b/util/drivers.txt | |||
| @@ -11,4 +11,5 @@ libusb,ATmega32U2,03EB,2FF0,ddc2c572-cb6e-4f61-a6cc-1a5de941f063 | |||
| 11 | libusb,ATmega16U4,03EB,2FF3,3180d426-bf93-4578-a693-2efbc337da8e | 11 | libusb,ATmega16U4,03EB,2FF3,3180d426-bf93-4578-a693-2efbc337da8e |
| 12 | libusb,ATmega32U4,03EB,2FF4,5f9726fd-f9de-487a-9fbd-8b3524a7a56a | 12 | libusb,ATmega32U4,03EB,2FF4,5f9726fd-f9de-487a-9fbd-8b3524a7a56a |
| 13 | libusb,AT90USB64,03EB,2FF9,c6a708ad-e97d-43cd-b04a-3180d737a71b | 13 | libusb,AT90USB64,03EB,2FF9,c6a708ad-e97d-43cd-b04a-3180d737a71b |
| 14 | libusb,AT90USB162,03EB,2FFA,ef8546f0-ef09-4e7c-8fc2-ffbae1dcd84a | ||
| 14 | libusb,AT90USB128,03EB,2FFB,fd217df3-59d0-440a-a8f3-4c0c8c84daa3 | 15 | libusb,AT90USB128,03EB,2FFB,fd217df3-59d0-440a-a8f3-4c0c8c84daa3 |
diff --git a/util/install/gentoo.sh b/util/install/gentoo.sh index d4284e9a9..97eb5df07 100755 --- a/util/install/gentoo.sh +++ b/util/install/gentoo.sh | |||
| @@ -23,7 +23,7 @@ _qmk_install() { | |||
| 23 | sudo emerge -auN sys-devel/gcc | 23 | sudo emerge -auN sys-devel/gcc |
| 24 | sudo emerge -au --noreplace \ | 24 | sudo emerge -au --noreplace \ |
| 25 | app-arch/unzip app-arch/zip net-misc/wget sys-devel/clang sys-devel/crossdev \ | 25 | app-arch/unzip app-arch/zip net-misc/wget sys-devel/clang sys-devel/crossdev \ |
| 26 | \>=dev-lang/python-3.6 \ | 26 | \>=dev-lang/python-3.7 \ |
| 27 | dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util | 27 | dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util |
| 28 | 28 | ||
| 29 | sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr | 29 | sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr |
diff --git a/util/install/opensuse.sh b/util/install/opensuse.sh deleted file mode 100755 index 47b44ae36..000000000 --- a/util/install/opensuse.sh +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | _qmk_install_prepare() { | ||
| 4 | case $(grep ID /etc/os-release) in | ||
| 5 | *15.1*) | ||
| 6 | REPO_RELEASE=Leap_15.1;; | ||
| 7 | *15.2*) | ||
| 8 | REPO_RELEASE=Leap_15.2;; | ||
| 9 | *) | ||
| 10 | #REPO_RELEASE=Tumbleweed;; | ||
| 11 | echo "ERROR: Tumbleweed is currently not supported." | ||
| 12 | exit 1 | ||
| 13 | esac | ||
| 14 | |||
| 15 | sudo zypper addrepo https://download.opensuse.org/repositories/devel:gcc/openSUSE_$REPO_RELEASE/devel:gcc.repo | ||
| 16 | sudo zypper addrepo https://download.opensuse.org/repositories/hardware/openSUSE_$REPO_RELEASE/hardware.repo | ||
| 17 | sudo zypper --gpg-auto-import-keys refresh | ||
| 18 | } | ||
| 19 | |||
| 20 | _qmk_install() { | ||
| 21 | echo "Installing dependencies" | ||
| 22 | |||
| 23 | sudo zypper install -y \ | ||
| 24 | make clang gcc unzip wget zip \ | ||
| 25 | python3-pip \ | ||
| 26 | cross-avr-binutils cross-avr-gcc8 avr-libc \ | ||
| 27 | cross-arm-binutils cross-arm-none-gcc8 cross-arm-none-newlib-devel \ | ||
| 28 | avrdude dfu-programmer dfu-util | ||
| 29 | |||
| 30 | python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt | ||
| 31 | } | ||
diff --git a/util/install/sabayon.sh b/util/install/sabayon.sh deleted file mode 100755 index fd4f4d8df..000000000 --- a/util/install/sabayon.sh +++ /dev/null | |||
| @@ -1,15 +0,0 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | _qmk_install() { | ||
| 4 | echo "Installing dependencies" | ||
| 5 | |||
| 6 | sudo equo install \ | ||
| 7 | app-arch/unzip app-arch/zip net-misc/wget dev-vcs/git sys-devel/clang sys-devel/gcc sys-devel/crossdev \ | ||
| 8 | dev-python/pip \ | ||
| 9 | dev-embedded/avrdude dev-embedded/dfu-programmer app-mobilephone/dfu-util | ||
| 10 | |||
| 11 | sudo crossdev -s4 --stable --g \<9 --portage --verbose --target avr | ||
| 12 | sudo crossdev -s4 --stable --g \<9 --portage --verbose --target arm-none-eabi | ||
| 13 | |||
| 14 | python3 -m pip install --user -r $QMK_FIRMWARE_DIR/requirements.txt | ||
| 15 | } | ||
diff --git a/util/qmk_install.sh b/util/qmk_install.sh index 5076e980a..421a91a99 100755 --- a/util/qmk_install.sh +++ b/util/qmk_install.sh | |||
| @@ -25,10 +25,6 @@ case $(uname -a) in | |||
| 25 | . "$QMK_FIRMWARE_UTIL_DIR/install/fedora.sh";; | 25 | . "$QMK_FIRMWARE_UTIL_DIR/install/fedora.sh";; |
| 26 | *gentoo*) | 26 | *gentoo*) |
| 27 | . "$QMK_FIRMWARE_UTIL_DIR/install/gentoo.sh";; | 27 | . "$QMK_FIRMWARE_UTIL_DIR/install/gentoo.sh";; |
| 28 | *opensuse*|*tumbleweed*) | ||
| 29 | . "$QMK_FIRMWARE_UTIL_DIR/install/opensuse.sh";; | ||
| 30 | *sabayon*) | ||
| 31 | . "$QMK_FIRMWARE_UTIL_DIR/install/sabayon.sh";; | ||
| 32 | *slackware*) | 28 | *slackware*) |
| 33 | . "$QMK_FIRMWARE_UTIL_DIR/install/slackware.sh";; | 29 | . "$QMK_FIRMWARE_UTIL_DIR/install/slackware.sh";; |
| 34 | *solus*) | 30 | *solus*) |
| @@ -36,9 +32,9 @@ case $(uname -a) in | |||
| 36 | *void*) | 32 | *void*) |
| 37 | . "$QMK_FIRMWARE_UTIL_DIR/install/void.sh";; | 33 | . "$QMK_FIRMWARE_UTIL_DIR/install/void.sh";; |
| 38 | *) | 34 | *) |
| 39 | echo "Sorry, we don't recognize your distribution. Help us by contributing support!" | 35 | echo "Sorry, we don't recognize your distribution. Try using the docker image instead:" |
| 40 | echo | 36 | echo |
| 41 | echo "https://docs.qmk.fm/#/contributing" | 37 | echo "https://docs.qmk.fm/#/getting_started_docker" |
| 42 | exit 1;; | 38 | exit 1;; |
| 43 | esac | 39 | esac |
| 44 | 40 | ||
diff --git a/util/sample_parser.py b/util/sample_parser.py new file mode 100755 index 000000000..70e193aee --- /dev/null +++ b/util/sample_parser.py | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | # | ||
| 3 | # Copyright 2019 Jack Humbert | ||
| 4 | # | ||
| 5 | # This program is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation, either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program 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 | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | # | ||
| 18 | |||
| 19 | import wave, struct, sys | ||
| 20 | |||
| 21 | waveFile = wave.open(sys.argv[1], 'r') | ||
| 22 | # print(str(waveFile.getparams())) | ||
| 23 | # sys.exit() | ||
| 24 | |||
| 25 | if (waveFile.getsampwidth() != 2): | ||
| 26 | raise(Exception("This script currently only works with 16bit audio files")) | ||
| 27 | |||
| 28 | length = waveFile.getnframes() | ||
| 29 | out = "#define DAC_SAMPLE_CUSTOM_LENGTH " + str(length) + "\n\n" | ||
| 30 | out += "static const dacsample_t dac_sample_custom[" + str(length) + "] = {" | ||
| 31 | for i in range(0,length): | ||
| 32 | if (i % 8 == 0): | ||
| 33 | out += "\n " | ||
| 34 | waveData = waveFile.readframes(1) | ||
| 35 | data = struct.unpack("<h", waveData) | ||
| 36 | out += str(int((int(data[0]) + 0x8000) / 16)) + ", " | ||
| 37 | out = out[:-2] | ||
| 38 | out += "\n};" | ||
| 39 | print(out) | ||
diff --git a/util/udev/50-qmk.rules b/util/udev/50-qmk.rules index 70bd7e6e3..acaa7dcc5 100644 --- a/util/udev/50-qmk.rules +++ b/util/udev/50-qmk.rules | |||
| @@ -9,6 +9,8 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff3", TAG+="uacc | |||
| 9 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" | 9 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff4", TAG+="uaccess" |
| 10 | ### AT90USB64 | 10 | ### AT90USB64 |
| 11 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" | 11 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ff9", TAG+="uaccess" |
| 12 | ### AT90USB162 | ||
| 13 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffa", TAG+="uaccess" | ||
| 12 | ### AT90USB128 | 14 | ### AT90USB128 |
| 13 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" | 15 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2ffb", TAG+="uaccess" |
| 14 | 16 | ||
diff --git a/util/wavetable_parser.py b/util/wavetable_parser.py new file mode 100755 index 000000000..be0f01f7b --- /dev/null +++ b/util/wavetable_parser.py | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | # | ||
| 3 | # Copyright 2019 Jack Humbert | ||
| 4 | # | ||
| 5 | # This program is free software: you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by | ||
| 7 | # the Free Software Foundation, either version 2 of the License, or | ||
| 8 | # (at your option) any later version. | ||
| 9 | # | ||
| 10 | # This program 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 | ||
| 13 | # GNU General Public License for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License | ||
| 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | # | ||
| 18 | |||
| 19 | import wave, struct, sys | ||
| 20 | |||
| 21 | waveFile = wave.open(sys.argv[1], 'r') | ||
| 22 | |||
| 23 | length = waveFile.getnframes() | ||
| 24 | out = "#define DAC_WAVETABLE_CUSTOM_LENGTH " + str(int(length / 256)) + "\n\n" | ||
| 25 | out += "static const dacsample_t dac_wavetable_custom[" + str(int(length / 256)) + "][256] = {" | ||
| 26 | for i in range(0,length): | ||
| 27 | if (i % 8 == 0): | ||
| 28 | out += "\n " | ||
| 29 | if (i % 256 == 0): | ||
| 30 | out = out[:-2] | ||
| 31 | out += "{\n " | ||
| 32 | waveData = waveFile.readframes(1) | ||
| 33 | data = struct.unpack("<h", waveData) | ||
| 34 | out += str(int((int(data[0]) + 0x8000) / 16)) + ", " | ||
| 35 | if (i % 256 == 255): | ||
| 36 | out = out[:-2] | ||
| 37 | out += "\n }," | ||
| 38 | out = out[:-1] | ||
| 39 | out += "\n};" | ||
| 40 | print(out) | ||
