aboutsummaryrefslogtreecommitdiff
path: root/keyboards/cannonkeys
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/cannonkeys')
-rw-r--r--keyboards/cannonkeys/an_c/config.h6
-rw-r--r--keyboards/cannonkeys/instant60/config.h6
-rw-r--r--keyboards/cannonkeys/iron165/config.h3
-rw-r--r--keyboards/cannonkeys/satisfaction75/config.h3
-rw-r--r--keyboards/cannonkeys/satisfaction75/led_custom.h2
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.c63
-rw-r--r--keyboards/cannonkeys/savage65/config.h6
-rw-r--r--keyboards/cannonkeys/stm32f072/keyboard.c78
-rw-r--r--keyboards/cannonkeys/stm32f072/led_custom.h2
-rw-r--r--keyboards/cannonkeys/tmov2/config.h6
10 files changed, 175 insertions, 0 deletions
diff --git a/keyboards/cannonkeys/an_c/config.h b/keyboards/cannonkeys/an_c/config.h
index 55414ba50..6390e0789 100644
--- a/keyboards/cannonkeys/an_c/config.h
+++ b/keyboards/cannonkeys/an_c/config.h
@@ -62,6 +62,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62// dynamic keymaps start after this. 62// dynamic keymaps start after this.
63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1
64 64
65// VIA lighting is handled by the keyboard-level code
66#define VIA_CUSTOM_LIGHTING_ENABLE
67
68// Let VIA handle the QMK RGBLIGHT
69#define VIA_QMK_RGBLIGHT_ENABLE
70
65/* 71/*
66 * Feature disable options 72 * Feature disable options
67 * These options are also useful to firmware size reduction. 73 * These options are also useful to firmware size reduction.
diff --git a/keyboards/cannonkeys/instant60/config.h b/keyboards/cannonkeys/instant60/config.h
index 2d23d5f83..4fa76cb88 100644
--- a/keyboards/cannonkeys/instant60/config.h
+++ b/keyboards/cannonkeys/instant60/config.h
@@ -62,6 +62,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62// dynamic keymaps start after this. 62// dynamic keymaps start after this.
63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1
64 64
65// VIA lighting is handled by the keyboard-level code
66#define VIA_CUSTOM_LIGHTING_ENABLE
67
68// Let VIA handle the QMK RGBLIGHT
69#define VIA_QMK_RGBLIGHT_ENABLE
70
65/* 71/*
66 * Feature disable options 72 * Feature disable options
67 * These options are also useful to firmware size reduction. 73 * These options are also useful to firmware size reduction.
diff --git a/keyboards/cannonkeys/iron165/config.h b/keyboards/cannonkeys/iron165/config.h
index 640f6fb65..6350514d7 100644
--- a/keyboards/cannonkeys/iron165/config.h
+++ b/keyboards/cannonkeys/iron165/config.h
@@ -54,6 +54,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
54// dynamic keymaps start after this. 54// dynamic keymaps start after this.
55#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 55#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1
56 56
57// VIA lighting is handled by the keyboard-level code
58#define VIA_CUSTOM_LIGHTING_ENABLE
59
57/* 60/*
58 * Feature disable options 61 * Feature disable options
59 * These options are also useful to firmware size reduction. 62 * These options are also useful to firmware size reduction.
diff --git a/keyboards/cannonkeys/satisfaction75/config.h b/keyboards/cannonkeys/satisfaction75/config.h
index 7a4354c8a..69d02806e 100644
--- a/keyboards/cannonkeys/satisfaction75/config.h
+++ b/keyboards/cannonkeys/satisfaction75/config.h
@@ -73,6 +73,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
73// 6 for 3x custom encoder settings, left, right, and press (18 bytes) 73// 6 for 3x custom encoder settings, left, right, and press (18 bytes)
74#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 21 74#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 21
75 75
76// VIA lighting is handled by the keyboard-level code
77#define VIA_CUSTOM_LIGHTING_ENABLE
78
76/* 79/*
77 * Feature disable options 80 * Feature disable options
78 * These options are also useful to firmware size reduction. 81 * These options are also useful to firmware size reduction.
diff --git a/keyboards/cannonkeys/satisfaction75/led_custom.h b/keyboards/cannonkeys/satisfaction75/led_custom.h
index fe5c9e5dc..d818b48ce 100644
--- a/keyboards/cannonkeys/satisfaction75/led_custom.h
+++ b/keyboards/cannonkeys/satisfaction75/led_custom.h
@@ -3,3 +3,5 @@
3void backlight_task(void); 3void backlight_task(void);
4void breathing_interrupt_disable(void); 4void breathing_interrupt_disable(void);
5void breathing_interrupt_enable(void); 5void breathing_interrupt_enable(void);
6void breathing_enable(void);
7void breathing_disable(void);
diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
index 0fe09c384..f92067c98 100644
--- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c
+++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
@@ -55,6 +55,54 @@ backlight_config_t kb_backlight_config = {
55}; 55};
56 56
57#ifdef VIA_ENABLE 57#ifdef VIA_ENABLE
58
59void backlight_get_value( uint8_t *data )
60{
61 uint8_t *value_id = &(data[0]);
62 uint8_t *value_data = &(data[1]);
63 switch (*value_id)
64 {
65 case id_qmk_backlight_brightness:
66 {
67 // level / BACKLIGHT_LEVELS * 255
68 value_data[0] = ((uint16_t)kb_backlight_config.level) * 255 / BACKLIGHT_LEVELS;
69 break;
70 }
71 case id_qmk_backlight_effect:
72 {
73 value_data[0] = kb_backlight_config.breathing ? 1 : 0;
74 break;
75 }
76 }
77}
78
79void backlight_set_value( uint8_t *data )
80{
81 uint8_t *value_id = &(data[0]);
82 uint8_t *value_data = &(data[1]);
83 switch (*value_id)
84 {
85 case id_qmk_backlight_brightness:
86 {
87 // level / 255 * BACKLIGHT_LEVELS
88 kb_backlight_config.level = ((uint16_t)value_data[0]) * BACKLIGHT_LEVELS / 255;
89 backlight_set(kb_backlight_config.level);
90 break;
91 }
92 case id_qmk_backlight_effect:
93 {
94 if ( value_data[0] == 0 ) {
95 kb_backlight_config.breathing = false;
96 breathing_disable();
97 } else {
98 kb_backlight_config.breathing = true;
99 breathing_enable();
100 }
101 break;
102 }
103 }
104}
105
58void raw_hid_receive_kb( uint8_t *data, uint8_t length ) 106void raw_hid_receive_kb( uint8_t *data, uint8_t length )
59{ 107{
60 uint8_t *command_id = &(data[0]); 108 uint8_t *command_id = &(data[0]);
@@ -139,6 +187,21 @@ void raw_hid_receive_kb( uint8_t *data, uint8_t length )
139 } 187 }
140 break; 188 break;
141 } 189 }
190 case id_lighting_set_value:
191 {
192 backlight_set_value(command_data);
193 break;
194 }
195 case id_lighting_get_value:
196 {
197 backlight_get_value(command_data);
198 break;
199 }
200 case id_lighting_save:
201 {
202 backlight_config_save();
203 break;
204 }
142 default: 205 default:
143 { 206 {
144 // Unhandled message. 207 // Unhandled message.
diff --git a/keyboards/cannonkeys/savage65/config.h b/keyboards/cannonkeys/savage65/config.h
index b69aba39e..98ec1067a 100644
--- a/keyboards/cannonkeys/savage65/config.h
+++ b/keyboards/cannonkeys/savage65/config.h
@@ -62,6 +62,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62// dynamic keymaps start after this. 62// dynamic keymaps start after this.
63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1
64 64
65// VIA lighting is handled by the keyboard-level code
66#define VIA_CUSTOM_LIGHTING_ENABLE
67
68// Let VIA handle the QMK RGBLIGHT
69#define VIA_QMK_RGBLIGHT_ENABLE
70
65/* 71/*
66 * Feature disable options 72 * Feature disable options
67 * These options are also useful to firmware size reduction. 73 * These options are also useful to firmware size reduction.
diff --git a/keyboards/cannonkeys/stm32f072/keyboard.c b/keyboards/cannonkeys/stm32f072/keyboard.c
index bf35a76c1..fdda018fc 100644
--- a/keyboards/cannonkeys/stm32f072/keyboard.c
+++ b/keyboards/cannonkeys/stm32f072/keyboard.c
@@ -126,8 +126,86 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
126 return process_record_user(keycode, record);; 126 return process_record_user(keycode, record);;
127} 127}
128 128
129#ifdef VIA_ENABLE
129 130
131void backlight_get_value( uint8_t *data )
132{
133 uint8_t *value_id = &(data[0]);
134 uint8_t *value_data = &(data[1]);
135 switch (*value_id)
136 {
137 case id_qmk_backlight_brightness:
138 {
139 // level / BACKLIGHT_LEVELS * 255
140 value_data[0] = ((uint16_t)kb_backlight_config.level) * 255 / BACKLIGHT_LEVELS;
141 break;
142 }
143 case id_qmk_backlight_effect:
144 {
145 value_data[0] = kb_backlight_config.breathing ? 1 : 0;
146 break;
147 }
148 }
149}
130 150
151void backlight_set_value( uint8_t *data )
152{
153 uint8_t *value_id = &(data[0]);
154 uint8_t *value_data = &(data[1]);
155 switch (*value_id)
156 {
157 case id_qmk_backlight_brightness:
158 {
159 // level / 255 * BACKLIGHT_LEVELS
160 kb_backlight_config.level = ((uint16_t)value_data[0]) * BACKLIGHT_LEVELS / 255;
161 backlight_set(kb_backlight_config.level);
162 break;
163 }
164 case id_qmk_backlight_effect:
165 {
166 if ( value_data[0] == 0 ) {
167 kb_backlight_config.breathing = false;
168 breathing_disable();
169 } else {
170 kb_backlight_config.breathing = true;
171 breathing_enable();
172 }
173 break;
174 }
175 }
176}
177
178void raw_hid_receive_kb( uint8_t *data, uint8_t length )
179{
180 uint8_t *command_id = &(data[0]);
181 uint8_t *command_data = &(data[1]);
182 switch ( *command_id )
183 {
184 case id_lighting_set_value:
185 {
186 backlight_set_value(command_data);
187 break;
188 }
189 case id_lighting_get_value:
190 {
191 backlight_get_value(command_data);
192 break;
193 }
194 case id_lighting_save:
195 {
196 backlight_config_save();
197 break;
198 }
199 default:
200 {
201 // Unhandled message.
202 *command_id = id_unhandled;
203 break;
204 }
205 }
206 // DO NOT call raw_hid_send(data,length) here, let caller do this
207}
208#endif
131 209
132// 210//
133// In the case of VIA being disabled, we still need to check if 211// In the case of VIA being disabled, we still need to check if
diff --git a/keyboards/cannonkeys/stm32f072/led_custom.h b/keyboards/cannonkeys/stm32f072/led_custom.h
index 28e0f02ed..550d5b84c 100644
--- a/keyboards/cannonkeys/stm32f072/led_custom.h
+++ b/keyboards/cannonkeys/stm32f072/led_custom.h
@@ -4,3 +4,5 @@ void backlight_task(void);
4void breathing_interrupt_disable(void); 4void breathing_interrupt_disable(void);
5void breathing_interrupt_enable(void); 5void breathing_interrupt_enable(void);
6void breathing_toggle(void); 6void breathing_toggle(void);
7void breathing_enable(void);
8void breathing_disable(void);
diff --git a/keyboards/cannonkeys/tmov2/config.h b/keyboards/cannonkeys/tmov2/config.h
index d5f1d0788..159382fbc 100644
--- a/keyboards/cannonkeys/tmov2/config.h
+++ b/keyboards/cannonkeys/tmov2/config.h
@@ -62,6 +62,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
62// dynamic keymaps start after this. 62// dynamic keymaps start after this.
63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1 63#define VIA_EEPROM_CUSTOM_CONFIG_SIZE 1
64 64
65// VIA lighting is handled by the keyboard-level code
66#define VIA_CUSTOM_LIGHTING_ENABLE
67
68// Let VIA handle the QMK RGBLIGHT
69#define VIA_QMK_RGBLIGHT_ENABLE
70
65/* 71/*
66 * Feature disable options 72 * Feature disable options
67 * These options are also useful to firmware size reduction. 73 * These options are also useful to firmware size reduction.