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
e8528908
Commit
e8528908
authored
Jun 14, 2020
by
schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(mp): Enable (u)bluetooth module using stubs
parent
b6832e3f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
175 additions
and
1 deletion
+175
-1
lib/micropython/meson.build
lib/micropython/meson.build
+1
-0
pycardium/meson.build
pycardium/meson.build
+2
-1
pycardium/modules/modbluetooth_card10.c
pycardium/modules/modbluetooth_card10.c
+171
-0
pycardium/mpconfigport.h
pycardium/mpconfigport.h
+1
-0
No files found.
lib/micropython/meson.build
View file @
e8528908
...
...
@@ -182,6 +182,7 @@ micropython_additional_sources = files(
micropython_extmod_sources = files(
'micropython/extmod/utime_mphal.c',
'micropython/extmod/modbluetooth.c',
'micropython/extmod/modbtree.c',
'micropython/extmod/modframebuf.c',
'micropython/extmod/modubinascii.c',
...
...
pycardium/meson.build
View file @
e8528908
...
...
@@ -11,6 +11,7 @@ modsrc = files(
'modules/light_sensor.c',
'modules/max30001-sys.c',
'modules/max86150.c',
'modules/modbluetooth_card10.c',
'modules/os.c',
'modules/personal_state.c',
'modules/power.c',
...
...
@@ -20,7 +21,7 @@ modsrc = files(
'modules/sys_leds.c',
'modules/utime.c',
'modules/vibra.c',
'modules/ws2812.c'
'modules/ws2812.c'
,
)
#################################
...
...
pycardium/modules/modbluetooth_card10.c
0 → 100644
View file @
e8528908
#include "extmod/modbluetooth.h"
#include <stdint.h>
// Enables the Bluetooth stack.
int
mp_bluetooth_init
(
void
)
{
return
0
;
}
// Disables the Bluetooth stack. Is a no-op when not enabled.
void
mp_bluetooth_deinit
(
void
)
{
}
// Returns true when the Bluetooth stack is enabled.
bool
mp_bluetooth_is_enabled
(
void
)
{
return
false
;
}
// Gets the MAC addr of this device in big-endian format.
void
mp_bluetooth_get_device_addr
(
uint8_t
*
addr
)
{
}
// Start advertisement. Will re-start advertisement when already enabled.
// Returns errno on failure.
int
mp_bluetooth_gap_advertise_start
(
bool
connectable
,
int32_t
interval_us
,
const
uint8_t
*
adv_data
,
size_t
adv_data_len
,
const
uint8_t
*
sr_data
,
size_t
sr_data_len
)
{
return
0
;
}
// Stop advertisement. No-op when already stopped.
void
mp_bluetooth_gap_advertise_stop
(
void
)
{
}
// Start adding services. Must be called before mp_bluetooth_register_service.
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.
// 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
,
uint8_t
*
characteristic_flags
,
mp_obj_bluetooth_uuid_t
**
descriptor_uuids
,
uint8_t
*
descriptor_flags
,
uint8_t
*
num_descriptors
,
uint16_t
*
handles
,
size_t
num_characteristics
)
{
return
0
;
}
// Register any queued services.
int
mp_bluetooth_gatts_register_service_end
()
{
return
0
;
}
// Read the value from the local gatts db (likely this has been written by a central).
int
mp_bluetooth_gatts_read
(
uint16_t
value_handle
,
uint8_t
**
value
,
size_t
*
value_len
)
{
return
0
;
}
// Write a value to the local gatts db (ready to be queried by a central).
int
mp_bluetooth_gatts_write
(
uint16_t
value_handle
,
const
uint8_t
*
value
,
size_t
value_len
)
{
return
0
;
}
// Notify the central that it should do a read.
int
mp_bluetooth_gatts_notify
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
return
0
;
}
// Notify the central, including a data payload. (Note: does not set the gatts db value).
int
mp_bluetooth_gatts_notify_send
(
uint16_t
conn_handle
,
uint16_t
value_handle
,
const
uint8_t
*
value
,
size_t
*
value_len
)
{
return
0
;
}
// Indicate the central.
int
mp_bluetooth_gatts_indicate
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
return
0
;
}
// Resize and enable/disable append-mode on a value.
// Append-mode means that remote writes will append and local reads will clear after reading.
int
mp_bluetooth_gatts_set_buffer
(
uint16_t
value_handle
,
size_t
len
,
bool
append
)
{
return
0
;
}
// Disconnect from a central or peripheral.
int
mp_bluetooth_gap_disconnect
(
uint16_t
conn_handle
)
{
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
,
int32_t
interval_us
,
int32_t
window_us
)
{
return
0
;
}
// Stop discovery (if currently active).
int
mp_bluetooth_gap_scan_stop
(
void
)
{
return
0
;
}
// Connect to a found peripheral.
int
mp_bluetooth_gap_peripheral_connect
(
uint8_t
addr_type
,
const
uint8_t
*
addr
,
int32_t
duration_ms
)
{
return
0
;
}
// Find all primary services on the connected peripheral.
int
mp_bluetooth_gattc_discover_primary_services
(
uint16_t
conn_handle
)
{
return
0
;
}
// Find all characteristics on the specified service on a connected peripheral.
int
mp_bluetooth_gattc_discover_characteristics
(
uint16_t
conn_handle
,
uint16_t
start_handle
,
uint16_t
end_handle
)
{
return
0
;
}
// Find all descriptors on the specified characteristic on a connected peripheral.
int
mp_bluetooth_gattc_discover_descriptors
(
uint16_t
conn_handle
,
uint16_t
start_handle
,
uint16_t
end_handle
)
{
return
0
;
}
// Initiate read of a value from the remote peripheral.
int
mp_bluetooth_gattc_read
(
uint16_t
conn_handle
,
uint16_t
value_handle
)
{
return
0
;
}
// Write the value to the remote peripheral.
int
mp_bluetooth_gattc_write
(
uint16_t
conn_handle
,
uint16_t
value_handle
,
const
uint8_t
*
value
,
size_t
*
value_len
,
unsigned
int
mode
)
{
return
0
;
}
#endif
pycardium/mpconfigport.h
View file @
e8528908
...
...
@@ -52,6 +52,7 @@ int mp_hal_trng_read_int(void);
#define MICROPY_PY_IO_FILEIO (1)
#define MICROPY_PY_UERRNO (1)
#define MICROPY_PY_FRAMEBUF (1)
#define MICROPY_PY_BLUETOOTH (1)
/* Modules */
#define MODULE_BHI160_ENABLED (1)
...
...
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