Skip to content

Commit

Permalink
feature-11 Fix headers
Browse files Browse the repository at this point in the history
  • Loading branch information
zored committed May 24, 2020
1 parent 7dff2c2 commit 74aba72
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 19 deletions.
10 changes: 6 additions & 4 deletions compiler/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function main () {
)
const files = new KeymapFiles(keyboard)

const { comboCount } = compileKeymap(layers, keyboard, files, keyFactory, config.dance_enemies, config)
const { comboCount } = compileKeymap(layers, keyboard, files, keyFactory, config.dance_enemies)
compileSettings(keyboard, files, {
COMBO_COUNT: comboCount
})
Expand Down Expand Up @@ -542,16 +542,18 @@ function compileKeymap (layers, keyboard, files, keyFactory, danceEnemies) {
const Mustache = require('mustache')

const { combos, comboCount } = getCombos(keyboard.config.combos, keyFactory)
const result = Mustache.render(fs.readFileSync('compiler/template/zored_keymap.c', 'utf8'), _.merge({
const config = _.merge({
dance: getDanceTemplateData(layers, danceEnemies, keyFactory),
unicode: getUnicodeTemplateData(layers),
layers: getLayersTemplateData(layers, keyboard),
functions: getFunctions(),
combos,
mappings: getMappings(keyboard.config.mappings, keyFactory),
keyGroups: getKeyGroups(layers)
}, keyboard.getTemplateData(layers)))
files.add('keymap.c', result)
}, keyboard.getTemplateData(layers));
[['zored_keymap.h','keymap.h'],['zored_keymap.c','keymap.c']].forEach(([from, to]) =>
files.add(to, Mustache.render(fs.readFileSync(`compiler/template/${from}`, 'utf8'), config))
);

return { comboCount }
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/template/rgb_matrix_user.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "keymap.h"

#ifndef DISABLE_RGB_MATRIX_ZORED_EFFECT
RGB_MATRIX_EFFECT(zored_effect)

#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#include "keymap.h"

static bool zored_effect(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
Expand Down
7 changes: 2 additions & 5 deletions compiler/template/zored_keymap.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{! Keymap template for all of my keymaps. Has a lot of common code. }}

{{! This guy should be before RGB. }}
#include "keymap.h"

{{#ergodox}}
#include "ergodox_ez.h"
Expand All @@ -23,10 +23,7 @@
#include "keymap_steno.h"
#endif

enum operating_systems {
OS_MACOS = 1,
OS_WINDOWS,
} zored_os = OS_WINDOWS;
operating_systems zored_os = OS_WINDOWS;

{{#mappings}}
uint8_t mappingIndex = 0;
Expand Down
12 changes: 11 additions & 1 deletion compiler/template/zored_keymap.h
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#include QMK_KEYBOARD_H
#ifndef ZORED_KEYMAP_H
#define ZORED_KEYMAP_H

typedef enum {
OS_MACOS = 1,
OS_WINDOWS,
} operating_systems;

extern operating_systems zored_os;

#endif // ZORED_KEYMAP_H
6 changes: 2 additions & 4 deletions example/planck/keymap.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#include "keymap.h"


#include QMK_KEYBOARD_H
Expand All @@ -13,10 +14,7 @@
#include "keymap_steno.h"
#endif

enum operating_systems {
OS_MACOS = 1,
OS_WINDOWS,
} zored_os = OS_WINDOWS;
operating_systems zored_os = OS_WINDOWS;


uint8_t map_mod (uint8_t mod) {
Expand Down
12 changes: 11 additions & 1 deletion example/planck/keymap.h
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
#include QMK_KEYBOARD_H
#ifndef ZORED_KEYMAP_H
#define ZORED_KEYMAP_H

typedef enum {
OS_MACOS = 1,
OS_WINDOWS,
} operating_systems;

extern operating_systems zored_os;

#endif // ZORED_KEYMAP_H
3 changes: 1 addition & 2 deletions example/planck/rgb_matrix_user.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#include "keymap.h"

#ifndef DISABLE_RGB_MATRIX_ZORED_EFFECT
RGB_MATRIX_EFFECT(zored_effect)

#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
#include "keymap.h"

static bool zored_effect(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
Expand Down

0 comments on commit 74aba72

Please sign in to comment.