muse/book-reading-clip-lamp

A 60‑mm ESP32‑S3 lamp-head PCB combining USB‑C battery charging/power regulation, OV5640 autofocus camera interfacing, I²S microphone and differential speaker audio, six‑LED boost-driven reading light, buttons, status indicators, and battery monitoring.

Version
0.2.5
License
unset
Stars
0

mcu-parts.tsx

SchematicSchematic preview for mcu-parts.tsx
import type { ChipProps } from "@tscircuit/props"
import { ESP32_S3_WROOM_1U_N16R8 as CatalogESP32 } from "./imports/ESP32_S3_WROOM_1U_N16R8"

// IMPORTANT: the C3013946 import has incorrect pin labels (including GND on
// pin 2). Override ALL labels and electrical attributes using Espressif v1.8,
// Table 3-1 / Figure 3-1. The underlying numerical land pattern is retained.
// https://www.espressif.com/sites/default/files/documentation/esp32-s3-wroom-1_wroom-1u_datasheet_en.pdf
export const esp32PinLabels = {
  pin1: ["GND1"], pin2: ["V3V3"], pin3: ["EN"],
  pin4: ["IO4"], pin5: ["IO5"], pin6: ["IO6"], pin7: ["IO7"],
  pin8: ["IO15"], pin9: ["IO16"], pin10: ["IO17"], pin11: ["IO18"],
  pin12: ["IO8"], pin13: ["IO19", "USB_DM"], pin14: ["IO20", "USB_DP"],
  pin15: ["IO3"], pin16: ["IO46"], pin17: ["IO9"], pin18: ["IO10"],
  pin19: ["IO11"], pin20: ["IO12"], pin21: ["IO13"], pin22: ["IO14"],
  pin23: ["IO21"], pin24: ["IO47"], pin25: ["IO48"], pin26: ["IO45"],
  pin27: ["IO0", "BOOT"],
  // N16R8 uses Octal PSRAM. These physical pins MUST remain unconnected.
  pin28: ["PSRAM_IO35_NC"], pin29: ["PSRAM_IO36_NC"], pin30: ["PSRAM_IO37_NC"],
  pin31: ["IO38"], pin32: ["IO39"], pin33: ["IO40"], pin34: ["IO41"],
  pin35: ["IO42"], pin36: ["IO44", "RXD0"], pin37: ["IO43", "TXD0"],
  pin38: ["IO2"], pin39: ["IO1"], pin40: ["GND40"], pin41: ["pin41", "EPAD_GND"],
} as const

export const esp32PinAttributes = {
  pin1: { requiresGround: true },
  pin2: { requiresPower: true },
  pin40: { requiresGround: true },
  pin41: { requiresGround: true },
} as const

// The catalog component's inferred prop type encodes the incorrect labels.
// This assertion changes that type, while the following explicit props replace
// the corresponding runtime values. Geometry and supplier metadata stay intact.
const CorrectedCatalogESP32 = CatalogESP32 as unknown as (
  props: ChipProps<typeof esp32PinLabels>
) => ReturnType<typeof CatalogESP32>

export const ESP32S3N16R8 = (props: ChipProps<typeof esp32PinLabels>) => (
  <CorrectedCatalogESP32
    {...props}
    pinLabels={esp32PinLabels}
    pinAttributes={esp32PinAttributes as NonNullable<ChipProps<typeof esp32PinLabels>["pinAttributes"]>}
  />
)

export const ESP32S3 = ESP32S3N16R8