summaryrefslogtreecommitdiff
path: root/keyboards/rama/m6_b
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 /keyboards/rama/m6_b
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
Diffstat (limited to 'keyboards/rama/m6_b')
-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
10 files changed, 726 insertions, 0 deletions
diff --git a/keyboards/rama/m6_b/config.h b/keyboards/rama/m6_b/config.h
new file mode 100644
index 0000000000..1adaad3f9e
--- /dev/null
+++ b/keyboards/rama/m6_b/config.h
@@ -0,0 +1,129 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#pragma once
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0x5241 // "RW"
+#define PRODUCT_ID 0x006B // 6-B
+#define DEVICE_VER 0x0001
+#define MANUFACTURER RAMA.WORKS
+#define PRODUCT RAMA M6-B
+#define DESCRIPTION RAMA M6-B Macropad
+
+/* key matrix size */
+#define MATRIX_ROWS 1
+#define MATRIX_COLS 6
+
+/*
+ * Keyboard Matrix Assignments
+ *
+ * Change this to how you wired your keyboard
+ * COLS: AVR pins used for columns, left to right
+ * ROWS: AVR pins used for rows, top to bottom
+ * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
+ * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
+ *
+*/
+#define MATRIX_ROW_PINS { E6 }
+#define MATRIX_COL_PINS { D4, B5, F4, D7, C6, F6 }
+#define UNUSED_PINS
+
+/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
+#define DIODE_DIRECTION COL2ROW
+
+// #define BACKLIGHT_PIN B7
+// #define BACKLIGHT_BREATHING
+// #define BACKLIGHT_LEVELS 3
+
+
+/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
+#define DEBOUNCING_DELAY 5
+
+/* define if matrix has ghost (lacks anti-ghosting diodes) */
+//#define MATRIX_HAS_GHOST
+
+/* number of backlight levels */
+
+/* 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
+
+/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
+ * This is userful for the Windows task manager shortcut (ctrl+shift+esc).
+ */
+// #define GRAVE_ESC_CTRL_OVERRIDE
+
+/*
+ * Force NKRO
+ *
+ * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
+ * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
+ * makefile for this to work.)
+ *
+ * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
+ * until the next keyboard reset.
+ *
+ * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
+ * fully operational during normal computer usage.
+ *
+ * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
+ * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
+ * bootmagic, NKRO mode will always be enabled until it is toggled again during a
+ * power-up.
+ *
+ */
+//#define FORCE_NKRO
+
+/*
+ * Magic Key Options
+ *
+ * Magic keys are hotkey commands that allow control over firmware functions of
+ * the keyboard. They are best used in combination with the HID Listen program,
+ * found here: https://www.pjrc.com/teensy/hid_listen.html
+ *
+ * The options below allow the magic key functionality to be changed. This is
+ * useful if your keyboard/keypad is missing keys and you want magic key support.
+ *
+ */
+
+/* key combination for magic key command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+#define RGB_BACKLIGHT_ENABLED 1
+
+#define DYNAMIC_KEYMAP_LAYER_COUNT 4
+
+
+// EEPROM usage
+
+// TODO: refactor with new user EEPROM code (coming soon)
+#define EEPROM_MAGIC 0x451F
+#define EEPROM_MAGIC_ADDR 32
+// Bump this every time we change what we store
+// This will automatically reset the EEPROM with defaults
+// and avoid loading invalid data from the EEPROM
+#define EEPROM_VERSION 0x07
+#define EEPROM_VERSION_ADDR 34
+
+// Backlight config starts after EEPROM version
+#define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35
+// Dynamic keymap starts after backlight config (35+37)
+#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 0000000000..c88a3cc618
--- /dev/null
+++ b/keyboards/rama/m6_b/info.json
@@ -0,0 +1,19 @@
+{
+ "keyboard_name": "m6-b",
+ "url": "",
+ "maintainer": "qmk",
+ "width": 3,
+ "height": 2,
+ "layouts": {
+ "LAYOUT": {
+ "layout": [
+ { "x": 0, "y": 0 },
+ { "x": 1, "y": 0 },
+ { "x": 2, "y": 0 },
+ { "x": 0, "y": 1 },
+ { "x": 1, "y": 1 },
+ { "x": 2, "y": 1 }
+ ]
+ }
+ }
+}
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 0000000000..7a408fa8aa
--- /dev/null
+++ b/keyboards/rama/m6_b/keymaps/default/keymap.c
@@ -0,0 +1,16 @@
+#include QMK_KEYBOARD_H
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ LAYOUT(
+ KC_1, KC_2, KC_3, KC_4, KC_5, KC_6),
+
+ LAYOUT(
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
+
+ LAYOUT(
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO),
+
+ LAYOUT(
+ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO) };
+
diff --git a/keyboards/rama/m6_b/m6_b.c b/keyboards/rama/m6_b/m6_b.c
new file mode 100644
index 0000000000..e7cd2f6287
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b.c
@@ -0,0 +1,230 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#include "m6_b.h"
+#include "m6_b_api.h"
+
+// Check that no backlight functions are called
+#if RGB_BACKLIGHT_ENABLED
+#include "rgb_backlight.h"
+#endif // RGB_BACKLIGHT_ENABLED
+
+#include "raw_hid.h"
+#include "dynamic_keymap.h"
+#include "timer.h"
+#include "tmk_core/common/eeprom.h"
+
+bool eeprom_is_valid(void)
+{
+ return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
+ eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
+}
+
+void eeprom_set_valid(bool valid)
+{
+ eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF);
+ eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF);
+}
+
+void eeprom_reset(void)
+{
+ // Set the keyboard-specific EEPROM state as invalid.
+ eeprom_set_valid(false);
+ // Set the TMK/QMK EEPROM state as invalid.
+ eeconfig_disable();
+}
+
+#ifdef RAW_ENABLE
+
+void raw_hid_receive( uint8_t *data, uint8_t length )
+{
+ uint8_t *command_id = &(data[0]);
+ uint8_t *command_data = &(data[1]);
+ switch ( *command_id )
+ {
+ case id_get_protocol_version:
+ {
+ command_data[0] = PROTOCOL_VERSION >> 8;
+ command_data[1] = PROTOCOL_VERSION & 0xFF;
+ break;
+ }
+ case id_get_keyboard_value:
+ {
+ if ( command_data[0] == id_uptime )
+ {
+ uint32_t value = timer_read32();
+ command_data[1] = (value >> 24 ) & 0xFF;
+ command_data[2] = (value >> 16 ) & 0xFF;
+ command_data[3] = (value >> 8 ) & 0xFF;
+ command_data[4] = value & 0xFF;
+ }
+ else
+ {
+ *command_id = id_unhandled;
+ }
+ break;
+ }
+#ifdef DYNAMIC_KEYMAP_ENABLE
+ case id_dynamic_keymap_get_keycode:
+ {
+ uint16_t keycode = dynamic_keymap_get_keycode( command_data[0], command_data[1], command_data[2] );
+ command_data[3] = keycode >> 8;
+ command_data[4] = keycode & 0xFF;
+ break;
+ }
+ case id_dynamic_keymap_set_keycode:
+ {
+ dynamic_keymap_set_keycode( command_data[0], command_data[1], command_data[2], ( command_data[3] << 8 ) | command_data[4] );
+ break;
+ }
+ case id_dynamic_keymap_reset:
+ {
+ dynamic_keymap_reset();
+ break;
+ }
+#endif // DYNAMIC_KEYMAP_ENABLE
+#if RGB_BACKLIGHT_ENABLED
+ case id_backlight_config_set_value:
+ {
+ //backlight_config_set_value(command_data);
+ break;
+ }
+ case id_backlight_config_get_value:
+ {
+ //backlight_config_get_value(command_data);
+ break;
+ }
+ case id_backlight_config_save:
+ {
+ //backlight_config_save();
+ break;
+ }
+#endif // RGB_BACKLIGHT_ENABLED
+ case id_eeprom_reset:
+ {
+ eeprom_reset();
+ break;
+ }
+ case id_bootloader_jump:
+ {
+ // Need to send data back before the jump
+ // Informs host that the command is handled
+ raw_hid_send( data, length );
+ // Give host time to read it
+ wait_ms(100);
+ bootloader_jump();
+ break;
+ }
+ default:
+ {
+ // Unhandled message.
+ *command_id = id_unhandled;
+ break;
+ }
+ }
+
+ // Return same buffer with values changed
+ raw_hid_send( data, length );
+
+}
+
+#endif
+
+void main_init(void)
+{
+ // If the EEPROM has the magic, the data is good.
+ // OK to load from EEPROM.
+ if (eeprom_is_valid()) {
+#if RGB_BACKLIGHT_ENABLED
+ //backlight_config_load();
+#endif // RGB_BACKLIGHT_ENABLED
+ } else {
+#if RGB_BACKLIGHT_ENABLED
+ // If the EEPROM has not been saved before, or is out of date,
+ // save the default values to the EEPROM. Default values
+ // come from construction of the zeal_backlight_config instance.
+ //backlight_config_save();
+#endif // RGB_BACKLIGHT_ENABLED
+#ifdef DYNAMIC_KEYMAP_ENABLE
+ // This resets the keymaps in EEPROM to what is in flash.
+ dynamic_keymap_reset();
+#endif
+ // Save the magic number last, in case saving was interrupted
+ eeprom_set_valid(true);
+ }
+#if RGB_BACKLIGHT_ENABLED
+ // Initialize LED drivers for backlight.
+ backlight_init_drivers();
+
+ backlight_timer_init();
+ backlight_timer_enable();
+#endif // RGB_BACKLIGHT_ENABLED
+}
+
+void bootmagic_lite(void)
+{
+ // The lite version of TMK's bootmagic.
+ // 100% less potential for accidentally making the
+ // keyboard do stupid things.
+
+ // We need multiple scans because debouncing can't be turned off.
+ matrix_scan();
+ wait_ms(DEBOUNCING_DELAY);
+ wait_ms(DEBOUNCING_DELAY);
+ matrix_scan();
+
+ // If the Esc (matrix 0,0) is held down on power up,
+ // reset the EEPROM valid state and jump to bootloader.
+ if ( matrix_get_row(0) & (1<<0) ) {
+ eeprom_reset();
+ bootloader_jump();
+ }
+}
+
+void matrix_init_kb(void) {
+ bootmagic_lite();
+ main_init();
+ matrix_init_user();
+}
+
+void matrix_scan_kb(void) {
+#if RGB_BACKLIGHT_ENABLED
+ // This only updates the LED driver buffers if something has changed.
+ backlight_update_pwm_buffers();
+#endif // BACKLIGHT_ENABLED
+ matrix_scan_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ return process_record_user(keycode, record);
+}
+
+void led_set_kb(uint8_t usb_led) {
+ led_set_user(usb_led);
+}
+
+void suspend_power_down_kb(void)
+{
+#if RGB_BACKLIGHT_ENABLED
+ //backlight_set_suspend_state(true);
+#endif // BACKLIGHT_ENABLED
+}
+
+void suspend_wakeup_init_kb(void)
+{
+#if RGB_BACKLIGHT_ENABLED
+ //backlight_set_suspend_state(false);
+#endif // BACKLIGHT_ENABLED
+}
diff --git a/keyboards/rama/m6_b/m6_b.h b/keyboards/rama/m6_b/m6_b.h
new file mode 100644
index 0000000000..bd4158bcb1
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b.h
@@ -0,0 +1,28 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#pragma once
+
+#include "quantum.h"
+
+// This a shortcut to help you visually see your layout.
+// The first section contains all of the arguments
+// The second converts the arguments into a two-dimensional array
+#define LAYOUT( \
+ K00, K01, K02, K03, K04, K05) \
+ { \
+ {K00, K01, K02, K03, K04, K05}, \
+ }
+
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 0000000000..041fd6e6ee
--- /dev/null
+++ b/keyboards/rama/m6_b/m6_b_api.h
@@ -0,0 +1,39 @@
+/* Copyright 2017 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#pragma once
+
+#define PROTOCOL_VERSION 0x0001
+
+enum m6_b_command_id
+{
+ id_get_protocol_version = 0x01, // always 0x01
+ id_get_keyboard_value,
+ id_set_keyboard_value,
+ id_dynamic_keymap_get_keycode,
+ id_dynamic_keymap_set_keycode,
+ id_dynamic_keymap_reset,
+ id_backlight_config_set_value,
+ id_backlight_config_get_value,
+ id_backlight_config_save,
+ id_eeprom_reset,
+ id_bootloader_jump,
+ id_unhandled = 0xFF,
+};
+
+enum m6_b_keyboard_value_id
+{
+ id_uptime = 0x01
+};
diff --git a/keyboards/rama/m6_b/readme.md b/keyboards/rama/m6_b/readme.md
new file mode 100644
index 0000000000..d6bdd0c4c2
--- /dev/null
+++ b/keyboards/rama/m6_b/readme.md
@@ -0,0 +1,15 @@
+# RAMA M6-B
+
+![RAMA M6-B](https://static1.squarespace.com/static/563c788ae4b099120ae219e2/t/59fc7b1053450adf5bf9a852/1515932239307/RAMA-RAMA-M6-DSA-XO-CAPS.73-3_1.jpg?format=1500w)
+
+A 6-key companion keyboard. [More info at RAMA WORKS](https://rama.works/m6a)
+
+Keyboard Maintainer: [Wilba6582](https://github.com/Wilba6582)
+Hardware Supported: RAMA M6-B PCB
+Hardware Availability: [RAMA WORKS Store](https://ramaworks.store/)
+
+Make example for this keyboard (after setting up your build environment):
+
+ make rama/m6_b:default
+
+See 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 0000000000..8f7ac06303
--- /dev/null
+++ b/keyboards/rama/m6_b/rgb_backlight.c
@@ -0,0 +1,139 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#if RGB_BACKLIGHT_ENABLED
+
+#include "rgb_backlight.h"
+//#include "rgb_backlight_api.h"
+
+#include <avr/io.h>
+#include <util/delay.h>
+#include <avr/interrupt.h>
+#include "progmem.h"
+
+#include "quantum/color.h"
+#include "drivers/avr/i2c_master.h"
+#include "drivers/issi/is31fl3218.h"
+
+bool g_suspend_state = false;
+
+// Global tick at 20 Hz
+uint32_t g_tick = 0;
+uint8_t g_config_effect_speed = 0;
+uint8_t g_config_brightness = 255;
+
+void backlight_update_pwm_buffers(void)
+{
+ IS31FL3218_update_pwm_buffers();
+}
+
+void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue )
+{
+ IS31FL3218_set_color( index, red, green, blue );
+}
+
+void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue )
+{
+ IS31FL3218_set_color_all( red, green, blue );
+}
+
+
+// This is (F_CPU/1024) / 20 Hz
+// = 15625 Hz / 20 Hz
+// = 781
+#define TIMER3_TOP 260
+
+void backlight_timer_init(void)
+{
+ static uint8_t backlight_timer_is_init = 0;
+ if ( backlight_timer_is_init )
+ {
+ return;
+ }
+ backlight_timer_is_init = 1;
+
+ // Timer 3 setup
+ TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP
+ _BV(CS32) | _BV(CS30); // prescale by /1024
+ // Set TOP value
+ uint8_t sreg = SREG;
+ cli();
+
+ OCR3AH = (TIMER3_TOP >> 8) & 0xff;
+ OCR3AL = TIMER3_TOP & 0xff;
+ SREG = sreg;
+}
+
+void backlight_timer_enable(void)
+{
+ TIMSK3 |= _BV(OCIE3A);
+}
+
+void backlight_timer_disable(void)
+{
+ TIMSK3 &= ~_BV(OCIE3A);
+}
+
+void backlight_set_suspend_state(bool state)
+{
+ g_suspend_state = state;
+}
+
+void backlight_effect_cycle_all(void)
+{
+ uint8_t hueOffset = ( g_tick << g_config_effect_speed ) & 0xFF;
+ uint8_t satOffset = 127;
+ // Relies on hue being 8-bit and wrapping
+ for ( int i=0; i<6; i++ )
+ {
+ HSV hsv = { .h = hueOffset, .s = satOffset, .v = g_config_brightness };
+ RGB rgb = hsv_to_rgb( hsv );
+ backlight_set_color( i, rgb.r, rgb.g, rgb.b );
+ }
+}
+
+ISR(TIMER3_COMPA_vect)
+{
+ // delay 1 second before driving LEDs or doing anything else
+ static uint8_t startup_tick = 0;
+ if ( startup_tick < 20 )
+ {
+ startup_tick++;
+ return;
+ }
+
+ g_tick++;
+
+ if ( g_suspend_state )
+ {
+ backlight_set_color_all( 0, 0, 0 );
+ }
+ else
+ {
+ //HSV hsv = { .h = 240, .s = 255, .v = g_config_brightness };
+ //RGB rgb = hsv_to_rgb( hsv );
+ //backlight_set_color_all( rgb.r, rgb.g, rgb.b );
+ backlight_effect_cycle_all();
+ }
+}
+
+void backlight_init_drivers(void)
+{
+ // Initialize I2C
+ i2c_init();
+ IS31FL3218_init();
+}
+
+#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 0000000000..bbf605284b
--- /dev/null
+++ b/keyboards/rama/m6_b/rgb_backlight.h
@@ -0,0 +1,34 @@
+/* Copyright 2018 Jason Williams (Wilba)
+ *
+ * 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/>.
+ */
+#pragma once
+
+#if RGB_BACKLIGHT_ENABLED
+#else
+#error rgb_backlight.h included when RGB_BACKLIGHT_ENABLED == 0
+#endif // RGB_BACKLIGHT_ENABLED
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "quantum/color.h"
+
+void backlight_init_drivers(void);
+void backlight_update_pwm_buffers(void);
+void backlight_timer_init(void);
+void backlight_timer_enable(void);
+void backlight_timer_disable(void);
+void backlight_set_suspend_state(bool state);
+
diff --git a/keyboards/rama/m6_b/rules.mk b/keyboards/rama/m6_b/rules.mk
new file mode 100644
index 0000000000..8226debd45
--- /dev/null
+++ b/keyboards/rama/m6_b/rules.mk
@@ -0,0 +1,77 @@
+# project specific files
+SRC = rgb_backlight.c \
+ quantum/color.c \
+ drivers/issi/is31fl3218.c \
+ drivers/avr/i2c_master.c
+
+
+# MCU name
+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
+BOOTLOADER = atmel-dfu
+
+# Do not put the microcontroller into power saving mode
+# when we get USB suspend event. We want it to keep updating
+# backlight effects.
+OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
+
+
+# Build Options
+# change yes to no to disable
+#
+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
+# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
+SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
+# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+NKRO_ENABLE = yes # USB Nkey Rollover
+BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
+MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
+UNICODE_ENABLE = no # Unicode
+BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
+AUDIO_ENABLE = no # Audio output on port C6
+FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
+
+RAW_ENABLE = yes
+DYNAMIC_KEYMAP_ENABLE = yes
+CIE1931_CURVE = yes