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
chris007
firmware
Commits
3019031a
Verified
Commit
3019031a
authored
5 years ago
by
genofire
Browse files
Options
Downloads
Patches
Plain Diff
ble: review card10 svc
parent
5f82570f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Documentation/bluetooth/card10.rst
+4
-3
4 additions, 3 deletions
Documentation/bluetooth/card10.rst
Documentation/pycardium/light-sensor.rst
+1
-1
1 addition, 1 deletion
Documentation/pycardium/light-sensor.rst
epicardium/ble/card10.c
+24
-30
24 additions, 30 deletions
epicardium/ble/card10.c
with
29 additions
and
34 deletions
Documentation/bluetooth/card10.rst
+
4
−
3
View file @
3019031a
...
...
@@ -34,6 +34,7 @@ light sensor characteristic
---------------------------------
The light sensor characteristic makes it possible to read the current value of the light sensor by receiving a ``uint16``.
The range of this sensor is between 0 (``0x0``) and 400 (``0x9001``).
- reading of ``0x0e00`` means **14**
...
...
@@ -55,8 +56,8 @@ Dataformat:
======= ======= =======
0 1 2
------- ------- -------
r
ocket0
r
ocket1
r
ocket2
R
ocket0
R
ocket1
R
ocket2
======= ======= =======
- Enable only Rocket
1
: ``0xff0000``
- Enable all rockets with 50%
l
ightness: ``0x7f7f7f``
- Enable only Rocket
0
: ``0xff0000``
- Enable all rockets with 50%
br
ightness: ``0x7f7f7f``
This diff is collapsed.
Click to expand it.
Documentation/pycardium/light-sensor.rst
+
1
−
1
View file @
3019031a
...
...
@@ -14,7 +14,7 @@ be fairly stable.
.. py:function:: light_sensor.get_reading()
Get an ambient brightness reading. The returned value is in no particular
unit, though it seems to be fairly stable. Common values:
unit, though it seems to be fairly stable.
The value could be between 0 and 400.
Common values:
- ~8: Very dark are
- ~17: Typical hackerspace brightness
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/card10.c
+
24
−
30
View file @
3019031a
...
...
@@ -32,7 +32,7 @@
/*
* This has to match in order and number of members to the functions
* called in
fileTransAdd
GroupDyn() otherwise the stack breaks.
* called in
addCard10
GroupDyn() otherwise the stack breaks.
*/
enum
{
/*!< \brief card10 service declaration */
...
...
@@ -50,32 +50,28 @@ enum {
CARD10_MAX_HDL
};
/* clang-format off */
/* BLE UUID for card10 service*/
static
const
uint8_t
UUID_svc
[]
=
{
CARD10_UUID_SUFFIX
,
0x0
,
0xf0
,
0x0
,
0x0
};
/* BLE UUID for card10 char vibra */
static
const
uint8_t
UUID_char_vibra
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_VIBRA_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0xf
,
0xf1
,
0x0
,
0x0
};
static
const
uint8_t
UUID_char_vibra
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_VIBRA_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0xf
,
0xf1
,
0x0
,
0x0
};
static
const
uint8_t
UUID_attChar_vibra
[]
=
{
CARD10_UUID_SUFFIX
,
0xf
,
0xf1
,
0x0
,
0x0
};
/* BLE UUID for card10 char rockets */
static
const
uint8_t
UUID_char_rockets
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_ROCKETS_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x10
,
0xf1
,
0x0
,
0x0
};
static
const
uint8_t
UUID_char_rockets
[]
=
{
ATT_PROP_WRITE_NO_RSP
,
UINT16_TO_BYTES
(
CARD10_ROCKETS_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0x10
,
0xf1
,
0x0
,
0x0
};
static
const
uint8_t
UUID_attChar_rockets
[]
=
{
CARD10_UUID_SUFFIX
,
0x10
,
0xf1
,
0x0
,
0x0
...
...
@@ -85,15 +81,12 @@ static const uint8_t UUID_attChar_rockets[] = {
static
const
uint8_t
UUID_char_light_sensor
[]
=
{
ATT_PROP_READ
,
UINT16_TO_BYTES
(
CARD10_LIGHT_SENSOR_VAL_HDL
),
CARD10_UUID_SUFFIX
,
0xf0
,
0xf0
,
0x0
,
0x0
CARD10_UUID_SUFFIX
,
0xf0
,
0xf0
,
0x0
,
0x0
};
static
const
uint8_t
UUID_attChar_light_sensor
[]
=
{
CARD10_UUID_SUFFIX
,
0xf0
,
0xf0
,
0x0
,
0x0
};
/* clang-format on */
/*
* Create the BLE service description.
...
...
@@ -132,7 +125,7 @@ static void *addCard10GroupDyn(void)
pSHdl
,
UUID_attChar_vibra
,
NULL
,
sizeof
(
uint16_t
)
,
0
,
sizeof
(
uint16_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
...
...
@@ -153,7 +146,7 @@ static void *addCard10GroupDyn(void)
pSHdl
,
UUID_attChar_rockets
,
NULL
,
3
*
sizeof
(
uint8_t
)
,
0
,
3
*
sizeof
(
uint8_t
),
ATTS_SET_WRITE_CBACK
,
ATTS_PERMIT_WRITE
...
...
@@ -180,16 +173,13 @@ static void *addCard10GroupDyn(void)
ATTS_PERMIT_READ
);
APP_TRACE_INFO0
(
"ble-card10: services b
inde
d
\n
"
);
APP_TRACE_INFO0
(
"ble-card10: services b
oun
d
\n
"
);
}
return
pSHdl
;
}
/*
* BLE file transfer write callback.
*
* This gets called when data is written by a BLE central to our BLE
* peripheral. Here we take care of handling the received data.
* BLE card10 write callback.
*/
static
uint8_t
writeCard10CB
(
...
...
@@ -228,6 +218,10 @@ static uint8_t writeCard10CB(
}
}
/*
* BLE card10 read callback.
*/
static
uint8_t
readCard10CB
(
dmConnId_t
connId
,
uint16_t
handle
,
...
...
@@ -252,7 +246,7 @@ static uint8_t readCard10CB(
}
/*
* This registers and starts the BLE
file transfer
service.
* This registers and starts the BLE
card10
service.
*/
void
bleCard10_init
(
void
)
...
...
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