diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f695569 --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +all: + ./build.sh + +clean: + ./clean.sh diff --git a/case/bottom.stl b/case/bottom.stl index 6b7c558..7b61fbb 100644 Binary files a/case/bottom.stl and b/case/bottom.stl differ diff --git a/case/top.stl b/case/top.stl index 2a4e589..80f74eb 100644 Binary files a/case/top.stl and b/case/top.stl differ diff --git a/qmk/cvntpad/keymaps/default/cvntled.c b/qmk/cvntpad/keymaps/default/cvntled.c new file mode 100644 index 0000000..1b2cd90 --- /dev/null +++ b/qmk/cvntpad/keymaps/default/cvntled.c @@ -0,0 +1,28 @@ +#include "cvntled.h" + +void cvntled_new(CvntLed* led, + unsigned int com_pin, unsigned int red_pin, + unsigned int green_pin, unsigned int blue_pin, + RGBLedType led_type) +{ + led = malloc(sizeof(CvntLed)); + led->comPin = com_pin; + led->redPin = red_pin; + led->greenPin = green_pin; + led->bluePin = blue_pin; + led->type = led_type; + + // Turn led on + writePin(led->comPin, (led->type == COM_ANODE) ? 1 : 0); +} + +void cvntled_set(CvntLed* led, bool r, bool g, bool b) { + writePin(led->redPin, (int)r); + writePin(led->greenPin, (int)g); + writePin(led->bluePin, (int)b); +} + +void cvntled_toggle(CvntLed* led) { + int comPinValue = readPin(led->comPin); + writePin(led->comPin, !comPinValue); +} diff --git a/qmk/cvntpad/keymaps/default/cvntled.h b/qmk/cvntpad/keymaps/default/cvntled.h new file mode 100644 index 0000000..b073d3b --- /dev/null +++ b/qmk/cvntpad/keymaps/default/cvntled.h @@ -0,0 +1,31 @@ +#include QMK_KEYBOARD_H + +typedef enum RGBLedType { + COM_ANODE, + COM_CATHODE +} RGBLedType; + +typedef struct CvntLed { + // Common anode/cathode pin + unsigned int comPin; + // Red Pin + unsigned int redPin; + // Green Pin + unsigned int greenPin; + // Blue Pin + unsigned int bluePin; + // Led type (common anode/cathode) + RGBLedType type; +} CvntLed; + +// Create a new CvntLed "object" +void cvntled_new(CvntLed* led, + unsigned int com_pin, unsigned int red_pin, + unsigned int green_pin, unsigned int blue_pin, + RGBLedType led_type); + +// Set RGB LED Color +void cvntled_set(CvntLed* led, bool r, bool g, bool b); + +// Toggle On/Off State +void cvntled_toggle(CvntLed* led); diff --git a/qmk/cvntpad/keymaps/default/keymap.c b/qmk/cvntpad/keymaps/default/keymap.c index fc971c7..1b09034 100644 --- a/qmk/cvntpad/keymaps/default/keymap.c +++ b/qmk/cvntpad/keymaps/default/keymap.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include QMK_KEYBOARD_H +// #include "cvntled.h" #define MIDI_ADVANCED @@ -10,11 +11,24 @@ extern MidiDevice midi_device; #define MIDI_CC_OFF 0 #define MIDI_CC_ON 127 +// #define COM_PIN GP26 +// #define RED_PIN GP27 +// #define GREEN_PIN GP28 +// #define BLUE_PIN GP29 + +// CvntLed* thatLed; + enum custom_keycodes { MIDI_CC80 = SAFE_RANGE, }; +// void bootmagic_lite(void) { +// cvntled_new(thatLed, COM_PIN, RED_PIN, GREEN_PIN, BLUE_PIN, COM_CATHODE); +// } + bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // should be red ig! + // cvntled_set(thatLed, 1, 0, 0); switch(keycode) { case MIDI_CC80: