Commit aff737ed authored by genofire's avatar genofire Committed by schneider
Browse files

ble: card10 svc - dim leds

parent f0532a23
......@@ -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.
......
......@@ -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],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment