Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
thk_led_strip_controller
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thk_libs
microcontrollers
thk_led_strip_controller
Commits
f7dc36a5
Commit
f7dc36a5
authored
2 years ago
by
Orhan-Timo Altan
Browse files
Options
Downloads
Patches
Plain Diff
added 2 functions: set_brightness, get_pixel_color
parent
89a967ec
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
thk_ledstrip_controller.cpp
+9
-1
9 additions, 1 deletion
thk_ledstrip_controller.cpp
thk_ledstrip_controller.h
+2
-0
2 additions, 0 deletions
thk_ledstrip_controller.h
with
11 additions
and
1 deletion
thk_ledstrip_controller.cpp
+
9
−
1
View file @
f7dc36a5
...
@@ -10,6 +10,10 @@ void thk_LedStripController::init() {
...
@@ -10,6 +10,10 @@ void thk_LedStripController::init() {
show
();
show
();
}
}
void
thk_LedStripController
::
set_brightness
(
uint8_t
brightness
)
{
ptrStrip
->
setBrightness
(
brightness
);
}
void
thk_LedStripController
::
clear
()
{
void
thk_LedStripController
::
clear
()
{
ptrStrip
->
clear
();
ptrStrip
->
clear
();
}
}
...
@@ -27,6 +31,11 @@ void thk_LedStripController::set_pixel_color(uint16_t start_index, uint16_t amou
...
@@ -27,6 +31,11 @@ void thk_LedStripController::set_pixel_color(uint16_t start_index, uint16_t amou
ptrStrip
->
fill
(
color
,
start_index
,
amount
);
ptrStrip
->
fill
(
color
,
start_index
,
amount
);
}
}
uint32_t
thk_LedStripController
::
get_pixel_color
(
uint16_t
index
)
{
uint32_t
pixel_color
=
ptrStrip
->
getPixelColor
(
index
);
return
pixel_color
;
}
void
thk_LedStripController
::
show
()
{
void
thk_LedStripController
::
show
()
{
ptrStrip
->
show
();
ptrStrip
->
show
();
}
}
...
@@ -120,7 +129,6 @@ void thk_LedStripController::running_light(unsigned long wait_time, uint8_t leng
...
@@ -120,7 +129,6 @@ void thk_LedStripController::running_light(unsigned long wait_time, uint8_t leng
ptrStrip
->
show
();
// Send the updated pixel colors to the hardware.
ptrStrip
->
show
();
// Send the updated pixel colors to the hardware.
delay
(
wait_time
);
// Pause before next pass through loop
delay
(
wait_time
);
// Pause before next pass through loop
Serial
.
println
(
last_pixel
);
}
}
clear
();
clear
();
show
();
show
();
...
...
This diff is collapsed.
Click to expand it.
thk_ledstrip_controller.h
+
2
−
0
View file @
f7dc36a5
...
@@ -22,10 +22,12 @@ class thk_LedStripController {
...
@@ -22,10 +22,12 @@ class thk_LedStripController {
thk_LedStripController
(
const
uint16_t
MAX_LED_NUMBER
,
const
uint16_t
DATA_PIN
,
uint8_t
brightness
=
64
);
thk_LedStripController
(
const
uint16_t
MAX_LED_NUMBER
,
const
uint16_t
DATA_PIN
,
uint8_t
brightness
=
64
);
void
init
();
void
init
();
void
clear
();
void
clear
();
void
set_brightness
(
uint8_t
brightness
);
static
uint32_t
Color
(
uint8_t
red
,
uint8_t
green
,
uint8_t
blue
)
{
return
Adafruit_NeoPixel
::
Color
(
red
,
green
,
blue
);};
static
uint32_t
Color
(
uint8_t
red
,
uint8_t
green
,
uint8_t
blue
)
{
return
Adafruit_NeoPixel
::
Color
(
red
,
green
,
blue
);};
void
set_pixel_color
(
uint32_t
color
);
void
set_pixel_color
(
uint32_t
color
);
void
set_pixel_color
(
uint16_t
index
,
uint32_t
color
);
void
set_pixel_color
(
uint16_t
index
,
uint32_t
color
);
void
set_pixel_color
(
uint16_t
index
,
uint16_t
amount
,
uint32_t
color
);
void
set_pixel_color
(
uint16_t
index
,
uint16_t
amount
,
uint32_t
color
);
uint32_t
get_pixel_color
(
uint16_t
index
);
void
show
();
void
show
();
uint32_t
color_hsv
(
int
pixelHue
);
uint32_t
color_hsv
(
int
pixelHue
);
uint32_t
gamma
(
int
pixelHue
);
uint32_t
gamma
(
int
pixelHue
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment