From a2d3fc98b8eb83a550fefce9acd2884ebac3eee8 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 10 Jul 2017 17:31:58 +0300 Subject: [PATCH 01/19] Initial structure for shared msys2 and wsl installation --- .gitignore | 1 + util/msys2_install.sh | 4 ++ util/win_shared_install.sh | 137 +++++++++++++++++++++++++++++++++++++ util/wsl_install.sh | 130 +---------------------------------- 4 files changed, 144 insertions(+), 128 deletions(-) create mode 100644 util/msys2_install.sh create mode 100644 util/win_shared_install.sh diff --git a/.gitignore b/.gitignore index ffa7662bd..e40308193 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ quantum/version.h CMakeLists.txt .DS_STORE /util/wsl_downloaded +/util/win_downloaded # Eclipse/PyCharm/Other IDE Settings .cproject diff --git a/util/msys2_install.sh b/util/msys2_install.sh new file mode 100644 index 000000000..945009e5e --- /dev/null +++ b/util/msys2_install.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +source "$dir/win_shared_install.sh" \ No newline at end of file diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh new file mode 100644 index 000000000..d86553bf0 --- /dev/null +++ b/util/win_shared_install.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +download_dir=win_downloaded +wsl_download_dir=wsl_downloaded + +function install_utils { + rm -f -r $download_dir + mkdir $download_dir + + pushd $download_dir + + echo "Installing dfu-programmer" + wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' + unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip + + echo "Installing dfu-util" + wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' + unzip dfu-util-0.9-win64.zip + + echo "Installing teensy_loader_cli" + wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' + unzip teensy_loader_cli_windows.zip + + echo "Installing Atmel Flip" + wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' + mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe + + echo "Downloading the QMK driver installer" + wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - + + rm -f *.zip + + popd > /dev/null +} + +function install_drivers { + pushd $download_dir + cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt + popd > /dev/null +} + +pushd "$dir" + +if [ -d "$wsl_download_dir" ]; then + echo "Renaming existing wsl_download_dir to win_download" + mv -f "$wsl_download_dir" "$download_dir" +fi + +if [ ! -d "$download_dir" ]; then + install_utils +else + while true; do + echo + read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res + case $res in + [Yy]* ) install_utils; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi + +while true; do + echo + read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res + case $res in + [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + + +while true; do + echo + echo "Which USB drivers do you want to install?" + echo "(A)all - All supported drivers will be installed" + echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" + echo "(F)force - Like all, but will also override existing drivers for connected keyboards" + echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" + read -p "(A/C/F/N)? " res + case $res in + [Aa]* ) install_drivers --all; break;; + [Cc]* ) install_drivers; break;; + [Ff]* ) install_drivers --all --force; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + +echo +echo "Creating a softlink to the utils directory as ~/qmk_utils." +echo "This is needed so that the the make system can find all utils it need." +read -p "Press any key to continue (ctrl-c to abort)" +ln -sfn "$dir" ~/qmk_utils + +if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc +then + echo + echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" + echo "Not adding it twice" +else + while true; do + echo + echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" + echo "Without this make won't find the needed utils, so if you don't want to do it automatically," + echo "then you have to do it manually." + read -p "(Y/N)? " res + case $res in + [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi + +while true; do + echo + echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" + echo "This will create a folder 'qmk_firmware' in your home directory." + echo "In the future you can use this folder instead of the full path on your windows file system" + read -p "(Y/N)? " res + case $res in + [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + +echo +echo "******************************************************************************" +echo "Installation completed!" +echo "You need to open a new batch command prompt for all the utils to work properly" +echo "******************************************************************************" + +popd > /dev/null + diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 8999da8a4..578fcb88c 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -1,44 +1,7 @@ #!/bin/bash -download_dir=wsl_downloaded - -function install_utils { - rm -f -r $download_dir - mkdir $download_dir - - pushd $download_dir - - echo "Installing dfu-programmer" - wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' - unzip -d dfu-programmer dfu-programmer-win-0.7.2.zip - - echo "Installing dfu-util" - wget 'http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip' - unzip dfu-util-0.9-win64.zip - - echo "Installing teensy_loader_cli" - wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip' - unzip teensy_loader_cli_windows.zip - - echo "Installing Atmel Flip" - wget 'http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe' - mv Flip\ Installer\ \-\ 3.4.7.112.exe FlipInstaller.exe - - echo "Downloading the QMK driver installer" - wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i - - - rm -f *.zip - - popd > /dev/null -} - -function install_drivers { - pushd $download_dir - cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt - popd > /dev/null -} - dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +pushd "$dir"; if [[ $dir != /mnt/* ]]; then @@ -48,7 +11,6 @@ then exit 1 fi -pushd "$dir" while true; do echo @@ -66,94 +28,6 @@ done echo "Installing dependencies needed for the installation (unzip, wget)" echo "This will ask for the sudo password" sudo apt-get install unzip wget - - -if [ ! -d "$download_dir" ]; then - install_utils -else - while true; do - echo - read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res - case $res in - [Yy]* ) install_utils; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done -fi - -while true; do - echo - read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res - case $res in - [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done - - -while true; do - echo - echo "Which USB drivers do you want to install?" - echo "(A)all - All supported drivers will be installed" - echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" - echo "(F)force - Like all, but will also override existing drivers for connected keyboards" - echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" - read -p "(A/C/F/N)? " res - case $res in - [Aa]* ) install_drivers --all; break;; - [Cc]* ) install_drivers; break;; - [Ff]* ) install_drivers --all --force; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done - -echo -echo "Creating a softlink to the utils directory as ~/qmk_utils." -echo "This is needed so that the the make system can find all utils it need." -read -p "Press any key to continue (ctrl-c to abort)" -ln -sfn "$dir" ~/qmk_utils - -if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc -then - echo - echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" - echo "Not adding it twice" -else - while true; do - echo - echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" - echo "Without this make won't find the needed utils, so if you don't want to do it automatically," - echo "then you have to do it manually." - read -p "(Y/N)? " res - case $res in - [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done -fi - -while true; do - echo - echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" - echo "This will create a folder 'qmk_firmware' in your home directory." - echo "In the future you can use this folder instead of the full path on your windows file system" - read -p "(Y/N)? " res - case $res in - [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done - -echo -echo "******************************************************************************" -echo "Installation completed!" -echo "You need to open a new batch command prompt for all the utils to work properly" -echo "******************************************************************************" +source "$dir/win_shared_install.sh" popd > /dev/null - From 7bedf8f4f2b86f5f67c30843dcd95f31675d86a7 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 10 Jul 2017 17:51:59 +0300 Subject: [PATCH 02/19] Fix launch of qmk_driver_installer on msys2 --- util/win_shared_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index d86553bf0..78346284a 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -35,7 +35,8 @@ function install_utils { function install_drivers { pushd $download_dir - cmd.exe /C qmk_driver_installer.exe $1 $2 ../drivers.txt + echo + cmd.exe /c "qmk_driver_installer.exe $1 $2 ..\\drivers.txt" popd > /dev/null } From 861087096bf4308b0fa4608ca66173e4eb6f5b76 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 10 Jul 2017 18:05:32 +0300 Subject: [PATCH 03/19] Add symlinks only on WSL --- util/msys2_install.sh | 8 ++++++- util/win_shared_install.sh | 44 ------------------------------------- util/wsl_install.sh | 45 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 945009e5e..ac21b3cad 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -1,4 +1,10 @@ #!/bin/bash dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) -source "$dir/win_shared_install.sh" \ No newline at end of file +source "$dir/win_shared_install.sh" + +echo +echo "******************************************************************************" +echo "Installation completed!" +echo "You need to open a new batch command prompt for all the utils to work properly" +echo "******************************************************************************" \ No newline at end of file diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index 78346284a..c30e28796 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -89,50 +89,6 @@ while true; do esac done -echo -echo "Creating a softlink to the utils directory as ~/qmk_utils." -echo "This is needed so that the the make system can find all utils it need." -read -p "Press any key to continue (ctrl-c to abort)" -ln -sfn "$dir" ~/qmk_utils - -if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc -then - echo - echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" - echo "Not adding it twice" -else - while true; do - echo - echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" - echo "Without this make won't find the needed utils, so if you don't want to do it automatically," - echo "then you have to do it manually." - read -p "(Y/N)? " res - case $res in - [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac - done -fi - -while true; do - echo - echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" - echo "This will create a folder 'qmk_firmware' in your home directory." - echo "In the future you can use this folder instead of the full path on your windows file system" - read -p "(Y/N)? " res - case $res in - [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done - -echo -echo "******************************************************************************" -echo "Installation completed!" -echo "You need to open a new batch command prompt for all the utils to work properly" -echo "******************************************************************************" popd > /dev/null diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 578fcb88c..5da64b1d0 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -30,4 +30,49 @@ echo "This will ask for the sudo password" sudo apt-get install unzip wget source "$dir/win_shared_install.sh" +echo +echo "Creating a softlink to the utils directory as ~/qmk_utils." +echo "This is needed so that the the make system can find all utils it need." +read -p "Press any key to continue (ctrl-c to abort)" +ln -sfn "$dir" ~/qmk_utils + +if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc +then + echo + echo "The line source ~/qmk_utils/activate_wsl.sh is already added to your /.bashrc" + echo "Not adding it twice" +else + while true; do + echo + echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" + echo "Without this make won't find the needed utils, so if you don't want to do it automatically," + echo "then you have to do it manually." + read -p "(Y/N)? " res + case $res in + [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi + +while true; do + echo + echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" + echo "This will create a folder 'qmk_firmware' in your home directory." + echo "In the future you can use this folder instead of the full path on your windows file system" + read -p "(Y/N)? " res + case $res in + [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done + +echo +echo "******************************************************************************" +echo "Installation completed!" +echo "You need to open a new batch command prompt for all the utils to work properly" +echo "******************************************************************************" + popd > /dev/null From 32fc4da4a7c0ebaaa9404971dcafba0c67220507 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Mon, 10 Jul 2017 18:16:35 +0300 Subject: [PATCH 04/19] Install unzip --- util/msys2_install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index ac21b3cad..b59eac0ca 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -1,6 +1,10 @@ #!/bin/bash dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) + +echo "Installing dependencies needed for the installation (quazip)" +pacman -S msys/unzip + source "$dir/win_shared_install.sh" echo From d47db637edb4215f2313d59b6646e5e3dbb97e7c Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 16:11:37 +0300 Subject: [PATCH 05/19] Use home directory for download on msys2 --- util/msys2_install.sh | 4 +++- util/win_shared_install.sh | 23 +++++++++-------------- util/wsl_install.sh | 3 +++ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index b59eac0ca..aed6c42bd 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -3,7 +3,9 @@ dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) echo "Installing dependencies needed for the installation (quazip)" -pacman -S msys/unzip +pacman --needed -S msys/unzip + +export download_dir=~/qmk_utils source "$dir/win_shared_install.sh" diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index c30e28796..e02511cf3 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -1,13 +1,10 @@ #!/bin/bash -download_dir=win_downloaded -wsl_download_dir=wsl_downloaded - function install_utils { - rm -f -r $download_dir - mkdir $download_dir + rm -f -r "$download_dir" + mkdir "$download_dir" - pushd $download_dir + pushd "$download_dir" echo "Installing dfu-programmer" wget 'http://downloads.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip' @@ -34,19 +31,15 @@ function install_utils { } function install_drivers { - pushd $download_dir + pushd "$download_dir" + cp -f "$dir/drivers.txt" . echo - cmd.exe /c "qmk_driver_installer.exe $1 $2 ..\\drivers.txt" + cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt" popd > /dev/null } pushd "$dir" -if [ -d "$wsl_download_dir" ]; then - echo "Renaming existing wsl_download_dir to win_download" - mv -f "$wsl_download_dir" "$download_dir" -fi - if [ ! -d "$download_dir" ]; then install_utils else @@ -61,15 +54,17 @@ else done fi +pushd "$download_dir" while true; do echo read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res case $res in - [Yy]* ) cmd.exe /c $download_dir\\FlipInstaller.exe; break;; + [Yy]* ) cmd.exe /c FlipInstaller.exe; break;; [Nn]* ) break;; * ) echo "Invalid answer";; esac done +popd while true; do diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 5da64b1d0..b593c6e77 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -28,6 +28,9 @@ done echo "Installing dependencies needed for the installation (unzip, wget)" echo "This will ask for the sudo password" sudo apt-get install unzip wget + +download_dir=wsl_downloaded + source "$dir/win_shared_install.sh" echo From b85ce4ce225e6e4f42d0cd8a8d9615260960edc6 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 16:26:29 +0300 Subject: [PATCH 06/19] Fix overlong lines, and a few spelling errors --- util/win_shared_install.sh | 16 +++++++++++----- util/wsl_install.sh | 13 +++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index e02511cf3..cfae57845 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -45,7 +45,8 @@ if [ ! -d "$download_dir" ]; then else while true; do echo - read -p "The utils seem to already be downloaded, do you want to re-download them and update to the newest version (Y/N) " res + echo "The utils seem to already be downloaded." + read -p "Do you want to re-download them and update to the newest version (Y/N) " res case $res in [Yy]* ) install_utils; break;; [Nn]* ) break;; @@ -57,7 +58,9 @@ fi pushd "$download_dir" while true; do echo - read -p "Flip need to be installed if you want to use that for programming, do you want to install it now? (Y/N) " res + echo "Flip need to be installed if you want to use that for programming." + echo "Please install it to the default location!" + read -p "Do you want to install it now? (Y/N) " res case $res in [Yy]* ) cmd.exe /c FlipInstaller.exe; break;; [Nn]* ) break;; @@ -71,9 +74,12 @@ while true; do echo echo "Which USB drivers do you want to install?" echo "(A)all - All supported drivers will be installed" - echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode) will be installed" - echo "(F)force - Like all, but will also override existing drivers for connected keyboards" - echo "(N)one - No drivers will be installed, flashing your keyboard will most likely not work" + echo "(C)onnected - Only drivers for connected keyboards (in bootloader/flashing mode)" + echo " will be installed" + echo "(F)force - Like all, but will also override existing drivers for connected" + echo " keyboards" + echo "(N)one - No drivers will be installed," + echo " flashing your keyboard will most likely not work" read -p "(A/C/F/N)? " res case $res in [Aa]* ) install_drivers --all; break;; diff --git a/util/wsl_install.sh b/util/wsl_install.sh index b593c6e77..89552b991 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -47,9 +47,9 @@ then else while true; do echo - echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of you .bashrc file?" - echo "Without this make won't find the needed utils, so if you don't want to do it automatically," - echo "then you have to do it manually." + echo "Do you want to add 'source ~/qmk_utils/activate_wsl.sh' to the end of your" + echo ".bashrc file? Without this make won't find the needed utils, so if you don't" + echo "want to do it automatically, then you have to do it manually later." read -p "(Y/N)? " res case $res in [Yy]* ) echo "source ~/qmk_utils/activate_wsl.sh" >> ~/.bashrc; break;; @@ -61,9 +61,10 @@ fi while true; do echo - echo "Do you want to add a symlink to the QMK repository in your home directory for convenience?" - echo "This will create a folder 'qmk_firmware' in your home directory." - echo "In the future you can use this folder instead of the full path on your windows file system" + echo "Do you want to add a symlink to the QMK repository in your home directory for" + echo "convenience? This will create a folder 'qmk_firmware' in your home directory." + echo "In the future you can use this folder instead of the full path on your Windows" + echo "file system." read -p "(Y/N)? " res case $res in [Yy]* ) ln -sfn "$dir/.." ~/qmk_firmware; break;; From b8c363099b76db8b017333ffbbb7630f5c21b1dd Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 16:44:46 +0300 Subject: [PATCH 07/19] Download and extract avr tools --- util/msys2_install.sh | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index aed6c42bd..1b99806b5 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -1,14 +1,52 @@ #!/bin/bash dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +download_dir=~/qmk_utils +avrtools=avr8-gnu-toolchain echo "Installing dependencies needed for the installation (quazip)" -pacman --needed -S msys/unzip +pacman --needed -S msys/unzip msys/p7zip + -export download_dir=~/qmk_utils source "$dir/win_shared_install.sh" +function install_avr { + rm -f -r "$avrtools" + wget "http://www.atmel.com/images/avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe" + 7z x avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe + rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe +} + +pushd "$download_dir" + + +if [ ! -d "$avrtools" ]; then + while true; do + echo + echo "The AVR toolchain is not installed." + echo "This is needed for building AVR based keboards." + read -p "Do you want to install it? (Y/N) " res + case $res in + [Yy]* ) install_avr; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +else + while true; do + echo + echo "The AVR toolchain is already installed" + read -p "Do you want to reinstall? (Y/N) " res + case $res in + [Yy]* ) install_avr; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi +popd + echo echo "******************************************************************************" echo "Installation completed!" From 76bd0d3e184f77ff89f9db2274574093f78e49ca Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 17:18:24 +0300 Subject: [PATCH 08/19] Install arm toolchain --- util/msys2_install.sh | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 1b99806b5..0bb75f94c 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -3,12 +3,11 @@ dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) download_dir=~/qmk_utils avrtools=avr8-gnu-toolchain +armtools=gcc-arm-none-eabi echo "Installing dependencies needed for the installation (quazip)" pacman --needed -S msys/unzip msys/p7zip - - source "$dir/win_shared_install.sh" function install_avr { @@ -18,8 +17,13 @@ function install_avr { rm avr8-gnu-toolchain-installer-3.5.4.91-win32.any.x86.exe } -pushd "$download_dir" +function install_arm { + wget -O gcc-arm-none-eabi.zip "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip?product=GNU%20ARM%20Embedded%20Toolchain,ZIP,,Windows,6-2017-q2-update" + unzip -d gcc-arm-none-eabi gcc-arm-none-eabi.zip + rm gcc-arm-none-eabi.zip +} +pushd "$download_dir" if [ ! -d "$avrtools" ]; then while true; do @@ -45,6 +49,31 @@ else esac done fi + +if [ ! -d "$armtools" ]; then + while true; do + echo + echo "The ARM toolchain is not installed." + echo "This is needed for building ARM based keboards." + read -p "Do you want to install it? (Y/N) " res + case $res in + [Yy]* ) install_arm; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +else + while true; do + echo + echo "The ARM toolchain is already installed" + read -p "Do you want to reinstall? (Y/N) " res + case $res in + [Yy]* ) install_arm; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi popd echo From 0d9e7f635e8f05356101d72725342fc272b7b71b Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 17:32:58 +0300 Subject: [PATCH 09/19] Extract flip --- util/msys2_install.sh | 12 ++++++++++++ util/win_shared_install.sh | 15 --------------- util/wsl_install.sh | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 0bb75f94c..866cc25a7 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -4,6 +4,7 @@ dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) download_dir=~/qmk_utils avrtools=avr8-gnu-toolchain armtools=gcc-arm-none-eabi +installflip=false echo "Installing dependencies needed for the installation (quazip)" pacman --needed -S msys/unzip msys/p7zip @@ -23,8 +24,19 @@ function install_arm { rm gcc-arm-none-eabi.zip } +function extract_flip { + rm -f -r flip + 7z -oflip x FlipInstaller.exe +} + pushd "$download_dir" +if [ -f "FlipInstaller.exe" ]; then + echo + echo "Extracting flip" + extract_flip +fi + if [ ! -d "$avrtools" ]; then while true; do echo diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index cfae57845..8d1949ae9 100644 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -55,21 +55,6 @@ else done fi -pushd "$download_dir" -while true; do - echo - echo "Flip need to be installed if you want to use that for programming." - echo "Please install it to the default location!" - read -p "Do you want to install it now? (Y/N) " res - case $res in - [Yy]* ) cmd.exe /c FlipInstaller.exe; break;; - [Nn]* ) break;; - * ) echo "Invalid answer";; - esac -done -popd - - while true; do echo echo "Which USB drivers do you want to install?" diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 89552b991..157480353 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -33,6 +33,21 @@ download_dir=wsl_downloaded source "$dir/win_shared_install.sh" +pushd "$download_dir" +while true; do + echo + echo "Flip need to be installed if you want to use that for programming." + echo "Please install it to the default location!" + read -p "Do you want to install it now? (Y/N) " res + case $res in + [Yy]* ) cmd.exe /c FlipInstaller.exe; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac +done +popd + + echo echo "Creating a softlink to the utils directory as ~/qmk_utils." echo "This is needed so that the the make system can find all utils it need." From 5c3fd671989cfed9563db4d38deb776d72d513de Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 17:55:03 +0300 Subject: [PATCH 10/19] Add tools to the path --- util/activate_msys2.sh | 16 ++++++++++++++++ util/msys2_install.sh | 24 +++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 util/activate_msys2.sh diff --git a/util/activate_msys2.sh b/util/activate_msys2.sh new file mode 100644 index 000000000..bb0485302 --- /dev/null +++ b/util/activate_msys2.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +function export_variables { + local util_dir=~/qmk_utils + export PATH=$PATH:$util_dir/dfu-programmer + export PATH=$PATH:$util_dir/dfu-util-0.9-win64 + export PATH=$PATH:$util_dir/flip/bin + export PATH=$PATH:$util_dir/avr8-gnu-toolchain/bin + export PATH=$PATH:$util_dir/gcc-arm-none-eabi/bin +} + +export_variables + + + + diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 866cc25a7..85f4e5f6c 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -88,8 +88,30 @@ else fi popd +cp -f "$dir/activate_msys2.sh" "$download_dir/" + +if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc +then + echo + echo "The line source ~/qmk_utils/activate_msys2.sh is already added to your /.bashrc" + echo "Not adding it twice!" +else + while true; do + echo + echo "Do you want to add 'source ~/qmk_utils/activate_msys2.sh' to the end of your" + echo ".bashrc file? Without this make won't find the needed utils, so if you don't" + echo "want to do it automatically, then you have to do it manually later." + read -p "(Y/N)? " res + case $res in + [Yy]* ) echo "source ~/qmk_utils/activate_msys2.sh" >> ~/.bashrc; break;; + [Nn]* ) break;; + * ) echo "Invalid answer";; + esac + done +fi + echo echo "******************************************************************************" echo "Installation completed!" -echo "You need to open a new batch command prompt for all the utils to work properly" +echo "Please close this Window and restart MSYS2 MinGW" echo "******************************************************************************" \ No newline at end of file From 5a25d5016892790acb08883a33ec21b1724a96c8 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 18:51:52 +0300 Subject: [PATCH 11/19] Add more dependencies, everything can be compiled now --- util/msys2_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/msys2_install.sh b/util/msys2_install.sh index 85f4e5f6c..de03b89ac 100644 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -7,7 +7,7 @@ armtools=gcc-arm-none-eabi installflip=false echo "Installing dependencies needed for the installation (quazip)" -pacman --needed -S msys/unzip msys/p7zip +pacman --needed -S msys/unzip msys/p7zip base-devel msys/git mingw-w64-x86_64-toolchain source "$dir/win_shared_install.sh" From 78545b95090816767bf3e17c4745bb0c3db01a5f Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Tue, 11 Jul 2017 19:41:04 +0300 Subject: [PATCH 12/19] Fix unreferenced errors with mingw compiler and unit tests --- quantum/keymap_common.c | 1 - tests/basic/keymap.c | 5 ++++- tests/test_common/matrix.c | 3 +++ tests/test_common/test_fixture.cpp | 4 ++-- tests/test_common/test_fixture.hpp | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index b1460c53c..1c522e8b8 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c @@ -169,7 +169,6 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) } // translates key to keycode -__attribute__ ((weak)) uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { // Read entire word (16bits) diff --git a/tests/basic/keymap.c b/tests/basic/keymap.c index 3274f213f..3f97c0a0e 100644 --- a/tests/basic/keymap.c +++ b/tests/basic/keymap.c @@ -40,4 +40,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { } } return MACRO_NONE; -}; \ No newline at end of file +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { +} \ No newline at end of file diff --git a/tests/test_common/matrix.c b/tests/test_common/matrix.c index 0d9fa68b0..4b501039b 100644 --- a/tests/test_common/matrix.c +++ b/tests/test_common/matrix.c @@ -58,3 +58,6 @@ void release_key(uint8_t col, uint8_t row) { void clear_all_keys(void) { memset(matrix, 0, sizeof(matrix)); } + +void led_set(uint8_t usb_led) { +} diff --git a/tests/test_common/test_fixture.cpp b/tests/test_common/test_fixture.cpp index df57338df..4084ee9c6 100644 --- a/tests/test_common/test_fixture.cpp +++ b/tests/test_common/test_fixture.cpp @@ -44,8 +44,8 @@ void TestFixture::run_one_scan_loop() { advance_time(1); } -void TestFixture::idle_for(uint time) { - for (uint i=0; i Date: Tue, 11 Jul 2017 18:53:41 +0200 Subject: [PATCH 13/19] Updates maartenwut's keymap (#1489) * Updated keymap * Added backlight breathing to fix compile error --- keyboards/tada68/keymaps/maartenwut/config.h | 3 + keyboards/tada68/keymaps/maartenwut/keymap.c | 81 ++++++++++++++++---- 2 files changed, 70 insertions(+), 14 deletions(-) create mode 100755 keyboards/tada68/keymaps/maartenwut/config.h diff --git a/keyboards/tada68/keymaps/maartenwut/config.h b/keyboards/tada68/keymaps/maartenwut/config.h new file mode 100755 index 000000000..7d81548b7 --- /dev/null +++ b/keyboards/tada68/keymaps/maartenwut/config.h @@ -0,0 +1,3 @@ +#include "../../config.h" + +#define BACKLIGHT_BREATHING \ No newline at end of file diff --git a/keyboards/tada68/keymaps/maartenwut/keymap.c b/keyboards/tada68/keymaps/maartenwut/keymap.c index ce3800c49..d1e63a6b3 100755 --- a/keyboards/tada68/keymaps/maartenwut/keymap.c +++ b/keyboards/tada68/keymaps/maartenwut/keymap.c @@ -5,10 +5,11 @@ #include "command.h" #define _MA 0 -#define _FL 1 -#define _AR 2 -#define _LO 3 -#define _UL 4 +#define _GA 1 +#define _FL 2 +#define _AR 3 +#define _LO 4 +#define _UL 5 #define TRNS KC_TRNS #define trigger_time 400 @@ -29,6 +30,15 @@ #define LSHIFT OSM(MOD_LSFT) #define SPACE LT(_AR, KC_SPC) +#define MACRO_BREATH_TOGGLE 13 +#define MACRO_BREATH_SPEED_INC 14 +#define MACRO_BREATH_SPEED_DEC 15 +#define MACRO_BREATH_DEFAULT 16 +#define M_BRTOG M(MACRO_BREATH_TOGGLE) +#define M_BSPDU M(MACRO_BREATH_SPEED_INC) +#define M_BSPDD M(MACRO_BREATH_SPEED_DEC) +#define M_BDFLT M(MACRO_BREATH_DEFAULT) + static uint16_t key_timer; enum emoticons { @@ -57,28 +67,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ LSHIFT, END_HOME, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ KC_LCTL, KC_LGUI, KC_LALT, SPACE, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT), - + /* Keymap _FL: Function Layer * ,----------------------------------------------------------------. - * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12| |Prsc| + * |~` | F1|F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Reset |Prsc| * |----------------------------------------------------------------| * | |MbL|MsU|MbR| | | | | | | | | | |_LO | * |----------------------------------------------------------------| - * | |MsL|MsD|MsR| | | | | | | | | |Hme | + * | |MsL|MsD|MsR| |_GA| | | | | | | |Hme | * |----------------------------------------------------------------| - * | | | | | | | | | |VoU|VoD|Mut| |MwU|End | + * | | |BL-|BL+|BL |BR-|BR+|BR | |VoU|VoD|Mut| |MwU|End | * |----------------------------------------------------------------| * | | | | | | | |MwL|MwD|MwR | * `----------------------------------------------------------------' */ [_FL] = KEYMAP_ANSI( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, TRNS, KC_PSCR, \ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, RESET, KC_PSCR, \ TRNS, KC_BTN1, KC_MS_U, KC_BTN2, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TO(_LO), \ - TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \ - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \ + TRNS, KC_MS_L, KC_MS_D, KC_MS_R, TRNS, TG(_GA), TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_HOME, \ + TRNS, TRNS, BL_DEC, BL_INC, BL_TOGG, M_BSPDD, M_BSPDU, M_BRTOG, TRNS, KC_VOLD, KC_VOLU, KC_MUTE, TRNS, KC_WH_U, KC_END, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, KC_WH_L, KC_WH_D, KC_WH_R), - /* Keymap _UL: Unlock layer + /* Keymap _AR: Arrow layer * ,----------------------------------------------------------------. * | | | | | | | | | | | | | | | | * |----------------------------------------------------------------| @@ -95,9 +105,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ LENNY, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ DWNHRT, TRNS, TRNS, TRNS, TRNS, TRNS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, TRNS, TRNS, TRNS, TRNS, \ - SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ + SHRUG, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \ TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS), + /* Keymap _GA: Game layer + * ,----------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp |P/P | + * |----------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ |Del | + * |----------------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return |PgUp| + * |----------------------------------------------------------------| + * |Shft|End| Z| X| C| V| B| N| M| ,| .| /|Shift | Up|PgDn| + * |----------------------------------------------------------------| + * |Ctrl|Win |Alt | Space |Alt|Ctrl| FN|Lef|Dow|Rig | + * `----------------------------------------------------------------' + */ +[_GA] = KEYMAP_ANSI( + KC_ESC, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, KC_BSPC, KC_MPLY, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, \ + KC_LSFT, END_HOME, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, \ + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTRL, MO(_FL), KC_LEFT, KC_DOWN, KC_RGHT), + /* Keymap _UL: Unlock layer * ,----------------------------------------------------------------. * | | | | | | | | | | | | | | | | @@ -378,6 +408,29 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { } } break; + case MACRO_BREATH_TOGGLE: + if (record->event.pressed) { + breathing_toggle(); + } + break; + + case MACRO_BREATH_SPEED_INC: + if (record->event.pressed) { + breathing_speed_inc(1); + } + break; + + case MACRO_BREATH_SPEED_DEC: + if (record->event.pressed) { + breathing_speed_dec(1); + } + break; + + case MACRO_BREATH_DEFAULT: + if (record->event.pressed) { + breathing_defaults(); + } + break; } return MACRO_NONE; -}; \ No newline at end of file +}; From cc6db9c5408ad303b9d3f47e4deaf78b4fc854d3 Mon Sep 17 00:00:00 2001 From: ishtob Date: Tue, 11 Jul 2017 13:53:50 -0400 Subject: [PATCH 14/19] Adds Hadron Keyboard (#1492) * adding hadron keymaps * fix embedded comment * fixed TWI driver path * Delete glcdfont.c * Delete ssd1306.c * Delete ssd1306.h * Update readme.md --- keyboards/hadron/Makefile | 5 + keyboards/hadron/config.h | 83 ++++ keyboards/hadron/hadron.c | 26 ++ keyboards/hadron/hadron.h | 30 ++ keyboards/hadron/i2c.c | 166 +++++++ keyboards/hadron/i2c.h | 49 ++ keyboards/hadron/keymaps/default/Makefile | 26 ++ keyboards/hadron/keymaps/default/config.h | 20 + keyboards/hadron/keymaps/default/keymap.c | 408 +++++++++++++++++ keyboards/hadron/keymaps/default/readme.md | 2 + keyboards/hadron/keymaps/readme.md | 23 + keyboards/hadron/keymaps/side_numpad/Makefile | 26 ++ keyboards/hadron/keymaps/side_numpad/config.h | 20 + keyboards/hadron/keymaps/side_numpad/keymap.c | 418 ++++++++++++++++++ .../hadron/keymaps/side_numpad/readme.md | 2 + keyboards/hadron/out.txt | 66 +++ keyboards/hadron/readme.md | 1 + keyboards/hadron/rules.mk | 72 +++ keyboards/hadron/ver0/Makefile | 3 + keyboards/hadron/ver0/config.h | 35 ++ keyboards/hadron/ver0/rules.mk | 5 + keyboards/hadron/ver0/ver0.c | 1 + keyboards/hadron/ver0/ver0.h | 6 + keyboards/hadron/ver2/Makefile | 3 + keyboards/hadron/ver2/config.h | 35 ++ keyboards/hadron/ver2/rules.mk | 5 + keyboards/hadron/ver2/ver2.c | 1 + keyboards/hadron/ver2/ver2.h | 6 + 28 files changed, 1543 insertions(+) create mode 100644 keyboards/hadron/Makefile create mode 100644 keyboards/hadron/config.h create mode 100644 keyboards/hadron/hadron.c create mode 100644 keyboards/hadron/hadron.h create mode 100644 keyboards/hadron/i2c.c create mode 100644 keyboards/hadron/i2c.h create mode 100644 keyboards/hadron/keymaps/default/Makefile create mode 100644 keyboards/hadron/keymaps/default/config.h create mode 100644 keyboards/hadron/keymaps/default/keymap.c create mode 100644 keyboards/hadron/keymaps/default/readme.md create mode 100644 keyboards/hadron/keymaps/readme.md create mode 100644 keyboards/hadron/keymaps/side_numpad/Makefile create mode 100644 keyboards/hadron/keymaps/side_numpad/config.h create mode 100644 keyboards/hadron/keymaps/side_numpad/keymap.c create mode 100644 keyboards/hadron/keymaps/side_numpad/readme.md create mode 100644 keyboards/hadron/out.txt create mode 100644 keyboards/hadron/readme.md create mode 100644 keyboards/hadron/rules.mk create mode 100644 keyboards/hadron/ver0/Makefile create mode 100644 keyboards/hadron/ver0/config.h create mode 100644 keyboards/hadron/ver0/rules.mk create mode 100644 keyboards/hadron/ver0/ver0.c create mode 100644 keyboards/hadron/ver0/ver0.h create mode 100644 keyboards/hadron/ver2/Makefile create mode 100644 keyboards/hadron/ver2/config.h create mode 100644 keyboards/hadron/ver2/rules.mk create mode 100644 keyboards/hadron/ver2/ver2.c create mode 100644 keyboards/hadron/ver2/ver2.h diff --git a/keyboards/hadron/Makefile b/keyboards/hadron/Makefile new file mode 100644 index 000000000..e0e1cc6fb --- /dev/null +++ b/keyboards/hadron/Makefile @@ -0,0 +1,5 @@ +SUBPROJECT_DEFAULT = ver2 + +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/config.h b/keyboards/hadron/config.h new file mode 100644 index 000000000..0c19d6c79 --- /dev/null +++ b/keyboards/hadron/config.h @@ -0,0 +1,83 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define MANUFACTURER ishtob +#define PRODUCT Hadron Keyboard +#define DESCRIPTION A cherry ML ortholinear keyboard + + + + +//#define AUDIO_VOICES + +//#define BACKLIGHT_PIN B7 + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +//#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION +#ifdef SUBPROJECT_ver0 + #include "ver0/config.h" +#endif +#ifdef SUBPROJECT_ver2 + #include "ver2/config.h" +#endif + +#endif diff --git a/keyboards/hadron/hadron.c b/keyboards/hadron/hadron.c new file mode 100644 index 000000000..ca5b20e89 --- /dev/null +++ b/keyboards/hadron/hadron.c @@ -0,0 +1,26 @@ +#include "hadron.h" + + +void matrix_init_kb(void) { + + matrix_init_user(); +} + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + + led_set_user(usb_led); +} \ No newline at end of file diff --git a/keyboards/hadron/hadron.h b/keyboards/hadron/hadron.h new file mode 100644 index 000000000..fceae50d9 --- /dev/null +++ b/keyboards/hadron/hadron.h @@ -0,0 +1,30 @@ +#ifndef HADRON_H +#define HADRON_H + +#ifdef SUBPROJECT_ver0 + #include "ver0.h" +#endif +#ifdef SUBPROJECT_ver2 + #include "ver2.h" +#endif + +#include "quantum.h" + + +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ + K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E \ + ) \ +{ \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, KC_NO, KC_NO, KC_NO }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48, K49, K4A, K4B, K4C, K4D, K4E } \ +} + + +#endif diff --git a/keyboards/hadron/i2c.c b/keyboards/hadron/i2c.c new file mode 100644 index 000000000..cd2b835d5 --- /dev/null +++ b/keyboards/hadron/i2c.c @@ -0,0 +1,166 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 800000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/hadron/keymaps/default/Makefile b/keyboards/hadron/keymaps/default/Makefile new file mode 100644 index 000000000..e24ba04b5 --- /dev/null +++ b/keyboards/hadron/keymaps/default/Makefile @@ -0,0 +1,26 @@ + + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +ONEHAND_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/keymaps/default/config.h b/keyboards/hadron/keymaps/default/config.h new file mode 100644 index 000000000..4a5a8fad3 --- /dev/null +++ b/keyboards/hadron/keymaps/default/config.h @@ -0,0 +1,20 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define LEADER_TIMEOUT 300 +//#define BACKLIGHT_BREATHING +#define PREVENT_STUCK_MODIFIERS + +#define USE_I2C +#define SSD1306OLED + +/* ws2812 RGB LED*/ +#define RGB_DI_PIN D4 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 14 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 + +#endif diff --git a/keyboards/hadron/keymaps/default/keymap.c b/keyboards/hadron/keymaps/default/keymap.c new file mode 100644 index 000000000..24fa0b27f --- /dev/null +++ b/keyboards/hadron/keymaps/default/keymap.c @@ -0,0 +1,408 @@ +#include "hadron.h" +#include "bootloader.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#ifdef USE_I2C +#include "i2c.h" +#endif +#ifdef SSD1306OLED +#include "ssd1306.h" +#endif +extern keymap_config_t keymap_config; + +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _MOUSECURSOR 8 +#define _ADJUST 16 + +enum preonic_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + BACKLIT, + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, +}; + +enum macro_keycodes { + KC_DEMOMACRO, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl +#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +// Requires KC_TRNS/_______ for the trigger key in the destination layer +#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor +#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise +#define DEMOMACRO M(KC_DEMOMACRO) // Sample for macros + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | DEL | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | Tab | Q | W | E | R | T | 7 | 8 | 9 | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | CAPS | A | S | D | F | G | 4 | 5 | 6 | H | J | K | L | ;/Nav| ' | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | 1 | 2 | 3 | N | M | , | . | / |Ctl/Et| + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | + * `--------------------------------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_P7, KC_P8, KC_P9, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_P4, KC_P5, KC_P6, KC_H, KC_J, KC_K, KC_L,LT_MC(KC_SCLN), KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, CTL_ENT, \ + KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Colemak + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | Tab | Q | W | F | P | G | 7 | 8 | 9 | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | CAPS | A | R | S | T | D | 4 | 5 | 6 | H | N | E | I | O | ' | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | 1 | 2 | 3 | K | M | , | . | / |Ctl/Et| + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | + * `--------------------------------------------------------------------------------------------------------' + */ +[_COLEMAK] = KEYMAP( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_P7, KC_P8, KC_P9, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ + KC_LCTRL, KC_A, KC_R, KC_S, KC_T, KC_D, KC_P4, KC_P5, KC_P6, KC_H, KC_N, KC_E, KC_I, LT_MC(KC_O), KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_P1, KC_P2, KC_P3, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, CTL_ENT, \ + KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + ), + +/* Dvorak + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | Tab | " | , | . | P | Y | 7 | 8 | 9 | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | Esc | A | O | E | U | I | 4 | 5 | 6 | D | H | T | N | S | / | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | 1 | 2 | 3 | B | M | W | V | Z |Ctl/Et| + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | ` | Ctrl | Alt | GUI |Lower |Space | 0 | . | = |Space |Raise | Left | Down | Up |Right | + * `--------------------------------------------------------------------------------------------------------' + */ +[_DVORAK] = KEYMAP( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_DEL,\ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_P7, KC_P8, KC_P9, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + KC_LCTL, KC_A, KC_O, KC_E, KC_U, KC_I, KC_P4, KC_P5, KC_P6, KC_D, KC_H, KC_T, KC_N, LT_MC(KC_S), KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_P1, KC_P2, KC_P3, KC_B, KC_M, KC_W, KC_V, KC_Z, CTL_ENT, \ + KC_GRV, KC_LCTRL, KC_LGUI, KC_LALT, LOWER, KC_SPC, KC_P0, KC_DOT, KC_EQL, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Lower + * ,------+------+------+------+------+------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | ~ | ! | @ | # | $ | % | | | | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO ~ |ISO | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `--------------------------------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_UNDS, KC_PLUS, KC_LBRC, KC_RBRC, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | | | | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | | | | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | | | | F12 |ISO # |ISO / | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | Next | Vol- | Vol+ | Play | + * `--------------------------------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, _______, _______, _______, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, KC_SPC, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Mouse Layer (semi-col) + * ,------+------+------+------+------+------------------------------------------------. + * | ACCL0| ACCL1| ACCL2| | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | | | | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| Macro| | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | BTN1 | | | | BTN1 | | | | | | + * `--------------------------------------------------------------------------------------------------------' + */ + +[_MOUSECURSOR] = KEYMAP( + KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R,DEMOMACRO,_______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, \ + _______, _______, _______, _______, _______, KC_BTN1, _______, _______, _______, KC_BTN1, _______, _______, _______, _______, _______ \ +), + +/* Adjust (Lower + Raise) + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | Reset|RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | | | | Del | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm| | | |AGswap|Qwerty|Colemk| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff| | | | | | | | BL + |BL ST |BL TG | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \ + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______\ +) + + + +}; + + +#ifdef AUDIO_ENABLE + +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +// define variables for reactive RGB +bool RGB_INIT = false; +bool TOG_STATUS = false; +int RGB_current_mode; + + + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + rgblight_mode(RGB_current_mode); + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistant_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (RGB_INIT) {} else { + RGB_current_mode = rgblight_config.mode; + RGB_INIT = true; + } + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(16); + } + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + TOG_STATUS = false; + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (RGB_INIT) {} else { + RGB_current_mode = rgblight_config.mode; + RGB_INIT = true; + } + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(15); + } + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + layer_off(_RAISE); + TOG_STATUS = false; + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + case RGB_MOD: + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +void matrix_scan_user(void) { + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif +} + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{cc + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); +} + +#endif + +/* + * Macro definition + */ +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + + switch (id) { + case KC_DEMOMACRO: + if (record->event.pressed){ + return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); + } + } + + return MACRO_NONE; +} diff --git a/keyboards/hadron/keymaps/default/readme.md b/keyboards/hadron/keymaps/default/readme.md new file mode 100644 index 000000000..de9680b49 --- /dev/null +++ b/keyboards/hadron/keymaps/default/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout + diff --git a/keyboards/hadron/keymaps/readme.md b/keyboards/hadron/keymaps/readme.md new file mode 100644 index 000000000..54fb5f6d9 --- /dev/null +++ b/keyboards/hadron/keymaps/readme.md @@ -0,0 +1,23 @@ +# How to add your own keymap + +Folders can be named however you'd like (will be approved upon merging), or should follow the format with a preceding `_`: + + _[ISO 3166-1 alpha-2 code*]_[layout variant]_[layout name/author] + +\* See full list: https://en.wikipedia.org/wiki/ISO_3166-1#Officially_assigned_code_elements + +and contain the following files: + +* `keymap.c` +* `readme.md` *recommended* +* `config.h` *optional*, found automatically when compiling +* `Makefile` *optional*, found automatically when compling + +When adding your keymap to this list, keep it organised alphabetically (select list, edit->sort lines), and use this format: + + * **folder_name** description + +# List of Planck keymaps + +* **default** default Planck layout +* **cbbrowne** cbbrowne's Planck layout \ No newline at end of file diff --git a/keyboards/hadron/keymaps/side_numpad/Makefile b/keyboards/hadron/keymaps/side_numpad/Makefile new file mode 100644 index 000000000..5cdc186cd --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/Makefile @@ -0,0 +1,26 @@ + + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = yes # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +ONEHAND_ENABLE = no # Enable one-hand typing + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/keymaps/side_numpad/config.h b/keyboards/hadron/keymaps/side_numpad/config.h new file mode 100644 index 000000000..4a5a8fad3 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/config.h @@ -0,0 +1,20 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define LEADER_TIMEOUT 300 +//#define BACKLIGHT_BREATHING +#define PREVENT_STUCK_MODIFIERS + +#define USE_I2C +#define SSD1306OLED + +/* ws2812 RGB LED*/ +#define RGB_DI_PIN D4 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 14 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 + +#endif diff --git a/keyboards/hadron/keymaps/side_numpad/keymap.c b/keyboards/hadron/keymaps/side_numpad/keymap.c new file mode 100644 index 000000000..cfe6cc539 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/keymap.c @@ -0,0 +1,418 @@ +#include "hadron.h" +#include "bootloader.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "LUFA/Drivers/Peripheral/TWI.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif +#ifdef USE_I2C +#include "i2c.h" +#endif +#ifdef SSD1306OLED +#include "ssd1306.h" +#endif +extern keymap_config_t keymap_config; + +//Following line allows macro to read current RGB settings +extern rgblight_config_t rgblight_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _LOWER 3 +#define _RAISE 4 +#define _FNLAYER 6 +#define _NUMLAY 7 +#define _MOUSECURSOR 8 +#define _ADJUST 16 + +enum preonic_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + BACKLIT, + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, +}; + +enum macro_keycodes { + KC_DEMOMACRO, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl +#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +// Requires KC_TRNS/_______ for the trigger key in the destination layer +#define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer +#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor +#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise +#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY +#define DEMOMACRO M(KC_DEMOMACRO) // My login macros + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,------+------+------+------+------+------------------------------------------------. + * | Esc | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | 7 | 8 | 9 | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | CAPS | A | S | D | F | G | H | J | K | L | ; |Enter | 4 | 5 | 6 | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / | = | 1 | 2 | 3 | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | ~ | Ctrl | Alt | GUI |Lower |Space |Space |Raise | RAlt | Ins | Del |NumLay| 0 | . | ENT | + * `--------------------------------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,\ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_P7, KC_P8, KC_P9, \ + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT_MC(KC_SCLN), CTL_ENT, KC_P4, KC_P5, KC_P6, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_EQL, KC_P1, KC_P2, KC_P3, \ + KC_GRV, KC_RCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_RALT, KC_INS, KC_DEL, TG_NUMLAY, KC_P0, KC_PDOT, KC_PENT \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | CAPS | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | [ | ] | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | + * `--------------------------------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( + KC_ESC, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV, KC_BSLS, _______, _______, _______, \ + KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_PIPE, _______, _______, _______, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______\ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | ~ | \ | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------+------+------+------| + * | | A | Up | D | PrSc | | 4 | 5 | 6 | * | : | ' | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | Lt | Dn | Rt | Mute | | 1 | 2 | 3 | Up | / | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | |Space | 0 | | Left | Down | Right| | | | | + * `--------------------------------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_PLUS, KC_BSLS, _______, _______, _______, \ + _______, KC_A, KC_UP, KC_D, KC_PSCR, _______, KC_4, KC_5, KC_6, KC_PAST, KC_COLN, KC_QUOT, _______, _______, _______, \ + _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC__MUTE, _______, KC_1, KC_2, KC_3, KC_UP, KC_SLSH, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, KC_SPC, KC_0, _______, KC_LEFT, KC_DOWN, KC_RIGHT, _______, _______, _______, _______ \ +), + +/* FN layer on Esc key + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | + | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | = | [ | ] | ' | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | { | } | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | Next | Vol- | Vol+ | Play | | | | + * `--------------------------------------------------------------------------------------------------------' + */ +[_FNLAYER] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PLUS, _______, _______, _______, \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_EQL, KC_LBRC, KC_RBRC, KC_QUOT, _______, _______, _______, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS), S(KC_NUBS), KC_LCBR, KC_RCBR, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, _______, _______ \ +), + +/* Num Layer + * ,-----------------------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | | | | | | | | | | | | | F7 | F8 | F9 | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | F4 | F5 | F6 | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | | Up | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | Exit | Left | Down | Rght | + * `--------------------------------------------------------------------------------------------------------' + */ +[_NUMLAY] = KEYMAP( + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_HOME, KC_PGUP, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, KC_END, KC_PGDN, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PMNS, KC_UP, KC_PPLS, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RIGHT \ +), + +/* Mouse Layer (semi-col) + * ,-----------------------------------------------------------------------------------. + * | |ACCL0| ACCL1| ACCL2 | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | | | | | | Home | Wh_Up| WHL_L| M_Up | WHL_R| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | End | Wh_Dn| M_Lft| M_Dn | M_Rt | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | BTN2 | BTN3 | BTN4 | BTN5 | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | BTN1 | | | | BTN1 | | | | | | + * `--------------------------------------------------------------------------------------------------------' + */ + +[_MOUSECURSOR] = KEYMAP( + _______, KC_ACL0, KC_ACL1, KC_ACL2, _______, _______, _______, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_WH_L, KC_MS_U, KC_WH_R, DEMOMACRO, _______, _______, _______, _______, \ + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_END , KC_PGDN, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______, _______, _______, _______, \ + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, _______, _______, _______ \ +), + +/* Adjust (Lower + Raise) + + * ,-----------------------------------------------------------------------------------. + * | Reset| | | | | | | | | VolD | VolU | Mute | + * |------+------+------+------+------+------+------+------+------+------+------+------+--------------------. + * | |RGB TG|RGB ST|RGBH -|RGBH +|RGBS -|RGBS +|RGBV -|RGBV +| | | Del | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty| | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | BL + |BL ST |BLSTEP| BL TG| | | | + * |------+------+------+------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | | | | | + * `--------------------------------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( + RESET, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLD, KC_VOLU, KC_MUTE, \ + _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, KC_DEL, _______, _______, _______, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, _______, _______, _______, _______, _______, \ + _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +) + + + +}; + + +#ifdef AUDIO_ENABLE + +float tone_startup[][2] = SONG(STARTUP_SOUND); +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float music_scale[][2] = SONG(MUSIC_SCALE_SOUND); +float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +// define variables for reactive RGB +bool RGB_INIT = false; +bool TOG_STATUS = false; +bool NUMLAY_STATUS = false; +int RGB_current_mode; + + + +void persistant_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) { + if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) { + rgblight_mode(RGB_current_mode); + layer_on(layer3); + } else { + layer_off(layer3); + } +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistant_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (RGB_INIT) {} else { + RGB_current_mode = rgblight_config.mode; + RGB_INIT = true; + } + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(16); + } + layer_on(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + TOG_STATUS = false; + layer_off(_LOWER); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + //not sure how to have keyboard check mode and set it to a variable, so my work around + //uses another variable that would be set to true after the first time a reactive key is pressed. + if (RGB_INIT) {} else { + RGB_current_mode = rgblight_config.mode; + RGB_INIT = true; + } + if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false + } else { + TOG_STATUS = !TOG_STATUS; + rgblight_mode(15); + } + layer_on(_RAISE); + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } else { + rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change + layer_off(_RAISE); + TOG_STATUS = false; + update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + //my attempt for RGB layer lock indication via changing the mode, still have to figure out how to not have other keypress not override this mode + case TG_NUMLAY: + if (record->event.pressed) { + if (RGB_INIT) {} else { + RGB_current_mode = rgblight_config.mode; + RGB_INIT = true; + } + NUMLAY_STATUS = !NUMLAY_STATUS; + if (NUMLAY_STATUS) { + rgblight_mode(4); + layer_on(_NUMLAY); + } else { + rgblight_mode(RGB_current_mode); + layer_off(_NUMLAY); } + } + return false; + break; + case RGB_MOD: + //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released + if (record->event.pressed) { + rgblight_mode(RGB_current_mode); + rgblight_step(); + RGB_current_mode = rgblight_config.mode; + } + return false; + break; + } + return true; +} + +void matrix_init_user(void) { + #ifdef USE_I2C + i2c_master_init(); + #ifdef SSD1306OLED + // calls code for the SSD1306 OLED + _delay_ms(400); + TWI_Init(TWI_BIT_PRESCALE_1, TWI_BITLENGTH_FROM_FREQ(1, 800000)); + iota_gfx_init(); // turns on the display + #endif + #endif + #ifdef AUDIO_ENABLE + startup_user(); + #endif +} + +void matrix_scan_user(void) { + #ifdef SSD1306OLED + iota_gfx_task(); // this is what updates the display continuously + #endif +} + +#ifdef AUDIO_ENABLE + +void startup_user() +{ + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); +} + +void shutdown_user() +{cc + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); +} + +void music_on_user(void) +{ + music_scale_user(); +} + +void music_scale_user(void) +{ + PLAY_NOTE_ARRAY(music_scale, false, 0); +} + +#endif + +/* + * Macro definition + */ +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + + switch (id) { + case KC_DEMOMACRO: + if (record->event.pressed){ + return MACRO (I(1), T(H),T(E),T(L), T(L), T(O), T(SPACE), T(W), T(O), T(R), T(L), T(D), END); + } + } + + return MACRO_NONE; +} diff --git a/keyboards/hadron/keymaps/side_numpad/readme.md b/keyboards/hadron/keymaps/side_numpad/readme.md new file mode 100644 index 000000000..de9680b49 --- /dev/null +++ b/keyboards/hadron/keymaps/side_numpad/readme.md @@ -0,0 +1,2 @@ +# The Default Planck Layout + diff --git a/keyboards/hadron/out.txt b/keyboards/hadron/out.txt new file mode 100644 index 000000000..644a6a777 --- /dev/null +++ b/keyboards/hadron/out.txt @@ -0,0 +1,66 @@ +-------- begin -------- +avr-gcc.exe (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 4.9.2 +Copyright (C) 2014 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +Compiling: ../../keyboards/planck/planck.c [OK] +Compiling: ../../keyboards/planck/keymaps/experimental/keymap.c [WARNINGS] + | + | ../../keyboards/planck/keymaps/experimental/keymap.c: In function 'action_get_macro': + | ../../keyboards/planck/keymaps/experimental/keymap.c:227:17: warning: implicit declaration of function 'breathing_speed_set' [-Wimplicit-function-declaration] + | breathing_speed_set(2); + | ^ + | ../../keyboards/planck/keymaps/experimental/keymap.c:228:17: warning: implicit declaration of function 'breathing_pulse' [-Wimplicit-function-declaration] + | breathing_pulse(); + | ^ + | +Compiling: ../../quantum/quantum.c [OK] +Compiling: ../../quantum/keymap.c [OK] +Compiling: ../../quantum/keycode_config.c [OK] +Compiling: ../../quantum/matrix.c [OK] +Compiling: ../../quantum/audio/audio.c [OK] +Compiling: ../../quantum/audio/voices.c [OK] +Compiling: ../../quantum/audio/luts.c [OK] +Compiling: ../../tmk_core/protocol/lufa/lufa.c [OK] +Compiling: ../../tmk_core/protocol/lufa/descriptor.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Class/Common/HIDParser.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/ConfigDescriptors.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/DeviceStandardReq.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/Events.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/HostStandardReq.c [OK] +Compiling: ../../tmk_core/protocol/lufa/LUFA-git/LUFA/Drivers/USB/Core/USBTask.c [OK] +Compiling: ../../tmk_core/common/host.c [OK] +Compiling: ../../tmk_core/common/keyboard.c [OK] +Compiling: ../../tmk_core/common/action.c [OK] +Compiling: ../../tmk_core/common/action_tapping.c [OK] +Compiling: ../../tmk_core/common/action_macro.c [OK] +Compiling: ../../tmk_core/common/action_layer.c [OK] +Compiling: ../../tmk_core/common/action_util.c [OK] +Compiling: ../../tmk_core/common/print.c [OK] +Compiling: ../../tmk_core/common/debug.c [OK] +Compiling: ../../tmk_core/common/util.c [OK] +Compiling: ../../tmk_core/common/avr/suspend.c [OK] +Assembling: ../../tmk_core/common/avr/xprintf.S [OK] +Compiling: ../../tmk_core/common/avr/timer.c [OK] +Compiling: ../../tmk_core/common/avr/bootloader.c [OK] +Compiling: ../../tmk_core/common/magic.c [OK] +Compiling: ../../tmk_core/common/avr/eeconfig.c [OK] +Compiling: ../../tmk_core/common/mousekey.c [OK] +Compiling: ../../tmk_core/common/command.c [OK] +Compiling: ../../tmk_core/common/backlight.c [OK] +Linking: .build/planck_experimental.elf [ERRORS] + | + | .build/obj_planck_experimental/keyboards/planck/keymaps/experimental/keymap.o: In function `action_get_macro': + | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:240: undefined reference to `breathing_speed_set' + | C:\Users\Fred Wales\Documents\Programming\qmk_firmware\keyboards\planck/../../keyboards/planck/keymaps/experimental/keymap.c:241: undefined reference to `breathing_pulse' + | collect2.exe: error: ld returned 1 exit status + | diff --git a/keyboards/hadron/readme.md b/keyboards/hadron/readme.md new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/keyboards/hadron/readme.md @@ -0,0 +1 @@ + diff --git a/keyboards/hadron/rules.mk b/keyboards/hadron/rules.mk new file mode 100644 index 000000000..78f86f982 --- /dev/null +++ b/keyboards/hadron/rules.mk @@ -0,0 +1,72 @@ +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=512 + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= no # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= no # Console for debug(+400) +COMMAND_ENABLE ?= no # Commands for debug and configuration +NKRO_ENABLE ?= no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality +MIDI_ENABLE ?= no # MIDI controls +AUDIO_ENABLE ?= no # Audio output on port C6 +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE ?= no # Enable WS2812 RGB underlight. +API_SYSEX_ENABLE = yes + +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend + +SRC = i2c.c \ + ssd1306.c + diff --git a/keyboards/hadron/ver0/Makefile b/keyboards/hadron/ver0/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/hadron/ver0/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/ver0/config.h b/keyboards/hadron/ver0/config.h new file mode 100644 index 000000000..039d4f1c7 --- /dev/null +++ b/keyboards/hadron/ver0/config.h @@ -0,0 +1,35 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifndef VER0_CONFIG_H +#define VER0_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define DEVICE_VER 0x0001 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* Hadron Ver0 PCB default pin-out */ +#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } +#define MATRIX_COL_PINS { F6, F7, C6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } +#define UNUSED_PINS + + +#endif diff --git a/keyboards/hadron/ver0/rules.mk b/keyboards/hadron/ver0/rules.mk new file mode 100644 index 000000000..0f9667a8a --- /dev/null +++ b/keyboards/hadron/ver0/rules.mk @@ -0,0 +1,5 @@ +#AUDIO_ENABLE ?= yes # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/ver0/ver0.c b/keyboards/hadron/ver0/ver0.c new file mode 100644 index 000000000..acb3a9105 --- /dev/null +++ b/keyboards/hadron/ver0/ver0.c @@ -0,0 +1 @@ +#include "ver0.h" \ No newline at end of file diff --git a/keyboards/hadron/ver0/ver0.h b/keyboards/hadron/ver0/ver0.h new file mode 100644 index 000000000..5710af322 --- /dev/null +++ b/keyboards/hadron/ver0/ver0.h @@ -0,0 +1,6 @@ +#ifndef VER0_H +#define VER0_H + +#include "../hadron.h" + +#endif \ No newline at end of file diff --git a/keyboards/hadron/ver2/Makefile b/keyboards/hadron/ver2/Makefile new file mode 100644 index 000000000..191c6bb66 --- /dev/null +++ b/keyboards/hadron/ver2/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/ver2/config.h b/keyboards/hadron/ver2/config.h new file mode 100644 index 000000000..71a0ab5b3 --- /dev/null +++ b/keyboards/hadron/ver2/config.h @@ -0,0 +1,35 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ +#ifndef VER2_CONFIG_H +#define VER2_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define DEVICE_VER 0x0002 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* Hadron Ver0 PCB default pin-out */ +#define MATRIX_ROW_PINS { D7, E6, B4, B5, B6 } +#define MATRIX_COL_PINS { F6, F7, D6, C7, F5, F4, F1, F0, D2, D3, D5, B3, B2, B1, B0 } +#define UNUSED_PINS + + +#endif diff --git a/keyboards/hadron/ver2/rules.mk b/keyboards/hadron/ver2/rules.mk new file mode 100644 index 000000000..0f9667a8a --- /dev/null +++ b/keyboards/hadron/ver2/rules.mk @@ -0,0 +1,5 @@ +#AUDIO_ENABLE ?= yes # Audio output on port C6 + +ifndef QUANTUM_DIR + include ../../../Makefile +endif \ No newline at end of file diff --git a/keyboards/hadron/ver2/ver2.c b/keyboards/hadron/ver2/ver2.c new file mode 100644 index 000000000..bc0917746 --- /dev/null +++ b/keyboards/hadron/ver2/ver2.c @@ -0,0 +1 @@ +#include "ver2.h" \ No newline at end of file diff --git a/keyboards/hadron/ver2/ver2.h b/keyboards/hadron/ver2/ver2.h new file mode 100644 index 000000000..54e141ffa --- /dev/null +++ b/keyboards/hadron/ver2/ver2.h @@ -0,0 +1,6 @@ +#ifndef VER2_H +#define VER2_H + +#include "../hadron.h" + +#endif \ No newline at end of file From 387b07404a1c3f7e8de15345157d4d0fb482d28c Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 11 Jul 2017 13:57:58 -0400 Subject: [PATCH 15/19] update drivers to exclude lets_split include --- drivers/avr/ssd1306.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c index f9312d2dc..e454f5437 100644 --- a/drivers/avr/ssd1306.c +++ b/drivers/avr/ssd1306.c @@ -5,7 +5,6 @@ #include "i2c.h" #include #include "print.h" -#include "lets_split.h" #include "glcdfont.c" #ifdef ADAFRUIT_BLE_ENABLE #include "adafruit_ble.h" From cc468523dfec8175939f575a214714eea8aaa7a3 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 11 Jul 2017 14:23:26 -0400 Subject: [PATCH 16/19] clean up ssd1306 implementation --- drivers/avr/ssd1306.c | 174 ++---------------- drivers/avr/ssd1306.h | 77 ++++++++ .../lets_split/keymaps/OLED_sample/keymap.c | 78 ++++++++ 3 files changed, 169 insertions(+), 160 deletions(-) diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c index e454f5437..03a909e9d 100644 --- a/drivers/avr/ssd1306.c +++ b/drivers/avr/ssd1306.c @@ -1,7 +1,6 @@ #ifdef SSD1306OLED #include "ssd1306.h" -#include "config.h" #include "i2c.h" #include #include "print.h" @@ -13,18 +12,7 @@ #include "lufa.h" #endif #include "sendchar.h" -#include "pincontrol.h" - -//assign the right code to your layers -#define _BASE 0 -#define _LOWER 8 -#define _RAISE 16 -#define _FNLAYER 64 -#define _NUMLAY 128 -#define _NLOWER 136 -#define _NFNLAYER 192 -#define _MOUSECURSOR 256 -#define _ADJUST 65560 +#include "timer.h" // Set this to 1 to help diagnose early startup problems // when testing power-on with ble. Turn it off otherwise, @@ -32,26 +20,6 @@ // with the matrix scan, causing keys to drop. #define DEBUG_TO_SCREEN 0 -// Controls the SSD1306 128x32 OLED display via i2c - -#define i2cAddress 0x3C - -#define DisplayHeight 32 -#define DisplayWidth 128 - -#define FontHeight 8 -#define FontWidth 6 - -#define MatrixRows (DisplayHeight / FontHeight) -#define MatrixCols (DisplayWidth / FontWidth) - -struct CharacterMatrix { - uint8_t display[MatrixRows][MatrixCols]; - uint8_t *cursor; - bool dirty; -}; - -static struct CharacterMatrix display; //static uint16_t last_battery_update; //static uint32_t vbat; //#define BatteryUpdateInterval 10000 /* milliseconds */ @@ -61,54 +29,13 @@ static uint8_t displaying; #endif static uint16_t last_flush; -enum ssd1306_cmds { - DisplayOff = 0xAE, - DisplayOn = 0xAF, - - SetContrast = 0x81, - DisplayAllOnResume = 0xA4, - - DisplayAllOn = 0xA5, - NormalDisplay = 0xA6, - InvertDisplay = 0xA7, - SetDisplayOffset = 0xD3, - SetComPins = 0xda, - SetVComDetect = 0xdb, - SetDisplayClockDiv = 0xD5, - SetPreCharge = 0xd9, - SetMultiPlex = 0xa8, - SetLowColumn = 0x00, - SetHighColumn = 0x10, - SetStartLine = 0x40, - - SetMemoryMode = 0x20, - ColumnAddr = 0x21, - PageAddr = 0x22, - - ComScanInc = 0xc0, - ComScanDec = 0xc8, - SegRemap = 0xa0, - SetChargePump = 0x8d, - ExternalVcc = 0x01, - SwitchCapVcc = 0x02, - - ActivateScroll = 0x2f, - DeActivateScroll = 0x2e, - SetVerticalScrollArea = 0xa3, - RightHorizontalScroll = 0x26, - LeftHorizontalScroll = 0x27, - VerticalAndRightHorizontalScroll = 0x29, - VerticalAndLeftHorizontalScroll = 0x2a, -}; - - // Write command sequence. // Returns true on success. static inline bool _send_cmd1(uint8_t cmd) { bool res = false; - if (i2c_start_write(i2cAddress)) { - xprintf("failed to start write to %d\n", i2cAddress); + if (i2c_start_write(SSD1306_ADDRESS)) { + xprintf("failed to start write to %d\n", SSD1306_ADDRESS); goto done; } @@ -153,8 +80,6 @@ static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) { #define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;} #define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;} -static void matrix_clear(struct CharacterMatrix *matrix); - static void clear_display(void) { matrix_clear(&display); @@ -163,7 +88,7 @@ static void clear_display(void) { send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1); send_cmd3(ColumnAddr, 0, DisplayWidth - 1); - if (i2c_start_write(i2cAddress)) { + if (i2c_start_write(SSD1306_ADDRESS)) { goto done; } if (i2c_master_write(0x40)) { @@ -262,7 +187,7 @@ done: return success; } -static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { *matrix->cursor = c; ++matrix->cursor; @@ -275,7 +200,7 @@ static void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) { } } -static void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) { matrix->dirty = true; if (c == '\n') { @@ -296,7 +221,7 @@ void iota_gfx_write_char(uint8_t c) { matrix_write_char(&display, c); } -static void matrix_write(struct CharacterMatrix *matrix, const char *data) { +void matrix_write(struct CharacterMatrix *matrix, const char *data) { const char *end = data + strlen(data); while (data < end) { matrix_write_char(matrix, *data); @@ -308,7 +233,7 @@ void iota_gfx_write(const char *data) { matrix_write(&display, data); } -static void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { +void matrix_write_P(struct CharacterMatrix *matrix, const char *data) { while (true) { uint8_t c = pgm_read_byte(data); if (c == 0) { @@ -323,7 +248,7 @@ void iota_gfx_write_P(const char *data) { matrix_write_P(&display, data); } -static void matrix_clear(struct CharacterMatrix *matrix) { +void matrix_clear(struct CharacterMatrix *matrix) { memset(matrix->display, ' ', sizeof(matrix->display)); matrix->cursor = &matrix->display[0][0]; matrix->dirty = true; @@ -333,7 +258,7 @@ void iota_gfx_clear_screen(void) { matrix_clear(&display); } -static void matrix_render(struct CharacterMatrix *matrix) { +void matrix_render(struct CharacterMatrix *matrix) { last_flush = timer_read(); iota_gfx_on(); #if DEBUG_TO_SCREEN @@ -344,7 +269,7 @@ static void matrix_render(struct CharacterMatrix *matrix) { send_cmd3(PageAddr, 0, MatrixRows - 1); send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1); - if (i2c_start_write(i2cAddress)) { + if (i2c_start_write(SSD1306_ADDRESS)) { goto done; } if (i2c_master_write(0x40)) { @@ -379,84 +304,13 @@ void iota_gfx_flush(void) { matrix_render(&display); } -static void matrix_update(struct CharacterMatrix *dest, - const struct CharacterMatrix *source) { - if (memcmp(dest->display, source->display, sizeof(dest->display))) { - memcpy(dest->display, source->display, sizeof(dest->display)); - dest->dirty = true; - } -} +__attribute__((weak)) +void iota_gfx_task_user(void) { -static void render_status_info(void) { -#if DEBUG_TO_SCREEN - if (debug_enable) { - return; - } -#endif - - struct CharacterMatrix matrix; - - matrix_clear(&matrix); - matrix_write_P(&matrix, PSTR("USB: ")); -#ifdef PROTOCOL_LUFA - switch (USB_DeviceState) { - case DEVICE_STATE_Unattached: - matrix_write_P(&matrix, PSTR("Unattached")); - break; - case DEVICE_STATE_Suspended: - matrix_write_P(&matrix, PSTR("Suspended")); - break; - case DEVICE_STATE_Configured: - matrix_write_P(&matrix, PSTR("Connected")); - break; - case DEVICE_STATE_Powered: - matrix_write_P(&matrix, PSTR("Powered")); - break; - case DEVICE_STATE_Default: - matrix_write_P(&matrix, PSTR("Default")); - break; - case DEVICE_STATE_Addressed: - matrix_write_P(&matrix, PSTR("Addressed")); - break; - default: - matrix_write_P(&matrix, PSTR("Invalid")); - } -#endif - -// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below - - char buf[40]; - snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); - matrix_write_P(&matrix, PSTR("\n\nLayer: ")); - switch (layer_state) { - case _BASE: - matrix_write_P(&matrix, PSTR("Default")); - break; - case _RAISE: - matrix_write_P(&matrix, PSTR("Raise")); - break; - case _LOWER: - matrix_write_P(&matrix, PSTR("Lower")); - break; - case _ADJUST: - matrix_write_P(&matrix, PSTR("ADJUST")); - break; - default: - matrix_write(&matrix, buf); - } - - // Host Keyboard LED Status - char led[40]; - snprintf(led, sizeof(led), "\n%s %s %s", - (host_keyboard_leds() & (1< #include +#include "pincontrol.h" +#include "config.h" + +enum ssd1306_cmds { + DisplayOff = 0xAE, + DisplayOn = 0xAF, + + SetContrast = 0x81, + DisplayAllOnResume = 0xA4, + + DisplayAllOn = 0xA5, + NormalDisplay = 0xA6, + InvertDisplay = 0xA7, + SetDisplayOffset = 0xD3, + SetComPins = 0xda, + SetVComDetect = 0xdb, + SetDisplayClockDiv = 0xD5, + SetPreCharge = 0xd9, + SetMultiPlex = 0xa8, + SetLowColumn = 0x00, + SetHighColumn = 0x10, + SetStartLine = 0x40, + + SetMemoryMode = 0x20, + ColumnAddr = 0x21, + PageAddr = 0x22, + + ComScanInc = 0xc0, + ComScanDec = 0xc8, + SegRemap = 0xa0, + SetChargePump = 0x8d, + ExternalVcc = 0x01, + SwitchCapVcc = 0x02, + + ActivateScroll = 0x2f, + DeActivateScroll = 0x2e, + SetVerticalScrollArea = 0xa3, + RightHorizontalScroll = 0x26, + LeftHorizontalScroll = 0x27, + VerticalAndRightHorizontalScroll = 0x29, + VerticalAndLeftHorizontalScroll = 0x2a, +}; + +// Controls the SSD1306 128x32 OLED display via i2c + +#ifndef SSD1306_ADDRESS +#define SSD1306_ADDRESS 0x3C +#endif + +#define DisplayHeight 32 +#define DisplayWidth 128 + +#define FontHeight 8 +#define FontWidth 6 + +#define MatrixRows (DisplayHeight / FontHeight) +#define MatrixCols (DisplayWidth / FontWidth) + +struct CharacterMatrix { + uint8_t display[MatrixRows][MatrixCols]; + uint8_t *cursor; + bool dirty; +}; + +struct CharacterMatrix display; bool iota_gfx_init(void); void iota_gfx_task(void); @@ -14,4 +79,16 @@ void iota_gfx_write(const char *data); void iota_gfx_write_P(const char *data); void iota_gfx_clear_screen(void); +__attribute__((weak)) +void iota_gfx_task_user(void); + +void matrix_clear(struct CharacterMatrix *matrix); +void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c); +void matrix_write(struct CharacterMatrix *matrix, const char *data); +void matrix_write_P(struct CharacterMatrix *matrix, const char *data); +void matrix_render(struct CharacterMatrix *matrix); + + + #endif diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index 5dbab5332..ad32269c8 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -357,3 +357,81 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; } + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case _QWERTY: + case _COLEMAK: + case _DVORAK: + matrix_write_P(&matrix, PSTR("Default")); + break; + case _RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case _LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case _ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1< Date: Tue, 11 Jul 2017 22:05:01 +0300 Subject: [PATCH 17/19] Fix bitfield problem when compiling in native mingw --- tmk_core/native.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tmk_core/native.mk b/tmk_core/native.mk index 50232ee9b..530b50b84 100644 --- a/tmk_core/native.mk +++ b/tmk_core/native.mk @@ -1,3 +1,5 @@ +SYSTEM_TYPE := $(shell gcc -dumpmachine) + CC = gcc OBJCOPY = OBJDUMP = @@ -14,6 +16,9 @@ COMPILEFLAGS += -funsigned-bitfields COMPILEFLAGS += -ffunction-sections COMPILEFLAGS += -fdata-sections COMPILEFLAGS += -fshort-enums +ifneq ($(findstring mingw, ${SYSTEM_TYPE}),) +COMPILEFLAGS += -mno-ms-bitfields +endif CFLAGS += $(COMPILEFLAGS) CFLAGS += -fno-inline-small-functions From b7d8dec7dccc9bc6b458e26a8d12fcdb4d73cdeb Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Wed, 12 Jul 2017 13:04:50 +0300 Subject: [PATCH 18/19] Fix printf error in make output on msys2 --- message.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/message.mk b/message.mk index fa051fd71..4f72202e6 100644 --- a/message.mk +++ b/message.mk @@ -21,8 +21,8 @@ OK_STRING=$(OK_COLOR)[OK]$(NO_COLOR)\n ERROR_STRING=$(ERROR_COLOR)[ERRORS]$(NO_COLOR)\n WARN_STRING=$(WARN_COLOR)[WARNINGS]$(NO_COLOR)\n -TAB_LOG = printf "\n$$LOG\n\n" | $(AWK) '{ sub(/^/," | "); print }' -TAB_LOG_PLAIN = printf "$$LOG\n" +TAB_LOG = printf "\n%s\n\n" "$$LOG" | $(AWK) '{ sub(/^/," | "); print }' +TAB_LOG_PLAIN = printf "%s\n" "$$LOG" AWK_STATUS = $(AWK) '{ printf " %-10s\n", $$1; }' AWK_CMD = $(AWK) '{ printf "%-99s", $$0; }' PRINT_ERROR = ($(SILENT) ||printf " $(ERROR_STRING)" | $(AWK_STATUS)) && $(TAB_LOG) && $(ON_ERROR) From 087af43dee545792f486069481460ed5997bc41b Mon Sep 17 00:00:00 2001 From: ishtob Date: Wed, 12 Jul 2017 12:10:28 -0400 Subject: [PATCH 19/19] fix implementation issues from SSD1306 clean up, added rotation (#1494) * moved OLED update task to keymap * fix splitting render display to keymap * Added rotation option for OLED, fixed splitting display render update to keymap * issues with attribute --- drivers/avr/ssd1306.c | 16 ++-- drivers/avr/ssd1306.h | 1 - keyboards/hadron/keymaps/default/config.h | 1 + keyboards/hadron/keymaps/default/keymap.c | 88 +++++++++++++++++++ keyboards/hadron/keymaps/side_numpad/config.h | 1 + keyboards/hadron/keymaps/side_numpad/keymap.c | 87 ++++++++++++++++++ .../lets_split/keymaps/OLED_sample/config.h | 1 + .../lets_split/keymaps/OLED_sample/keymap.c | 22 +++-- 8 files changed, 203 insertions(+), 14 deletions(-) diff --git a/drivers/avr/ssd1306.c b/drivers/avr/ssd1306.c index 03a909e9d..bb8938bba 100644 --- a/drivers/avr/ssd1306.c +++ b/drivers/avr/ssd1306.c @@ -134,14 +134,17 @@ bool iota_gfx_init(void) { send_cmd2(SetChargePump, 0x14 /* Enable */); send_cmd2(SetMemoryMode, 0 /* horizontal addressing */); -/// Flips the display orientation 0 degrees - send_cmd1(SegRemap | 0x1); - send_cmd1(ComScanDec); -/* +#ifdef OLED_ROTATE180 // the following Flip the display orientation 180 degrees send_cmd1(SegRemap); send_cmd1(ComScanInc); -// end flip */ +#endif +#ifndef OLED_ROTATE180 +// Flips the display orientation 0 degrees + send_cmd1(SegRemap | 0x1); + send_cmd1(ComScanDec); +#endif + send_cmd2(SetComPins, 0x2); send_cmd2(SetContrast, 0x8f); send_cmd2(SetPreCharge, 0xf1); @@ -304,9 +307,8 @@ void iota_gfx_flush(void) { matrix_render(&display); } -__attribute__((weak)) +__attribute__ ((weak)) void iota_gfx_task_user(void) { - } void iota_gfx_task(void) { diff --git a/drivers/avr/ssd1306.h b/drivers/avr/ssd1306.h index 1b6f8a493..df6a75359 100644 --- a/drivers/avr/ssd1306.h +++ b/drivers/avr/ssd1306.h @@ -79,7 +79,6 @@ void iota_gfx_write(const char *data); void iota_gfx_write_P(const char *data); void iota_gfx_clear_screen(void); -__attribute__((weak)) void iota_gfx_task_user(void); void matrix_clear(struct CharacterMatrix *matrix); diff --git a/keyboards/hadron/keymaps/default/config.h b/keyboards/hadron/keymaps/default/config.h index 4a5a8fad3..0f349ad93 100644 --- a/keyboards/hadron/keymaps/default/config.h +++ b/keyboards/hadron/keymaps/default/config.h @@ -9,6 +9,7 @@ #define USE_I2C #define SSD1306OLED +#define OLED_ROTATE180 /* ws2812 RGB LED*/ #define RGB_DI_PIN D4 diff --git a/keyboards/hadron/keymaps/default/keymap.c b/keyboards/hadron/keymaps/default/keymap.c index 24fa0b27f..01cc8abab 100644 --- a/keyboards/hadron/keymaps/default/keymap.c +++ b/keyboards/hadron/keymaps/default/keymap.c @@ -406,3 +406,91 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; } + +void matrix_update(struct CharacterMatrix *dest, + const struct CharacterMatrix *source) { + if (memcmp(dest->display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(&matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case L_ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<display, source->display, sizeof(dest->display))) { + memcpy(dest->display, source->display, sizeof(dest->display)); + dest->dirty = true; + } +} + +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + +void iota_gfx_task_user(void) { +#if DEBUG_TO_SCREEN + if (debug_enable) { + return; + } +#endif + + struct CharacterMatrix matrix; + + matrix_clear(&matrix); + matrix_write_P(&matrix, PSTR("USB: ")); +#ifdef PROTOCOL_LUFA + switch (USB_DeviceState) { + case DEVICE_STATE_Unattached: + matrix_write_P(&matrix, PSTR("Unattached")); + break; + case DEVICE_STATE_Suspended: + matrix_write_P(&matrix, PSTR("Suspended")); + break; + case DEVICE_STATE_Configured: + matrix_write_P(&matrix, PSTR("Connected")); + break; + case DEVICE_STATE_Powered: + matrix_write_P(&matrix, PSTR("Powered")); + break; + case DEVICE_STATE_Default: + matrix_write_P(&matrix, PSTR("Default")); + break; + case DEVICE_STATE_Addressed: + matrix_write_P(&matrix, PSTR("Addressed")); + break; + default: + matrix_write_P(&matrix, PSTR("Invalid")); + } +#endif + +// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below + + char buf[40]; + snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); + matrix_write_P(&matrix, PSTR("\n\nLayer: ")); + switch (layer_state) { + case L_BASE: + matrix_write_P(&matrix, PSTR("Default")); + break; + case L_RAISE: + matrix_write_P(&matrix, PSTR("Raise")); + break; + case L_LOWER: + matrix_write_P(&matrix, PSTR("Lower")); + break; + case L_ADJUST: + matrix_write_P(&matrix, PSTR("ADJUST")); + break; + default: + matrix_write(&matrix, buf); + } + + // Host Keyboard LED Status + char led[40]; + snprintf(led, sizeof(led), "\n%s %s %s", + (host_keyboard_leds() & (1<. #define FLIP_HALF #define SSD1306OLED +//#define OLED_ROTATE180 #define PREVENT_STUCK_MODIFIERS diff --git a/keyboards/lets_split/keymaps/OLED_sample/keymap.c b/keyboards/lets_split/keymaps/OLED_sample/keymap.c index ad32269c8..9553309f8 100644 --- a/keyboards/lets_split/keymaps/OLED_sample/keymap.c +++ b/keyboards/lets_split/keymaps/OLED_sample/keymap.c @@ -358,6 +358,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) return MACRO_NONE; } + void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) { if (memcmp(dest->display, source->display, sizeof(dest->display))) { @@ -366,6 +367,17 @@ void matrix_update(struct CharacterMatrix *dest, } } +//assign the right code to your layers for OLED display +#define L_BASE 0 +#define L_LOWER 8 +#define L_RAISE 16 +#define L_FNLAYER 64 +#define L_NUMLAY 128 +#define L_NLOWER 136 +#define L_NFNLAYER 192 +#define L_MOUSECURSOR 256 +#define L_ADJUST 65560 + void iota_gfx_task_user(void) { #if DEBUG_TO_SCREEN if (debug_enable) { @@ -408,18 +420,16 @@ void iota_gfx_task_user(void) { snprintf(buf,sizeof(buf), "Undef-%ld", layer_state); matrix_write_P(&matrix, PSTR("\n\nLayer: ")); switch (layer_state) { - case _QWERTY: - case _COLEMAK: - case _DVORAK: + case L_BASE: matrix_write_P(&matrix, PSTR("Default")); break; - case _RAISE: + case L_RAISE: matrix_write_P(&matrix, PSTR("Raise")); break; - case _LOWER: + case L_LOWER: matrix_write_P(&matrix, PSTR("Lower")); break; - case _ADJUST: + case L_ADJUST: matrix_write_P(&matrix, PSTR("ADJUST")); break; default: