All types for Jaculus
jlm install @types
curl -o ./src/libs/platform.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/platform.d.ts
curl -o ./src/libs/motor.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/motor.d.ts
curl -o ./src/libs/basicStream.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/basicStream.d.ts
curl -o ./src/libs/stdio.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/stdio.d.ts
curl -o ./src/libs/timers.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/timers.d.ts
curl -o ./src/libs/smartled.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/smartled.d.ts
curl -o ./src/libs/gridui.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/gridui.d.ts
curl -o ./src/libs/simpleradio.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/simpleradio.d.ts
curl -o ./src/libs/keyvalue.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/keyvalue.d.ts
curl -o ./src/libs/misc.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/misc.d.ts
curl -o ./src/libs/adc.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/adc.d.ts
curl -o ./src/libs/ledc.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/ledc.d.ts
curl -o ./src/libs/pulseCounter.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/pulseCounter.d.ts
curl -o ./src/libs/path.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/path.d.ts
curl -o ./src/libs/wifi.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/wifi.d.ts
curl -o ./src/libs/fs.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/fs.d.ts
curl -o ./src/libs/timestamp.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/timestamp.d.ts
curl -o ./src/libs/gpio.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/gpio.d.ts
curl -o ./src/libs/i2c.d.ts https://c2coder.github.io/Jaculus-libraries/data/@types/i2c.d.ts
declare const PlatformInfo: {
/**
* The name of the platform the program is running on.
*/
name: string
}
declare module "motor" {
type MoveDuration = { distance: number; } | { time: number; } | { };
type MotorPins = {
motA: number;
motB: number;
encA: number;
encB: number;
};
type LedcConfig = {
timer: number;
channelA: number;
channelB: number;
};
type RegParams = {
// All values must be integers, defaults to 0
kp?: number; // Proportional gain
ki?: number; // Integral gain
kd?: number; // Derivative gain
kv?: number; // Velocity feedforward
ka?: number; // Acceleration feedforward
kc?: number; // Constant feedforward
maxIOut?: number; // Maximum integral output
unwindFactor?: number; // Integral unwind factor (0 for no change)
}
class Motor {
/**
* Construc a new Motor instance
* @param options Motor configuration
* @note Units used in the circumference parameter determines the units used in the other methods
*/
constructor(options: { pins: MotorPins, ledc: LedcConfig, reg: RegParams, encTicks: number, circumference: number });
/**
* Set the speed of the motor
* @param speed Speed in units per second
* @note The units are the same as used in the circumference parameter
*/
setSpeed(speed: number): void;
/**
* Set the speed ramp of the motor
* @param ramp Speed ramp in units per second squared
* @note The units are the same as used in the circumference parameter
*/
setRamp(ramp: number): void;
/**
* Set the end position tolerance for distance moves
* @param tolerance
*/
setEndPosTolerance(tolerance: number): void;
/**
* Move the motor
* @param duration Duration of the movement
* @note The units are the same as used in the circumference parameter
* @note If the duration is not provided, the motor will move indefinitely
*/
move(duration?: MoveDuration): Promise<void>;
/**
* Set raw power to the motor
* @param pwm Power in the range -1023 to 1023
* @note This switches the motor to unregulated mode
*/
setRaw(power: number): void;
/**
* Stop the motor
* @param brake If true, the motor will brake, otherwise it will coast to a stop
*/
stop(brake?: boolean): Promise<void>;
/**
* Get the position of the motor
* @note The units are the same as used in the circumference parameter
* @returns The position of the motor
*/
getPosition(): number;
/**
* Close the motor
*/
close(): void;
/**
* Start logging motor data for reporting
* @param everyNth Log every nth data point
* @note The data is stored in memory and if the memory is full,
* may cause the program to crash. Use everyNth to limit
* the data points.
* @note Previous data is not cleared until reportClear is called.
*/
reportStart(everyNth: number): void;
/**
* Stop logging motor data
*/
reportStop(): void;
/**
* Clear the report data
*/
reportClear(): void;
/**
* Dump the report data to stdout
*/
reportDump(): void;
}
}
declare interface Writable {
/**
* Write the given data to the stream.
* @param data The data to write.
*/
write(data: string): void;
}
declare interface Readable {
/**
* Read a single character from the stream.
* @returns Promise that resolves to the character read.
*/
get(): Promise<string>;
/**
* Read a chunk of data from the stream. The size of the chunk is
* given by the implementation and available data.
* @returns Promise that resolves to the data read.
*/
read(): Promise<string>;
}
declare module "stdio" {
let stdout: Writable;
let stderr: Writable;
let stdin: Readable;
}
declare const console: {
debug(arg: any): void;
log(arg: any): void;
warn(arg: any): void;
info(arg: any): void;
error(arg: any): void;
}
/**
* Returns a promise that resolves after the specified time.
* @param ms The number of milliseconds to wait before resolving the promise.
*/
declare function sleep(ms: number): Promise<void>;
/**
* Calls a function after the specified time.
* @param callback The function to call.
* @param ms The number of milliseconds to wait before calling the function.
*/
declare function setTimeout(callback: () => void, ms: number): number;
/**
* Calls a function repeatedly, with a fixed time delay between each call.
* @param callback The function to call.
* @param ms The number of milliseconds to wait before calling the function.
*/
declare function setInterval(callback: () => void, ms: number): number;
/**
* Cancels a timeout previously established by calling setTimeout().
* @param id The identifier of the timeout to cancel.
*/
declare function clearTimeout(id: number): void;
/**
* Cancels a timeout previously established by calling setInterval().
* @param id The identifier of the interval to cancel.
*/
declare function clearInterval(id: number): void;
declare module "smartled" {
interface Rgb {
r: number;
g: number;
b: number;
}
interface LedType {
T0H: number;
T1H: number;
T0L: number;
T1L: number;
TRS: number;
}
class SmartLed {
/**
* Create a new Smart LED strip.
* @param pin The pin the strip is connected to.
* @param count The number of LEDs in the strip.
* @param type The type of LED strip.
*/
constructor(pin: number, count: number, type?: LedType);
/**
* Show the current buffer on the strip.
*/
public show(): void;
/**
* Set the color of the given LED.
* @param index The index of the LED to set.
* @param rgb The color to set the LED to.
*/
public set(index: number, rgb: Rgb): void;
/**
* Get the color of the given LED.
* @param index The index of the LED to get.
* @returns The color of the LED.
*/
public get(index: number): Rgb;
/**
* Clear the buffer.
*/
public clear(): void;
}
const LED_WS2812: LedType;
const LED_WS2812B: LedType;
const LED_WS2812B_2020: LedType;
const LED_SK6812: LedType;
const LED_WS2813: LedType;
}
declare module "gridui" {
namespace widget {
interface Base {
readonly uuid: number
widgetX: number
widgetY: number
widgetW: number
widgetH: number
widgetTab: number
css(key: string): string
setCss(key: string, value: string): void
}
interface Arm extends Base {
readonly x: number
readonly y: number
}
interface Bar extends Base {
color: string
fontSize: number
min: number
max: number
value: number
showValue: boolean
}
interface Button extends Base {
text: string
fontSize: number
color: string
background: string
align: string
valign: string
disabled: boolean
readonly pressed: boolean
}
interface Camera extends Base {
rotation: number
clip: boolean
}
interface Checkbox extends Base {
fontSize: number
checked: boolean
color: string
text: string
}
interface Circle extends Base {
color: string
fontSize: number
min: number
max: number
lineWidth: number
valueStart: number
value: number
showValue: boolean
}
interface Input extends Base {
text: string
color: string
type: string
disabled: boolean
}
interface Joystick extends Base {
color: string
keys: string
text: string
readonly x: number
readonly y: number
}
interface Led extends Base {
color: string
on: boolean
}
interface Orientation extends Base {
color: string
readonly yaw: number
readonly pitch: number
readonly roll: number
readonly joystickX: number
readonly joystickY: number
}
interface Select extends Base {
color: string
background: string
disabled: boolean
options: string
selectedIndex: number
}
interface Slider extends Base {
color: string
fontSize: number
min: number
max: number
value: number
precision: number
showValue: boolean
}
interface SpinEdit extends Base {
fontSize: number
color: string
value: number
step: number
precision: number
}
interface Switcher extends Base {
fontSize: number
color: string
value: number
min: number
max: number
}
interface Text extends Base {
text: string
fontSize: number
color: string
background: string
align: string
valign: string
prefix: string
suffix: string
}
}
namespace builder {
interface Base {
css(key: string, value: string): this
}
interface Arm extends Base {
info(info: Record<string, any>): Arm
onGrab(callback: (arm: widget.Arm) => void): Arm
onPositionChanged(callback: (arm: widget.Arm) => void): Arm
finish(): widget.Arm
}
interface Bar extends Base {
color(color: string): Bar
fontSize(fontSize: number): Bar
min(min: number): Bar
max(max: number): Bar
value(value: number): Bar
showValue(showValue: boolean): Bar
finish(): widget.Bar
}
interface Button extends Base {
text(text: string): Button
fontSize(fontSize: number): Button
color(color: string): Button
background(background: string): Button
align(align: string): Button
valign(valign: string): Button
disabled(disabled: boolean): Button
onPress(callback: (button: widget.Button) => void): Button
onRelease(callback: (button: widget.Button) => void): Button
finish(): widget.Button
}
interface Camera extends Base {
rotation(rotation: number): Camera
clip(clip: boolean): Camera
tags(tags: any /* TODO: fix type */): Camera
finish(): widget.Camera
}
interface Checkbox extends Base {
fontSize(fontSize: number): Checkbox
checked(checked: boolean): Checkbox
color(color: string): Checkbox
text(text: string): Checkbox
onChanged(callback: (checkbox: widget.Checkbox) => void): Checkbox
finish(): widget.Checkbox
}
interface Circle extends Base {
color(color: string): Circle
fontSize(fontSize: number): Circle
min(min: number): Circle
max(max: number): Circle
lineWidth(lineWidth: number): Circle
valueStart(valueStart: number): Circle
value(value: number): Circle
showValue(showValue: boolean): Circle
finish(): widget.Circle
}
interface Input extends Base {
text(text: string): Input
color(color: string): Input
type(type: string): Input
disabled(disabled: boolean): Input
onChanged(callback: (input: widget.Input) => void): Input
finish(): widget.Input
}
interface Joystick extends Base {
color(color: string): Joystick
keys(keys: string): Joystick
text(text: string): Joystick
onClick(callback: (joystick: widget.Joystick) => void): Joystick
onPositionChanged(callback: (joystick: widget.Joystick) => void): Joystick
finish(): widget.Joystick
}
interface Led extends Base {
color(color: string): Led
on(on: boolean): Led
finish(): widget.Led
}
interface Orientation extends Base {
color(color: string): Orientation
onPositionChanged(callback: (orientation: widget.Orientation) => void): Orientation
finish(): widget.Orientation
}
interface Select extends Base {
color(color: string): Select
background(background: string): Select
disabled(disabled: boolean): Select
options(options: string): Select
selectedIndex(selectedIndex: number): Select
onChanged(callback: (select: widget.Select) => void): Select
finish(): widget.Select
}
interface Slider extends Base {
color(color: string): Slider
fontSize(fontSize: number): Slider
min(min: number): Slider
max(max: number): Slider
value(value: number): Slider
precision(precision: number): Slider
showValue(showValue: boolean): Slider
onChanged(callback: (slider: widget.Slider) => void): Slider
finish(): widget.Slider
}
interface SpinEdit extends Base {
fontSize(fontSize: number): SpinEdit
color(color: string): SpinEdit
value(value: number): SpinEdit
step(step: number): SpinEdit
precision(precision: number): SpinEdit
onChanged(callback: (spinEdit: widget.SpinEdit) => void): SpinEdit
finish(): widget.SpinEdit
}
interface Switcher extends Base {
fontSize(fontSize: number): Switcher
color(color: string): Switcher
value(value: number): Switcher
min(min: number): Switcher
max(max: number): Switcher
onChanged(callback: (switcher: widget.Switcher) => void): Switcher
finish(): widget.Switcher
}
interface Text extends Base {
text(text: string): Text
fontSize(fontSize: number): Text
color(color: string): Text
background(background: string): Text
align(align: string): Text
valign(valign: string): Text
prefix(prefix: string): Text
suffix(suffix: string): Text
finish(): widget.Text
}
}
class Builder {
arm(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Arm
bar(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Bar
button(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Button
camera(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Camera
checkbox(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Checkbox
circle(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Circle
input(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Input
joystick(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Joystick
led(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Led
orientation(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Orientation
select(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Select
slider(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Slider
spinEdit(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.SpinEdit
switcher(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Switcher
text(x: number, y: number, w: number, h: number, uuid?: number, tab?: number): builder.Text
}
/**
* Initialize GridUI.
* @param ownerName name of the owner, must match the name entered in RBController app.
* @param deviceName name of this device, visible in the RBController app.
* @param builderCallback callback, which receives the builder instance that can be used to create widgets.
*/
function begin(ownerName: string, deviceName: string, builderCallback: (builder: Builder) => void): void
/**
* Stop GridUI.
*/
function end(): void
/**
* Set current tab index
*/
function changeTab(index: number): void
/**
* Send a message to the integrated terminal at the top of the UI.
*/
function log(message: string): void
/**
* Returns included GridUI version as number, to be compared with hex representation of the version.
*
* For example, for version 5.1.0, do: `gridui.version() >= 0x050100`
*/
function version(): number
}
declare module "simpleradio" {
type PacketDataType = "number" | "string" | "keyvalue";
interface PacketInfo {
group: number;
address: string;
rssi: number;
}
/**
* Initialize the radio.
* @param group The radio group to use.
*/
function begin(group: number): void;
/**
* Set the radio group.
* @param group The radio group to use, between 0 and 15 inclusive.
*/
function setGroup(group: number): void;
/**
* Get current radio group
* @returns ID of the current group
*/
function group(): number;
/**
* Get the local device address.
* @returns the local device address. Only works after begin() is called.
*/
function address(): string;
/**
* Send a string.
* @param str The string to send.
*/
function sendString(str: string): void;
/**
* Send a number.
* @param num The number to send.
*/
function sendNumber(num: number): void;
/**
* Send a key-value pair.
* @param key The key to send.
* @param value The number to send.
*/
function sendKeyValue(key: string, value: number): void;
/**
* Register a callback for a packet type.
* @param type The packet type to register for.
* @param callback The callback to register.
*/
function on(type: "number", callback: (num: number, info: PacketInfo) => void): void;
/**
* Register a callback for a packet type.
* @param type The packet type to register for.
* @param callback The callback to register.
*/
function on(type: "string", callback: (str: string, info: PacketInfo) => void): void;
/**
* Register a callback for a packet type.
* @param type The packet type to register for.
* @param callback The callback to register.
*/
function on(type: "keyvalue", callback: (key: string, value: number, info: PacketInfo) => void): void;
/**
* Unregister a callback for a packet type.
* @param type The packet type to unregister for.
*/
function off(type: PacketDataType): void;
/**
* Stop the radio.
*/
function end(): void;
}
declare module "keyvalue" {
class KeyValueNamespace {
/**
* Get saved value.
* @param key key, max 15 characters.
* @return saved value or null if not present
*/
get(key: string): string | number | null;
/**
* Get string saved value.
* @param key key, max 15 characters.
* @return saved value or null if not present or if not string
*/
getString(key: string): string | null;
/**
* Get number saved value.
* @param key key, max 15 characters.
* @return saved value or null if not present or if not number
*/
getNumber(key: string): number | null;
/**
* Set value in KeyValue namespace, overwriting any previous value.
* Call commit() after setting everything, otherwise changes will be lost!
* @param key key, max 15 characters.
* @param value value
*/
set(key: string, value: string | number): void;
/**
* Erase value from KeyValue namespace.
* Call commit() after setting everything, otherwise changes will be lost!
* @param key key, max 15 characters.
*/
erase(key: string): void;
/**
* Check existance of a key.
* @param key key, max 15 characters.
* @returns true if exists, false otherwise
*/
exists(key: string): boolean;
/**
* Save modifications to persistent storage.
*/
commit(): void;
}
/**
* Open a KeyValue namespace for use. KeyValue is a persitent storage for small
* pieces of data that saves values across restarts.
*
* The namespaces are isolated from each other.
*
* @param namespace Namespace name, max 15 characters.
*/
function open(namespace: string): KeyValueNamespace;
}
/**
* Exits the current program.
* @param code The exit code to use.
*/
declare function exit(code?: number): void;
declare module "adc" {
type Atten = number;
const Attenuation: {
readonly Db0: Atten;
readonly Db2_5: Atten;
readonly Db6: Atten;
readonly Db11: Atten;
};
/**
* Enable ADC on the given pin.
* @param pin The pin to enable ADC on.
*/
function configure(pin: number, attenuation?: Atten): void;
/**
* Read the value of the given pin.
* @param pin The pin to read.
* @returns The value of the pin (0-1023)
*/
function read(pin: number): number;
}
declare module "ledc" {
/**
* Configure the given timer.
* @param timer The timer to configure.
* @param frequency The frequency to configure the timer to.
* @param resolution The resolution to configure the timer to (default 10 bits, changes frequency range)
*/
function configureTimer(timer: number, frequency: number, resolution?: number): void;
/**
* Configure the given LEDC channel.
* @param channel The channel to configure.
* @param pin The pin to configure the channel to.
* @param timer The timer to configure the channel to.
* @param duty The duty to configure the channel to (0-1023).
*/
function configureChannel(channel: number, pin: number, timer: number, duty: number): void;
/**
* Set the frequency of the given timer.
* @param timer The timer to set the frequency of.
* @param frequency The frequency to set the timer to.
*/
function setFrequency(timer: number, frequency: number): void;
/**
* Set the duty of the given channel.
* @param channel The channel to set the duty of.
* @param duty The duty to set the channel to (0-1023).
*/
function setDuty(channel: number, duty: number): void;
/**
* Stop the given timer.
* @param timer The timer to stop.
*/
function stopTimer(timer: number): void;
/**
* Stop the given channel.
* @param channel The channel to stop.
*/
function stopChannel(channel: number): void;
}
declare module "pulseCounter" {
type LevelAction = number;
type EdgeAction = number;
const LevelAction: {
Keep: LevelAction;
Inverse: LevelAction;
Hold: LevelAction;
};
const EdgeAction: {
Hold: EdgeAction;
Increase: EdgeAction;
Decrease: EdgeAction;
};
type LevelMode = {
low: LevelAction,
high: LevelAction,
}
type EdgeMode = {
pos: EdgeAction,
neg: EdgeAction,
}
class PulseCounter {
/**
* Create a new pulse counter instance.
* @param options The options for the pulse counter.
*/
constructor(options: {
pinLevel: number,
pinEdge: number,
levelMode: LevelMode,
edgeMode: EdgeMode,
})
/**
* Read the current value of the pulse counter.
*/
read(): number;
/**
* Reset the pulse counter to 0.
*/
clear(): void;
/**
* Start the pulse counter.
*/
start(): void;
/**
* Stop the pulse counter.
*/
stop(): void;
/**
* Close the pulse counter.
*/
close(): void;
}
}
declare module "path" {
/**
* Normalize the given path.
* @param path The path to normalize.
* @returns The normalized path.
*/
function normalize(path: string): string;
/**
* Get the parent directory of the given path.
* @param path The path to get the parent directory of.
* @returns The parent directory.
*/
function dirname(path: string): string;
/**
* Get the last part of the given path.
* @param path The path to get the last part of.
* @returns The last part of the path.
*/
function basename(path: string): string;
/**
* Join the given paths.
* @param paths The paths to join.
* @returns The joined path.
*/
function join(...paths: string[]): string;
/**
* Check if the given path is absolute.
* @param path The path to check.
* @returns True if the path is absolute, false otherwise.
*/
function isAbsolute(path: string): boolean;
}
declare module "wifi" {
/**
* Return current IPv4 of the device, or null if WiFi is disabled or not connected.
*/
function currentIp(): string | null;
}
declare module "fs" {
interface File {
path: string;
/**
* Check if the file is open.
*/
isOpen(): boolean;
/**
* Close the file.
*/
close(): void;
/**
* Read characters from the file.
* @param len The number of characters to read.
*/
read(len: number): string;
/**
* Write text to the file.
* @param text The text to write.
*/
write(text: string): void;
}
/**
* Open the given file in the given mode.
* @param path The path to the file.
* @param mode The mode to open the file in ("r", "w", "a" and combinations).
*/
function open(path: string, mode: string): File;
/**
* Check if the given path exists.
* @param path The path to check.
* @returns True if the path exists, false otherwise.
*/
function exists(path: string): boolean;
/**
* Check if the given path is a file.
* @param path The path to check.
* @returns True if the path is a file, false otherwise.
*/
function isFile(path: string): boolean;
/**
* Check if the given path is a directory.
* @param path The path to check.
* @returns True if the path is a directory, false otherwise.
*/
function isDirectory(path: string): boolean;
/**
* Create a directory at the given path.
* @param path The path to create the directory at.
*/
function mkdir(path: string): void;
/**
* Remove the file at the given path.
* @param path The path to the file to remove.
*/
function rm(path: string): void;
/**
* Remove the directory at the given path.
* @param path The path to the directory to remove.
*/
function rmdir(path: string): void;
/**
* List the files in the given directory.
* @param path The path to the directory to list.
* @returns An array of file names in the directory.
*/
function readdir(path: string): string[];
}
declare interface Timestamp {
/**
* Convert the timestamp to milliseconds.
*/
millis(): number;
/**
* Get the lower 10^3 part of the timestamp in microseconds.
*/
micros(): number;
}
declare module "gpio" {
const PinMode: {
readonly DISABLE: number,
readonly OUTPUT: number,
readonly INPUT: number,
readonly INPUT_PULLUP: number,
readonly INPUT_PULLDOWN: number,
};
interface EventInfo {
timestamp: Timestamp;
}
/**
* Configure the given pin.
* @param pin The pin to configure.
* @param mode The mode to configure the pin in.
*/
function pinMode(pin: number, mode: number): void;
/**
* Write digital value to the given pin.
* @param pin The pin to write to.
* @param value The value to write.
*/
function write(pin: number, value: number): void;
/**
* Read digital value from the given pin.
* @param pin The pin to read from.
* @returns The value of the pin (0 or 1).
*/
function read(pin: number): number;
/**
* Set event handler for the given pin.
* @param event The event to handle.
* @param pin The pin to handle the event for.
* @param callback The callback to call when the event occurs.
*/
function on(event: "rising" | "falling" | "change", pin: number, callback: (info: EventInfo) => void): void;
/**
* Remove event handler for the given pin.
* @param event The event to remove.
* @param pin The pin to remove the event handler for.
*/
function off(event: "rising" | "falling" | "change", pin: number): void;
}
declare module "i2c" {
interface I2C {
/**
* Find an I2C interface by its pin.
* @param pin The pin the I2C interface is connected to.
* @returns The I2C interface, or undefined if not found.
*/
find(pin: number): I2C | undefined;
/**
* Read from the given address.
* @param address The address to read from.
* @param quantity The number of bytes to read.
* @returns The bytes read.
*/
readFrom(address: number, quantity: number): Uint8Array;
/**
* Write to the given address.
* @param address The address to write to.
* @param buffer The data to write.
*/
writeTo(address: number, buffer: ArrayBuffer | Uint8Array | number[] | string | number): void;
/**
* Setup the I2C interface.
* @param options The options to use when setting up the I2C interface.
*/
setup(options: { scl?: number, sda?: number, bitrate?: number }): void;
}
const I2C1: I2C;
const I2C2: I2C | undefined;
}