@typecad/hal 1.0.0-alpha.13 → 1.0.0-alpha.15

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.
Files changed (121) hide show
  1. package/README.md +145 -87
  2. package/dist/adc-pin.d.ts +53 -0
  3. package/dist/adc-pin.js +69 -0
  4. package/dist/async.d.ts +3 -11
  5. package/dist/async.js +3 -15
  6. package/dist/ble.d.ts +42 -78
  7. package/dist/ble.js +79 -98
  8. package/dist/counter.d.ts +16 -0
  9. package/dist/counter.js +32 -0
  10. package/dist/dac-pin.d.ts +13 -0
  11. package/dist/dac-pin.js +21 -0
  12. package/dist/emit.d.ts +123 -196
  13. package/dist/emit.js +146 -208
  14. package/dist/fs.d.ts +12 -31
  15. package/dist/fs.js +30 -40
  16. package/dist/gpio-pin.d.ts +46 -0
  17. package/dist/gpio-pin.js +77 -0
  18. package/dist/gpio.d.ts +0 -103
  19. package/dist/gpio.js +16 -227
  20. package/dist/http.d.ts +38 -39
  21. package/dist/http.js +53 -78
  22. package/dist/i2c-target.d.ts +28 -0
  23. package/dist/i2c-target.js +52 -0
  24. package/dist/i2c.d.ts +5 -43
  25. package/dist/i2c.js +17 -130
  26. package/dist/index.d.ts +30 -42
  27. package/dist/index.js +27 -39
  28. package/dist/math.d.ts +0 -13
  29. package/dist/math.js +9 -13
  30. package/dist/mqtt.d.ts +15 -25
  31. package/dist/mqtt.js +32 -28
  32. package/dist/power.d.ts +9 -17
  33. package/dist/power.js +22 -20
  34. package/dist/preferences.d.ts +17 -25
  35. package/dist/preferences.js +54 -52
  36. package/dist/pulse.d.ts +4 -4
  37. package/dist/pulse.js +6 -2
  38. package/dist/pwm-pin.d.ts +24 -0
  39. package/dist/pwm-pin.js +38 -0
  40. package/dist/random.d.ts +0 -2
  41. package/dist/random.js +14 -20
  42. package/dist/sensor-catalog.generated.d.ts +997 -0
  43. package/dist/sensor-catalog.generated.js +764 -0
  44. package/dist/sensor.d.ts +46 -0
  45. package/dist/sensor.js +52 -0
  46. package/dist/shift-pin.d.ts +2 -0
  47. package/dist/shift-pin.js +13 -0
  48. package/dist/spi-target.d.ts +25 -0
  49. package/dist/spi-target.js +42 -0
  50. package/dist/spi.d.ts +8 -26
  51. package/dist/spi.js +15 -87
  52. package/dist/thread.d.ts +18 -0
  53. package/dist/thread.js +36 -0
  54. package/dist/time.d.ts +23 -0
  55. package/dist/time.js +43 -0
  56. package/dist/timing.d.ts +17 -7
  57. package/dist/timing.js +17 -7
  58. package/dist/types.d.ts +4 -34
  59. package/dist/types.js +5 -47
  60. package/dist/uart-port.d.ts +26 -0
  61. package/dist/uart-port.js +52 -0
  62. package/dist/uart.d.ts +0 -17
  63. package/dist/uart.js +10 -53
  64. package/dist/usb.d.ts +26 -0
  65. package/dist/usb.js +66 -0
  66. package/dist/watchdog.d.ts +12 -0
  67. package/dist/watchdog.js +28 -0
  68. package/dist/wifi.d.ts +88 -64
  69. package/dist/wifi.js +112 -126
  70. package/dist/zephyr-tokens.generated.d.ts +8 -0
  71. package/dist/zephyr-tokens.generated.js +73 -0
  72. package/package.json +7 -8
  73. package/src/adc-pin.ts +89 -0
  74. package/src/async.ts +3 -16
  75. package/src/ble.ts +84 -111
  76. package/src/counter.ts +40 -0
  77. package/src/dac-pin.ts +28 -0
  78. package/src/emit.ts +157 -238
  79. package/src/fs.ts +47 -54
  80. package/src/gpio-pin.ts +91 -0
  81. package/src/gpio.ts +49 -320
  82. package/src/http.ts +75 -95
  83. package/src/i2c-target.ts +63 -0
  84. package/src/i2c.ts +29 -167
  85. package/src/index.ts +32 -46
  86. package/src/math.ts +9 -14
  87. package/src/mqtt.ts +39 -31
  88. package/src/preferences.ts +52 -61
  89. package/src/pwm-pin.ts +54 -0
  90. package/src/random.ts +14 -21
  91. package/src/sensor-catalog.generated.ts +1238 -0
  92. package/src/sensor.ts +80 -0
  93. package/src/shift-pin.ts +16 -0
  94. package/src/spi-target.ts +53 -0
  95. package/src/spi.ts +27 -121
  96. package/src/thread.ts +44 -0
  97. package/src/time.ts +50 -0
  98. package/src/types.ts +14 -89
  99. package/src/uart-port.ts +64 -0
  100. package/src/usb.ts +82 -0
  101. package/src/watchdog.ts +35 -0
  102. package/src/wifi.ts +147 -179
  103. package/src/zephyr-tokens.generated.ts +77 -0
  104. package/src/adc.ts +0 -30
  105. package/src/capacitive.ts +0 -31
  106. package/src/constants.ts +0 -23
  107. package/src/dac.ts +0 -21
  108. package/src/eeprom.ts +0 -26
  109. package/src/interrupts.ts +0 -35
  110. package/src/mdns.ts +0 -50
  111. package/src/ota.ts +0 -44
  112. package/src/power.ts +0 -36
  113. package/src/pulse.ts +0 -63
  114. package/src/rmt.ts +0 -125
  115. package/src/shift.ts +0 -88
  116. package/src/temperature.ts +0 -20
  117. package/src/timer.ts +0 -58
  118. package/src/timing.ts +0 -67
  119. package/src/uart.ts +0 -77
  120. package/src/utils.ts +0 -17
  121. package/src/wdt.ts +0 -17
package/dist/emit.d.ts CHANGED
@@ -1,224 +1,148 @@
1
+ import type { SerialValue } from './types.js';
1
2
  /** Set a digital pin HIGH or LOW. */
2
3
  export declare function gpioWrite(pin: number | string, value: number | boolean): void;
3
4
  /** Read a digital pin. Returns HIGH (1) or LOW (0). */
4
5
  export declare function gpioRead(pin: number | string): number;
5
6
  /** Toggle a digital pin. */
6
7
  export declare function gpioToggle(pin: number | string): void;
7
- /** Set pin mode: "output" | "input" | "input_pullup" | "input_pulldown". */
8
- export declare function gpioSetMode(pin: number | string, mode: string): void;
9
- /** Write PWM duty cycle to a pin. */
10
- export declare function pwmWrite(pin: number | string, duty: number): void;
11
- import type { Pin } from './gpio.js';
12
- type RmtPin = Pin | number | string;
13
- /** Positional semantic primitive. Args: pin, resolutionHz, bit0Hi, bit0Lo,
14
- * bit1Hi, bit1Lo, msbFirst, queueDepth. Use rmtTxInit() from hal/rmt.ts. */
15
- export declare function rmtTxInit(pin: RmtPin, resolutionHz: number, bit0Hi: number, bit0Lo: number, bit1Hi: number, bit1Lo: number, msbFirst: boolean, queueDepth: number): void;
16
- /** Write bytes via the channel's bytes-encoder (timings fixed at init). */
17
- export declare function rmtTxWriteBytes(pin: RmtPin, bytes: number[] | Uint8Array): void;
18
- /** Write raw RMT symbols arbitrary [hiTicks, loTicks] pairs. */
19
- export declare function rmtTxWriteSymbols(pin: RmtPin, symbols: [number, number][]): void;
20
- /** Block until the queued TX completes. */
21
- export declare function rmtTxWaitDone(pin: RmtPin, timeoutMs?: number): void;
22
- /** Tear down the TX channel and release its slot. */
23
- export declare function rmtTxDeinit(pin: RmtPin): void;
24
- /** Positional semantic primitive use rmtRxInit() from hal/rmt.ts. */
25
- export declare function rmtRxInit(pin: RmtPin, resolutionHz: number): void;
26
- /** Register a callback-by-name invoked when an RX burst completes. */
27
- export declare function rmtRxOnReceived(pin: RmtPin, handler: string): void;
28
- /** Start receiving. */
29
- export declare function rmtRxStart(pin: RmtPin): void;
30
- /** Stop receiving. */
31
- export declare function rmtRxStop(pin: RmtPin): void;
32
- /** Blocking read returns flattened symbols [d0,l0,d1,l1,…] in ticks. */
33
- export declare function rmtRxRead(pin: RmtPin, maxCount: number): number[];
34
- /** Tear down the RX channel and release its slot. */
35
- export declare function rmtRxDeinit(pin: RmtPin): void;
36
- /** Read analog value from a pin. */
37
- export declare function adcRead(pin: number | string): number;
38
- /** Read analog voltage from a pin (ADC value converted to voltage). */
39
- export declare function adcReadVoltage(pin: number | string): number;
40
- /** Set the analog reference. */
41
- export declare function adcSetReference(ref: string | number): void;
42
- /** Attach an interrupt handler to a pin. */
43
- export declare function interruptAttach(pin: number | string, handler: string, mode: string): void;
8
+ /** Thin GPIO (hal/gpio-pin.ts): configure with Zephyr flag tokens
9
+ * ("GPIO.OUTPUT | GPIO.PULL_UP"). The lowering maps token names to the
10
+ * GPIO_* macros; the emitted configure is guarded per pin (first use wins). */
11
+ export declare function gpioConfigure(pin: number | string, flags: number | string): void;
12
+ /** GPIO.shiftOut/shiftIn: bit-banged shift via two pins (one op each). */
13
+ export declare function gpioShiftOut(dataPin: number | import('./gpio.js').Pin, clockPin: number | import('./gpio.js').Pin, value: number, msbFirst: boolean): void;
14
+ export declare function gpioShiftIn(dataPin: number | import('./gpio.js').Pin, clockPin: number | import('./gpio.js').Pin, msbFirst: boolean): number;
15
+ /** Thin GPIO read with FUSED guarded configure one op, one statement-
16
+ * expression: correct in any expression position (if-conditions drop a
17
+ * method's leading side-effect ops, so get() must not rely on a separate
18
+ * configure op). */
19
+ export declare function gpioReadCfg(pin: number | string, flags: number | string): number;
20
+ /** Thin PWM (hal/pwm-pin.ts): set pulse width in ns against the constructed
21
+ * period. The first use also applies the construction period
22
+ * (pwm_set_dt with an idle pulse), then pwm_set_pulse_dt. */
23
+ export declare function pwmSetPulse(pin: number | string, periodNs: number, pulseNs: number, controller?: string, channel?: number): void;
24
+ /** Thin PWM duty sugar: pulse = duty(0.0–1.0) × periodNs — one
25
+ * pwm_set_pulse_dt call, no 0–255 scaling. */
26
+ export declare function pwmSetDuty(pin: number | string, periodNs: number, duty: number, controller?: string, channel?: number): void;
27
+ /** Thin PWM: change the period at runtime (pwm_set_dt; the pulse resets to
28
+ * idle Zephyr 4.4 has no period-only setter). */
29
+ export declare function pwmSetPeriod(pin: number | string, periodNs: number, controller?: string, channel?: number): void;
30
+ /** Thin ADC (hal/adc-pin.ts): raw read with construction-time gain/reference
31
+ * tokens ("ADC.GAIN_1_4" / "ADC.REF_INTERNAL"); empty strings
32
+ * mean "use the chip descriptor's defaults". */
33
+ export declare function adcReadRaw(pin: number | string, gain: number | string, reference: number | string, channel?: number, device?: string, pinctrl?: string): number;
34
+ /** Thin ADC: millivolts read (adc_raw_to_millivolts) with the same
35
+ * construction-time gain/reference tokens. */
36
+ export declare function adcReadMv(pin: number | string, gain: number | string, reference: number | string, channel?: number, device?: string, pinctrl?: string): number;
37
+ /** Thin GPIO interrupts (hal/gpio-pin.ts onInterrupt): attach with Zephyr
38
+ * INT_* tokens ("GPIO.INT_EDGE_FALLING") instead of mode strings. */
39
+ export declare function interruptAttachFlags(pin: number | string, handler: string, intFlags: number | string): void;
44
40
  /** Detach an interrupt from a pin. */
45
41
  export declare function interruptDetach(pin: number | string): void;
46
- /** Play a tone on a pin at the given frequency, optionally for a duration. */
47
- export declare function tonePlay(pin: number | string, frequency: number, duration?: number): void;
48
- /** Stop tone playback on a pin. */
49
- export declare function toneStop(pin: number | string): void;
50
- /** Delay for the given number of milliseconds. */
51
- export declare function delayMs(ms: number): void;
52
- /** Delay for the given number of microseconds. */
53
- export declare function delayMicro(us: number): void;
54
- /** Get milliseconds since boot. */
55
- export declare function getMillis(): number;
56
- /** Get microseconds since boot. */
57
- export declare function getMicros(): number;
58
- /** Get free heap bytes. Architecture-aware: the strategy maps this to the right
59
- * symbol per target (ESP.getFreeHeap() on ESP32, __heap_start trick on AVR). */
60
- export declare function getFreeHeap(): number;
61
- /** Initialize I2C bus (master mode if no address, slave mode with address). */
62
- export declare function i2cBegin(bus: string, address?: number): void;
63
- /** Disable I2C bus. */
64
- export declare function i2cEnd(bus: string): void;
65
- /** Set I2C bus clock speed. */
66
- export declare function i2cSetClock(bus: string, hz: number): void;
67
- /** Begin I2C transmission to a slave address. */
68
- export declare function i2cBeginTx(bus: string, address: number): void;
69
- /** Write data to I2C bus. */
70
- export declare function i2cWrite(bus: string, data: string | number | number[] | Uint8Array): void;
71
- /** Write a byte buffer to I2C bus (expands array literals to per-byte writes). */
72
- export declare function i2cWriteBuffer(bus: string, data: number[] | Uint8Array): void;
73
- /** End I2C transmission. Returns status. */
74
- export declare function i2cEndTx(bus: string, stop: boolean): number;
75
- /** Request bytes from I2C slave. */
76
- export declare function i2cRequestFrom(bus: string, address: number, quantity: number, stop?: boolean): number;
77
- /** Check if bytes are available from I2C. */
78
- export declare function i2cAvailable(bus: string): number;
79
- /** Read a byte from I2C. */
80
- export declare function i2cRead(bus: string): number;
81
- /**
82
- * Drain `count` bytes requested from the I2C bus into a caller-provided buffer.
83
- * Semantic primitive: lowers to the `i2c.read_buffer` HAL op. The `buffer`
84
- * argument is emitted as a placeholder (`__HAL_READ_BUF__`) that the var-init
85
- * transformer rewrites to the caller's own buffer variable, so bytes land in
86
- * the `uint8_t data[N]` declared in user scope — NOT an internal temp that
87
- * decays to a pointer on return. Keeps `data.length` / `data[i]` valid.
88
- */
89
- export declare function i2cReadBuffer(bus: string, count: number, buffer: number[] | Uint8Array): void;
90
- /** Initialize SPI bus. */
91
- export declare function spiBegin(bus: string): void;
92
- /** Disable SPI bus. */
93
- export declare function spiEnd(bus: string): void;
94
- /** Transfer data on SPI bus. */
95
- export declare function spiTransfer(bus: string, data: string | number | Uint8Array): number;
96
- /** Begin SPI transaction with settings. */
97
- export declare function spiBeginTx(bus: string, settings: string | any): void;
98
- /** End SPI transaction. */
99
- export declare function spiEndTx(bus: string): void;
100
- /** Set SPI chip-select pin LOW. */
101
- export declare function spiCsLow(pin: number | string): void;
102
- /** Set SPI chip-select pin HIGH. */
103
- export declare function spiCsHigh(pin: number | string): void;
104
- /**
105
- * Read `count` bytes from the SPI bus into a caller-provided buffer by clocking
106
- * dummy (0x00) transfers. Semantic primitive: lowers to the `spi.read_buffer`
107
- * HAL op (per-byte `bus.transfer(0)` read loop). The `buffer` placeholder is
108
- * rewritten to the caller's variable. Mirrors i2cReadBuffer. The caller is
109
- * responsible for asserting/de-asserting chip-select around it.
110
- */
111
- export declare function spiReadBuffer(bus: string, count: number, buffer: number[] | Uint8Array): void;
112
- /** Set SPI data mode. */
113
- export declare function spiSetMode(bus: string, mode: number): void;
114
- /** Set SPI bit order. */
115
- export declare function spiSetBitOrder(bus: string, order: string): void;
116
- /** Initialize serial port with baud rate. */
117
- export declare function uartBegin(port: string, baud: number): void;
118
- /** Disable serial port. */
119
- export declare function uartEnd(port: string): void;
120
- /** Print value to serial. */
121
- export declare function uartPrint(port: string, value: any): void;
122
- /** Print value with newline to serial. */
123
- export declare function uartPrintln(port: string, value: any): void;
124
- /** printf-style formatted print to serial. */
125
- export declare function uartPrintf(port: string, format: any, args: any[]): void;
126
- /** Write raw data to serial. */
127
- export declare function uartWrite(port: string, data: any): void;
128
- /** Read a byte from serial. */
129
- export declare function uartRead(port: string): number;
130
- /** Peek at next byte from serial without consuming. */
131
- export declare function uartPeek(port: string): number;
132
- /** Check if bytes are available from serial. */
133
- export declare function uartAvailable(port: string): number;
134
- /** Flush serial output. */
135
- export declare function uartFlush(port: string): void;
136
- /** Measure pulse duration on a pin. */
137
- export declare function pulseIn_(pin: number | string, value: number, timeout?: number): number;
138
- /** Measure long pulse using high-precision timer. */
139
- export declare function pulseInLong_(pin: number | string, value: number): number;
140
- /** Shift a byte out to a pin. */
141
- export declare function shiftOut_(dataPin: number | string, clockPin: number | string, bitOrder: number, value: number): void;
142
- /** Shift a byte in from a pin. */
143
- export declare function shiftIn_(dataPin: number | string, clockPin: number | string, bitOrder: number): number;
144
- /** Write a value to a DAC pin. */
145
- export declare function dacWrite(pin: number | string, value: number): void;
146
- /** Enable the watchdog timer with the given timeout (string preset or number). */
147
- export declare function wdtEnable(timeout: string | number): void;
148
- /** Reset (kick) the watchdog timer. */
149
- export declare function wdtReset(): void;
42
+ /** Time.sleep yielding sleep in milliseconds (Zephyr: k_msleep). */
43
+ export declare function timeSleep(ms: number): void;
44
+ /** Time.now milliseconds since boot as a double (Zephyr: k_uptime_get). */
45
+ export declare function timeNow(): number;
46
+ /** Time.nowUs microseconds since boot as a double, uptime-derived
47
+ * (k_uptime_get() * 1000) on every board — uniform, monotonic. */
48
+ export declare function timeNowUs(): number;
49
+ /** Time.busyWaitUs spin-wait the given microseconds, no yield (Zephyr: k_busy_wait). */
50
+ export declare function timeBusyWaitUs(us: number): void;
51
+ export declare function i2cRegWrite(bus: string, address: number, hz: number, reg: number, value: number): void;
52
+ export declare function i2cRegRead(bus: string, address: number, hz: number, reg: number): number;
53
+ export declare function i2cRegUpdate(bus: string, address: number, hz: number, reg: number, mask: number, value: number): void;
54
+ export declare function i2cDevWrite(bus: string, address: number, hz: number, data: number[] | Uint8Array): void;
55
+ /** Enable the USB device + open the CDC serial port with a baud hint. */
56
+ export declare function usbBegin(port: string): void;
57
+ /** Disable the CDC serial port. */
58
+ export declare function usbEnd(port: string): void;
59
+ /** Print value to the USB serial port. */
60
+ export declare function usbPrint(port: string, value: SerialValue): void;
61
+ /** Print value with newline to the USB serial port. */
62
+ export declare function usbPrintln(port: string, value: SerialValue): void;
63
+ /** Read a byte from the USB serial port (-1 if none). */
64
+ export declare function usbRead(port: string): number;
65
+ /** Check if bytes are available from the USB serial port. */
66
+ export declare function usbAvailable(port: string): number;
67
+ /** True when the host has opened the port (DTR asserted). */
68
+ export declare function usbConnected(port: string): boolean;
69
+ /** Thin waitLinked(): bounded DTR poll in the shim. */
70
+ export declare function usbWaitReady(port: string, timeoutMs: number): boolean;
71
+ /** Thin DAC (hal/dac-pin.ts): raw dac_write_value with a construction-time
72
+ * resolution (0 = the chip descriptor's channel resolution). */
73
+ export declare function dacWriteValue(pin: number | string, value: number, resolution: number): void;
150
74
  /** Disable the watchdog timer. */
151
75
  export declare function wdtDisable(): void;
76
+ /** Thin Watchdog (hal/watchdog.ts): arm with the construction timeout in ms
77
+ * (wdt_install_timeout + wdt_setup). */
78
+ export declare function wdtSetup(timeoutMs: number): void;
79
+ /** Thin Watchdog: feed (wdt_feed). */
80
+ export declare function wdtFeed(): void;
81
+ /** Thin Counter (hal/counter.ts): register the alarm handler. */
82
+ export declare function counterOnAlarm(instance: number, handler: string): void;
83
+ /** Thin Counter: apply hz as the top value and start (counter_start). */
84
+ export declare function counterStart(instance: number, hz: number): void;
85
+ /** Thin Counter: stop (counter_stop). */
86
+ export declare function counterStop(instance: number): void;
87
+ export declare function spiTransceiveDt(bus: string, cs: number, hz: number, mode: number, tx: number[] | Uint8Array, rx: Uint8Array | number[]): void;
88
+ export declare function spiWriteDt(bus: string, cs: number, hz: number, mode: number, tx: number[] | Uint8Array): void;
89
+ /** SPITarget.readReg sugar: one-byte register read via spi_transceive_dt
90
+ * against an INTERNAL buffer — no caller array needed. */
91
+ export declare function spiReadReg(bus: string, cs: number, hz: number, mode: number, reg: number): number;
92
+ export declare function uartPollWrite(port: string, baud: number, data: SerialValue): void;
93
+ export declare function uartRxAvailable(port: string, ring: number): number;
94
+ export declare function uartRxPeek(port: string, ring: number): number;
95
+ export declare function uartRxRead(port: string, ring: number): number;
96
+ export declare function threadStart(index: number, stackBytes: number, priority: number, handler: string): void;
97
+ /** Thin Thread: block until exit (k_thread_join, K_FOREVER). */
98
+ export declare function threadJoin(index: number): void;
152
99
  /** Resolve a board definition path to a compile-time constant. */
