@typecad/board-esp32s3 0.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 typecad0
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ # @typecad/board-esp32s3
2
+
3
+ ESP32-S3 board definition package for TypeCAD.
4
+
5
+ ## Overview
6
+
7
+ `@typecad/board-esp32s3` provides typed pins, peripherals, and board metadata for boards built on the ESP32-S3 (dual-core Xtensa LX7 @ 240 MHz, Wi-Fi 4 + BLE 5, native USB-OTG). It re-exports silicon-level pin definitions from [`@typecad/mcu-esp32s3`](../mcu-esp32s3) and HAL utilities from [`@typecad/hal`](../hal).
8
+
9
+ ## Quick start
10
+
11
+ ```ts
12
+ import { GPIO2, delay } from '@typecad/board';
13
+
14
+ const led = GPIO2.asOutput(false);
15
+
16
+ while (true) {
17
+ led.toggle();
18
+ delay(1000);
19
+ }
20
+ ```
21
+
22
+ Reference this board in `cuttlefish.config.ts`:
23
+
24
+ ```ts
25
+ board: '@typecad/board-esp32s3',
26
+ ```
27
+
28
+ ## What's inside
29
+
30
+ - **GPIO pins**: `GPIO0`–`GPIO48` (silicon pins from `@typecad/mcu-esp32s3`)
31
+ - **Peripheral instances**: `I2C0`, `SPI0`, `UART0`, `ADC`
32
+ - **HAL utilities** (re-exported from `@typecad/hal`): `delay`, `millis`, `Pin`, `I2CBus`, `SPIBus`, etc.
33
+ - **Board metadata**: `BoardDefinition` manifest with PWM/analog/interrupt pin capabilities and memory specs
34
+
35
+ Direct imports from `@typecad/board-esp32s3` are also supported when you want explicit board package references.
36
+
37
+ ## Related packages
38
+
39
+ - [`@typecad/mcu-esp32s3`](../mcu-esp32s3) — silicon-level pin definitions for the ESP32-S3 chip
40
+ - [`@typecad/hal`](../hal) — hardware abstraction layer (GPIO, I2C, SPI, UART)
41
+
42
+ ## License
43
+
44
+ MIT
@@ -0,0 +1,4 @@
1
+ /** Default reference (3.3V). */
2
+ export declare const DEFAULT = 0;
3
+ /** Internal 1.1V reference. */
4
+ export declare const INTERNAL = 3;
package/dist/analog.js ADDED
@@ -0,0 +1,7 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Analog constants
3
+ // ---------------------------------------------------------------------------
4
+ /** Default reference (3.3V). */
5
+ export const DEFAULT = 0;
6
+ /** Internal 1.1V reference. */
7
+ export const INTERNAL = 3;
@@ -0,0 +1,80 @@
1
+ import type { BoardDefinition } from '@typecad/cuttlefish/api/schema';
2
+ import * as boardIndex from './index.js';
3
+ export declare const Board: {
4
+ readonly definition: BoardDefinition;
5
+ D1: boardIndex.Pin;
6
+ D2: boardIndex.Pin;
7
+ D3: boardIndex.Pin;
8
+ D4: boardIndex.Pin;
9
+ D5: boardIndex.Pin;
10
+ D6: boardIndex.Pin;
11
+ D7: boardIndex.Pin;
12
+ D8: boardIndex.Pin;
13
+ D9: boardIndex.Pin;
14
+ D10: boardIndex.Pin;
15
+ D38: boardIndex.Pin;
16
+ D39: boardIndex.Pin;
17
+ D40: boardIndex.Pin;
18
+ D41: boardIndex.Pin;
19
+ D42: boardIndex.Pin;
20
+ D43: boardIndex.Pin;
21
+ D44: boardIndex.Pin;
22
+ D45: boardIndex.Pin;
23
+ D46: boardIndex.Pin;
24
+ D47: boardIndex.Pin;
25
+ D48: boardIndex.Pin;
26
+ A0: boardIndex.Pin;
27
+ A1: boardIndex.Pin;
28
+ A2: boardIndex.Pin;
29
+ A3: boardIndex.Pin;
30
+ A4: boardIndex.Pin;
31
+ A5: boardIndex.Pin;
32
+ A6: boardIndex.Pin;
33
+ A7: boardIndex.Pin;
34
+ A8: boardIndex.Pin;
35
+ A9: boardIndex.Pin;
36
+ LED: boardIndex.Pin;
37
+ I2C0: boardIndex.I2CBus;
38
+ I2C1: boardIndex.I2CBus;
39
+ SPI0: boardIndex.SPIBus;
40
+ SPI1: boardIndex.SPIBus;
41
+ UART0: boardIndex.SerialPort;
42
+ UART1: boardIndex.SerialPort;
43
+ UART2: boardIndex.SerialPort;
44
+ digital: {
45
+ D1: boardIndex.Pin;
46
+ D2: boardIndex.Pin;
47
+ D3: boardIndex.Pin;
48
+ D4: boardIndex.Pin;
49
+ D5: boardIndex.Pin;
50
+ D6: boardIndex.Pin;
51
+ D7: boardIndex.Pin;
52
+ D8: boardIndex.Pin;
53
+ D9: boardIndex.Pin;
54
+ D10: boardIndex.Pin;
55
+ D38: boardIndex.Pin;
56
+ D39: boardIndex.Pin;
57
+ D40: boardIndex.Pin;
58
+ D41: boardIndex.Pin;
59
+ D42: boardIndex.Pin;
60
+ D43: boardIndex.Pin;
61
+ D44: boardIndex.Pin;
62
+ D45: boardIndex.Pin;
63
+ D46: boardIndex.Pin;
64
+ D47: boardIndex.Pin;
65
+ D48: boardIndex.Pin;
66
+ };
67
+ analog: {
68
+ A0: boardIndex.Pin;
69
+ A1: boardIndex.Pin;
70
+ A2: boardIndex.Pin;
71
+ A3: boardIndex.Pin;
72
+ A4: boardIndex.Pin;
73
+ A5: boardIndex.Pin;
74
+ A6: boardIndex.Pin;
75
+ A7: boardIndex.Pin;
76
+ A8: boardIndex.Pin;
77
+ A9: boardIndex.Pin;
78
+ };
79
+ };
80
+ export default Board;
package/dist/board.js ADDED
@@ -0,0 +1,31 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Board namespace
3
+ //
4
+ // Convenience namespace that exposes every board feature under one object.
5
+ // For method calls on pins/peripherals, prefer direct imports:
6
+ //
7
+ // import { D2, UART0 } from '@typecad/board-esp32s3';
8
+ // D2.high();
9
+ // UART0.begin(115200);
10
+ //
11
+ // The Board object is useful for pin iteration and metadata access.
12
+ // ---------------------------------------------------------------------------
13
+ import { D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, LED, } from './pins.js';
14
+ import { I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2 } from '@typecad/mcu-esp32s3';
15
+ import * as boardIndex from './index.js';
16
+ export const Board = {
17
+ get definition() { return boardIndex.ESP32S3Board; },
18
+ // Common digital pins (strapping/flash/USB pins omitted from the convenience namespace)
19
+ D1, D2, D3, D4, D5, D6, D7, D8, D9, D10,
20
+ D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48,
21
+ // Analog aliases
22
+ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
23
+ // Convenience aliases
24
+ LED,
25
+ // Peripherals
26
+ I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2,
27
+ // Collections
28
+ digital: { D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48 },
29
+ analog: { A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 },
30
+ };
31
+ export default Board;
@@ -0,0 +1,59 @@
1
+ import type { BoardDefinition } from '@typecad/cuttlefish/api/schema';
2
+ export declare const ESP32S3Board: BoardDefinition;
3
+ export default ESP32S3Board;
4
+ export * from '@typecad/mcu-esp32s3';
5
+ export * from '@typecad/hal';
6
+ /**
7
+ * Pin collections for runtime capability discovery.
8
+ */
9
+ export declare const pins: {
10
+ /** PWM-capable pins (all output-capable GPIOs that are not flash/USB/strap). */
11
+ readonly pwm: readonly [import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin];
12
+ /** Analog input pins (ADC1 — usable while Wi-Fi active). */
13
+ readonly analog: readonly [import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin];
14
+ /** All GPIOs support interrupts on ESP32-S3. */
15
+ readonly interrupt: readonly [import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin];
16
+ /** All digital I/O pins. */
17
+ readonly digital: readonly [import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin, import("@typecad/hal").Pin];
18
+ };
19
+ /**
20
+ * Peripheral-to-pin mapping for the ESP32-S3.
21
+ */
22
+ export declare const PeripheralPins: {
23
+ /** I2C bus 0 — default GPIO8 (SDA) / GPIO9 (SCL); remappable via GPIO matrix. */
24
+ readonly I2C0: {
25
+ readonly SDA: "GPIO8";
26
+ readonly SCL: "GPIO9";
27
+ };
28
+ /** I2C bus 1 — no fixed pins (remappable). */
29
+ readonly I2C1: {
30
+ readonly SDA: "remappable";
31
+ readonly SCL: "remappable";
32
+ };
33
+ /** SPI bus 0 / FSPI — GPIO12 (MOSI), GPIO13 (MISO), GPIO11 (SCK). GPIO10 is default CS. */
34
+ readonly SPI0: {
35
+ readonly MOSI: "GPIO12";
36
+ readonly MISO: "GPIO13";
37
+ readonly SCK: "GPIO11";
38
+ readonly CS: "GPIO10";
39
+ };
40
+ /** SPI bus 1 / GPSI — no fixed pins (remappable). */
41
+ readonly SPI1: {
42
+ readonly MOSI: "remappable";
43
+ readonly MISO: "remappable";
44
+ readonly SCK: "remappable";
45
+ };
46
+ /** UART 0 — GPIO43 (TX) / GPIO44 (RX). USB-CDC serial available too. */
47
+ readonly UART0: {
48
+ readonly TX: "GPIO43";
49
+ readonly RX: "GPIO44";
50
+ };
51
+ /** UART 1 — no fixed pins (remappable). */
52
+ readonly UART1: {
53
+ readonly TX: "remappable";
54
+ readonly RX: "remappable";
55
+ };
56
+ };
57
+ export * from './pins.js';
58
+ export * from './analog.js';
59
+ export { Board } from './board.js';
package/dist/index.js ADDED
@@ -0,0 +1,112 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Board definition manifest
3
+ // ---------------------------------------------------------------------------
4
+ import { ESP32S3 } from '@typecad/mcu-esp32s3';
5
+ /** Arduino core API version for this board's build defines. */
6
+ const ARDUINO_CORE_VERSION = '10819';
7
+ // ---------------------------------------------------------------------------
8
+ // Board definition
9
+ // ---------------------------------------------------------------------------
10
+ export const ESP32S3Board = {
11
+ id: 'esp32s3',
12
+ name: 'ESP32-S3',
13
+ vendor: 'Espressif',
14
+ description: 'Generic ESP32-S3 (vendor-agnostic). Dual-core Xtensa LX7 @ 240 MHz ' +
15
+ 'with Wi-Fi 4 + BLE 5 and native USB-OTG. Flash/PSRAM are module-dependent; ' +
16
+ 'override via FQBN menu options, e.g. ' +
17
+ 'esp32:esp32:esp32s3:FlashSize=16M,PSRAM=opi',
18
+ mcu: ESP32S3,
19
+ clockSpeed: 240_000_000, // 240 MHz
20
+ // ----- Memory (module-level defaults; silicon memory lives on the MCU) ---
21
+ memory: {
22
+ flash: 8 * 1024 * 1024, // 8 MB module flash (N8R2-class default)
23
+ externalRam: 2 * 1024 * 1024, // 2 MB octal PSRAM
24
+ },
25
+ // ----- Pins --------------------------------------------------------------
26
+ pins: {
27
+ ...ESP32S3.pins,
28
+ led: 'GPIO48',
29
+ },
30
+ // ----- Peripherals -------------------------------------------------------
31
+ peripherals: {
32
+ ...ESP32S3.peripherals,
33
+ aliases: {
34
+ UART0: 'Serial',
35
+ UART1: 'Serial1',
36
+ UART2: 'Serial2',
37
+ I2C0: 'Wire',
38
+ I2C1: 'Wire1',
39
+ SPI0: 'SPI',
40
+ SPI1: 'SPI1',
41
+ },
42
+ },
43
+ // ----- Build config ------------------------------------------------------
44
+ build: {
45
+ frameworks: {
46
+ platformio: 'esp32s3',
47
+ arduino: 'esp32:esp32:esp32s3',
48
+ },
49
+ defines: {
50
+ F_CPU: '240000000UL',
51
+ ARDUINO: ARDUINO_CORE_VERSION,
52
+ ARDUINO_ESP32S3_DEV: '1',
53
+ },
54
+ },
55
+ };
56
+ export default ESP32S3Board;
57
+ // ---------------------------------------------------------------------------
58
+ // Re-exports — convenience barrel
59
+ // ---------------------------------------------------------------------------
60
+ // Silicon-level (local MCU module)
61
+ export * from '@typecad/mcu-esp32s3';
62
+ // Generic HAL re-exports from @typecad/hal. Full re-export so this board package
63
+ // is a superset of @typecad/hal — `import { ... } from '@typecad/hal'` resolves
64
+ // here at transpile time and exposes every HAL symbol plus board-specific pins.
65
+ export * from '@typecad/hal';
66
+ // Board-level pin Discovery API (uses local silicon pins)
67
+ import { GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44, GPIO45, GPIO46, GPIO47, GPIO48, } from '@typecad/mcu-esp32s3';
68
+ /**
69
+ * Pin collections for runtime capability discovery.
70
+ */
71
+ export const pins = {
72
+ /** PWM-capable pins (all output-capable GPIOs that are not flash/USB/strap). */
73
+ pwm: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
74
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
75
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
76
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48],
77
+ /** Analog input pins (ADC1 — usable while Wi-Fi active). */
78
+ analog: [GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10],
79
+ /** All GPIOs support interrupts on ESP32-S3. */
80
+ interrupt: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
81
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
82
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
83
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48],
84
+ /** All digital I/O pins. */
85
+ digital: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
86
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
87
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
88
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48],
89
+ };
90
+ /**
91
+ * Peripheral-to-pin mapping for the ESP32-S3.
92
+ */
93
+ export const PeripheralPins = {
94
+ /** I2C bus 0 — default GPIO8 (SDA) / GPIO9 (SCL); remappable via GPIO matrix. */
95
+ I2C0: { SDA: 'GPIO8', SCL: 'GPIO9' },
96
+ /** I2C bus 1 — no fixed pins (remappable). */
97
+ I2C1: { SDA: 'remappable', SCL: 'remappable' },
98
+ /** SPI bus 0 / FSPI — GPIO12 (MOSI), GPIO13 (MISO), GPIO11 (SCK). GPIO10 is default CS. */
99
+ SPI0: { MOSI: 'GPIO12', MISO: 'GPIO13', SCK: 'GPIO11', CS: 'GPIO10' },
100
+ /** SPI bus 1 / GPSI — no fixed pins (remappable). */
101
+ SPI1: { MOSI: 'remappable', MISO: 'remappable', SCK: 'remappable' },
102
+ /** UART 0 — GPIO43 (TX) / GPIO44 (RX). USB-CDC serial available too. */
103
+ UART0: { TX: 'GPIO43', RX: 'GPIO44' },
104
+ /** UART 1 — no fixed pins (remappable). */
105
+ UART1: { TX: 'remappable', RX: 'remappable' },
106
+ };
107
+ // Board-level typed pins (Arduino-style aliases D0, A0, etc.)
108
+ export * from './pins.js';
109
+ // Board-specific analog constants
110
+ export * from './analog.js';
111
+ // Board namespace (single-import convenience)
112
+ export { Board } from './board.js';
package/dist/pins.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ export declare const D0: import("@typecad/hal").Pin;
2
+ export declare const D1: import("@typecad/hal").Pin;
3
+ export declare const D2: import("@typecad/hal").Pin;
4
+ export declare const D3: import("@typecad/hal").Pin;
5
+ export declare const D4: import("@typecad/hal").Pin;
6
+ export declare const D5: import("@typecad/hal").Pin;
7
+ export declare const D6: import("@typecad/hal").Pin;
8
+ export declare const D7: import("@typecad/hal").Pin;
9
+ export declare const D8: import("@typecad/hal").Pin;
10
+ export declare const D9: import("@typecad/hal").Pin;
11
+ export declare const D10: import("@typecad/hal").Pin;
12
+ export declare const D11: import("@typecad/hal").Pin;
13
+ export declare const D12: import("@typecad/hal").Pin;
14
+ export declare const D13: import("@typecad/hal").Pin;
15
+ export declare const D14: import("@typecad/hal").Pin;
16
+ export declare const D15: import("@typecad/hal").Pin;
17
+ export declare const D16: import("@typecad/hal").Pin;
18
+ export declare const D17: import("@typecad/hal").Pin;
19
+ export declare const D18: import("@typecad/hal").Pin;
20
+ export declare const D19: import("@typecad/hal").Pin;
21
+ export declare const D20: import("@typecad/hal").Pin;
22
+ export declare const D21: import("@typecad/hal").Pin;
23
+ export declare const D38: import("@typecad/hal").Pin;
24
+ export declare const D39: import("@typecad/hal").Pin;
25
+ export declare const D40: import("@typecad/hal").Pin;
26
+ export declare const D41: import("@typecad/hal").Pin;
27
+ export declare const D42: import("@typecad/hal").Pin;
28
+ export declare const D43: import("@typecad/hal").Pin;
29
+ export declare const D44: import("@typecad/hal").Pin;
30
+ export declare const D45: import("@typecad/hal").Pin;
31
+ export declare const D46: import("@typecad/hal").Pin;
32
+ export declare const D47: import("@typecad/hal").Pin;
33
+ export declare const D48: import("@typecad/hal").Pin;
34
+ export declare const A0: import("@typecad/hal").Pin;
35
+ export declare const A1: import("@typecad/hal").Pin;
36
+ export declare const A2: import("@typecad/hal").Pin;
37
+ export declare const A3: import("@typecad/hal").Pin;
38
+ export declare const A4: import("@typecad/hal").Pin;
39
+ export declare const A5: import("@typecad/hal").Pin;
40
+ export declare const A6: import("@typecad/hal").Pin;
41
+ export declare const A7: import("@typecad/hal").Pin;
42
+ export declare const A8: import("@typecad/hal").Pin;
43
+ export declare const A9: import("@typecad/hal").Pin;
44
+ /** On-board LED (GPIO48 — addressable RGB on most S3 dev modules). */
45
+ export declare const LED: import("@typecad/hal").Pin;
46
+ export { I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2 } from '@typecad/mcu-esp32s3';
package/dist/pins.js ADDED
@@ -0,0 +1,62 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Pin aliases
3
+ // ---------------------------------------------------------------------------
4
+ import { GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44, GPIO45, GPIO46, GPIO47, GPIO48, } from '@typecad/mcu-esp32s3';
5
+ // ---------------------------------------------------------------------------
6
+ // Arduino-style digital pin aliases (D-numbers match GPIO numbers on ESP32-S3)
7
+ // ---------------------------------------------------------------------------
8
+ export const D0 = GPIO0;
9
+ export const D1 = GPIO1;
10
+ export const D2 = GPIO2;
11
+ export const D3 = GPIO3;
12
+ export const D4 = GPIO4;
13
+ export const D5 = GPIO5;
14
+ export const D6 = GPIO6;
15
+ export const D7 = GPIO7;
16
+ export const D8 = GPIO8;
17
+ export const D9 = GPIO9;
18
+ export const D10 = GPIO10;
19
+ export const D11 = GPIO11;
20
+ export const D12 = GPIO12;
21
+ export const D13 = GPIO13;
22
+ export const D14 = GPIO14;
23
+ export const D15 = GPIO15;
24
+ export const D16 = GPIO16;
25
+ export const D17 = GPIO17;
26
+ export const D18 = GPIO18;
27
+ export const D19 = GPIO19;
28
+ export const D20 = GPIO20;
29
+ export const D21 = GPIO21;
30
+ export const D38 = GPIO38;
31
+ export const D39 = GPIO39;
32
+ export const D40 = GPIO40;
33
+ export const D41 = GPIO41;
34
+ export const D42 = GPIO42;
35
+ export const D43 = GPIO43;
36
+ export const D44 = GPIO44;
37
+ export const D45 = GPIO45;
38
+ export const D46 = GPIO46;
39
+ export const D47 = GPIO47;
40
+ export const D48 = GPIO48;
41
+ // ---------------------------------------------------------------------------
42
+ // Analog input aliases (ADC1 channels — usable while Wi-Fi is active).
43
+ // ADC2 pins (GPIO11-GPIO20) are omitted from Ax aliases because they are
44
+ // unusable while Wi-Fi is enabled.
45
+ // ---------------------------------------------------------------------------
46
+ export const A0 = GPIO1;
47
+ export const A1 = GPIO2;
48
+ export const A2 = GPIO3;
49
+ export const A3 = GPIO4;
50
+ export const A4 = GPIO5;
51
+ export const A5 = GPIO6;
52
+ export const A6 = GPIO7;
53
+ export const A7 = GPIO8;
54
+ export const A8 = GPIO9;
55
+ export const A9 = GPIO10;
56
+ // ---------------------------------------------------------------------------
57
+ // Board-specific aliases
58
+ // ---------------------------------------------------------------------------
59
+ /** On-board LED (GPIO48 — addressable RGB on most S3 dev modules). */
60
+ export const LED = GPIO48;
61
+ // Bus aliases (default pins for I2C0 / SPI0 / UART0)
62
+ export { I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2 } from '@typecad/mcu-esp32s3';
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@typecad/board-esp32s3",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "TypeCAD ESP32-S3 board definition with typed pins and peripherals",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "src"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "prepublishOnly": "npm run build"
15
+ },
16
+ "dependencies": {
17
+ "@typecad/cuttlefish": "0.1.0-alpha.1",
18
+ "@typecad/hal": "0.1.0-alpha.1",
19
+ "@typecad/mcu-esp32s3": "0.1.0-alpha.1"
20
+ },
21
+ "license": "MIT",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/justind000/typecode.git",
28
+ "directory": "packages/board-esp32s3"
29
+ },
30
+ "homepage": "https://github.com/justind000/typecode/tree/main/packages/board-esp32s3",
31
+ "bugs": {
32
+ "url": "https://github.com/justind000/typecode/issues"
33
+ },
34
+ "keywords": [
35
+ "arduino",
36
+ "board",
37
+ "cpp",
38
+ "cuttlefish",
39
+ "devkit",
40
+ "embedded",
41
+ "esp32s3",
42
+ "firmware",
43
+ "microcontroller",
44
+ "pins",
45
+ "typecad",
46
+ "typescript"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "author": "typecad0",
52
+ "sideEffects": false,
53
+ "exports": {
54
+ ".": {
55
+ "types": "./dist/index.d.ts",
56
+ "default": "./dist/index.js"
57
+ },
58
+ "./package.json": "./package.json"
59
+ }
60
+ }
package/src/analog.ts ADDED
@@ -0,0 +1,8 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Analog constants
3
+ // ---------------------------------------------------------------------------
4
+
5
+ /** Default reference (3.3V). */
6
+ export const DEFAULT = 0;
7
+ /** Internal 1.1V reference. */
8
+ export const INTERNAL = 3;
package/src/board.ts ADDED
@@ -0,0 +1,47 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Board namespace
3
+ //
4
+ // Convenience namespace that exposes every board feature under one object.
5
+ // For method calls on pins/peripherals, prefer direct imports:
6
+ //
7
+ // import { D2, UART0 } from '@typecad/board-esp32s3';
8
+ // D2.high();
9
+ // UART0.begin(115200);
10
+ //
11
+ // The Board object is useful for pin iteration and metadata access.
12
+ // ---------------------------------------------------------------------------
13
+
14
+ import type { BoardDefinition } from '@typecad/cuttlefish/api/schema';
15
+
16
+ import {
17
+ D1, D2, D3, D4, D5, D6, D7, D8, D9, D10,
18
+ D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48,
19
+ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
20
+ LED,
21
+ } from './pins.js';
22
+
23
+ import { I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2 } from '@typecad/mcu-esp32s3';
24
+ import * as boardIndex from './index.js';
25
+
26
+ export const Board = {
27
+ get definition() { return boardIndex.ESP32S3Board; },
28
+
29
+ // Common digital pins (strapping/flash/USB pins omitted from the convenience namespace)
30
+ D1, D2, D3, D4, D5, D6, D7, D8, D9, D10,
31
+ D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48,
32
+
33
+ // Analog aliases
34
+ A0, A1, A2, A3, A4, A5, A6, A7, A8, A9,
35
+
36
+ // Convenience aliases
37
+ LED,
38
+
39
+ // Peripherals
40
+ I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2,
41
+
42
+ // Collections
43
+ digital: { D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D38, D39, D40, D41, D42, D43, D44, D45, D46, D47, D48 },
44
+ analog: { A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 },
45
+ };
46
+
47
+ export default Board;
package/src/index.ts ADDED
@@ -0,0 +1,139 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Board definition manifest
3
+ // ---------------------------------------------------------------------------
4
+
5
+ import type { BoardDefinition } from '@typecad/cuttlefish/api/schema';
6
+ import { ESP32S3 } from '@typecad/mcu-esp32s3';
7
+
8
+ /** Arduino core API version for this board's build defines. */
9
+ const ARDUINO_CORE_VERSION = '10819';
10
+
11
+ // ---------------------------------------------------------------------------
12
+ // Board definition
13
+ // ---------------------------------------------------------------------------
14
+
15
+ export const ESP32S3Board: BoardDefinition = {
16
+ id: 'esp32s3',
17
+ name: 'ESP32-S3',
18
+ vendor: 'Espressif',
19
+ description:
20
+ 'Generic ESP32-S3 (vendor-agnostic). Dual-core Xtensa LX7 @ 240 MHz ' +
21
+ 'with Wi-Fi 4 + BLE 5 and native USB-OTG. Flash/PSRAM are module-dependent; ' +
22
+ 'override via FQBN menu options, e.g. ' +
23
+ 'esp32:esp32:esp32s3:FlashSize=16M,PSRAM=opi',
24
+
25
+ mcu: ESP32S3,
26
+ clockSpeed: 240_000_000, // 240 MHz
27
+
28
+ // ----- Memory (module-level defaults; silicon memory lives on the MCU) ---
29
+ memory: {
30
+ flash: 8 * 1024 * 1024, // 8 MB module flash (N8R2-class default)
31
+ externalRam: 2 * 1024 * 1024, // 2 MB octal PSRAM
32
+ },
33
+
34
+ // ----- Pins --------------------------------------------------------------
35
+ pins: {
36
+ ...ESP32S3.pins,
37
+ led: 'GPIO48',
38
+ },
39
+
40
+ // ----- Peripherals -------------------------------------------------------
41
+ peripherals: {
42
+ ...ESP32S3.peripherals,
43
+ aliases: {
44
+ UART0: 'Serial',
45
+ UART1: 'Serial1',
46
+ UART2: 'Serial2',
47
+ I2C0: 'Wire',
48
+ I2C1: 'Wire1',
49
+ SPI0: 'SPI',
50
+ SPI1: 'SPI1',
51
+ },
52
+ },
53
+
54
+ // ----- Build config ------------------------------------------------------
55
+ build: {
56
+ frameworks: {
57
+ platformio: 'esp32s3',
58
+ arduino: 'esp32:esp32:esp32s3',
59
+ },
60
+ defines: {
61
+ F_CPU: '240000000UL',
62
+ ARDUINO: ARDUINO_CORE_VERSION,
63
+ ARDUINO_ESP32S3_DEV: '1',
64
+ },
65
+ },
66
+ };
67
+
68
+ export default ESP32S3Board;
69
+
70
+ // ---------------------------------------------------------------------------
71
+ // Re-exports — convenience barrel
72
+ // ---------------------------------------------------------------------------
73
+
74
+ // Silicon-level (local MCU module)
75
+ export * from '@typecad/mcu-esp32s3';
76
+
77
+ // Generic HAL re-exports from @typecad/hal. Full re-export so this board package
78
+ // is a superset of @typecad/hal — `import { ... } from '@typecad/hal'` resolves
79
+ // here at transpile time and exposes every HAL symbol plus board-specific pins.
80
+ export * from '@typecad/hal';
81
+
82
+ // Board-level pin Discovery API (uses local silicon pins)
83
+ import {
84
+ GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7,
85
+ GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14,
86
+ GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21,
87
+ GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44,
88
+ GPIO45, GPIO46, GPIO47, GPIO48,
89
+ } from '@typecad/mcu-esp32s3';
90
+
91
+ /**
92
+ * Pin collections for runtime capability discovery.
93
+ */
94
+ export const pins = {
95
+ /** PWM-capable pins (all output-capable GPIOs that are not flash/USB/strap). */
96
+ pwm: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
97
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
98
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
99
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48] as const,
100
+ /** Analog input pins (ADC1 — usable while Wi-Fi active). */
101
+ analog: [GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10] as const,
102
+ /** All GPIOs support interrupts on ESP32-S3. */
103
+ interrupt: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
104
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
105
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
106
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48] as const,
107
+ /** All digital I/O pins. */
108
+ digital: [GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9,
109
+ GPIO10, GPIO11, GPIO12, GPIO13, GPIO14, GPIO15, GPIO16, GPIO17, GPIO18,
110
+ GPIO19, GPIO20, GPIO21, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43,
111
+ GPIO44, GPIO45, GPIO46, GPIO47, GPIO48] as const,
112
+ } as const;
113
+
114
+ /**
115
+ * Peripheral-to-pin mapping for the ESP32-S3.
116
+ */
117
+ export const PeripheralPins = {
118
+ /** I2C bus 0 — default GPIO8 (SDA) / GPIO9 (SCL); remappable via GPIO matrix. */
119
+ I2C0: { SDA: 'GPIO8', SCL: 'GPIO9' } as const,
120
+ /** I2C bus 1 — no fixed pins (remappable). */
121
+ I2C1: { SDA: 'remappable', SCL: 'remappable' } as const,
122
+ /** SPI bus 0 / FSPI — GPIO12 (MOSI), GPIO13 (MISO), GPIO11 (SCK). GPIO10 is default CS. */
123
+ SPI0: { MOSI: 'GPIO12', MISO: 'GPIO13', SCK: 'GPIO11', CS: 'GPIO10' } as const,
124
+ /** SPI bus 1 / GPSI — no fixed pins (remappable). */
125
+ SPI1: { MOSI: 'remappable', MISO: 'remappable', SCK: 'remappable' } as const,
126
+ /** UART 0 — GPIO43 (TX) / GPIO44 (RX). USB-CDC serial available too. */
127
+ UART0: { TX: 'GPIO43', RX: 'GPIO44' } as const,
128
+ /** UART 1 — no fixed pins (remappable). */
129
+ UART1: { TX: 'remappable', RX: 'remappable' } as const,
130
+ } as const;
131
+
132
+ // Board-level typed pins (Arduino-style aliases D0, A0, etc.)
133
+ export * from './pins.js';
134
+
135
+ // Board-specific analog constants
136
+ export * from './analog.js';
137
+
138
+ // Board namespace (single-import convenience)
139
+ export { Board } from './board.js';
package/src/pins.ts ADDED
@@ -0,0 +1,55 @@
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/board-esp32s3 — Pin aliases
3
+ // ---------------------------------------------------------------------------
4
+
5
+ import {
6
+ GPIO0, GPIO1, GPIO2, GPIO3, GPIO4, GPIO5, GPIO6, GPIO7,
7
+ GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13, GPIO14,
8
+ GPIO15, GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21,
9
+ GPIO38, GPIO39, GPIO40, GPIO41, GPIO42, GPIO43, GPIO44,
10
+ GPIO45, GPIO46, GPIO47, GPIO48,
11
+ } from '@typecad/mcu-esp32s3';
12
+
13
+ // ---------------------------------------------------------------------------
14
+ // Arduino-style digital pin aliases (D-numbers match GPIO numbers on ESP32-S3)
15
+ // ---------------------------------------------------------------------------
16
+
17
+ export const D0 = GPIO0; export const D1 = GPIO1; export const D2 = GPIO2;
18
+ export const D3 = GPIO3; export const D4 = GPIO4; export const D5 = GPIO5;
19
+ export const D6 = GPIO6; export const D7 = GPIO7; export const D8 = GPIO8;
20
+ export const D9 = GPIO9; export const D10 = GPIO10; export const D11 = GPIO11;
21
+ export const D12 = GPIO12; export const D13 = GPIO13; export const D14 = GPIO14;
22
+ export const D15 = GPIO15; export const D16 = GPIO16; export const D17 = GPIO17;
23
+ export const D18 = GPIO18; export const D19 = GPIO19; export const D20 = GPIO20;
24
+ export const D21 = GPIO21;
25
+ export const D38 = GPIO38; export const D39 = GPIO39; export const D40 = GPIO40;
26
+ export const D41 = GPIO41; export const D42 = GPIO42; export const D43 = GPIO43;
27
+ export const D44 = GPIO44; export const D45 = GPIO45; export const D46 = GPIO46;
28
+ export const D47 = GPIO47; export const D48 = GPIO48;
29
+
30
+ // ---------------------------------------------------------------------------
31
+ // Analog input aliases (ADC1 channels — usable while Wi-Fi is active).
32
+ // ADC2 pins (GPIO11-GPIO20) are omitted from Ax aliases because they are
33
+ // unusable while Wi-Fi is enabled.
34
+ // ---------------------------------------------------------------------------
35
+
36
+ export const A0 = GPIO1;
37
+ export const A1 = GPIO2;
38
+ export const A2 = GPIO3;
39
+ export const A3 = GPIO4;
40
+ export const A4 = GPIO5;
41
+ export const A5 = GPIO6;
42
+ export const A6 = GPIO7;
43
+ export const A7 = GPIO8;
44
+ export const A8 = GPIO9;
45
+ export const A9 = GPIO10;
46
+
47
+ // ---------------------------------------------------------------------------
48
+ // Board-specific aliases
49
+ // ---------------------------------------------------------------------------
50
+
51
+ /** On-board LED (GPIO48 — addressable RGB on most S3 dev modules). */
52
+ export const LED = GPIO48;
53
+
54
+ // Bus aliases (default pins for I2C0 / SPI0 / UART0)
55
+ export { I2C0, I2C1, SPI0, SPI1, UART0, UART1, UART2 } from '@typecad/mcu-esp32s3';