Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
François Revol
firmware
Commits
be11cab9
Verified
Commit
be11cab9
authored
Aug 24, 2019
by
genofire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ble: card10 svc - add lcd brightness
parent
d70f6e30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
Documentation/bluetooth/card10.rst
Documentation/bluetooth/card10.rst
+12
-0
epicardium/ble/card10.c
epicardium/ble/card10.c
+42
-0
No files found.
Documentation/bluetooth/card10.rst
View file @
be11cab9
...
...
@@ -80,6 +80,11 @@ The current draft uses following service specification:
UUID: ``42230220-2342-2342-2342-234223422342``
read and write no reponse
- LCD brightness characteristic:
UUID: ``42230221-2342-2342-2342-234223422342``
write no reponse
- Light sensor characteristic:
UUID: ``422302f0-2342-2342-2342-234223422342``
...
...
@@ -178,6 +183,13 @@ By defining 11x rgb from left to right. You need also to set exchange a bigger M
- set a rainbow beginnig with red on the right edge: ``0xff0000ff8b00e8ff005dff0000ff2e00ffb900b9ff002eff5d00ffe800ffff008b``
LCD brightness characteristic
---------------------------------
This charatieristic set the brightness of the lcd backlight 0-100 in ``uint16``.
- set to 100 % ``0x6400``
- set to 20 % ``0x1400`` (default value)
Light sensor characteristic
---------------------------------
...
...
epicardium/ble/card10.c
View file @
be11cab9
...
...
@@ -65,6 +65,9 @@ enum {
/*!< \brief leds above characteristic */
CARD10_LEDS_ABOVE_CH_HDL
,
CARD10_LEDS_ABOVE_VAL_HDL
,
/*!< \brief lcd birhtness characteristic */
CARD10_LCD_BRIGHTNESS_CH_HDL
,
CARD10_LCD_BRIGHTNESS_VAL_HDL
,
/*!< \brief light sensor characteristic */
CARD10_LIGHT_SENSOR_CH_HDL
,
CARD10_LIGHT_SENSOR_VAL_HDL
,
...
...
@@ -263,6 +266,17 @@ static uint8_t aboveLEDsValue[] = {
};
static
uint16_t
aboveLEDsLen
=
sizeof
(
aboveLEDsValue
);
/* BLE UUID for card10 set lcd brightness */
static
const
uint8_t
UUID_char_lcd_brightness
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_LCD_BRIGHTNESS_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x21
,
CARD10_UUID_PREFIX
};
static
const
uint8_t
UUID_attChar_lcd_brightness
[]
=
{
CARD10_UUID_SUFFIX
,
0x21
,
CARD10_UUID_PREFIX
};
// starting at 0xf0 with read only characteristics
/* BLE UUID for card10 char light sensor */
...
...
@@ -543,6 +557,24 @@ static const attsAttr_t card10SvcAttrList[] = {
ATTS_PERMIT_READ_ENC
|
ATTS_PERMIT_READ_AUTH
,
},
// LCD Brightness
{
.
pUuid
=
attChUuid
,
.
pValue
=
(
uint8_t
*
)
UUID_char_lcd_brightness
,
.
pLen
=
(
uint16_t
*
)
&
UUID_char_len
,
.
maxLen
=
sizeof
(
UUID_char_lcd_brightness
),
.
permissions
=
ATTS_PERMIT_READ
,
},
{
.
pUuid
=
UUID_attChar_lcd_brightness
,
.
pValue
=
NULL
,
.
maxLen
=
sizeof
(
uint16_t
),
.
settings
=
ATTS_SET_WRITE_CBACK
,
.
permissions
=
ATTS_PERMIT_WRITE
|
ATTS_PERMIT_WRITE_ENC
|
ATTS_PERMIT_WRITE_AUTH
,
},
// Light sensor
{
...
...
@@ -630,6 +662,7 @@ static uint8_t writeCard10CB(
)
{
uint16_t
ui16
=
0
;
uint8_t
ui8
=
0
;
int
intVar
=
0
;
switch
(
handle
)
{
// time
...
...
@@ -788,6 +821,15 @@ static uint8_t writeCard10CB(
}
epic_leds_update
();
return
ATT_SUCCESS
;
case
CARD10_LCD_BRIGHTNESS_VAL_HDL
:
BYTES_TO_UINT16
(
ui16
,
pValue
);
intVar
=
epic_disp_backlight
(
ui16
);
APP_TRACE_INFO2
(
"ble-card10: set lcd brightness to %ld - %d
\n
"
,
ui16
,
intVar
);
return
ATT_SUCCESS
;
default:
APP_TRACE_INFO1
(
"ble-card10: unsupported handle: %x
\n
"
,
handle
);
return
ATT_ERR_HANDLE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment