aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilba6582 <Wilba6582@users.noreply.github.com>2018-10-01 01:35:10 +1000
committerJack Humbert <jack.humb@gmail.com>2018-09-30 11:35:10 -0400
commit66ef1e3d6770e388d631d25e4cd1c6b1640cea24 (patch)
treedc0b4eb5b3f2adba1a41c4199871e4a0d341611e
parent6734cd9c5c7b63677d3d4cf9bef8ccf878fd3551 (diff)
downloadqmk_firmware-66ef1e3d6770e388d631d25e4cd1c6b1640cea24.tar.gz
qmk_firmware-66ef1e3d6770e388d631d25e4cd1c6b1640cea24.zip
RAMA M6-B and IS31FL3218 driver (#4021)
* Initial RAMA M6-B commit. * Moved IS31FL3218 driver, minor cleanups * Refactor, added dynamic keymap. * Added dynamic keymaps to RAMA M6-A * Refactor M6-A and M6-B to use common code. * Formatting * Cleanup * Cleanup * Changes from review
-rw-r--r--drivers/issi/is31fl3218.c102
-rw-r--r--drivers/issi/is31fl3218.h (renamed from keyboards/rama/m6_a/keymaps/default/config.h)16
-rw-r--r--keyboards/rama/m6_a/config.h24
-rw-r--r--keyboards/rama/m6_a/keymaps/default/keymap.c316
-rw-r--r--keyboards/rama/m6_a/m6_a.c31
-rw-r--r--keyboards/rama/m6_a/readme.md2
-rw-r--r--keyboards/rama/m6_a/rules.mk44
-rw-r--r--keyboards/rama/m6_b/config.h129
-rw-r--r--keyboards/rama/m6_b/info.json19
-rw-r--r--keyboards/rama/m6_b/keymaps/default/keymap.c16
-rw-r--r--keyboards/rama/m6_b/m6_b.c230
-rw-r--r--keyboards/rama/m6_b/m6_b.h28
-rw-r--r--keyboards/rama/m6_b/m6_b_api.h39
-rw-r--r--keyboards/rama/m6_b/readme.md15
-rw-r--r--keyboards/rama/m6_b/rgb_backlight.c139
-rw-r--r--keyboards/rama/m6_b/rgb_backlight.h34
-rw-r--r--keyboards/rama/m6_b/rules.mk77
-rw-r--r--quantum/dynamic_keymap.c2
18 files changed, 885 insertions, 378 deletions
diff --git a/drivers/issi/is31fl3218.c b/drivers/issi/is31fl3218.c
new file mode 100644
index 000000000..db44f7256
--- /dev/null
+++ b/drivers/issi/is31fl3218.c
@@ -0,0 +1,102 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "is31fl3218.h"
17#include "i2c_master.h"
18
19// This is the full 8-bit address
20#define ISSI_ADDRESS 0b10101000
21
22// These are the register addresses
23#define ISSI_REG_SHUTDOWN 0x00
24#define ISSI_REG_PWM 0x01
25#define ISSI_REG_CONTROL 0x13
26#define ISSI_REG_UPDATE 0x16
27#define ISSI_REG_RESET 0x17
28
29// Default timeout if no I2C response
30#define ISSI_TIMEOUT 100
31
32// Reusable buffer for transfers
33uint8_t g_twi_transfer_buffer[20];
34
35// IS31FL3218 has 18 PWM outputs and a fixed I2C address, so no chaining.
36// If used as RGB LED driver, LEDs are assigned RGB,RGB,RGB,RGB,RGB,RGB
37uint8_t g_pwm_buffer[18];
38bool g_pwm_buffer_update_required = false;
39
40void IS31FL3218_write_register( uint8_t reg, uint8_t data )
41{
42 g_twi_transfer_buffer[0] = reg;
43 g_twi_transfer_buffer[1] = data;
44 i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
45}
46
47void IS31FL3218_write_pwm_buffer( uint8_t *pwm_buffer )
48{
49 g_twi_transfer_buffer[0] = ISSI_REG_PWM;
50 for ( int i=0; i<18; i++ ) {
51 g_twi_transfer_buffer[1+i] = pwm_buffer[i];
52 }
53
54 i2c_transmit( ISSI_ADDRESS, g_twi_transfer_buffer, 19, ISSI_TIMEOUT);
55}
56
57void IS31FL3218_init(void)
58{
59 // In case we ever want to reinitialize (?)
60 IS31FL3218_write_register( ISSI_REG_RESET, 0x00 );
61
62 // Turn off software shutdown
63 IS31FL3218_write_register( ISSI_REG_SHUTDOWN, 0x01 );
64
65 // Set all PWM values to zero
66 for ( uint8_t i = 0; i < 18; i++ ) {
67 IS31FL3218_write_register( ISSI_REG_PWM+i, 0x00 );
68 }
69
70 // Enable all channels
71 for ( uint8_t i = 0; i < 3; i++ ) {
72 IS31FL3218_write_register( ISSI_REG_CONTROL+i, 0b00111111 );
73 }
74
75 // Load PWM registers and LED Control register data
76 IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 );
77}
78
79void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
80{
81 g_pwm_buffer[index * 3 + 0] = red;
82 g_pwm_buffer[index * 3 + 1] = green;
83 g_pwm_buffer[index * 3 + 2] = blue;
84 g_pwm_buffer_update_required = true;
85}
86
87void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
88{
89 for ( int i = 0; i < 6; i++ ) {
90 IS31FL3218_set_color( i, red, green, blue );
91 }
92}
93
94void IS31FL3218_update_pwm_buffers(void)
95{
96 if ( g_pwm_buffer_update_required ) {
97 IS31FL3218_write_pwm_buffer( g_pwm_buffer );
98 // Load PWM registers and LED Control register data
99 IS31FL3218_write_register( ISSI_REG_UPDATE, 0x01 );
100 }
101 g_pwm_buffer_update_required = false;
102}
diff --git a/keyboards/rama/m6_a/keymaps/default/config.h b/drivers/issi/is31fl3218.h
index d150575c1..2d24e5146 100644
--- a/keyboards/rama/m6_a/keymaps/default/config.h
+++ b/drivers/issi/is31fl3218.h
@@ -1,4 +1,4 @@
1/* Copyright 2018 Wilba 1/* Copyright 2018 Jason Williams (Wilba)
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -13,12 +13,12 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#pragma once
16 17
17#ifndef CONFIG_USER_H 18#include <stdint.h>
18#define CONFIG_USER_H 19#include <stdbool.h>
19 20
20#include "../../config.h" 21void IS31FL3218_init(void);
21 22void IS31FL3218_set_color( int index, uint8_t red, uint8_t green, uint8_t blue );
22// place overrides here 23void IS31FL3218_set_color_all( uint8_t red, uint8_t green, uint8_t blue );
23 24void IS31FL3218_update_pwm_buffers(void);
24#endif
diff --git a/keyboards/rama/m6_a/config.h b/keyboards/rama/m6_a/config.h
index 0c5355f4a..8d77f5339 100644
--- a/keyboards/rama/m6_a/config.h
+++ b/keyboards/rama/m6_a/config.h
@@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>. 15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#ifndef CONFIG_H 18#pragma once
19#define CONFIG_H
20 19
21#include "config_common.h" 20#include "config_common.h"
22 21
@@ -187,4 +186,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
187/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ 186/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
188//#define MIDI_TONE_KEYCODE_OCTAVES 1 187//#define MIDI_TONE_KEYCODE_OCTAVES 1
189 188
190#endif 189#define RGB_BACKLIGHT_ENABLED 0
190
191#define DYNAMIC_KEYMAP_LAYER_COUNT 4
192
193
194// EEPROM usage
195
196// TODO: refactor with new user EEPROM code (coming soon)
197#define EEPROM_MAGIC 0x451F
198#define EEPROM_MAGIC_ADDR 32
199// Bump this every time we change what we store
200// This will automatically reset the EEPROM with defaults
201// and avoid loading invalid data from the EEPROM
202#define EEPROM_VERSION 0x07
203#define EEPROM_VERSION_ADDR 34
204
205// Backlight config starts after EEPROM version
206#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
207// Dynamic keymap starts after backlight config (35+37)
208#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/rama/m6_a/keymaps/default/keymap.c b/keyboards/rama/m6_a/keymaps/default/keymap.c
index 6b15f3cd1..7a408fa8a 100644
--- a/keyboards/rama/m6_a/keymaps/default/keymap.c
+++ b/keyboards/rama/m6_a/keymaps/default/keymap.c
@@ -3,322 +3,14 @@
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4 4
5 LAYOUT( 5 LAYOUT(
6 TO(1), KC_A, KC_B, KC_C, KC_D, KC_E), 6 KC_1, KC_2, KC_3, KC_4, KC_5, KC_6),
7 7
8 LAYOUT( 8 LAYOUT(
9 TO(2), KC_F, KC_G, KC_H, KC_I, KC_J), 9 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
10 10
11 LAYOUT( 11 LAYOUT(
12 TO(3), KC_K, KC_L, KC_M, KC_N, KC_O), 12 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
13 13
14 LAYOUT( 14 LAYOUT(
15 TO(4), KC_P, KC_Q, KC_R, KC_S, KC_T), 15 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO) };
16 16
17 LAYOUT(
18 TO(5), KC_U, KC_V, KC_W, KC_X, KC_Y),
19
20 LAYOUT(
21 TO(0), KC_Z, KC_1, KC_2, KC_3, KC_4)};
22
23const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
24{
25 //keyevent_t event = record->event;
26
27 switch (id)
28 {
29 case 0:
30 if (record->event.pressed)
31 {
32 return MACRO(T(T), T(G), T(L), T(H), T(F), T(ENT), END);
33 }
34 break;
35 case 1:
36 if (record->event.pressed)
37 {
38 return MACRO(T(T), T(G), T(G), T(ENT), END);
39 }
40 break;
41 case 2:
42 if (record->event.pressed)
43 {
44 return MACRO(D(NO), T(L), U(NO), END);
45 }
46 break;
47 case 3:
48 if (record->event.pressed)
49 {
50 return MACRO(D(LCTL), T(Z), U(LCTL), END);
51 }
52 break;
53 case 4:
54 if (record->event.pressed)
55 {
56 return MACRO(D(LCTL), D(LSFT), T(Z), U(LSFT), U(LCTL), END);
57 }
58 break;
59 case 5:
60 if (record->event.pressed)
61 {
62 return MACRO(D(LCTL), T(X), U(LCTL), END);
63 }
64 break;
65 case 6:
66 if (record->event.pressed)
67 {
68 return MACRO(D(LCTL), T(C), U(LCTL), END);
69 }
70 break;
71 case 7:
72 if (record->event.pressed)
73 {
74 return MACRO(D(LCTL), T(V), U(LCTL), END);
75 }
76 break;
77 }
78 return MACRO_NONE;
79}
80
81// M6-A LEDs are connected to D6, B6, F5, B4, C7, F7
82// This is 1-based because I copied it from Knops code.
83void set_switch_led(int ledId, bool state)
84{
85 if (state)
86 {
87 switch (ledId)
88 {
89 case 1:
90 PORTD |= (1 << 6);
91 break;
92 case 2:
93 PORTB |= (1 << 6);
94 break;
95 case 3:
96 PORTF |= (1 << 5);
97 break;
98 case 4:
99 PORTB |= (1 << 4);
100 break;
101 case 5:
102 PORTC |= (1 << 7);
103 break;
104 case 6:
105 PORTF |= (1 << 7);
106 break;
107 }
108 }
109 else
110 {
111 switch (ledId)
112 {
113 case 1:
114 PORTD &= ~(1 << 6);
115 break;
116 case 2:
117 PORTB &= ~(1 << 6);
118 break;
119 case 3:
120 PORTF &= ~(1 << 5);
121 break;
122 case 4:
123 PORTB &= ~(1 << 4);
124 break;
125 case 5:
126 PORTC &= ~(1 << 7);
127 break;
128 case 6:
129 PORTF &= ~(1 << 7);
130 break;
131 }
132 }
133}
134
135void set_layer_led(int layerId)
136{
137 // UNUSED
138}
139
140void led_set_layer(int layer);
141
142void matrix_init_user(void)
143{
144 led_init_ports();
145 led_set_layer(0);
146}
147
148void matrix_scan_user(void)
149{
150}
151
152// M6-A LEDs are connected to D6, B6, F5, B4, C7, F7
153void led_init_ports()
154{
155 // Switch #1
156 DDRD |= (1 << 6);
157 PORTD &= ~(1 << 6);
158
159 // Switch #2
160 DDRB |= (1 << 6);
161 PORTB &= ~(1 << 6);
162
163 // Switch #3
164 DDRF |= (1 << 5);
165 PORTF &= ~(1 << 5);
166
167 // Switch #4
168 DDRB |= (1 << 4);
169 PORTB &= ~(1 << 4);
170
171 // Switch #5
172 DDRC |= (1 << 7);
173 PORTC &= ~(1 << 7);
174
175 // Switch #6
176 DDRF |= (1 << 7);
177 PORTF &= ~(1 << 7);
178}
179
180void led_set_user(uint8_t usb_led)
181{
182
183 if (usb_led & (1 << USB_LED_NUM_LOCK))
184 {
185 }
186 else
187 {
188 }
189
190 if (usb_led & (1 << USB_LED_CAPS_LOCK))
191 {
192 }
193 else
194 {
195 }
196
197 if (usb_led & (1 << USB_LED_SCROLL_LOCK))
198 {
199 }
200 else
201 {
202 }
203
204 if (usb_led & (1 << USB_LED_COMPOSE))
205 {
206 }
207 else
208 {
209 }
210
211 if (usb_led & (1 << USB_LED_KANA))
212 {
213 }
214 else
215 {
216 }
217}
218
219void led_set_layer(int layer)
220{
221 switch (layer)
222 {
223 case 0:
224 set_switch_led(1, true);
225 set_switch_led(2, false);
226 set_switch_led(3, false);
227 set_switch_led(4, false);
228 set_switch_led(5, false);
229 set_switch_led(6, false);
230 break;
231 case 1:
232 set_switch_led(1, false);
233 set_switch_led(2, true);
234 set_switch_led(3, false);
235 set_switch_led(4, false);
236 set_switch_led(5, false);
237 set_switch_led(6, false);
238 break;
239 case 2:
240 set_switch_led(1, false);
241 set_switch_led(2, false);
242 set_switch_led(3, true);
243 set_switch_led(4, false);
244 set_switch_led(5, false);
245 set_switch_led(6, false);
246 break;
247 case 3:
248 set_switch_led(1, false);
249 set_switch_led(2, false);
250 set_switch_led(3, false);
251 set_switch_led(4, true);
252 set_switch_led(5, false);
253 set_switch_led(6, false);
254 break;
255 case 4:
256 set_switch_led(1, false);
257 set_switch_led(2, false);
258 set_switch_led(3, false);
259 set_switch_led(4, false);
260 set_switch_led(5, true);
261 set_switch_led(6, false);
262 break;
263 case 5:
264 set_switch_led(1, false);
265 set_switch_led(2, false);
266 set_switch_led(3, false);
267 set_switch_led(4, false);
268 set_switch_led(5, false);
269 set_switch_led(6, true);
270 break;
271 default:
272 set_switch_led(1, true);
273 set_switch_led(2, true);
274 set_switch_led(3, true);
275 set_switch_led(4, true);
276 set_switch_led(5, true);
277 set_switch_led(6, true);
278 break;
279 }
280}
281
282bool process_record_user(uint16_t keycode, keyrecord_t *record)
283{
284 switch (keycode)
285 {
286 case TO(0):
287 if (record->event.pressed)
288 {
289 led_set_layer(0);
290 }
291 break;
292 case TO(1):
293 if (record->event.pressed)
294 {
295 led_set_layer(1);
296 }
297 break;
298 case TO(2):
299 if (record->event.pressed)
300 {
301 led_set_layer(2);
302 }
303 break;
304 case TO(3):
305 if (record->event.pressed)
306 {
307 led_set_layer(3);
308 }
309 break;
310 case TO(4):
311 if (record->event.pressed)
312 {
313 led_set_layer(4);
314 }
315 break;
316 case TO(5):
317 if (record->event.pressed)
318 {
319 led_set_layer(5);
320 }
321 break;
322 }
323 return true;
324}
diff --git a/keyboards/rama/m6_a/m6_a.c b/keyboards/rama/m6_a/m6_a.c
index 1c84ea2b8..fa1900360 100644
--- a/keyboards/rama/m6_a/m6_a.c
+++ b/keyboards/rama/m6_a/m6_a.c
@@ -1,4 +1,4 @@
1/* Copyright 2018 Wilba 1/* Copyright 2018 Jason Williams (Wilba)
2 * 2 *
3 * This program is free software: you can redistribute it and/or modify 3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by 4 * it under the terms of the GNU General Public License as published by
@@ -13,32 +13,3 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16#include "m6_a.h"
17/*
18void matrix_init_kb(void) {
19 // put your keyboard start-up code here
20 // runs once when the firmware starts up
21
22 matrix_init_user();
23}
24
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31
32bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
33 // put your per-action keyboard code here
34 // runs for every action, just before processing by the firmware
35
36 return process_record_user(keycode, record);
37}
38
39void led_set_kb(uint8_t usb_led) {
40 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
41
42 led_set_user(usb_led);
43}
44*/
diff --git a/keyboards/rama/m6_a/readme.md b/keyboards/rama/m6_a/readme.md
index 5dd2b92e1..ceaf6a88d 100644
--- a/keyboards/rama/m6_a/readme.md
+++ b/keyboards/rama/m6_a/readme.md
@@ -12,4 +12,4 @@ Make example for this keyboard (after setting up your build environment):
12 12
13 make rama/m6_a:default 13 make rama/m6_a:default
14 14
15See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file 15See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file
diff --git a/keyboards/rama/m6_a/rules.mk b/keyboards/rama/m6_a/rules.mk
index ca2a2a5f8..ed85ac36d 100644
--- a/keyboards/rama/m6_a/rules.mk
+++ b/keyboards/rama/m6_a/rules.mk
@@ -1,5 +1,7 @@
1# project specific files
2SRC = keyboards/rama/m6_b/m6_b.c
3
1# MCU name 4# MCU name
2#MCU = at90usb1286
3MCU = atmega32u4 5MCU = atmega32u4
4 6
5# Processor frequency. 7# Processor frequency.
@@ -38,31 +40,27 @@ F_USB = $(F_CPU)
38# Interrupt driven control endpoint task(+60) 40# Interrupt driven control endpoint task(+60)
39OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT 41OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
40 42
41 43# Boot Section
42# Boot Section Size in *bytes* 44BOOTLOADER = atmel-dfu
43# Teensy halfKay 512
44# Teensy++ halfKay 1024
45# Atmel DFU loader 4096
46# LUFA bootloader 4096
47# USBaspLoader 2048
48OPT_DEFS += -DBOOTLOADER_SIZE=4096
49
50 45
51# Build Options 46# Build Options
52# change yes to no to disable 47# change yes to no to disable
53# 48#
54BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) 49BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
55MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) 50MOUSEKEY_ENABLE = no # Mouse keys(+4700)
56EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) 51EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
57CONSOLE_ENABLE ?= yes # Console for debug(+400) 52CONSOLE_ENABLE = no # Console for debug(+400)
58COMMAND_ENABLE ?= yes # Commands for debug and configuration 53COMMAND_ENABLE = no # Commands for debug and configuration
59# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 54# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
60SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend 55SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 56# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE ?= no # USB Nkey Rollover 57NKRO_ENABLE = yes # USB Nkey Rollover
63BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default 58BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config) 59MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE ?= no # Unicode 60UNICODE_ENABLE = no # Unicode
66BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID 61BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE ?= no # Audio output on port C6 62AUDIO_ENABLE = no # Audio output on port C6
68FAUXCLICKY_ENABLE ?= no # Use buzzer to emulate clicky switches 63FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
64
65RAW_ENABLE = yes
66DYNAMIC_KEYMAP_ENABLE = yes \ No newline at end of file
diff --git a/keyboards/rama/m6_b/config.h b/keyboards/rama/m6_b/config.h
new file mode 100644
index 000000000..1adaad3f9
--- /dev/null
+++ b/keyboards/rama/m6_b/config.h
@@ -0,0 +1,129 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include "config_common.h"
19
20/* USB Device descriptor parameter */
21#define VENDOR_ID 0x5241 // "RW"
22#define PRODUCT_ID 0x006B // 6-B
23#define DEVICE_VER 0x0001
24#define MANUFACTURER RAMA.WORKS
25#define PRODUCT RAMA M6-B
26#define DESCRIPTION RAMA M6-B Macropad
27
28/* key matrix size */
29#define MATRIX_ROWS 1
30#define MATRIX_COLS 6
31
32/*
33 * Keyboard Matrix Assignments
34 *
35 * Change this to how you wired your keyboard
36 * COLS: AVR pins used for columns, left to right
37 * ROWS: AVR pins used for rows, top to bottom
38 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
39 * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
40 *
41*/
42#define MATRIX_ROW_PINS { E6 }
43#define MATRIX_COL_PINS { D4, B5, F4, D7, C6, F6 }
44#define UNUSED_PINS
45
46/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
47#define DIODE_DIRECTION COL2ROW
48
49// #define BACKLIGHT_PIN B7
50// #define BACKLIGHT_BREATHING
51// #define BACKLIGHT_LEVELS 3
52
53
54/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
55#define DEBOUNCING_DELAY 5
56
57/* define if matrix has ghost (lacks anti-ghosting diodes) */
58//#define MATRIX_HAS_GHOST
59
60/* number of backlight levels */
61
62/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
63#define LOCKING_SUPPORT_ENABLE
64/* Locking resynchronize hack */
65#define LOCKING_RESYNC_ENABLE
66
67/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
68 * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
69 */
70// #define GRAVE_ESC_CTRL_OVERRIDE
71
72/*
73 * Force NKRO
74 *
75 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
76 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
77 * makefile for this to work.)
78 *
79 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
80 * until the next keyboard reset.
81 *
82 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
83 * fully operational during normal computer usage.
84 *
85 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
86 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
87 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
88 * power-up.
89 *
90 */
91//#define FORCE_NKRO
92
93/*
94 * Magic Key Options
95 *
96 * Magic keys are hotkey commands that allow control over firmware functions of
97 * the keyboard. They are best used in combination with the HID Listen program,
98 * found here: https://www.pjrc.com/teensy/hid_listen.html
99 *
100 * The options below allow the magic key functionality to be changed. This is
101 * useful if your keyboard/keypad is missing keys and you want magic key support.
102 *
103 */
104
105/* key combination for magic key command */
106#define IS_COMMAND() ( \
107 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
108)
109
110#define RGB_BACKLIGHT_ENABLED 1
111
112#define DYNAMIC_KEYMAP_LAYER_COUNT 4
113
114
115// EEPROM usage
116
117// TODO: refactor with new user EEPROM code (coming soon)
118#define EEPROM_MAGIC 0x451F
119#define EEPROM_MAGIC_ADDR 32
120// Bump this every time we change what we store
121// This will automatically reset the EEPROM with defaults
122// and avoid loading invalid data from the EEPROM
123#define EEPROM_VERSION 0x07
124#define EEPROM_VERSION_ADDR 34
125
126// Backlight config starts after EEPROM version
127#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
128// Dynamic keymap starts after backlight config (35+37)
129#define DYNAMIC_KEYMAP_EEPROM_ADDR 72
diff --git a/keyboards/rama/m6_b/info.json b/keyboards/rama/m6_b/info.json
new file mode 100644
index 000000000..c88a3cc61
--- /dev/null
+++ b/keyboards/rama/m6_b/info.json
@@ -0,0 +1,19 @@
1{
2 "keyboard_name": "m6-b",
3 "url": "",
4 "maintainer": "qmk",
5 "width": 3,
6 "height": 2,
7 "layouts": {
8 "LAYOUT": {
9 "layout": [
10 { "x": 0, "y": 0 },
11 { "x": 1, "y": 0 },
12 { "x": 2, "y": 0 },
13 { "x": 0, "y": 1 },
14 { "x": 1, "y": 1 },
15 { "x": 2, "y": 1 }
16 ]
17 }
18 }
19}
diff --git a/keyboards/rama/m6_b/keymaps/default/keymap.c b/keyboards/rama/m6_b/keymaps/default/keymap.c
new file mode 100644
index 000000000..7a408fa8a
--- /dev/null
+++ b/keyboards/rama/m6_b/keymaps/default/keymap.c
@@ -0,0 +1,16 @@
1#include QMK_KEYBOARD_H
2
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
4
5 LAYOUT(
6 KC_1, KC_2, KC_3, KC_4, KC_5, KC_6),
7
8 LAYOUT(
9 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
10
11 LAYOUT(
12 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
13
14 LAYOUT(
15 KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO) };
16
diff --git a/keyboards/rama/m6_b/m6_b.c b/keyboards/rama/m6_b/m6_b.c
new file mode 100644
index 000000000..e7cd2f628
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b.c
@@ -0,0 +1,230 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#include "m6_b.h"
17#include "m6_b_api.h"
18
19// Check that no backlight functions are called
20#if RGB_BACKLIGHT_ENABLED
21#include "rgb_backlight.h"
22#endif // RGB_BACKLIGHT_ENABLED
23
24#include "raw_hid.h"
25#include "dynamic_keymap.h"
26#include "timer.h"
27#include "tmk_core/common/eeprom.h"
28
29bool eeprom_is_valid(void)
30{
31 return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
32 eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
33}
34
35void eeprom_set_valid(bool valid)
36{
37 eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF);
38 eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF);
39}
40
41void eeprom_reset(void)
42{
43 // Set the keyboard-specific EEPROM state as invalid.
44 eeprom_set_valid(false);
45 // Set the TMK/QMK EEPROM state as invalid.
46 eeconfig_disable();
47}
48
49#ifdef RAW_ENABLE
50
51void raw_hid_receive( uint8_t *data, uint8_t length )
52{
53 uint8_t *command_id = &(data[0]);
54 uint8_t *command_data = &(data[1]);
55 switch ( *command_id )
56 {
57 case id_get_protocol_version:
58 {
59 command_data[0] = PROTOCOL_VERSION >> 8;
60 command_data[1] = PROTOCOL_VERSION & 0xFF;
61 break;
62 }
63 case id_get_keyboard_value:
64 {
65 if ( command_data[0] == id_uptime )
66 {
67 uint32_t value = timer_read32();
68 command_data[1] = (value >> 24 ) & 0xFF;
69 command_data[2] = (value >> 16 ) & 0xFF;
70 command_data[3] = (value >> 8 ) & 0xFF;
71 command_data[4] = value & 0xFF;
72 }
73 else
74 {
75 *command_id = id_unhandled;
76 }
77 break;
78 }
79#ifdef DYNAMIC_KEYMAP_ENABLE
80 case id_dynamic_keymap_get_keycode:
81 {
82 uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] );
83 command_data[3] = keycode >> 8;
84 command_data[4] = keycode & 0xFF;
85 break;
86 }
87 case id_dynamic_keymap_set_keycode:
88 {
89 dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] );
90 break;
91 }
92 case id_dynamic_keymap_reset:
93 {
94 dynamic_keymap_reset();
95 break;
96 }
97#endif // DYNAMIC_KEYMAP_ENABLE
98#if RGB_BACKLIGHT_ENABLED
99 case id_backlight_config_set_value:
100 {
101 //backlight_config_set_value(command_data);
102 break;
103 }
104 case id_backlight_config_get_value:
105 {
106 //backlight_config_get_value(command_data);
107 break;
108 }
109 case id_backlight_config_save:
110 {
111 //backlight_config_save();
112 break;
113 }
114#endif // RGB_BACKLIGHT_ENABLED
115 case id_eeprom_reset:
116 {
117 eeprom_reset();
118 break;
119 }
120 case id_bootloader_jump:
121 {
122 // Need to send data back before the jump
123 // Informs host that the command is handled
124 raw_hid_send( data, length );
125 // Give host time to read it
126 wait_ms(100);
127 bootloader_jump();
128 break;
129 }
130 default:
131 {
132 // Unhandled message.
133 *command_id = id_unhandled;
134 break;
135 }
136 }
137
138 // Return same buffer with values changed
139 raw_hid_send( data, length );
140
141}
142
143#endif
144
145void main_init(void)
146{
147 // If the EEPROM has the magic, the data is good.
148 // OK to load from EEPROM.
149 if (eeprom_is_valid()) {
150#if RGB_BACKLIGHT_ENABLED
151 //backlight_config_load();
152#endif // RGB_BACKLIGHT_ENABLED
153 } else {
154#if RGB_BACKLIGHT_ENABLED
155 // If the EEPROM has not been saved before, or is out of date,
156 // save the default values to the EEPROM. Default values
157 // come from construction of the zeal_backlight_config instance.
158 //backlight_config_save();
159#endif // RGB_BACKLIGHT_ENABLED
160#ifdef DYNAMIC_KEYMAP_ENABLE
161 // This resets the keymaps in EEPROM to what is in flash.
162 dynamic_keymap_reset();
163#endif
164 // Save the magic number last, in case saving was interrupted
165 eeprom_set_valid(true);
166 }
167#if RGB_BACKLIGHT_ENABLED
168 // Initialize LED drivers for backlight.
169 backlight_init_drivers();
170
171 backlight_timer_init();
172 backlight_timer_enable();
173#endif // RGB_BACKLIGHT_ENABLED
174}
175
176void bootmagic_lite(void)
177{
178 // The lite version of TMK's bootmagic.
179 // 100% less potential for accidentally making the
180 // keyboard do stupid things.
181
182 // We need multiple scans because debouncing can't be turned off.
183 matrix_scan();
184 wait_ms(DEBOUNCING_DELAY);
185 wait_ms(DEBOUNCING_DELAY);
186 matrix_scan();
187
188 // If the Esc (matrix 0,0) is held down on power up,
189 // reset the EEPROM valid state and jump to bootloader.
190 if ( matrix_get_row(0) & (1<<0) ) {
191 eeprom_reset();
192 bootloader_jump();
193 }
194}
195
196void matrix_init_kb(void) {
197 bootmagic_lite();
198 main_init();
199 matrix_init_user();
200}
201
202void matrix_scan_kb(void) {
203#if RGB_BACKLIGHT_ENABLED
204 // This only updates the LED driver buffers if something has changed.
205 backlight_update_pwm_buffers();
206#endif // BACKLIGHT_ENABLED
207 matrix_scan_user();
208}
209
210bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
211 return process_record_user(keycode, record);
212}
213
214void led_set_kb(uint8_t usb_led) {
215 led_set_user(usb_led);
216}
217
218void suspend_power_down_kb(void)
219{
220#if RGB_BACKLIGHT_ENABLED
221 //backlight_set_suspend_state(true);
222#endif // BACKLIGHT_ENABLED
223}
224
225void suspend_wakeup_init_kb(void)
226{
227#if RGB_BACKLIGHT_ENABLED
228 //backlight_set_suspend_state(false);
229#endif // BACKLIGHT_ENABLED
230}
diff --git a/keyboards/rama/m6_b/m6_b.h b/keyboards/rama/m6_b/m6_b.h
new file mode 100644
index 000000000..bd4158bcb
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b.h
@@ -0,0 +1,28 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#include "quantum.h"
19
20// This a shortcut to help you visually see your layout.
21// The first section contains all of the arguments
22// The second converts the arguments into a two-dimensional array
23#define LAYOUT( \
24 K00, K01, K02, K03, K04, K05) \
25 { \
26 {K00, K01, K02, K03, K04, K05}, \
27 }
28
diff --git a/keyboards/rama/m6_b/m6_b_api.h b/keyboards/rama/m6_b/m6_b_api.h
new file mode 100644
index 000000000..041fd6e6e
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b_api.h
@@ -0,0 +1,39 @@
1/* Copyright 2017 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#define PROTOCOL_VERSION 0x0001
19
20enum m6_b_command_id
21{
22 id_get_protocol_version = 0x01, // always 0x01
23 id_get_keyboard_value,
24 id_set_keyboard_value,
25 id_dynamic_keymap_get_keycode,
26 id_dynamic_keymap_set_keycode,
27 id_dynamic_keymap_reset,
28 id_backlight_config_set_value,
29 id_backlight_config_get_value,
30 id_backlight_config_save,
31 id_eeprom_reset,
32 id_bootloader_jump,
33 id_unhandled = 0xFF,
34};
35
36enum m6_b_keyboard_value_id
37{
38 id_uptime = 0x01
39};
diff --git a/keyboards/rama/m6_b/readme.md b/keyboards/rama/m6_b/readme.md
new file mode 100644
index 000000000..d6bdd0c4c
--- /dev/null
+++ b/keyboards/rama/m6_b/readme.md
@@ -0,0 +1,15 @@
1# RAMA M6-B
2
3![RAMA M6-B](https://static1.squarespace.com/static/563c788ae4b099120ae219e2/t/59fc7b1053450adf5bf9a852/1515932239307/RAMA-RAMA-M6-DSA-XO-CAPS.73-3_1.jpg?format=1500w)
4
5A 6-key companion keyboard. [More info at RAMA WORKS](https://rama.works/m6a)
6
7Keyboard Maintainer: [Wilba6582](https://github.com/Wilba6582)
8Hardware Supported: RAMA M6-B PCB
9Hardware Availability: [RAMA WORKS Store](https://ramaworks.store/)
10
11Make example for this keyboard (after setting up your build environment):
12
13 make rama/m6_b:default
14
15See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). \ No newline at end of file
diff --git a/keyboards/rama/m6_b/rgb_backlight.c b/keyboards/rama/m6_b/rgb_backlight.c
new file mode 100644
index 000000000..8f7ac0630
--- /dev/null
+++ b/keyboards/rama/m6_b/rgb_backlight.c
@@ -0,0 +1,139 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#if RGB_BACKLIGHT_ENABLED
17
18#include "rgb_backlight.h"
19//#include "rgb_backlight_api.h"
20
21#include <avr/io.h>
22#include <util/delay.h>
23#include <avr/interrupt.h>
24#include "progmem.h"
25
26#include "quantum/color.h"
27#include "drivers/avr/i2c_master.h"
28#include "drivers/issi/is31fl3218.h"
29
30bool g_suspend_state = false;
31
32// Global tick at 20 Hz
33uint32_t g_tick = 0;
34uint8_t g_config_effect_speed = 0;
35uint8_t g_config_brightness = 255;
36
37void backlight_update_pwm_buffers(void)
38{
39 IS31FL3218_update_pwm_buffers();
40}
41
42void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
43{
44 IS31FL3218_set_color( index, red, green, blue );
45}
46
47void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
48{
49 IS31FL3218_set_color_all( red, green, blue );
50}
51
52
53// This is (F_CPU/1024) / 20 Hz
54// = 15625 Hz / 20 Hz
55// = 781
56#define TIMER3_TOP 260
57
58void backlight_timer_init(void)
59{
60 static uint8_t backlight_timer_is_init = 0;
61 if ( backlight_timer_is_init )
62 {
63 return;
64 }
65 backlight_timer_is_init = 1;
66
67 // Timer 3 setup
68 TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP
69 _BV(CS32) | _BV(CS30); // prescale by /1024
70 // Set TOP value
71 uint8_t sreg = SREG;
72 cli();
73
74 OCR3AH = (TIMER3_TOP >> 8) & 0xff;
75 OCR3AL = TIMER3_TOP & 0xff;
76 SREG = sreg;
77}
78
79void backlight_timer_enable(void)
80{
81 TIMSK3 |= _BV(OCIE3A);
82}
83
84void backlight_timer_disable(void)
85{
86 TIMSK3 &= ~_BV(OCIE3A);
87}
88
89void backlight_set_suspend_state(bool state)
90{
91 g_suspend_state = state;
92}
93
94void backlight_effect_cycle_all(void)
95{
96 uint8_t hueOffset = ( g_tick << g_config_effect_speed ) & 0xFF;
97 uint8_t satOffset = 127;
98 // Relies on hue being 8-bit and wrapping
99 for ( int i=0; i<6; i++ )
100 {
101 HSV hsv = { .h = hueOffset, .s = satOffset, .v = g_config_brightness };
102 RGB rgb = hsv_to_rgb( hsv );
103 backlight_set_color( i, rgb.r, rgb.g, rgb.b );
104 }
105}
106
107ISR(TIMER3_COMPA_vect)
108{
109 // delay 1 second before driving LEDs or doing anything else
110 static uint8_t startup_tick = 0;
111 if ( startup_tick < 20 )
112 {
113 startup_tick++;
114 return;
115 }
116
117 g_tick++;
118
119 if ( g_suspend_state )
120 {
121 backlight_set_color_all( 0, 0, 0 );
122 }
123 else
124 {
125 //HSV hsv = { .h = 240, .s = 255, .v = g_config_brightness };
126 //RGB rgb = hsv_to_rgb( hsv );
127 //backlight_set_color_all( rgb.r, rgb.g, rgb.b );
128 backlight_effect_cycle_all();
129 }
130}
131
132void backlight_init_drivers(void)
133{
134 // Initialize I2C
135 i2c_init();
136 IS31FL3218_init();
137}
138
139#endif // RGB_BACKLIGHT_ENABLED
diff --git a/keyboards/rama/m6_b/rgb_backlight.h b/keyboards/rama/m6_b/rgb_backlight.h
new file mode 100644
index 000000000..bbf605284
--- /dev/null
+++ b/keyboards/rama/m6_b/rgb_backlight.h
@@ -0,0 +1,34 @@
1/* Copyright 2018 Jason Williams (Wilba)
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18#if RGB_BACKLIGHT_ENABLED
19#else
20#error rgb_backlight.h included when RGB_BACKLIGHT_ENABLED == 0
21#endif // RGB_BACKLIGHT_ENABLED
22
23#include <stdint.h>
24#include <stdbool.h>
25
26#include "quantum/color.h"
27
28void backlight_init_drivers(void);
29void backlight_update_pwm_buffers(void);
30void backlight_timer_init(void);
31void backlight_timer_enable(void);
32void backlight_timer_disable(void);
33void backlight_set_suspend_state(bool state);
34
diff --git a/keyboards/rama/m6_b/rules.mk b/keyboards/rama/m6_b/rules.mk
new file mode 100644
index 000000000..8226debd4
--- /dev/null
+++ b/keyboards/rama/m6_b/rules.mk
@@ -0,0 +1,77 @@
1# project specific files
2SRC = rgb_backlight.c \
3 quantum/color.c \
4 drivers/issi/is31fl3218.c \
5 drivers/avr/i2c_master.c
6
7
8# MCU name
9MCU = atmega32u4
10
11# Processor frequency.
12# This will define a symbol, F_CPU, in all source code files equal to the
13# processor frequency in Hz. You can then use this symbol in your source code to
14# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
15# automatically to create a 32-bit value in your source code.
16#
17# This will be an integer division of F_USB below, as it is sourced by
18# F_USB after it has run through any CPU prescalers. Note that this value
19# does not *change* the processor frequency - it should merely be updated to
20# reflect the processor speed set externally so that the code can use accurate
21# software delays.
22F_CPU = 16000000
23
24
25#
26# LUFA specific
27#
28# Target architecture (see library "Board Types" documentation).
29ARCH = AVR8
30
31# Input clock frequency.
32# This will define a symbol, F_USB, in all source code files equal to the
33# input clock frequency (before any prescaling is performed) in Hz. This value may
34# differ from F_CPU if prescaling is used on the latter, and is required as the
35# raw input clock is fed directly to the PLL sections of the AVR for high speed
36# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
37# at the end, this will be done automatically to create a 32-bit value in your
38# source code.
39#
40# If no clock division is performed on the input clock inside the AVR (via the
41# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
42F_USB = $(F_CPU)
43
44# Interrupt driven control endpoint task(+60)
45OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
46
47# Boot Section
48BOOTLOADER = atmel-dfu
49
50# Do not put the microcontroller into power saving mode
51# when we get USB suspend event. We want it to keep updating
52# backlight effects.
53OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
54
55
56# Build Options
57# change yes to no to disable
58#
59BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
60MOUSEKEY_ENABLE = no # Mouse keys(+4700)
61EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
62CONSOLE_ENABLE = no # Console for debug(+400)
63COMMAND_ENABLE = no # Commands for debug and configuration
64# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
65SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
66# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
67NKRO_ENABLE = yes # USB Nkey Rollover
68BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
69MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
70UNICODE_ENABLE = no # Unicode
71BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
72AUDIO_ENABLE = no # Audio output on port C6
73FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
74
75RAW_ENABLE = yes
76DYNAMIC_KEYMAP_ENABLE = yes
77CIE1931_CURVE = yes
diff --git a/quantum/dynamic_keymap.c b/quantum/dynamic_keymap.c
index 2c989d691..ee39a2025 100644
--- a/quantum/dynamic_keymap.c
+++ b/quantum/dynamic_keymap.c
@@ -17,7 +17,7 @@
17#include "config.h" 17#include "config.h"
18#include "keymap.h" // to get keymaps[][][] 18#include "keymap.h" // to get keymaps[][][]
19#include "tmk_core/common/eeprom.h" 19#include "tmk_core/common/eeprom.h"
20#include "progmem.h"// to read default from flash 20#include "progmem.h" // to read default from flash
21 21
22#include "dynamic_keymap.h" 22#include "dynamic_keymap.h"
23 23