Browse Source

Creates a userspace for keymaps (#1559)

* create a user space

* adds example

* document, add readme.md

* jackhumbert userspace, ergodox keymap
pull/1880/head 0.5.138
Jack Humbert 6 years ago
committed by GitHub
parent
commit
06f196c589
14 changed files with 92 additions and 0 deletions
  1. +5
    -0
      build_keyboard.mk
  2. +1
    -0
      docs/_summary.md
  3. +33
    -0
      docs/feature_userspace.md
  4. +0
    -0
      layouts/community/ergodox/jackhumbert/config.h
  5. +0
    -0
      layouts/community/ergodox/jackhumbert/keymap.c
  6. +5
    -0
      users/_example/_example.c
  7. +8
    -0
      users/_example/_example.h
  8. +14
    -0
      users/_example/readme.md
  9. +1
    -0
      users/_example/rules.mk
  10. +1
    -0
      users/jackhumbert/jackhumbert.c
  11. +6
    -0
      users/jackhumbert/jackhumbert.h
  12. +14
    -0
      users/jackhumbert/readme.md
  13. +1
    -0
      users/jackhumbert/rules.mk
  14. +3
    -0
      users/readme.md

+ 5
- 0
build_keyboard.mk View File

@ -183,6 +183,10 @@ else
# this state should never be reached
endif
# User space stuff
USER_PATH := users/$(KEYMAP)
-include $(USER_PATH)/rules.mk
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
# this an empty or blank macro!
@ -204,6 +208,7 @@ SRC += $(KEYBOARD_SRC) \
VPATH += $(KEYMAP_PATH)
VPATH += $(KEYBOARD_PATHS)
VPATH += $(COMMON_VPATH)
VPATH += $(USER_PATH)
include common_features.mk
include $(TMK_PATH)/protocol.mk


+ 1
- 0
docs/_summary.md View File

@ -15,6 +15,7 @@
* [Features](features.md)
* [Layouts](feature_layouts.md)
* [Common Shortcuts](feature_common_shortcuts.md)
* [Userspace](feature_userspace.md)
* [Backlight](feature_backlight.md)
* [Bootmagic](feature_bootmagic.md)
* [Dynamic Macros](dynamic_macros.md)


+ 33
- 0
docs/feature_userspace.md View File

@ -0,0 +1,33 @@
# Userspace: sharing code between keymaps
If you use more than one keyboard with a similar keymap, you might see the benefit in being able to share code between them. Create your own folder in `users/` named the same as your keymap (ideally your github username, `<name>`) with the following structure:
* `/users/<name>/` (added to the path automatically)
* `readme.md`
* `rules.mk` (included automatically)
* `<name>.h` (optional)
* `<name>.c` (optional)
`<name>.c` will need to be added to the SRC in `rules.mk` like this:
SRC += <name>.c
Additional files may be added in the same way - it's recommended you have one named `<name>`.c/.h though.
All this only happens when you build a keymap named `<name>`, like this:
make planck:<name>
For example,
make planck:jack
Will include the `/users/jack/` folder in the path, along with `/users/jack/rules.mk`.
## Readme
Please include authorship (your name, github username, email), and optionally [a license that's GPL compatible](https://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses).
## Example
For a brief example, checkout `/users/_example/` until we have more reasonable and useful examples.

layouts/community/ergodox/jack/config.h → layouts/community/ergodox/jackhumbert/config.h View File


layouts/community/ergodox/jack/keymap.c → layouts/community/ergodox/jackhumbert/keymap.c View File


+ 5
- 0
users/_example/_example.c View File

@ -0,0 +1,5 @@
#include "_example.h"
void my_custom_function(void) {
}

+ 8
- 0
users/_example/_example.h View File

@ -0,0 +1,8 @@
#ifndef USERSPACE
#define USERSPACE
#include "quantum.h"
void my_custom_function(void);
#endif

+ 14
- 0
users/_example/readme.md View File

@ -0,0 +1,14 @@
Copyright <year> <name> <email> @<github_username>
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 <http://www.gnu.org/licenses/>.

+ 1
- 0
users/_example/rules.mk View File

@ -0,0 +1 @@
SRC += _example.c

+ 1
- 0
users/jackhumbert/jackhumbert.c View File

@ -0,0 +1 @@
#include "jackhumbert.h"

+ 6
- 0
users/jackhumbert/jackhumbert.h View File

@ -0,0 +1,6 @@
#ifndef USERSPACE
#define USERSPACE
#include "quantum.h"
#endif

+ 14
- 0
users/jackhumbert/readme.md View File

@ -0,0 +1,14 @@
Copyright 2017 Jack Humbert <jack.humb@gmail.com> @jackhumbert
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 <http://www.gnu.org/licenses/>.

+ 1
- 0
users/jackhumbert/rules.mk View File

@ -0,0 +1 @@
SRC += jackhumbert.c

+ 3
- 0
users/readme.md View File

@ -0,0 +1,3 @@
# User space
This is a place for users to put code that they might use between keyboards. If you build the keymap `mine`, `/users/mine/rules.mk` will be included in your build, and `/users/mine/` will be in your path - keep these things in mind when naming your files and referencing them from other places.

Loading…
Cancel
Save