Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CyanLight
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fxk8y
CyanLight
Commits
70dc8005
Commit
70dc8005
authored
3 years ago
by
fxk8y
Browse files
Options
Downloads
Patches
Plain Diff
Adding gamma correction
parent
b0a211d5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CLC-qthing/Controller.cpp
+7
-0
7 additions, 0 deletions
CLC-qthing/Controller.cpp
CLC-qthing/CyanLightControl.hpp
+4
-1
4 additions, 1 deletion
CLC-qthing/CyanLightControl.hpp
with
11 additions
and
1 deletion
CLC-qthing/Controller.cpp
+
7
−
0
View file @
70dc8005
...
...
@@ -203,6 +203,8 @@ void CyanLight::Controller::setPWM(uint8_t channel, float value) {
return
;
}
value
=
this
->
gammaCorrector
(
value
);
if
(
value
<
0.0
f
)
value
=
0.0
f
;
if
(
value
>
1.0
f
)
value
=
1.0
f
;
...
...
@@ -213,6 +215,11 @@ void CyanLight::Controller::setPWM(uint8_t channel, float value) {
}
void
CyanLight
::
Controller
::
setGammaCorrector
(
GammaCorrector
gammaCorrector
)
{
this
->
gammaCorrector
=
gammaCorrector
;
}
bool
CyanLight
::
Controller
::
setFrqRes
(
uint32_t
frq_hz
,
uint8_t
res_bits
)
{
this
->
timer_cfg
.
duty_resolution
=
(
ledc_timer_bit_t
)
res_bits
;
...
...
This diff is collapsed.
Click to expand it.
CLC-qthing/CyanLightControl.hpp
+
4
−
1
View file @
70dc8005
...
...
@@ -16,7 +16,7 @@ namespace CyanLight {
const
uint8_t
channelGPIOS
[
MAX_CHANNELS
]
=
{
27
,
16
,
17
,
18
,
19
,
21
};
typedef
std
::
function
<
void
()
>
PacketHandledCallback
;
typedef
std
::
function
<
float
(
float
)
>
GammaCorrector
;
class
Controller
{
public:
...
...
@@ -24,6 +24,7 @@ namespace CyanLight {
void
setPWM
(
uint8_t
channel
,
float
value
);
void
setGammaCorrector
(
GammaCorrector
gammaCorrector
);
uint8_t
getChannelCount
();
...
...
@@ -62,6 +63,8 @@ namespace CyanLight {
ledc_timer_config_t
timer_cfg
;
GammaCorrector
gammaCorrector
=
[](
float
f
)
{
return
f
*
f
;
};
PacketHandledCallback
packetCallback
=
[]()
{};
void
callPacketCallback
();
};
...
...
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