153
100
  export declare function boardResolve(path: string): any;
154
- /** Enter deep sleep for the given duration (ms). Architecture-aware: the
155
- * strategy emits the right call per target (esp_deep_sleep on ESP32, a
156
- * not-supported comment elsewhere). */
157
- export declare function powerDeepSleep(ms: number): void;
158
- /** Enter light sleep. Architecture-aware. */
159
- export declare function powerLightSleep(): void;
160
- /** Set the CPU frequency (MHz). */
161
- export declare function powerSetCpuFrequency(mhz: number): void;
162
- /** Enter deep sleep until `pin` reaches `level` (pin wakeup). Architecture-aware:
163
- * ext0 on Xtensa (RTC pins), gpio-wakeup on RISC-V. */
164
- export declare function powerDeepSleepPin(pin: number, level: number): void;
165
- export declare function preferencesBegin(namespace: string, readOnly: boolean): void;
166
- export declare function preferencesEnd(): void;
167
- export declare function preferencesClear(): void;
168
- export declare function preferencesRemove(key: string): void;
169
- export declare function preferencesPutInt(key: string, value: number): void;
170
- export declare function preferencesGetInt(key: string, defaultValue: number): number;
171
- export declare function preferencesPutUInt(key: string, value: number): void;
172
- export declare function preferencesGetUInt(key: string, defaultValue: number): number;
173
- export declare function preferencesPutBool(key: string, value: boolean): void;
174
- export declare function preferencesGetBool(key: string, defaultValue: boolean): boolean;
175
- export declare function preferencesPutFloat(key: string, value: number): void;
176
- export declare function preferencesGetFloat(key: string, defaultValue: number): number;
177
- export declare function preferencesPutString(key: string, value: string): void;
178
- export declare function preferencesGetString(key: string, defaultValue: string): string;
179
- export declare function wifiConnect(ssid: string, password?: string, timeoutMs?: number): boolean;
101
+ export declare function fsReadText(path: string): string;
102
+ export declare function fsWriteText(path: string, content: string): void;
103
+ export declare function fsExists(path: string): boolean;
104
+ export declare function fsRemove(path: string): boolean;
105
+ export declare function mqttConnect(brokerUri: string, clientId: string): boolean;
106
+ export declare function mqttOnMessage(handler: string): void;
107
+ export declare function mqttSubscribe(topic: string): void;
108
+ export declare function mqttPublish(topic: string, data: string): void;
109
+ export declare function mqttConnected(): boolean;
110
+ export declare function mqttDisconnect(): void;
111
+ export declare function preferencesClear(ns: string): void;
112
+ export declare function preferencesRemove(ns: string, key: string): void;
113
+ export declare function preferencesPutInt(ns: string, key: string, value: number): void;
114
+ export declare function preferencesGetInt(ns: string, key: string, defaultValue: number): number;
115
+ export declare function preferencesPutBool(ns: string, key: string, value: boolean): void;
116
+ export declare function preferencesGetBool(ns: string, key: string, defaultValue: boolean): boolean;
117
+ export declare function preferencesPutFloat(ns: string, key: string, value: number): void;
118
+ export declare function preferencesGetFloat(ns: string, key: string, defaultValue: number): number;
119
+ export declare function preferencesPutString(ns: string, key: string, value: string): void;
120
+ export declare function preferencesGetString(ns: string, key: string, defaultValue: string): string;
180
121
  export declare function wifiConnectStart(ssid: string, password?: string): void;
