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
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
card10
firmware
Commits
f0532a23
Commit
f0532a23
authored
5 years ago
by
genofire
Committed by
schneider
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ble: add card10 svc every led
parent
0d322e7c
No related branches found
Branches containing commit
No related tags found
1 merge request
!89
ble: card10 srv - v2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/bluetooth/card10.rst
+46
-0
46 additions, 0 deletions
Documentation/bluetooth/card10.rst
epicardium/ble/card10.c
+228
-1
228 additions, 1 deletion
epicardium/ble/card10.c
with
274 additions
and
1 deletion
Documentation/bluetooth/card10.rst
+
46
−
0
View file @
f0532a23
...
...
@@ -30,6 +30,31 @@ The current draft uses following service specification:
UUID: ``42230210-2342-2342-2342-234223422342``
write
- Background LED Bottom Left characteristic:
UUID: ``42230211-2342-2342-2342-234223422342``
write
- Background LED Bottom Right characteristic:
UUID: ``42230212-2342-2342-2342-234223422342``
write
- Background LED Top Right characteristic:
UUID: ``42230213-2342-2342-2342-234223422342``
write
- Background LED Top Left characteristic:
UUID: ``42230214-2342-2342-2342-234223422342``
write
- LEDs above characteristic:
UUID: ``42230220-2342-2342-2342-234223422342``
write
- Single rgb led characteristic:
UUID: ``422302ef-2342-2342-2342-234223422342``
...
...
@@ -71,6 +96,27 @@ Rocket0 Rocket1 Rocket2
- Enable only Rocket0: ``0xff0000``
- Enable all rockets with 50% brightness: ``0x7f7f7f``
Background LED <Position> characteristic
---------------------------------
The Rockets characteristic makes it possible to address every three rockets.
Just write there three ``uint8`` for the rgb color.
Dataformat:
===== ======= =======
0 1 2
----- ------- -------
red green blue
===== ======= =======
- set led blue: ``0x0000ff``
- disabled: ``0x000000``
LEDs above characteristic
---------------------------------
This characteristic set every 11 leds on the top module at once.
Single rgb led characteristic
---------------------------------
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/card10.c
+
228
−
1
View file @
f0532a23
...
...
@@ -47,6 +47,21 @@ enum {
/*!< \brief rockets led characteristic */
CARD10_ROCKETS_CH_HDL
,
CARD10_ROCKETS_VAL_HDL
,
/*!< \brief led for background on bottom left characteristic */
CARD10_LED_BG_BOTTOM_LEFT_CH_HDL
,
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
,
/*!< \brief led for background on bottom right characteristic */
CARD10_LED_BG_BOTTOM_RIGHT_CH_HDL
,
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
,
/*!< \brief led for background on top right characteristic */
CARD10_LED_BG_TOP_RIGHT_CH_HDL
,
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
,
/*!< \brief led for background on top left characteristic */
CARD10_LED_BG_TOP_LEFT_CH_HDL
,
CARD10_LED_BG_TOP_LEFT_VAL_HDL
,
/*!< \brief leds above characteristic */
CARD10_LEDS_ABOVE_CH_HDL
,
CARD10_LEDS_ABOVE_VAL_HDL
,
/*!< \brief single led characteristic */
CARD10_LED_S_CH_HDL
,
CARD10_LED_S_VAL_HDL
,
...
...
@@ -101,6 +116,61 @@ static const uint8_t UUID_attChar_rockets[] = {
CARD10_UUID_SUFFIX
,
0x10
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 led background bottom left */
static
const
uint8_t
UUID_char_led_bg_bottom_left
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x11
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_led_bg_bottom_left
[]
=
{
CARD10_UUID_SUFFIX
,
0x11
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 led background bottom right */
static
const
uint8_t
UUID_char_led_bg_bottom_right
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LED_BG_BOTTOM_RIGHT_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x12
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_led_bg_bottom_right
[]
=
{
CARD10_UUID_SUFFIX
,
0x12
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 led background top right */
static
const
uint8_t
UUID_char_led_bg_top_right
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LED_BG_TOP_RIGHT_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x13
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_led_bg_top_right
[]
=
{
CARD10_UUID_SUFFIX
,
0x13
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 led background top left */
static
const
uint8_t
UUID_char_led_bg_top_left
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LED_BG_TOP_LEFT_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x14
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_led_bg_top_left
[]
=
{
CARD10_UUID_SUFFIX
,
0x14
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 above leds */
static
const
uint8_t
UUID_char_leds_above
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LEDS_ABOVE_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x20
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_leds_above
[]
=
{
CARD10_UUID_SUFFIX
,
0x20
,
CARD10_UUID_PREFIX
};
/* BLE UUID for card10 char led single (debugging) */
static
const
uint8_t
UUID_char_led_s
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
...
...
@@ -209,6 +279,111 @@ static void *addCard10GroupDyn(void)
ATTS_PERMIT_WRITE
);
// BG LED Bottom left
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_led_bg_bottom_left
,
sizeof
(
UUID_char_led_bg_bottom_left
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_led_bg_bottom_left
,
NULL
,
0
,
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// BG LED Bottom right
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_led_bg_bottom_right
,
sizeof
(
UUID_char_led_bg_bottom_right
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_led_bg_bottom_right
,
NULL
,
0
,
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// BG LED top right
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_led_bg_top_right
,
sizeof
(
UUID_char_led_bg_top_right
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_led_bg_top_right
,
NULL
,
0
,
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// BG LED top left
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_led_bg_top_left
,
sizeof
(
UUID_char_led_bg_top_left
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_led_bg_top_left
,
NULL
,
0
,
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// ABOVE LEDS
AttsDynAddAttrConst
(
pSHdl
,
attChUuid
,
UUID_char_leds_above
,
sizeof
(
UUID_char_leds_above
),
0
,
ATTS_PERMIT_READ
);
AttsDynAddAttr
(
pSHdl
,
UUID_attChar_leds_above
,
NULL
,
0
,
11
*
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
);
// SINGLE LED
AttsDynAddAttrConst
(
...
...
@@ -315,11 +490,63 @@ static uint8_t writeCard10CB(
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LED_BG_BOTTOM_LEFT_VAL_HDL
:
epic_leds_set
(
11
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
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
:
epic_leds_set
(
12
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
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
:
epic_leds_set
(
13
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
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
:
epic_leds_set
(
14
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]);
APP_TRACE_INFO3
(
"ble-card10: set bg top left: #%02x%02x%02x
\n
"
,
pValue
[
0
],
pValue
[
1
],
pValue
[
2
]
);
return
ATT_SUCCESS
;
case
CARD10_LEDS_ABOVE_VAL_HDL
:
for
(
ui16
=
0
;
ui16
<
11
;
ui16
++
)
{
epic_leds_set
(
ui16
,
pValue
[
ui16
*
3
],
pValue
[
ui16
*
3
+
1
],
pValue
[
ui16
*
3
+
2
]
);
APP_TRACE_INFO4
(
"ble-card10: set led %ld above to #%02x%02x%02x
\n
"
,
ui16
,
pValue
[
ui16
*
3
],
pValue
[
ui16
*
3
+
1
],
pValue
[
ui16
*
3
+
2
]
);
}
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
"
,
"ble-card10: set single led %ld to #%
02x%02x%02
x
\n
"
,
ui16
,
pValue
[
2
],
pValue
[
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