#pragma experiment("FOR_LOOP")
#pragma experiment("BRIDGE_CONNECT")

# Standard library imports
import ElectricPower
import Resistor

# Package imports from https://packages.atopile.io/
from "atopile/usb-connectors/usb-connectors.ato" import USB2_0TypeCHorizontalConnector
from "atopile/ti-tlv75901/ti-tlv75901.ato" import TI_TLV75901
from "atopile/espressif-esp32-c3/espressif-esp32-c3-mini.ato" import ESP32_C3_MINI_1

module ESP32_MINIMAL:
    """
    ESP32 S3 WROOM with USB-C connector and LDO
    """
    micro = new ESP32_C3_MINI_1
    usb_c = new USB2_0TypeCHorizontalConnector
    ldo_3V3 = new TI_TLV75901

    # Power
    power_3v3 = new ElectricPower
    usb_c.usb.usb_if.buspower ~> ldo_3V3 ~> power_3v3
    power_3v3 ~ micro.power

    # Configure LDO
    ldo_3V3.v_in = 5V +/- 5%
    ldo_3V3.v_out = 3.3V +/- 3%
    # Connect USB
    usb_c.usb.usb_if ~ micro.usb_if
