summaryrefslogtreecommitdiff
path: root/quantum/process_keycode/process_printer.c
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/process_keycode/process_printer.c')
-rw-r--r--quantum/process_keycode/process_printer.c40
1 files changed, 28 insertions, 12 deletions
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c
index 2e11dd366c..613af70183 100644
--- a/quantum/process_keycode/process_printer.c
+++ b/quantum/process_keycode/process_printer.c
@@ -1,15 +1,31 @@
+/* Copyright 2016 Jack Humbert
+ *
+ * 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 "process_printer.h"
#include "action_util.h"
bool printing_enabled = false;
uint8_t character_shift = 0;
-void enabled_printing() {
+void enable_printing(void) {
printing_enabled = true;
serial_init();
}
-void disable_printing() {
+void disable_printing(void) {
printing_enabled = false;
}
@@ -25,9 +41,14 @@ void print_char(char c) {
USB_Init();
}
-void print_box_string(uint8_t text[]) {
- uint8_t len = strlen(text);
- uint8_t out[len * 3 + 8];
+void print_string(char c[]) {
+ for(uint8_t i = 0; i < strlen(c); i++)
+ print_char(c[i]);
+}
+
+void print_box_string(const char text[]) {
+ size_t len = strlen(text);
+ char out[len * 3 + 8];
out[0] = 0xDA;
for (uint8_t i = 0; i < len; i++) {
out[i+1] = 0xC4;
@@ -53,14 +74,9 @@ void print_box_string(uint8_t text[]) {
print_string(out);
}
-void print_string(char c[]) {
- for(uint8_t i = 0; i < strlen(c); i++)
- print_char(c[i]);
-}
-
bool process_printer(uint16_t keycode, keyrecord_t *record) {
if (keycode == PRINT_ON) {
- enabled_printing();
+ enable_printing();
return false;
}
if (keycode == PRINT_OFF) {
@@ -251,4 +267,4 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) {
}
return true;
-} \ No newline at end of file
+}