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
datenwolf
firmware
Commits
0d322e7c
Commit
0d322e7c
authored
5 years ago
by
genofire
Committed by
schneider
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ble: card10 svc - add single RGB led characteristic
parent
a2693798
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
+22
-0
22 additions, 0 deletions
Documentation/bluetooth/card10.rst
epicardium/ble/card10.c
+45
-0
45 additions, 0 deletions
epicardium/ble/card10.c
with
67 additions
and
0 deletions
Documentation/bluetooth/card10.rst
+
22
−
0
View file @
0d322e7c
...
...
@@ -30,6 +30,11 @@ The current draft uses following service specification:
UUID: ``42230210-2342-2342-2342-234223422342``
write
- Single rgb led characteristic:
UUID: ``422302ef-2342-2342-2342-234223422342``
write
- Light sensor characteristic:
UUID: ``422302f0-2342-2342-2342-234223422342``
...
...
@@ -66,6 +71,23 @@ Rocket0 Rocket1 Rocket2
- Enable only Rocket0: ``0xff0000``
- Enable all rockets with 50% brightness: ``0x7f7f7f``
Single rgb led characteristic
---------------------------------
This characteristic makes it possible to address every single rgb led.
Just write a byte array ``uint18`` address of led and three ``uint8`` for the rgb color.
Dataformat:
====== ===== ===== =====
0-1 2 3 4
------ ----- ----- -----
led nr red green blue
- set led 14 red: ``0x0e00ff0000``
- set led 14 blue: ``0x0e000000ff``
- disable led 14: ``0x0e00000000``
Light sensor characteristic
---------------------------------
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/card10.c
+
45
−
0
View file @
0d322e7c
...
...
@@ -47,6 +47,9 @@ enum {
/*!< \brief rockets led characteristic */
CARD10_ROCKETS_CH_HDL
,
CARD10_ROCKETS_VAL_HDL
,
/*!< \brief single led characteristic */
CARD10_LED_S_CH_HDL
,
CARD10_LED_S_VAL_HDL
,
/*!< \brief light sensor characteristic */
CARD10_LIGHT_SENSOR_CH_HDL
,
CARD10_LIGHT_SENSOR_VAL_HDL
,
...
...
@@ -98,6 +101,16 @@ static const uint8_t UUID_attChar_rockets[] = {
CARD10_UUID_SUFFIX
,
0x10
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 char led single (debugging) */
static
const
uint8_t
UUID_char_led_s
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LED_S_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0xef
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_led_s
[]
=
{
CARD10_UUID_SUFFIX
,
0xef
,
CARD10_UUID_PREFIX
};
// starting at 0xf0 with read only characteristics
/* BLE UUID for card10 char light sensor */
...
...
@@ -196,6 +209,27 @@ static void *addCard10GroupDyn(void)
ATTS_PERMIT_WRITE
);
// SINGLE LED
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_led_s
,
sizeof
(
UUID_char_led_s
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_led_s
,
NULL
,
0
,
sizeof
(
uint16_t
)
+
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// LIGHT_SENSOR
AttsDynAddAttrConst
(
...
...
@@ -281,6 +315,17 @@ static uint8_t writeCard10CB(
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_S_VAL_HDL
:
BYTES_TO_UINT16
(
ui16
,
pValue
);
epic_leds_set
(
ui16
,
pValue
[
2
],
pValue
[
3
],
pValue
[
4
]);
APP_TRACE_INFO4
(
"ble-card10: set single led %ld to #%x%x%x
\n
"
,
ui16
,
pValue
[
2
],
pValue
[
3
],
pValue
[
4
]
);
return
ATT_SUCCESS
;
default:
APP_TRACE_INFO1
(
"ble-card10: unsupported characteristic: %c
\n
"
,
handle
...
...
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