Commit 80e79a77 authored by Damien George's avatar Damien George

zephyr: Add initial ubluetooth module integration.

Currently only advertising and scanning are supported, using the ring
buffer for events (ie not synchronous events at this stage).

The ble_gap_advertise.py multi-test passes (tested on a nucleo_wb55rg
board).
Signed-off-by: default avatarDamien George <damien@micropython.org>
parent 5cb2ade6
......@@ -40,6 +40,7 @@ set(MICROPY_SOURCE_PORT
machine_i2c.c
machine_pin.c
machine_uart.c
modbluetooth_zephyr.c
modmachine.c
moduos.c
modusocket.c
......
......@@ -49,6 +49,7 @@
#include "py/stackctrl.h"
#include "lib/utils/pyexec.h"
#include "lib/mp-readline/readline.h"
#include "extmod/modbluetooth.h"
#if MICROPY_VFS
#include "extmod/vfs.h"
......@@ -168,6 +169,9 @@ soft_reset:
printf("soft reboot\n");
#if MICROPY_PY_BLUETOOTH
mp_bluetooth_deinit();
#endif
#if MICROPY_PY_MACHINE
machine_pin_deinit();
#endif
......
This diff is collapsed.
......@@ -52,6 +52,7 @@
#define MICROPY_PY_BUILTINS_REVERSED (0)
#define MICROPY_PY_BUILTINS_SET (0)
#define MICROPY_PY_BUILTINS_STR_COUNT (0)
#define MICROPY_PY_BUILTINS_MEMORYVIEW (1)
#define MICROPY_PY_BUILTINS_HELP (1)
#define MICROPY_PY_BUILTINS_HELP_TEXT zephyr_help_text
#define MICROPY_PY_ARRAY (0)
......@@ -69,6 +70,13 @@
#define MICROPY_PY_UERRNO (1)
#define MICROPY_PY_USOCKET (1)
#endif
#ifdef CONFIG_BT
#define MICROPY_PY_BLUETOOTH (1)
#ifdef CONFIG_BT_CENTRAL
#define MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE (1)
#endif
#define MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT (0)
#endif
#define MICROPY_PY_UBINASCII (1)
#define MICROPY_PY_UHASHLIB (1)
#define MICROPY_PY_UOS (1)
......@@ -123,7 +131,8 @@ typedef long mp_off_t;
#define MICROPY_PORT_ROOT_POINTERS \
const char *readline_hist[8]; \
void *machine_pin_irq_list; /* Linked list of pin irq objects */
void *machine_pin_irq_list; /* Linked list of pin irq objects */ \
struct _mp_bluetooth_zephyr_root_pointers_t *bluetooth_zephyr_root_pointers;
extern const struct _mp_obj_module_t mp_module_machine;
extern const struct _mp_obj_module_t mp_module_time;
......
......@@ -36,4 +36,8 @@ void main(void) {
zephyr_getchar_init();
#endif
real_main();
// This is needed so the linker includes k_timer_init, z_impl_k_timer_start
// and z_impl_k_timer_stop, as used by libmicropython.a.
k_timer_start(NULL, K_MSEC(0), K_MSEC(0));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment