Skip to content

Commit 7413532

Browse files
committed
Progress update
1 parent 2fcd8a4 commit 7413532

File tree

4 files changed

+319
-86
lines changed

4 files changed

+319
-86
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/**
2+
**************************************************
3+
*
4+
* @file BluetoothSerial.ino
5+
* @brief Example showing how to use Bluetooth Serial on Inkplate 6FLICK
6+
* with an LVGL-based UI that safely renders incoming text.
7+
*
8+
* HOW TO USE
9+
* - Upload this example to Inkplate 6FLICK.
10+
* - Pair your phone with the device in Bluetooth settings (device name: "Inkplate 6FLICK").
11+
* - Open a Serial Bluetooth Terminal app (or similar) and connect to "Inkplate 6FLICK".
12+
* - Anything you type in the app will be shown on the serial monitor.
13+
* - Anything you type in the Arduino Serial Monitor will be sent to the phone.
14+
*
15+
*
16+
* For info on how to quickly get started with Inkplate 6FLICK visit
17+
* https://soldered.com/documentation/inkplate/6flick/overview/
18+
*
19+
* @authors Soldered
20+
* @date November 2025
21+
***************************************************/
22+
23+
24+
#include <Inkplate-LVGL.h>
25+
#include "BluetoothSerial.h"
26+
27+
Inkplate inkplate(INKPLATE_1BIT); // Inkplate LVGL display instance
28+
BluetoothSerial SerialBT; // Bluetooth Serial object
29+
30+
const char *btDeviceName = "Inkplate 6FLICK"; // Bluetooth device name
31+
32+
// Forward declaration
33+
void setLabelText(lv_obj_t *label, const char *text);
34+
35+
void setup()
36+
{
37+
Serial.begin(115200);
38+
39+
// Initialize Inkplate in FULL render mode (for LVGL)
40+
inkplate.begin(LV_DISP_RENDER_MODE_FULL);
41+
42+
// Set white background
43+
lv_obj_set_style_bg_color(lv_screen_active(), lv_color_hex(0xFFFFFF), LV_PART_MAIN);
44+
45+
// Create centered LVGL label
46+
lv_obj_t *label = lv_label_create(lv_screen_active());
47+
lv_obj_set_style_text_color(label, lv_color_hex(0x000000), LV_PART_MAIN);
48+
lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0);
49+
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
50+
51+
// Initial startup message
52+
Serial.println("Initializing Bluetooth...");
53+
54+
// Attempt to start Bluetooth
55+
if (!SerialBT.begin(btDeviceName))
56+
{
57+
setLabelText(label, "Error initializing Bluetooth!");
58+
}
59+
else
60+
{
61+
// Success message
62+
setLabelText(label,
63+
"Bluetooth Serial\n\n"
64+
"Device: Inkplate 6FLICK\n\n"
65+
"Pair your phone and connect\n"
66+
"using a Serial Bluetooth app.\n\n"
67+
"Baud: 115200");
68+
}
69+
70+
// Render the LVGL content
71+
lv_tick_inc(50);
72+
lv_timer_handler();
73+
inkplate.display();
74+
}
75+
76+
void loop()
77+
{
78+
// Forward data from USB Serial → Bluetooth
79+
if (Serial.available())
80+
{
81+
while (Serial.available())
82+
{
83+
SerialBT.write(Serial.read());
84+
}
85+
}
86+
87+
// Forward data from Bluetooth → USB Serial
88+
if (SerialBT.available())
89+
{
90+
while (SerialBT.available())
91+
{
92+
Serial.write(SerialBT.read());
93+
}
94+
}
95+
96+
delay(20);
97+
}
98+
99+
100+
// update LVGL label text and refresh display
101+
void setLabelText(lv_obj_t *label, const char *text)
102+
{
103+
lv_label_set_text(label, text);
104+
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
105+
106+
lv_tick_inc(50);
107+
lv_timer_handler();
108+
inkplate.display();
109+
}

examples/Inkplate6FLICK/Advanced/ImageFromBuffer/ImageFromBuffer.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,21 @@ const lv_image_dsc_t my_image = {
4343
};
4444

4545
// LVGL task that ticks the timer every 5 ms
46-
void lvgl_task(void *arg) {
47-
for (;;) {
46+
void lvgl_task(void *arg)
47+
{
48+
for (;;)
49+
{
4850
lv_tick_inc(5);
4951
lv_timer_handler();
5052
vTaskDelay(pdMS_TO_TICKS(5));
5153
}
5254
}
5355

54-
void setup() {
56+
void setup()
57+
{
5558
Serial.begin(115200);
5659
delay(1000);
57-
Serial.println("Starting LVGL grayscale image example on Inkplate 6...");
60+
Serial.println("Starting LVGL grayscale image example on Inkplate 6FLICK...");
5861

5962
// Initialize Inkplate + LVGL in full render mode
6063
inkplate.begin(LV_DISP_RENDER_MODE_FULL);
@@ -95,6 +98,7 @@ void setup() {
9598
Serial.println("Display updated with 8-bit grayscale (L8) image");
9699
}
97100

98-
void loop() {
101+
void loop()
102+
{
99103
// Nothing needed in loop
100104
}

examples/Inkplate6FLICK/Basic/SimpleFrontlight/SimpleFrontlight.ino

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)