aboutsummaryrefslogtreecommitdiff
path: root/extmod/mpbthci.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2020-08-14 15:43:09 +1000
committerDamien George <damien@micropython.org>2020-09-08 11:41:31 +1000
commited14435a8e6199b845c3404a9052f9ff4213292c (patch)
treec7fc4c10aeb002bbe9557e212c62bb75a735fee8 /extmod/mpbthci.c
parente46aac24bacdafcb5323fbfc702a3bd597f66072 (diff)
extmod/modbluetooth: Refactor stack/hci/driver/port bindings.
Previously the interaction between the different layers of the Bluetooth stack was different on each port and each stack. This commit defines common interfaces between them and implements them for cyw43, btstack, nimble, stm32, unix.
Diffstat (limited to 'extmod/mpbthci.c')
-rw-r--r--extmod/mpbthci.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/extmod/mpbthci.c b/extmod/mpbthci.c
new file mode 100644
index 000000000..79a865424
--- /dev/null
+++ b/extmod/mpbthci.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Jim Mussared
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+// Default definitions in case a controller doesn't implement this.
+
+#include "py/mphal.h"
+
+#if MICROPY_PY_BLUETOOTH
+
+#define DEBUG_printf(...) // printf(__VA_ARGS__)
+
+#include "extmod/mpbthci.h"
+
+
+#endif // MICROPY_PY_BLUETOOTH