122
+ /** Join with the station's construction facts (the thin WiFi.join). */
123
+ export declare function wifiJoin(ssid: string, psk: string | undefined, security: number, channel: number, band: number, timeoutMs: number, ps: number, ipAddr: string | undefined, gateway: string | undefined, netmask: string | undefined): boolean;
181
124
  export declare function wifiDisconnect(): void;
182
- export declare function wifiStatus(): number;
183
125
  export declare function wifiIsConnected(): boolean;
184
126
  export declare function wifiLocalIp(): string;
185
127
  export declare function wifiRssi(): number;
186
- export declare function wifiMac(): string;
187
- export declare function wifiSetHostname(name: string): void;
188
- export declare function wifiSetStaticIp(ip: string, gateway: string, subnet: string, dns?: string): void;
189
- export declare function wifiSetAutoReconnect(enabled: boolean): void;
190
- export declare function wifiSetPowerSave(mode: string): void;
191
- export declare function wifiSetTxPower(dbm: number): void;
128
+ export declare function wifiMac(): number;
192
129
  export declare function wifiOnEvent(event: string, handler: string): void;
193
130
  export declare function wifiApStart(ssid: string, password?: string, channel?: number, hidden?: boolean, maxClients?: number): boolean;
194
131
  export declare function wifiApStop(): void;
