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
Andy B-S
firmware
Commits
8be8c3c1
Verified
Commit
8be8c3c1
authored
5 years ago
by
genofire
Browse files
Options
Downloads
Patches
Plain Diff
ble: card10 svc - add lcd brightness
parent
83a19117
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
Documentation/bluetooth/card10.rst
+13
-0
13 additions, 0 deletions
Documentation/bluetooth/card10.rst
epicardium/ble/card10.c
+52
-0
52 additions, 0 deletions
epicardium/ble/card10.c
with
65 additions
and
0 deletions
Documentation/bluetooth/card10.rst
+
13
−
0
View file @
8be8c3c1
...
...
@@ -80,6 +80,11 @@ The current draft uses following service specification:
UUID: ``42230220-2342-2342-2342-234223422342``
write no reponse
- LCD brightness characteristic:
UUID: ``42230221-2342-2342-2342-234223422342``
write no reponse
- Light sensor characteristic:
UUID: ``422302f0-2342-2342-2342-234223422342``
...
...
@@ -175,6 +180,14 @@ 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``.
It works only, if no application (pycardium app) blocks the screen.
- set to 100 % ``0x6400``
- set to 20 % ``0x1400`` (default value)
Light sensor characteristic
---------------------------------
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/card10.c
+
52
−
0
View file @
8be8c3c1
...
...
@@ -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
,
...
...
@@ -235,6 +238,17 @@ static const uint8_t UUID_char_leds_above[] = {
static
const
uint8_t
UUID_attChar_leds_above
[]
=
{
CARD10_UUID_SUFFIX
,
0x20
,
CARD10_UUID_PREFIX
};
/* 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 */
...
...
@@ -463,6 +477,21 @@ static const attsAttr_t card10SvcAttrList[] = {
(
ATTS_PERMIT_WRITE
|
ATTS_PERMIT_WRITE_ENC
|
ATTS_PERMIT_WRITE_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
{
.
pUuid
=
attChUuid
,
...
...
@@ -515,6 +544,7 @@ static uint8_t writeCard10CB(
)
{
uint16_t
ui16
=
0
;
uint8_t
ui8
=
0
;
int
intVar
=
0
;
switch
(
handle
)
{
// time
...
...
@@ -704,6 +734,28 @@ static uint8_t writeCard10CB(
pValue
[
ui16
*
3
+
2
]
);
}
return
ATT_SUCCESS
;
case
CARD10_LCD_BRIGHTNESS_VAL_HDL
:
intVar
=
epic_disp_open
();
if
(
intVar
<
0
)
{
APP_TRACE_INFO1
(
"ble-card10: lock display to set brightness failed: %d"
,
intVar
);
return
ATT_ERR_RANGE
;
}
BYTES_TO_UINT16
(
ui16
,
pValue
);
;
intVar
=
epic_disp_backlight
(
ui16
);
APP_TRACE_INFO2
(
"ble-card10: set lcd brightness to %ld - %d
\n
"
,
ui16
,
intVar
);
if
(
intVar
<
0
)
return
ATT_ERR_RANGE
;
epic_disp_close
();
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