@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.
- package/README.md +145 -87
- package/dist/adc-pin.d.ts +53 -0
- package/dist/adc-pin.js +69 -0
- package/dist/async.d.ts +3 -11
- package/dist/async.js +3 -15
- package/dist/ble.d.ts +42 -78
- package/dist/ble.js +79 -98
- package/dist/counter.d.ts +16 -0
- package/dist/counter.js +32 -0
- package/dist/dac-pin.d.ts +13 -0
- package/dist/dac-pin.js +21 -0
- package/dist/emit.d.ts +123 -196
- package/dist/emit.js +146 -208
- package/dist/fs.d.ts +12 -31
- package/dist/fs.js +30 -40
- package/dist/gpio-pin.d.ts +46 -0
- package/dist/gpio-pin.js +77 -0
- package/dist/gpio.d.ts +0 -103
- package/dist/gpio.js +16 -227
- package/dist/http.d.ts +38 -39
- package/dist/http.js +53 -78
- package/dist/i2c-target.d.ts +28 -0
- package/dist/i2c-target.js +52 -0
- package/dist/i2c.d.ts +5 -43
- package/dist/i2c.js +17 -130
- package/dist/index.d.ts +30 -42
- package/dist/index.js +27 -39
- package/dist/math.d.ts +0 -13
- package/dist/math.js +9 -13
- package/dist/mqtt.d.ts +15 -25
- package/dist/mqtt.js +32 -28
- package/dist/power.d.ts +9 -17
- package/dist/power.js +22 -20
- package/dist/preferences.d.ts +17 -25
- package/dist/preferences.js +54 -52
- package/dist/pulse.d.ts +4 -4
- package/dist/pulse.js +6 -2
- package/dist/pwm-pin.d.ts +24 -0
- package/dist/pwm-pin.js +38 -0
- package/dist/random.d.ts +0 -2
- package/dist/random.js +14 -20
- package/dist/sensor-catalog.generated.d.ts +997 -0
- package/dist/sensor-catalog.generated.js +764 -0
- package/dist/sensor.d.ts +46 -0
- package/dist/sensor.js +52 -0
- package/dist/shift-pin.d.ts +2 -0
- package/dist/shift-pin.js +13 -0
- package/dist/spi-target.d.ts +25 -0
- package/dist/spi-target.js +42 -0
- package/dist/spi.d.ts +8 -26
- package/dist/spi.js +15 -87
- package/dist/thread.d.ts +18 -0
- package/dist/thread.js +36 -0
- package/dist/time.d.ts +23 -0
- package/dist/time.js +43 -0
- package/dist/timing.d.ts +17 -7
- package/dist/timing.js +17 -7
- package/dist/types.d.ts +4 -34
- package/dist/types.js +5 -47
- package/dist/uart-port.d.ts +26 -0
- package/dist/uart-port.js +52 -0
- package/dist/uart.d.ts +0 -17
- package/dist/uart.js +10 -53
- package/dist/usb.d.ts +26 -0
- package/dist/usb.js +66 -0
- package/dist/watchdog.d.ts +12 -0
- package/dist/watchdog.js +28 -0
- package/dist/wifi.d.ts +88 -64
- package/dist/wifi.js +112 -126
- package/dist/zephyr-tokens.generated.d.ts +8 -0
- package/dist/zephyr-tokens.generated.js +73 -0
- package/package.json +7 -8
- package/src/adc-pin.ts +89 -0
- package/src/async.ts +3 -16
- package/src/ble.ts +84 -111
- package/src/counter.ts +40 -0
- package/src/dac-pin.ts +28 -0
- package/src/emit.ts +157 -238
- package/src/fs.ts +47 -54
- package/src/gpio-pin.ts +91 -0
- package/src/gpio.ts +49 -320
- package/src/http.ts +75 -95
- package/src/i2c-target.ts +63 -0
- package/src/i2c.ts +29 -167
- package/src/index.ts +32 -46
- package/src/math.ts +9 -14
- package/src/mqtt.ts +39 -31
- package/src/preferences.ts +52 -61
- package/src/pwm-pin.ts +54 -0
- package/src/random.ts +14 -21
- package/src/sensor-catalog.generated.ts +1238 -0
- package/src/sensor.ts +80 -0
- package/src/shift-pin.ts +16 -0
- package/src/spi-target.ts +53 -0
- package/src/spi.ts +27 -121
- package/src/thread.ts +44 -0
- package/src/time.ts +50 -0
- package/src/types.ts +14 -89
- package/src/uart-port.ts +64 -0
- package/src/usb.ts +82 -0
- package/src/watchdog.ts +35 -0
- package/src/wifi.ts +147 -179
- package/src/zephyr-tokens.generated.ts +77 -0
- package/src/adc.ts +0 -30
- package/src/capacitive.ts +0 -31
- package/src/constants.ts +0 -23
- package/src/dac.ts +0 -21
- package/src/eeprom.ts +0 -26
- package/src/interrupts.ts +0 -35
- package/src/mdns.ts +0 -50
- package/src/ota.ts +0 -44
- package/src/power.ts +0 -36
- package/src/pulse.ts +0 -63
- package/src/rmt.ts +0 -125
- package/src/shift.ts +0 -88
- package/src/temperature.ts +0 -20
- package/src/timer.ts +0 -58
- package/src/timing.ts +0 -67
- package/src/uart.ts +0 -77
- package/src/utils.ts +0 -17
- 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
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export declare function
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export declare function
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
/**
|
|
47
|
-
export declare function
|
|
48
|
-
/**
|
|
49
|
-
export declare function
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export declare function
|
|
56
|
-
|
|
57
|
-
export declare function
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export declare function
|
|
61
|
-
/**
|
|
62
|
-
export declare function
|
|
63
|
-
/**
|
|
64
|
-
export declare function
|
|
65
|
-
/**
|
|
66
|
-
export declare function
|
|
67
|
-
/**
|
|
68
|
-
export declare function
|
|
69
|
-
/**
|
|
70
|
-
export declare function
|
|
71
|
-
/**
|
|
72
|
-
export declare function
|
|
73
|
-
/**
|
|
74
|
-
export declare function
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export declare function
|
|
158
|
-
|
|
159
|
-
export declare function
|
|
160
|
-
|
|
161
|
-
export declare function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
export declare function
|
|
165
|
-
export declare function
|
|
166
|
-
export declare function
|
|
167
|
-
export declare function
|
|
168
|
-
export declare function
|
|
169
|
-
export declare function
|
|
170
|
-
export declare function
|
|
171
|
-
export declare function
|
|
172
|
-
export declare function
|
|
173
|
-
export declare function
|
|
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():
|
|
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):
|
|
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
|
|
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
|
-
|
|
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;
|