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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marek
firmware
Commits
aff737ed
Commit
aff737ed
authored
5 years ago
by
genofire
Committed by
schneider
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ble: card10 svc - dim leds
parent
f0532a23
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/bluetooth/card10.rst
+17
-1
17 additions, 1 deletion
Documentation/bluetooth/card10.rst
epicardium/ble/card10.c
+79
-1
79 additions, 1 deletion
epicardium/ble/card10.c
with
96 additions
and
2 deletions
Documentation/bluetooth/card10.rst
+
17
−
1
View file @
aff737ed
...
...
@@ -50,6 +50,16 @@ The current draft uses following service specification:
UUID: ``42230214-2342-2342-2342-234223422342``
write
- LEDS dim bottom characteristic:
UUID: ``42230215-2342-2342-2342-234223422342``
write
- LEDs dim top characteristic:
UUID: ``42230216-2342-2342-2342-234223422342``
write
- LEDs above characteristic:
UUID: ``42230220-2342-2342-2342-234223422342``
...
...
@@ -99,7 +109,7 @@ Rocket0 Rocket1 Rocket2
Background LED <Position> characteristic
---------------------------------
The
Rockets
characteristic makes it possible to address
every three rockets
.
The
Background LEDs <Position>
characteristic makes it possible to address
the bottom LEDs by position
.
Just write there three ``uint8`` for the rgb color.
Dataformat:
...
...
@@ -113,6 +123,12 @@ Dataformat:
- set led blue: ``0x0000ff``
- disabled: ``0x000000``
LEDs dim <Position> characteristic
---------------------------------
The LEDs dim <Position> characteristic makes it possible to dim LEDs by position.
Just write a ``uint8`` between ``1`` and ``8``.
LEDs above characteristic
---------------------------------
This characteristic set every 11 leds on the top module at once.
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/card10.c
+
79
−
1
View file @
aff737ed
...
...
@@ -59,6 +59,12 @@ enum {
/*!< \brief led for background on top left characteristic */
CARD10_LED_BG_TOP_LEFT_CH_HDL
,
CARD10_LED_BG_TOP_LEFT_VAL_HDL
,
/*!< \brief dim leds on bottom characteristic */
CARD10_LEDS_BOTTOM_DIM_CH_HDL
,
CARD10_LEDS_BOTTOM_DIM_VAL_HDL
,
/*!< \brief dim leds on top characteristic */
CARD10_LEDS_TOP_DIM_CH_HDL
,
CARD10_LEDS_TOP_DIM_VAL_HDL
,
/*!< \brief leds above characteristic */
CARD10_LEDS_ABOVE_CH_HDL
,
CARD10_LEDS_ABOVE_VAL_HDL
,
...
...
@@ -160,6 +166,28 @@ static const uint8_t UUID_attChar_led_bg_top_left[] = {
CARD10_UUID_SUFFIX
,
0x14
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 dim leds on bottom */
static
const
uint8_t
UUID_char_leds_bottom_dim
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LEDS_BOTTOM_DIM_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x15
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_leds_bottom_dim
[]
=
{
CARD10_UUID_SUFFIX
,
0x15
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 dim leds on top */
static
const
uint8_t
UUID_char_leds_top_dim
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LEDS_TOP_DIM_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x16
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_leds_top_dim
[]
=
{
CARD10_UUID_SUFFIX
,
0x16
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 above leds */
static
const
uint8_t
UUID_char_leds_above
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
...
...
@@ -363,6 +391,48 @@ static void *addCard10GroupDyn(void)
ATTS_PERMIT_WRITE
);
// Dim bottom module
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_leds_bottom_dim
,
sizeof
(
UUID_char_leds_bottom_dim
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_leds_bottom_dim
,
NULL
,
0
,
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// Dim top module
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_leds_top_dim
,
sizeof
(
UUID_char_leds_top_dim
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_leds_top_dim
,
NULL
,
0
,
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// ABOVE LEDS
AttsDynAddAttrConst
(
...
...
@@ -526,8 +596,16 @@ static uint8_t writeCard10CB(
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LEDS_BOTTOM_DIM_VAL_HDL
:
epic_leds_dim_bottom
(
pValue
[
0
]);
APP_TRACE_INFO1
(
"dim bottom to: %d
\n
"
,
pValue
[
0
]);
return
ATT_SUCCESS
;
case
CARD10_LEDS_TOP_DIM_VAL_HDL
:
epic_leds_dim_top
(
pValue
[
0
]);
APP_TRACE_INFO1
(
"dim top to: %d
\n
"
,
pValue
[
0
]);
return
ATT_SUCCESS
;
case
CARD10_LEDS_ABOVE_VAL_HDL
:
for
(
ui16
=
0
;
ui16
<
11
;
ui16
++
)
{
for
(
ui16
=
0
;
ui16
<
11
;
ui16
++
)
{
epic_leds_set
(
ui16
,
pValue
[
ui16
*
3
],
...
...
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