-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rgb led support (unused for now, doesn't compile) and update case…
… designs
- Loading branch information
Matteo Forlani
committed
Nov 11, 2023
1 parent
bf831f9
commit 9753c5a
Showing
6 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
all: | ||
./build.sh | ||
|
||
clean: | ||
./clean.sh |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters