Chips interact with the simulator using digital pins. The pins are defined in a JSON file, calledDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/wokwi/wokwi-docs/llms.txt
Use this file to discover all available pages before exploring further.
{chip-name}.chip.json (replace {chip-name} with the actual name of the chip). For instance, the following JSON file defines a chip with 4 pins (IN, OUT, VCC, GND):
pin_init
mode parameters configure the initial state of the pin. The following values are available:
INPUT- configures the pin as a digital inputINPUT_PULLUP- configures the pin as a digital input, and attaches a pull-up register to the pin.INPUT_PULLDOWN- configures the pin as a digital input, and attaches a pull-down register to the pin.OUTPUT- configures the pin as a digital outputOUTPUT_LOW- configures the pin as a digital output, sets the value of the pin to LOWOUTPUT_HIGH- configures the pin as a digital output, sets the value of the pin to HIGHANALOG- configures the pin as an analog pin. See the Analog API section for more detail.
pin_mode
pin as digital input or output. The valid values for mode are the same as pin_init(): INPUT, INPUT_PULLUP, INPUT_PULLDOWN, OUTPUT, OUTPUT_LOW, OUTPUT_HIGH, and ANALOG.
pin_write
LOW and HIGH constants for value.
pin_read
LOW or HIGH.
pin_watch
| Field | Type | Description |
|---|---|---|
edge | uint32_t | What pin value changes we listen for (RISING, FALLING or BOTH) |
pin_change | callback | Called when the pin value changes (see below) |
user_data | void * | Data that will be passed in the first argument to pin_change |
BOTH- Listen for any value changeFALLING- Listen forHIGHtoLOWchangesRISING- Listen forLOWtoHIGHchanges
true if the watch was successfully set, or false in case there is already a watch defined for this pin (and thus the new watch was not set).
The pin_change callback signature is as follows: