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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
firmware
Commits
d2a91e93
Verified
Commit
d2a91e93
authored
5 years ago
by
genofire
Browse files
Options
Downloads
Patches
Plain Diff
ble: card10 svc - put bg leds into function
parent
6992ef6e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
epicardium/ble/card10.c
+40
-64
40 additions, 64 deletions
epicardium/ble/card10.c
with
40 additions
and
64 deletions
epicardium/ble/card10.c
+
40
−
64
View file @
d2a91e93
...
@@ -533,6 +533,38 @@ static uint8_t setTime(uint8_t *pValue)
...
@@ -533,6 +533,38 @@ static uint8_t setTime(uint8_t *pValue)
return
ATT_SUCCESS
;
return
ATT_SUCCESS
;
}
}
/*
* Set a rgb led
*/
static
uint8_t
setRGBLed
(
uint8_t
led
,
uint8_t
*
pValue
)
{
epic_leds_set
(
led
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
APP_TRACE_INFO4
(
"ble-card10: set rgb led %d: #%02x%02x%02x
\n
"
,
led
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
}
/*
* Get value of a rgb led
*/
static
uint8_t
getRGBLed
(
uint8_t
led
,
attsAttr_t
*
pAttr
)
{
epic_leds_get_rgb
(
led
,
pAttr
->
pValue
);
APP_TRACE_INFO4
(
"ble-card10: set rgb led %d: #%02x%02x%02x
\n
"
,
led
,
pAttr
->
pValue
[
0
],
pAttr
->
pValue
[
1
],
pAttr
->
pValue
[
2
]
);
return
ATT_SUCCESS
;
}
/*
/*
* BLE card10 write callback.
* BLE card10 write callback.
*/
*/
...
@@ -573,41 +605,13 @@ static uint8_t writeCard10CB(
...
@@ -573,41 +605,13 @@ static uint8_t writeCard10CB(
return
ATT_SUCCESS
;
return
ATT_SUCCESS
;
// bg leds
// bg leds
case
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
:
case
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
:
epic_leds_set
(
11
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
return
setRGBLed
(
11
,
pValue
);
APP_TRACE_INFO3
(
"ble-card10: set bg bottom left: #%02x%02x%02x
\n
"
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
:
case
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
:
epic_leds_set
(
12
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
return
setRGBLed
(
12
,
pValue
);
APP_TRACE_INFO3
(
"ble-card10: set bg bottom right: #%02x%02x%02x
\n
"
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
:
case
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
:
epic_leds_set
(
13
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
return
setRGBLed
(
13
,
pValue
);
APP_TRACE_INFO3
(
"ble-card10: set bg top right: #%02x%02x%02x
\n
"
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_TOP_LEFT_VAL_HDL
:
case
CARD10_LED_BG_TOP_LEFT_VAL_HDL
:
epic_leds_set
(
14
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
return
setRGBLed
(
14
,
pValue
);
APP_TRACE_INFO3
(
"ble-card10: set bg top left: #%02x%02x%02x
\n
"
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
// dim
// dim
case
CARD10_LEDS_BOTTOM_DIM_VAL_HDL
:
case
CARD10_LEDS_BOTTOM_DIM_VAL_HDL
:
ui8
=
pValue
[
0
];
ui8
=
pValue
[
0
];
...
@@ -773,41 +777,13 @@ static uint8_t readCard10CB(
...
@@ -773,41 +777,13 @@ static uint8_t readCard10CB(
return
ATT_SUCCESS
;
return
ATT_SUCCESS
;
// background leds
// background leds
case
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
:
case
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
:
epic_leds_get_rgb
(
11
,
pAttr
->
pValue
);
return
getRGBLed
(
11
,
pAttr
);
APP_TRACE_INFO3
(
"ble-card10: set bg bottom left: #%02x%02x%02x
\n
"
,
pAttr
->
pValue
[
0
],
pAttr
->
pValue
[
1
],
pAttr
->
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
:
case
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
:
epic_leds_get_rgb
(
12
,
pAttr
->
pValue
);
return
getRGBLed
(
12
,
pAttr
);
APP_TRACE_INFO3
(
"ble-card10: get bg bottom right: #%02x%02x%02x
\n
"
,
pAttr
->
pValue
[
0
],
pAttr
->
pValue
[
1
],
pAttr
->
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
:
case
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
:
epic_leds_get_rgb
(
13
,
pAttr
->
pValue
);
return
getRGBLed
(
13
,
pAttr
);
APP_TRACE_INFO3
(
"ble-card10: get bg top right: #%02x%02x%02x
\n
"
,
pAttr
->
pValue
[
0
],
pAttr
->
pValue
[
1
],
pAttr
->
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_TOP_LEFT_VAL_HDL
:
case
CARD10_LED_BG_TOP_LEFT_VAL_HDL
:
epic_leds_get_rgb
(
14
,
pAttr
->
pValue
);
return
getRGBLed
(
14
,
pAttr
);
APP_TRACE_INFO3
(
"ble-card10: get bg top left: #%02x%02x%02x
\n
"
,
pAttr
->
pValue
[
0
],
pAttr
->
pValue
[
1
],
pAttr
->
pValue
[
2
]
);
return
ATT_SUCCESS
;
// personal state
// personal state
case
CARD10_PERSONAL_STATE_VAL_HDL
:
case
CARD10_PERSONAL_STATE_VAL_HDL
:
ui16
=
epic_personal_state_get
();
ui16
=
epic_personal_state_get
();
...
...
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