195
- export declare function wifiApClientCount(): number;
196
- export declare function wifiApIp(): string;
197
- export declare function wifiApSetChannel(channel: number): void;
198
- export declare function wifiApSetHidden(hidden: boolean): void;
199
- export declare function wifiApSetMaxClients(maxClients: number): void;
200
132
  export declare function wifiScan(): number;
201
- export declare function wifiScanStart(): void;
202
133
  export declare function wifiScanCount(): number;
203
134
  export declare function wifiScanSsid(index: number): string;
204
135
  export declare function wifiScanRssi(index: number): number;
205
- export declare function wifiScanEncryption(index: number): number;
136
+ export declare function wifiScanEncryption(index: number): string;
206
137
  export declare function wifiScanChannel(index: number): number;
207
- export declare function wifiSaveCredentials(ssid: string, password: string): void;
208
- export declare function wifiConnectSaved(timeoutMs?: number): boolean;
209
- export declare function wifiClearCredentials(): void;
210
- export declare function wifiWaitConnected(timeoutMs?: number): boolean;
211
- export declare function wifiWaitDisconnected(): void;
212
138
  export declare function httpBegin(method: string, url: string): void;
213
- export declare function httpReset(): void;
214
139
  export declare function httpSetHeader(name: string, value: string): void;
215
140
  export declare function httpSetTimeout(ms: number): void;
216
141
  export declare function httpSetMaxBody(bytes: number): void;
217
142
  export declare function httpSetBody(data: string, json?: boolean): void;
218
- export declare function httpSetInsecure(): void;
143
+ export declare function httpSetInsecure(insecure: boolean): void;
219
144
  export declare function httpSetCaCert(pem: string): void;
220
145
  export declare function httpSend(): boolean;
221
- export declare function httpSendStart(): void;
222
146
  export declare function httpStatus(): number;
223
147
  export declare function httpOk(): boolean;
224
148
  export declare function httpBody(): string;
@@ -233,14 +157,9 @@ export declare function bleOnRead(index: number, handler: string): void;
233
157
  export declare function bleOnWrite(index: number, handler: string): void;
234
158
  export declare function bleOnConnect(handler: string): void;
235
159
  export declare function bleOnDisconnect(handler: string): void;
236
- export declare function bleNotify(index: number, value: number | string): void;
160
+ export declare function bleNotify(index: number, value: number): void;
237
161
  export declare function bleIsConnected(): boolean;
238
162
  export declare function bleClientCount(): number;
239
- export declare function bleSetName(name: string): void;
240
- export declare function bleUntilConnected(timeoutMs?: number): boolean;
241
- export declare function bleUntilConnectedStart(): void;
242
- export declare function bleSetTxPower(dbm: number): void;
243
- export declare function bleStatus(): number;
244
163
  /** Emit raw C++ code (escape hatch for unsupported operations). */
245
164
  export declare function rawCpp(code: string): void;
246
165
  /**
@@ -257,4 +176,12 @@ export declare function rawCpp(code: string): void;
257
176
  * wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
258
177
  */
259
178
  export declare function rawCppExpr<T>(code: string): T;
260
- export {};
179
+ /** Fetch a fresh sample from a DT-bound sensor part. Args: part token, bus
180
+ * name, bus port (I2C address or SPI CS pin), bus kind ('i2c' | 'spi'),
181
+ * SPI clock Hz, SPI mode 0-3, alert pin (-1 = none). */
182
+ export declare function sensorFetch(part: string, bus: string, port: number, kind: string, spiHz: number, spiMode: number, alertPin: number): void;
183
+ /** Read one channel (a SENSOR_CHAN_* suffix, see CHAN) from the fetched sample.
184
+ * Returns the value as a double (Zephyr's sensor_value val1 + val2/1e6).
185
+ * Carries the same construction facts as sensorFetch so either op alone
186
+ * yields a complete device. */
187
+ export declare function sensorGet(part: string, bus: string, port: number, kind: string, spiHz: number, spiMode: number, alertPin: number, chan: string): number;