aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDien-Nhung Nguyen-Phu <kein@kienlab.com>2024-06-23 19:22:20 +0700
committerDien-Nhung Nguyen-Phu <kein@kienlab.com>2024-06-23 19:33:13 +0700
commit8274cab154f198447f12028e1686bbe2a6de6ebd (patch)
tree35c825b6551afad7688813d7de510111a67bf007 /src/main.c
parent2383bf65e5f3ee9bc58877905dd29eed2e194d19 (diff)
feat: add initial Bluetooth LE module
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index d3a959b..613504e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,6 +5,9 @@
#include "button.h"
#include "fb.h"
+#include "ble/setup.h"
+#include "ble/profile.h"
+
#define FB_WIDTH (LED_COLS * 4)
#define SCROLL_IRATIO (16)
#define SCAN_F (2000)
@@ -103,6 +106,16 @@ void poweroff()
LowPower_Shutdown(0);
}
+void ble_start()
+{
+ ble_hardwareInit();
+ tmos_clockInit();
+
+ peripheral_init();
+ devInfo_registerService();
+ legacy_registerService();
+}
+
void handle_mode_transition()
{
static int prev_mode;
@@ -116,8 +129,9 @@ void handle_mode_transition()
// Take control of the current fb to display
// the Bluetooth animation
+ ble_start();
while (mode == DOWNLOAD) {
- /* Animation and Bluetooth will be placed here */
+ TMOS_SystemProcess();
}
// If not being flashed, pressing KEY1 again will
// make the badge goes off: