Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fleur
firmware
Commits
93176052
Commit
93176052
authored
5 years ago
by
Florian Kargl
Committed by
rahix
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor(leds): Use new portexpander API for leds
parent
f63c6728
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/card10/leds.c
+9
-12
9 additions, 12 deletions
lib/card10/leds.c
lib/card10/portexpander.c
+0
-31
0 additions, 31 deletions
lib/card10/portexpander.c
lib/card10/portexpander.h
+0
-4
0 additions, 4 deletions
lib/card10/portexpander.h
with
9 additions
and
47 deletions
lib/card10/leds.c
+
9
−
12
View file @
93176052
...
...
@@ -285,10 +285,7 @@ static uint8_t power_pin_conversion(uint8_t group)
static
void
power_all
(
void
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
portexpander_prep
(
i
,
0
);
}
portexpander_update
();
portexpander_out_clr
(
PIN_0
|
PIN_1
|
PIN_2
);
}
void
leds_update_power
(
void
)
...
...
@@ -301,14 +298,14 @@ void leds_update_power(void)
if
(
new_groups
==
active_groups
)
{
return
;
}
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
if
(
i
<
new_groups
)
{
portexpander_prep
(
power_pin_conversion
(
i
),
0
);
}
else
{
portexpander_prep
(
power_pin_conversion
(
i
),
1
);
}
uint8_t
out_val
=
0
;
for
(
int
i
=
new_groups
;
i
<
3
;
++
i
)
{
out_val
|=
(
1
<<
power_pin_conversion
(
i
));
}
portexpander_update
();
portexpander_out_put
(
PIN_0
|
PIN_1
|
PIN_2
,
out_val
);
if
(
active_groups
<
new_groups
)
{
for
(
int
i
=
0
;
i
<
powerup_wait_cycles
;
i
++
)
{
__NOP
();
...
...
@@ -343,7 +340,7 @@ void leds_update(void)
void
leds_flashlight
(
bool
power
)
{
portexpander_
set
(
7
,
(
power
)
?
0
:
1
);
portexpander_
out_put
(
PIN_
7
,
(
power
)
?
0
:
1
);
}
void
leds_set_gamma_table
(
uint8_t
rgb_channel
,
uint8_t
table
[
256
])
...
...
This diff is collapsed.
Click to expand it.
lib/card10/portexpander.c
+
0
−
31
View file @
93176052
...
...
@@ -188,19 +188,6 @@ bool portexpander_detected(void)
return
detected
;
}
void
portexpander_set
(
uint8_t
pin
,
uint8_t
value
)
{
if
(
detected
&&
pin
<
8
)
{
if
(
value
)
{
output_state
|=
(
1
<<
pin
);
}
else
{
output_state
&=
~
(
1
<<
pin
);
}
portexpander_write
(
PE_C_OUTPUT_PORT
,
output_state
);
}
}
/* ************************************************************************** */
void
portexpander_out_set
(
uint8_t
mask
)
{
...
...
@@ -219,30 +206,12 @@ void portexpander_out_clr(uint8_t mask)
}
}
void
portexpander_prep
(
uint8_t
pin
,
uint8_t
value
)
{
if
(
pin
<
8
)
{
if
(
value
)
{
output_state
|=
(
1
<<
pin
);
}
else
{
output_state
&=
~
(
1
<<
pin
);
}
}
}
/* ************************************************************************** */
uint8_t
portexpander_out_get
(
uint8_t
mask
)
{
return
output_state
&
mask
;
}
void
portexpander_update
(
void
)
{
if
(
detected
)
{
portexpander_write
(
PE_C_OUTPUT_PORT
,
output_state
);
}
}
/* ************************************************************************** */
void
portexpander_out_put
(
uint8_t
mask
,
uint8_t
val
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/card10/portexpander.h
+
0
−
4
View file @
93176052
...
...
@@ -6,10 +6,6 @@
#include
<stdint.h>
#include
<stdbool.h>
void
portexpander_set
(
uint8_t
pin
,
uint8_t
value
);
void
portexpander_prep
(
uint8_t
pin
,
uint8_t
value
);
void
portexpander_update
(
void
);
/**
* Structure type for configuring the portexpander.
*/
...
...
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