13 Commits

Author SHA1 Message Date
d967be0245 x
Some checks failed
Push (dev), Pull Request / Run Clang lint (push) Has been cancelled
Push (dev), Pull Request / Run Python lint (push) Has been cancelled
2026-01-02 01:43:15 -07:00
b040f336d4 (XXX) use scratch lwip 2026-01-02 01:43:15 -07:00
1bf1ea7596 [common] Log at warning level mDNS services or TXT records cannot be added 2026-01-02 01:43:15 -07:00
Kuba Szczodrzyński
29303f7ec9 [boards] Add generic-rtl8720cf-2mb-896k board
Some checks failed
Push (dev), Pull Request / Run Clang lint (push) Has been cancelled
Push (dev), Pull Request / Run Python lint (push) Has been cancelled
Push (master) / Deploy docs (push) Has been cancelled
2025-11-17 20:32:54 +01:00
Kuba Szczodrzyński
c6b06d4be6 [release] v1.9.2
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
2025-09-19 22:44:44 +02:00
Kuba Szczodrzyński
c9b2f9dd23 [boards] Fix syntax error in WB02A 2025-09-19 22:44:44 +02:00
Kuba Szczodrzyński
40590d174f [core] Update ltchiptool to v4.12.2 2025-09-19 22:39:47 +02:00
Rishab Mehta
780fb72bba [docs] Update README.md (#323) 2025-09-19 22:37:02 +02:00
Henri Chain
e9977a26e4 [boards] Add WB02A board (#332) 2025-09-19 22:36:51 +02:00
Piotr Szulc
1d97f0ce84 [core] Avoid re-defining C++ round() method (#321) 2025-09-19 22:36:35 +02:00
Luca Olivetti
895b6e89c5 [lightning-ln882h] Fix GPIO interrupt support (#326)
* fix interrupt handling for the ln882h

- all GPIOS can generate interrupts
- added calls to NVIC_SetPriority/NVIC_EnableIRQ/NVIC_DisableIRQ

* fix clang formatting error

* only call NVIC_DisableIRQ if no other gpio is using an interrupt

* fix (again) clang-format errors

* add IRQ capability on all pins

* don't bother with NVIC_DisableIRQ

* use pin->gpio instead of interruptNumber, use macro GPIO_GET_PORT for clarity

* Mark interrupts as supported for the LN882H

---------

Co-authored-by: lamauny <pub.elc@free.fr>
2025-09-19 22:25:03 +02:00
Kuba Szczodrzyński
9114bc4c49 [release] v1.9.1
Some checks failed
Release / Run Clang lint (push) Has been cancelled
Release / Publish PlatformIO platform (push) Has been cancelled
Release / Publish GitHub release (push) Has been cancelled
2025-06-01 19:38:36 +02:00
Kuba Szczodrzyński
9eae0cd253 [common] Add Arduino emptyString declaration 2025-06-01 19:38:11 +02:00
20 changed files with 498 additions and 34 deletions

View File

@@ -19,7 +19,7 @@
</div>
PlatformIO development platform for BK7231 and RTL8710 and LN882H IoT chips.
PlatformIO development platform for BK7231, RTL8710 and LN882H IoT chips.
The main goal of this project is to provide a usable build environment for IoT developers. While also providing vendor SDKs as PlatformIO cores,
the project focuses on developing working Arduino-compatible cores for supported families. The cores are inspired by Espressif's official core for ESP32,

View File

@@ -49,6 +49,7 @@
"12": {
"C_NAME": "PA_4",
"GPIO": "PA04",
"IRQ": null,
"ADC": 4,
"SWD": "CLK",
"I2C": [
@@ -89,6 +90,7 @@
"16": {
"C_NAME": "PA_8",
"GPIO": "PA08",
"IRQ": null,
"CTRL": "BOOT0",
"SD": "CMD",
"I2S": "0_WS",
@@ -100,6 +102,7 @@
"17": {
"C_NAME": "PA_9",
"GPIO": "PA09",
"IRQ": null,
"CTRL": "BOOT1",
"SD": "CLK",
"I2S": "0_SCLK",
@@ -111,6 +114,7 @@
"21": {
"C_NAME": "PA_10",
"GPIO": "PA10",
"IRQ": null,
"SD": "D0",
"I2S": "0_TX",
"I2C": [
@@ -121,6 +125,7 @@
"22": {
"C_NAME": "PA_11",
"GPIO": "PA11",
"IRQ": null,
"SD": "D1",
"I2C": [
"0_SCL",
@@ -130,6 +135,7 @@
"23": {
"C_NAME": "PA_12",
"GPIO": "PA12",
"IRQ": null,
"I2C": [
"0_SCL",
"0_SDA"
@@ -139,6 +145,7 @@
"C_NAME": "PB_3",
"GPIO": "PB03",
"GPIONUM": 19,
"IRQ": null,
"ADC": 5,
"I2C": [
"0_SCL",
@@ -149,6 +156,7 @@
"C_NAME": "PB_4",
"GPIO": "PB04",
"GPIONUM": 20,
"IRQ": null,
"ADC": 6,
"I2C": [
"0_SCL",
@@ -159,6 +167,7 @@
"C_NAME": "PB_5",
"GPIO": "PB05",
"GPIONUM": 21,
"IRQ": null,
"ADC": 7,
"I2C": [
"0_SCL",
@@ -169,6 +178,7 @@
"C_NAME": "PB_6",
"GPIO": "PB06",
"GPIONUM": 22,
"IRQ": null,
"I2C": [
"0_SCL",
"0_SDA"
@@ -178,6 +188,7 @@
"C_NAME": "PB_7",
"GPIO": "PB07",
"GPIONUM": 23,
"IRQ": null,
"I2C": [
"0_SCL",
"0_SDA"
@@ -187,6 +198,7 @@
"C_NAME": "PB_8",
"GPIO": "PB08",
"GPIONUM": 24,
"IRQ": null,
"UART": "1_RX",
"I2C": [
"0_SCL",

View File

@@ -0,0 +1,93 @@
{
"pcb": {
"test_pads": {
"TA9": "wb02a.back.a9.anchor",
"TGND": "wb02a.back.gnd.anchor",
"TRX1": "wb02a.back.rx1.anchor",
"TTX1": "wb02a.back.tx1.anchor"
},
"back": [
{
"type": "text",
"pos": "0.5,2.3",
"text": "WB02A-0882H-1518D1",
"font_size": 1.4,
"fill": {
"color": "${SILK_COLOR}"
}
},
{
"type": "circle",
"pos": "11.6,6.4",
"d": 4.5,
"preset": "copper1"
},
{
"type": "rect",
"pos": "3.5,8.5",
"size": "4.2,3.7",
"preset": "copper1"
},
{
"id": "a9",
"name": "label_line_up",
"pos": "1.9,12.3",
"vars": {
"DIR": "left",
"W": 1.3,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "2.5,12.3"
},
{
"id": "gnd",
"name": "label_line_up",
"pos": ".6,6.6",
"vars": {
"DIR": "left",
"W": 0,
"H": 0
}
},
{
"name": "test_pad_1mm",
"pos": "1.2,6.6"
},
{
"id": "rx1",
"name": "label_line_up",
"pos": "3.2,6",
"vars": {
"DIR": "left",
"W": 2.6,
"H": 1.4
}
},
{
"name": "test_pad_1mm",
"pos": "3.2,6.6"
},
{
"id": "tx1",
"name": "label_line_up",
"pos": "5.2,6",
"vars": {
"DIR": "left",
"W": 4.6,
"H": 3.4
}
},
{
"name": "test_pad_1mm",
"pos": "5.2,6.6"
},
{
"name": "test_pad_1mm",
"pos": "8.5,12.3"
}
]
}
}

View File

@@ -0,0 +1,75 @@
{
"pcb": {
"templates": [
"tuya2",
"pcb-blue-light",
"rf-type1"
],
"scale": 10.5,
"pinout_hidden": "I2S,TRIG,WAKE,CTS,RTS,SD,SPI,I2C",
"pinout": {
"1": {
"PWR": 3.3
},
"2": {
"IC": 15,
"ARD": "D0"
},
"3": {
"GND": null
},
"4": {
"IC": 13,
"ARD": "D1"
},
"5": {
"IC": 11,
"ARD": "D2"
},
"6": {
"IC": 21,
"ARD": "D3"
},
"7": {
"IC": 10,
"ARD": "D4"
},
"8": {
"IC": 9,
"ARD": [
"D5",
"A0"
]
},
"9": {
"IC": 12,
"ARD": [
"D6",
"A1"
]
},
"10": {
"IC": 7
},
"11": {
"IC": 13,
"ARD": "D1"
},
"TA9": {
"IC": 17,
"ARD": "D7"
},
"TGND": {
"GND": null
},
"TRX1": {
"IC": 29,
"ARD": "D8"
},
"TTX1": {
"IC": 30,
"ARD": "D9"
}
}
}
}

View File

@@ -2,8 +2,7 @@
"flash": {
"ota1": "0x010000+0xE0000",
"ota2": "0x0F0000+0xE0000",
"kvs": "0x1D0000+0x8000",
"userdata": "0x1D8000+0x28000"
"kvs": "0x1F8000+0x8000"
},
"upload": {
"flash_size": 2097152,

View File

@@ -0,0 +1,102 @@
{
"_base": [
"generic",
"realtek-ambz2",
"realtek-ambz2-8720",
"realtek-ambz2-image",
"realtek-ambz2-2mb-896k",
"ic/rtl8720cf"
],
"build": {
"mcu": "rtl8720cf",
"variant": "generic-rtl8720cf-2mb-896k"
},
"name": "Generic - RTL8720CF (2M/896k)",
"symbol": "RTL8720CF (2M/896k)",
"url": "https://docs.libretiny.eu/boards/generic-rtl8720cf-2mb-896k/",
"vendor": "Generic",
"pcb": {
"pinout": {
"1": {
"IC": 15,
"ARD": "D0"
},
"2": {
"IC": 16,
"ARD": "D1"
},
"3": {
"IC": 18,
"ARD": "D2"
},
"4": {
"IC": 19,
"ARD": "D3"
},
"5": {
"IC": 20,
"ARD": "D4"
},
"6": {
"IC": 21,
"ARD": "D5"
},
"7": {
"IC": 22,
"ARD": "D6"
},
"8": {
"IC": 23,
"ARD": "D7"
},
"9": {
"IC": 24,
"ARD": "D8"
},
"10": {
"IC": 25,
"ARD": "D9"
},
"11": {
"IC": 26,
"ARD": "D10"
},
"12": {
"IC": 33,
"ARD": "D11"
},
"13": {
"IC": 34,
"ARD": "D12"
},
"14": {
"IC": 36,
"ARD": "D13"
},
"15": {
"IC": 37,
"ARD": "D14"
},
"16": {
"IC": 38,
"ARD": "D15"
},
"17": {
"IC": 39,
"ARD": "D16"
},
"18": {
"IC": 40,
"ARD": "D17"
},
"19": {
"IC": 1,
"ARD": "D18"
},
"20": {
"IC": 3,
"ARD": "D19"
}
}
}
}

View File

@@ -17,7 +17,7 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D3: PA03, UART0_RX, I2C0_SCL, I2C0_SDA
{PA_3, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D4: PA04, ADC4, SWCLK, I2C0_SCL, I2C0_SDA
{PA_4, PIN_SWD | PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PA_4, PIN_SWD | PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D5: PA05, I2C0_SCL, I2C0_SDA
{PA_5, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D6: PA06, SD_D2, I2C0_SCL, I2C0_SDA
@@ -25,27 +25,27 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D7: PA07, SD_D3, I2S0_RX, I2C0_SCL, I2C0_SDA
{PA_7, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D8: PA08, BOOT0, SD_CMD, I2S0_WS, I2C0_SCL, I2C0_SDA
{PA_8, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_8, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D9: PA09, BOOT1, SD_CLK, I2S0_SCLK, I2C0_SCL, I2C0_SDA
{PA_9, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_9, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D10: PA10, SD_D0, I2S0_TX, I2C0_SCL, I2C0_SDA
{PA_10, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_10, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D11: PA11, SD_D1, I2C0_SCL, I2C0_SDA
{PA_11, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_11, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D12: PA12, I2C0_SCL, I2C0_SDA
{PA_12, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_12, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D13: PB03, ADC5, I2C0_SCL, I2C0_SDA
{PB_3, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_3, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D14: PB04, ADC6, I2C0_SCL, I2C0_SDA
{PB_4, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_4, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D15: PB05, ADC7, I2C0_SCL, I2C0_SDA
{PB_5, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_5, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D16: PB06, I2C0_SCL, I2C0_SDA
{PB_6, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_6, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D17: PB07, I2C0_SCL, I2C0_SDA
{PB_7, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_7, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D18: PB08, UART1_RX, I2C0_SCL, I2C0_SDA
{PB_8, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_8, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D19: PB09, UART1_TX, I2C0_SCL, I2C0_SDA
{PB_9, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
};

View File

@@ -9,13 +9,13 @@
// clang-format off
PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA11, SD_D1, I2C0_SCL, I2C0_SDA
{PA_11, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_11, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D1: PB03, ADC5, I2C0_SCL, I2C0_SDA
{PB_3, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_3, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D2: PA03, UART0_RX, I2C0_SCL, I2C0_SDA
{PA_3, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D3: PB08, UART1_RX, I2C0_SCL, I2C0_SDA
{PB_8, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_8, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D4: PA02, UART0_TX, I2C0_SCL, I2C0_SDA
{PA_2, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D5: PB09, UART1_TX, I2C0_SCL, I2C0_SDA
@@ -25,7 +25,7 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D7: PA00, ADC2, I2C0_SCL, I2C0_SDA
{PA_0, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D8: PA09, BOOT1, SD_CLK, I2S0_SCLK, I2C0_SCL, I2C0_SDA
{PA_9, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_9, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
};
PinInfo *lt_arduino_pin_gpio_map[] = {

45
boards/variants/wb02a.c Normal file
View File

@@ -0,0 +1,45 @@
/* This file was auto-generated from wb02a.json using boardgen */
#include <Arduino.h>
#ifdef LT_VARIANT_INCLUDE
#include LT_VARIANT_INCLUDE
#endif
// clang-format off
PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA07, SD_D3, I2S0_RX, I2C0_SCL, I2C0_SDA
{PA_7, , PIN_NONE, 0},
// D1: PA05, I2C0_SCL, I2C0_SDA
{PA_5, , PIN_NONE, 0},
// D2: PA03, UART0_RX, I2C0_SCL, I2C0_SDA
{PA_3, , PIN_NONE, 0},
// D3: PA10, SD_D0, I2S0_TX, I2C0_SCL, I2C0_SDA
{PA_10, , PIN_NONE, 0},
// D4: PA02, UART0_TX, I2C0_SCL, I2C0_SDA
{PA_2, , PIN_NONE, 0},
// D5: PA01, ADC3, SWDIO, I2C0_SCL, I2C0_SDA
{PA_1, , PIN_NONE, 0},
// D6: PA04, ADC4, SWCLK, I2C0_SCL, I2C0_SDA
{PA_4, , PIN_NONE, 0},
// D7: PA09, BOOT1, SD_CLK, I2S0_SCLK, I2C0_SCL, I2C0_SDA
{PA_9, , PIN_NONE, 0},
// D8: PB08, UART1_RX, I2C0_SCL, I2C0_SDA
{PB_8, , PIN_NONE, 0},
// D9: PB09, UART1_TX, I2C0_SCL, I2C0_SDA
{PB_9, , PIN_NONE, 0},
};
PinInfo *lt_arduino_pin_gpio_map[] = {
[1] = &(lt_arduino_pin_info_list[5]), // PA_1 (D5)
[2] = &(lt_arduino_pin_info_list[4]), // PA_2 (D4)
[3] = &(lt_arduino_pin_info_list[2]), // PA_3 (D2)
[4] = &(lt_arduino_pin_info_list[6]), // PA_4 (D6)
[5] = &(lt_arduino_pin_info_list[1]), // PA_5 (D1)
[7] = &(lt_arduino_pin_info_list[0]), // PA_7 (D0)
[9] = &(lt_arduino_pin_info_list[7]), // PA_9 (D7)
[10] = &(lt_arduino_pin_info_list[3]), // PA_10 (D3)
[24] = &(lt_arduino_pin_info_list[8]), // PB_8 (D8)
[25] = &(lt_arduino_pin_info_list[9]), // PB_9 (D9)
};
// clang-format on

110
boards/variants/wb02a.h Normal file
View File

@@ -0,0 +1,110 @@
/* This file was auto-generated from wb02a.json using boardgen */
#pragma once
// clang-format off
// Pins
// ----
#define PINS_COUNT 10 // Total GPIO count
#define NUM_DIGITAL_PINS 10 // Digital inputs/outputs
#define NUM_ANALOG_INPUTS 2 // ADC inputs
#define NUM_ANALOG_OUTPUTS 0 // PWM & DAC outputs
#define PINS_GPIO_MAX 25 // Last usable GPIO number
// Wire Interfaces
// ---------------
#define PIN_WIRE0_SCL_0 7u // PA_7
#define PIN_WIRE0_SCL_1 5u // PA_5
#define PIN_WIRE0_SCL_2 3u // PA_3
#define PIN_WIRE0_SCL_3 10u // PA_10
#define PIN_WIRE0_SCL_4 2u // PA_2
#define PIN_WIRE0_SCL_5 1u // PA_1
#define PIN_WIRE0_SCL_6 4u // PA_4
#define PIN_WIRE0_SCL_7 5u // PA_5
#define PIN_WIRE0_SCL_8 9u // PA_9
#define PIN_WIRE0_SCL_9 24u // PB_8
#define PIN_WIRE0_SCL_10 25u // PB_9
#define PIN_WIRE0_SDA_0 7u // PA_7
#define PIN_WIRE0_SDA_1 5u // PA_5
#define PIN_WIRE0_SDA_2 3u // PA_3
#define PIN_WIRE0_SDA_3 10u // PA_10
#define PIN_WIRE0_SDA_4 2u // PA_2
#define PIN_WIRE0_SDA_5 1u // PA_1
#define PIN_WIRE0_SDA_6 4u // PA_4
#define PIN_WIRE0_SDA_7 5u // PA_5
#define PIN_WIRE0_SDA_8 9u // PA_9
#define PIN_WIRE0_SDA_9 24u // PB_8
#define PIN_WIRE0_SDA_10 25u // PB_9
#define PINS_WIRE0_SCL (pin_size_t[]){7u, 5u, 3u, 10u, 2u, 1u, 4u, 5u, 9u, 24u, 25u}
#define PINS_WIRE0_SDA (pin_size_t[]){7u, 5u, 3u, 10u, 2u, 1u, 4u, 5u, 9u, 24u, 25u}
// Serial ports
// ------------
#define PIN_SERIAL0_RX 3u // PA_3
#define PIN_SERIAL0_TX 2u // PA_2
#define PIN_SERIAL1_RX 24u // PB_8
#define PIN_SERIAL1_TX 25u // PB_9
#define PINS_SERIAL0_RX (pin_size_t[]){3u}
#define PINS_SERIAL0_TX (pin_size_t[]){2u}
#define PINS_SERIAL1_RX (pin_size_t[]){24u}
#define PINS_SERIAL1_TX (pin_size_t[]){25u}
// Pin function macros
// -------------------
#define PIN_ADC3 1u // PA_1
#define PIN_ADC4 4u // PA_4
#define PIN_PA01 1u // PA_1
#define PIN_PA02 2u // PA_2
#define PIN_PA03 3u // PA_3
#define PIN_PA04 4u // PA_4
#define PIN_PA05 5u // PA_5
#define PIN_PA07 7u // PA_7
#define PIN_PA09 9u // PA_9
#define PIN_PA10 10u // PA_10
#define PIN_PB08 24u // PB_8
#define PIN_PB09 25u // PB_9
#define PIN_RX0 3u // PA_3
#define PIN_RX1 24u // PB_8
#define PIN_SCL0 25u // PB_9
#define PIN_SDA0 25u // PB_9
#define PIN_TX0 2u // PA_2
#define PIN_TX1 25u // PB_9
// Port availability
// -----------------
#define HAS_SERIAL0 1
#define HAS_SERIAL1 1
#define HAS_WIRE0 1
#define SERIAL_INTERFACES_COUNT 2
#define WIRE_INTERFACES_COUNT 1
// Arduino pin names
// -----------------
#define PIN_D0 7u // PA_7
#define PIN_D1 5u // PA_5
#define PIN_D2 3u // PA_3
#define PIN_D3 10u // PA_10
#define PIN_D4 2u // PA_2
#define PIN_D5 1u // PA_1
#define PIN_D6 4u // PA_4
#define PIN_D7 9u // PA_9
#define PIN_D8 24u // PB_8
#define PIN_D9 25u // PB_9
#define PIN_A0 1u // PA_1
#define PIN_A1 4u // PA_4
// Static pin names
// ----------------
static const unsigned char A0 = PIN_A0;
static const unsigned char A1 = PIN_A1;
static const unsigned char D0 = PIN_D0;
static const unsigned char D1 = PIN_D1;
static const unsigned char D2 = PIN_D2;
static const unsigned char D3 = PIN_D3;
static const unsigned char D4 = PIN_D4;
static const unsigned char D5 = PIN_D5;
static const unsigned char D6 = PIN_D6;
static const unsigned char D7 = PIN_D7;
static const unsigned char D8 = PIN_D8;
static const unsigned char D9 = PIN_D9;

View File

@@ -11,23 +11,23 @@ PinInfo lt_arduino_pin_info_list[PINS_COUNT] = {
// D0: PA07, SD_D3, I2S0_RX, I2C0_SCL, I2C0_SDA
{PA_7, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D1: PA12, I2C0_SCL, I2C0_SDA
{PA_12, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_12, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D2: PA03, UART0_RX, I2C0_SCL, I2C0_SDA
{PA_3, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D3: PA10, SD_D0, I2S0_TX, I2C0_SCL, I2C0_SDA
{PA_10, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_10, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D4: PA02, UART0_TX, I2C0_SCL, I2C0_SDA
{PA_2, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D5: PA00, ADC2, I2C0_SCL, I2C0_SDA
{PA_0, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D6: PB03, ADC5, I2C0_SCL, I2C0_SDA
{PB_3, PIN_I2C | PIN_ADC | PIN_GPIO, PIN_NONE, 0},
{PB_3, PIN_I2C | PIN_ADC | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D7: PA11, SD_D1, I2C0_SCL, I2C0_SDA
{PA_11, PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_11, PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D8: PA09, BOOT1, SD_CLK, I2S0_SCLK, I2C0_SCL, I2C0_SDA
{PA_9, PIN_I2S | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PA_9, PIN_I2S | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D9: PB08, UART1_RX, I2C0_SCL, I2C0_SDA
{PB_8, PIN_UART | PIN_I2C | PIN_GPIO, PIN_NONE, 0},
{PB_8, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D10: PB09, UART1_TX, I2C0_SCL, I2C0_SDA
{PB_9, PIN_UART | PIN_I2C | PIN_IRQ | PIN_GPIO, PIN_NONE, 0},
// D11: PA05, I2C0_SCL, I2C0_SDA

19
boards/wb02a.json Normal file
View File

@@ -0,0 +1,19 @@
{
"_base": [
"lightning-ln882x",
"lightning-ln882hki",
"ic/ln882hk",
"pcb/wb02a",
"pcb/wb02a-test"
],
"build": {
"mcu": "ln882hk",
"variant": "wb02a"
},
"name": "WB02A Wi-Fi/BLE Module",
"url": "https://docs.libretiny.eu/boards/wb02a/",
"vendor": "Unknown",
"pcb": {
"symbol": ""
}
}

View File

@@ -18,7 +18,7 @@ platform: PlatformBase = env.PioPlatform()
board: PlatformBoardConfig = env.BoardConfig()
python_deps = {
"ltchiptool": ">=4.12.0,<5.0",
"ltchiptool": ">=4.12.2,<5.0",
}
env.SConscript("python-venv.py", exports="env")
env.ConfigurePythonVenv()

View File

@@ -51,7 +51,7 @@ def env_add_core_sources(env: Environment, queue, name: str, path: str) -> bool:
"+<compat/*.c*>",
"+<port/*.c*>",
"+<posix/*.c>",
"+<wiring/*.c>",
"+<wiring/*.c*>",
"+<wraps/*.c>",
],
includes=[

View File

@@ -89,7 +89,7 @@ static void mdnsTxtCallback(struct mdns_service *service, void *userdata) {
for (const auto &record : sCachedServices[index].records) {
err_t err = mdns_resp_add_service_txtitem(service, record, strlen(record));
if (err != ERR_OK) {
LT_DM(MDNS, "Error %d while adding txt record: %s", err, record);
LT_WM(MDNS, "Error %d while adding txt record: %s", err, record);
}
}
}
@@ -131,7 +131,7 @@ static void addServices(struct netif *netif) {
);
if (slot < 0) {
LT_DM(MDNS, "mdns_resp_add_service returned error %d", slot);
LT_WM(MDNS, "mdns_resp_add_service returned error %d", slot);
}
}
}
@@ -244,7 +244,7 @@ bool mDNS::addServiceImpl(const char *name, const char *service, uint8_t proto,
);
if (slot < 0) {
LT_DM(MDNS, "mdns_resp_add_service returned error %d", slot);
LT_WM(MDNS, "mdns_resp_add_service returned error %d", slot);
}
added = true;

View File

@@ -7,3 +7,6 @@ String ipToString(const IPAddress &ip) {
sprintf(szRet, "%hhu.%hhu.%hhu.%hhu", ip[0], ip[1], ip[2], ip[3]);
return String(szRet);
}
// global empty string to allow returning const String& with nothing
const String emptyString;

View File

@@ -22,7 +22,9 @@ extern "C" {
#define voidFuncPtrArg voidFuncPtrParam
// Additional Arduino compatibility macros
#define round(x) ((x) >= 0 ? (long)((x) + 0.5) : (long)((x) - 0.5))
#ifndef __cplusplus
#define round(x) ((x) >= 0 ? (long)((x) + 0.5) : (long)((x) - 0.5))
#endif
#define digitalPinToInterrupt(pin) (pin)
// FreeRTOS utilities
@@ -35,6 +37,7 @@ extern "C" {
#ifdef __cplusplus
String ipToString(const IPAddress &ip);
extern const String emptyString;
#endif
#ifdef __cplusplus

View File

@@ -81,6 +81,9 @@ void attachInterruptParam(pin_size_t interruptNumber, voidFuncPtrParam callback,
hal_gpio_pin_it_cfg(data->gpio_base, data->gpio->pin, event);
hal_gpio_pin_it_en(data->gpio_base, data->gpio->pin, HAL_ENABLE);
uint16_t IRQForPin = GPIO_GET_PORT(pin->gpio) == PORT_A ? GPIOA_IRQn : GPIOB_IRQn;
NVIC_SetPriority(IRQForPin, 1);
NVIC_EnableIRQ(IRQForPin);
}
void detachInterrupt(pin_size_t interruptNumber) {

View File

@@ -49,7 +49,7 @@ Watchdog timer | ✔️ | ✔️ | ✔️ | ❓
**PERIPHERALS** (Wiring) | | | | | |
Digital I/O | ✔️ | ✔️ | ✔️ | ❓ | ❓ | ✔️
PWM | ✔️ | ✔️ | ✔️ | ❓ | ❓ | ❌
Interrupts | ✔️ | ✔️ | ✔️ | ❓ | ❓ |
Interrupts | ✔️ | ✔️ | ✔️ | ❓ | ❓ | ✔️
Analog input (ADC) | ✔️ | ✔️ | ✔️ | ❓ | ❓ | ✔️
`Wire` (I²C) | ❌ | ❌ | ❗ | ❌ | ❌ | ❓
`SPI` | ❌ | ❌ | ❌ | ❌ | ❌ | ❌

View File

@@ -6,7 +6,7 @@
"type": "git",
"url": "https://github.com/libretiny-eu/libretiny.git"
},
"version": "1.9.0",
"version": "1.9.2",
"frameworks": {
"base": {
"title": "Base Framework (SDK only)",
@@ -96,7 +96,7 @@
"library-lwip": {
"type": "framework",
"optional": true,
"base_url": "https://github.com/libretiny-eu/lwip"
"base_url": "https://gitea.dlitz.net/scratch/lwip.git"
},
"library-freertos": {
"type": "framework",