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
ea13596b
Commit
ea13596b
authored
4 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
change(mp): Plug in MP v1.14
parent
68a8906a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!452
change(mp): Plug in MP v1.14
Pipeline
#5143
passed
4 years ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/micropython/micropython
+1
-1
1 addition, 1 deletion
lib/micropython/micropython
pycardium/modules/modbluetooth_card10.c
+45
-26
45 additions, 26 deletions
pycardium/modules/modbluetooth_card10.c
with
46 additions
and
27 deletions
micropython
@
78b23c3a
Compare
b0932fcf
...
78b23c3a
Subproject commit
b0932fcf2e2f9a81abf7737ed4b2573bd9ad4a49
Subproject commit
78b23c3a1f064dc19bbee68930ef3aba110c781c
This diff is collapsed.
Click to expand it.
pycardium/modules/modbluetooth_card10.c
+
45
−
26
View file @
ea13596b
...
...
@@ -30,6 +30,14 @@ typedef struct {
static
bool
active
=
false
;
static
mp_obj_bluetooth_uuid_t
uuid_filter
;
const
char
*
const
not_implemented_message
=
"Not (yet) implemented on card10. See https://git.card10.badge.events.ccc.de/card10/firmware/-/issues/8"
;
static
void
raise
(
void
)
{
mp_raise_NotImplementedError
(
not_implemented_message
);
}
static
void
gatts_status_create_entry
(
mp_gatts_db_t
db
,
uint16_t
handle
)
{
mp_map_elem_t
*
elem
=
mp_map_lookup
(
...
...
@@ -213,18 +221,14 @@ static void handle_att_event(struct epic_att_event *att_event)
}
if
(
att_event
->
hdr
.
event
==
ATTC_READ_RSP
)
{
mp_uint_t
atomic_state
;
size_t
len
=
mp_bluetooth_gattc_on_data_available_start
(
mp_bluetooth_gattc_on_data_available
(
MP_BLUETOOTH_IRQ_GATTC_READ_RESULT
,
1
,
att_event
->
handle
,
att_event
->
valueLen
,
&
atomic_state
(
const
uint8_t
**
)
&
att_event
->
pValue
,
&
att_event
->
valueLen
,
1
);
mp_bluetooth_gattc_on_data_available_chunk
(
att_event
->
pValue
,
len
);
mp_bluetooth_gattc_on_data_available_end
(
atomic_state
);
mp_bluetooth_gattc_on_read_write_status
(
MP_BLUETOOTH_IRQ_GATTC_READ_DONE
,
1
,
...
...
@@ -238,18 +242,14 @@ static void handle_att_event(struct epic_att_event *att_event)
uint16_t
ev
=
att_event
->
hdr
.
event
==
ATTC_HANDLE_VALUE_NTF
?
MP_BLUETOOTH_IRQ_GATTC_NOTIFY
:
MP_BLUETOOTH_IRQ_GATTC_INDICATE
;
mp_uint_t
atomic_state
;
size_t
len
=
mp_bluetooth_gattc_on_data_available_start
(
mp_bluetooth_gattc_on_data_available
(
ev
,
1
,
att_event
->
handle
,
att_event
->
valueLen
,
&
atomic_state
);
mp_bluetooth_gattc_on_data_available_chunk
(
att_event
->
pValue
,
len
(
const
uint8_t
**
)
&
att_event
->
pValue
,
&
att_event
->
valueLen
,
1
);
mp_bluetooth_gattc_on_data_available_end
(
atomic_state
);
}
if
(
att_event
->
hdr
.
event
==
ATTC_WRITE_RSP
)
{
...
...
@@ -368,12 +368,19 @@ bool mp_bluetooth_is_active(void)
return
active
;
}
// Gets the
MAC
addr of this device in big-endian format.
void
mp_bluetooth_get_
device_addr
(
uint8_t
*
addr
)
// Gets the
current
addr
ess
of this device in big-endian format.
void
mp_bluetooth_get_
current_address
(
uint8_t
*
addr_type
,
uint8_t
*
addr
)
{
*
addr_type
=
0
;
// Public address
epic_ble_get_address
(
addr
);
}
// Sets the addressing mode to use.
void
mp_bluetooth_set_address_mode
(
uint8_t
addr_mode
)
{
raise
();
}
size_t
mp_bluetooth_gap_get_device_name
(
const
uint8_t
**
buf
)
{
uint16_t
len
;
...
...
@@ -427,14 +434,14 @@ int mp_bluetooth_gatts_register_service_begin(bool append)
return
0
;
}
//
// Add a service with the given list of characteristics to the queue to be registered.
// Add a service with the given list of characteristics to the queue to be registered.
// The value_handles won't be valid until after mp_bluetooth_register_service_end is called.
int
mp_bluetooth_gatts_register_service
(
mp_obj_bluetooth_uuid_t
*
service_uuid
,
mp_obj_bluetooth_uuid_t
**
characteristic_uuids
,
uint
8
_t
*
characteristic_flags
,
uint
16
_t
*
characteristic_flags
,
mp_obj_bluetooth_uuid_t
**
descriptor_uuids
,
uint
8
_t
*
descriptor_flags
,
uint
16
_t
*
descriptor_flags
,
uint8_t
*
num_descriptors
,
uint16_t
*
handles
,
size_t
num_characteristics
...
...
@@ -682,15 +689,20 @@ int mp_bluetooth_gap_disconnect(uint16_t conn_handle)
return
0
;
}
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
const
char
*
const
not_implemented_message
=
"Not (yet) implemented on card10. See https://git.card10.badge.events.ccc.de/card10/firmware/-/issues/8"
;
// Set/get the MTU that we will respond to a MTU exchange with.
int
mp_bluetooth_get_preferred_mtu
(
void
)
{
raise
();
return
0
;
}
static
void
raise
(
void
)
int
mp_bluetooth_set_preferred_mtu
(
uint16_t
mtu
)
{
mp_raise_NotImplementedError
(
not_implemented_message
);
raise
();
return
0
;
}
#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
// Start a discovery (scan). Set duration to zero to run continuously.
int
mp_bluetooth_gap_scan_start
(
int32_t
duration_ms
,
...
...
@@ -788,4 +800,11 @@ int mp_bluetooth_gattc_write(
}
return
err
;
}
// Initiate MTU exchange for a specific connection using the preferred MTU.
int
mp_bluetooth_gattc_exchange_mtu
(
uint16_t
conn_handle
)
{
raise
();
return
0
;
}
#endif
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