Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/pita_api/mod.ts>Redpitaya

API for Pita projects, simpliest way to develop secure and powerful webapps for redpitaya.
Latest
class Redpitaya
import { Redpitaya } from "https://deno.land/x/pita_api@0.9.1/mod.ts";

The Redpitaya class provides a way to exchange messages with a Redpitaya device and control its digital and analog inputs and outputs. Redpitaya class is a proxy for Redpitaya low level API.

Examples

Example 1

const redpitaya = await Project.init(config)
await redpitaya.channel.dac1.writeSlice([0, 0, 0, 256, 256, 256, 0, 0, 0])
console.log('Gate signal on DAC 1')
await redpitaya.pin.digital.led1.write(true)
console.log('Led 1 is ON')

Constructors

new
Redpitaya(unnamed 0: { endpoint: `ws://${string}`; })

Properties

channel: { readonly adc1: Channel<IOMode.RO>; readonly adc2: Channel<IOMode.RO>; readonly dac1: Channel<IOMode.WO>; readonly dac2: Channel<IOMode.WO>; }
readonly
closed

True if Redpitaya.close() called.

pin: { analog: AnalogPin; digital: DigitalPin; }

Methods

addEventListener(type: "connect" | "disconnect" | "error", listener: (event: Event) => void | Promise<void>)

Adds an event listener for connect, disconnect, or error events.

close(cause?: string)

Close the Redpitaya connection and triggers disconnect event.

Check if underlaying websocket is opened

connection<T extends "signals" | "parameters", K extends Exclude<MessageId, ConfigId>>(type: T, key: K)

Exchange messages with Redpitaya. Send and recieve signals and parameters from Redpitaya backend.