]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/honeycomb/honeycomb.c
Remove more commented out MCUs
[qmk_firmware.git] / keyboards / honeycomb / honeycomb.c
1 #include "honeycomb.h"
2 #include "pointing_device.h"
3 #include "report.h"
4
5 void uart_init(void) {
6         SERIAL_UART_INIT();
7 }
8
9 void pointing_device_task(void){
10         /*report_mouse_t currentReport = {};
11     SERIAL_UART_INIT();
12     uint32_t timeout = 0;
13
14     //the m character requests the RF slave to send the mouse report
15     SERIAL_UART_DATA = 'm';
16
17     //trust the external inputs completely, erase old data
18     uint8_t uart_data[5] = {0};
19
20     //there are 10 bytes corresponding to 10 columns, and an end byte
21     for (uint8_t i = 0; i < 5; i++) {
22         //wait for the serial data, timeout if it's been too long
23         //this only happened in testing with a loose wire, but does no
24         //harm to leave it in here
25         while(!SERIAL_UART_RXD_PRESENT){
26             timeout++;
27             if (timeout > 10000){
28                 xprintf("\r\nTIMED OUT");
29                 break;
30             }
31         }
32         xprintf("\r\nGOT DATA for %d",i);
33         uart_data[i] = SERIAL_UART_DATA;
34     }
35
36     //check for the end packet, bytes 1-4 are movement and scroll
37     //but byte 5 has bits 0-3 for the scroll button state
38         //(1000 if pressed, 0000 if not) and bits 4-7 are always 1
39         //We can use this to verify the report sent properly.
40     if (uart_data[4] == 0x0F || uart_data[4] == 0x8F)
41     {
42         xprintf("\r\nREQUESTED MOUSE, RECEIVED %i, %i, %i, %i, %i",uart_data[0],uart_data[1],uart_data[2],uart_data[3],uart_data[4]);
43                 currentReport = pointing_device_get_report();
44         //shifting and transferring the info to the mouse report varaible
45         //mouseReport.x = 127 max -127 min
46                 currentReport.x = (int8_t) uart_data[0];
47         //mouseReport.y = 127 max -127 min
48                 currentReport.y = (int8_t) uart_data[1];
49         //mouseReport.v = 127 max -127 min (scroll vertical)
50                 currentReport.v = (int8_t) uart_data[2];
51         //mouseReport.h = 127 max -127 min (scroll horizontal)
52                 currentReport.h = (int8_t) uart_data[3];
53         //mouseReport.buttons = 0x31 max (bitmask for mouse buttons 1-5) 0x00 min
54                 //mouse buttons 1 and 2 are handled by the keymap, but not 3
55                 if (uart_data[4] == 0x0F) { //then 3 is not pressed
56                         currentReport.buttons &= ~MOUSE_BTN3; //MOUSE_BTN3 is def in report.h
57                 } else { //3 must be pressed
58                         currentReport.buttons |= MOUSE_BTN3;
59                 }
60                 pointing_device_set_report(currentReport);
61     } else {
62         xprintf("\r\nRequested packet, data 4 was %d",uart_data[4]);
63     }*/
64     pointing_device_send();
65 }
66
67 void led_init(void) {
68   setPinOutput(D1);
69   writePinHigh(D1);
70   setPinOutput(F4);
71   writePinHigh(F4);
72   setPinOutput(F5);
73   writePinHigh(F5);
74 }
75
76 void matrix_init_kb(void) {
77         // put your keyboard start-up code here
78         // runs once when the firmware starts up
79         matrix_init_user();
80         uart_init();
81         led_init();
82 }
83
84 void matrix_scan_kb(void) {
85         // put your looping keyboard code here
86         // runs every cycle (a lot)
87         matrix_scan_user();
88 }
89
90 void led_set_kb(uint8_t usb_led) {
91
92 }