Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cranksters/pd-usb
/ functions
Functions
72 in github.com/cranksters/pd-usb
⨍
Functions
72
◇
Types & classes
11
↓ 34 callers
Function
assert
(condition: boolean, errMsg = 'Assert failed')
src/utils/assert.ts:19
↓ 8 callers
Method
emit
* Emit an event
src/PlaydateDevice.ts:135
↓ 4 callers
Method
assertNotBusy
()
src/PlaydateDevice.ts:475
↓ 4 callers
Method
sendCommand
* Send a custom USB command to the device * Some commands are potentially dangerous and could harm your Playdate. *Please* don't execute any comman
src/PlaydateDevice.ts:425
↓ 4 callers
Function
stringToBytes
(str: string)
src/utils/bytes.ts:16
↓ 4 callers
Method
writeAscii
* Send an ascii string to the serial device
src/Serial.ts:76
↓ 3 callers
Method
parseButtonFlags
(flags: number)
src/PlaydateDevice.ts:503
↓ 3 callers
Method
readLinesUntilTimeout
* Read lines until a timeout happens, indicating there's no more lines to read for now
src/Serial.ts:170
↓ 3 callers
Method
write
* Sends an Uint8Array to the serial device
src/Serial.ts:66
↓ 2 callers
Method
doReadWithTimeout
* Do one of the above read functions, but make it timeout after a given number of milliseconds * This is used to read everything until the device h
src/Serial.ts:137
↓ 2 callers
Function
error
(msg: string)
src/utils/assert.ts:11
↓ 2 callers
Function
mergeByteChunks
(chunks: Uint8Array[])
src/utils/bytes.ts:41
↓ 2 callers
Method
setMode
(mode: PDSerialMode)
src/SerialTransformer.ts:29
↓ 1 callers
Function
assertUsbSupported
()
src/index.ts:21
↓ 1 callers
Function
bytesPos
(haystack: Uint8Array, needle: Uint8Array, ptr = 0)
src/utils/bytes.ts:23
↓ 1 callers
Method
clearOut
()
src/SerialTransformer.ts:45
↓ 1 callers
Method
clearRead
* Clear the current reader.read() call that's being awaited, to prevent it from blocking further reads...
src/Serial.ts:106
↓ 1 callers
Method
flushBytes
(controller: PDStreamController<Uint8Array>)
src/SerialTransformer.ts:102
↓ 1 callers
Method
flushLines
(controller: PDStreamController<string>)
src/SerialTransformer.ts:97
↓ 1 callers
Method
getScreen
* Capture a screenshot from the Playdate, and get the raw framebuffer * This will return the 1-bit framebuffer data as an Uint8Array of bytes, wher
src/PlaydateDevice.ts:217
↓ 1 callers
Method
onData
(callbackFn: (data: Uint8Array) => void)
src/Serial.ts:34
↓ 1 callers
Method
onError
(callbackFn: (error: Error) => void)
src/Serial.ts:38
↓ 1 callers
Method
parseControlState
(state: string)
src/PlaydateDevice.ts:479
↓ 1 callers
Function
parseKeyVal
(str: string)
src/utils/fmt.ts:6
↓ 1 callers
Method
pollControlsLoop
* Continually read lines while control polling is active * Probably don't want to call this with await so that it doesn't lock everything
src/PlaydateDevice.ts:454
↓ 1 callers
Method
readBytes
* Reads an Uint8Array from the serial device * If numBytes is 0, it will resolve as soon as some bytes are received * If numBytes is more than 0
src/Serial.ts:86
↓ 1 callers
Method
readLine
* Reads a single line of ascii text from the serial device * Newline characters are not included, some lines may be empty
src/Serial.ts:117
↓ 1 callers
Method
requestDevice
()
src/PlaydateDevice.ts:83
↓ 1 callers
Method
sendBitmap
* Send a 1-bit bitmap buffer to display on the Playdate's screen * The input bitmap must be an Uint8Array of bytes, where each bit in the byte will
src/PlaydateDevice.ts:256
↓ 1 callers
Method
stopPollingControls
* Stop polling for control updates, after startPollingControls() has been called * After this has completed, you'll be able to communicate with the
src/PlaydateDevice.ts:363
↓ 1 callers
Method
transformBytes
(chunk: Uint8Array, controller: PDStreamController<Uint8Array>)
src/SerialTransformer.ts:82
↓ 1 callers
Method
transformLines
(chunk: Uint8Array, controller: PDStreamController<string>)
src/SerialTransformer.ts:75
Function
assertBrowserEnv
()
src/utils/env.ts:36
Function
assertExists
(value: S, name='')
src/utils/assert.ts:27
Function
assertNodeEnv
()
src/utils/env.ts:52
Function
assertWebWorkerEnv
()
src/utils/env.ts:70
Method
buttonIsPressed
* Equivalent to Playdate SDK's playdate.buttonIsPressed(button)
src/PlaydateDevice.ts:316
Method
buttonJustPressed
* Equivalent to Playdate SDK's playdate.buttonJustPressed(button)
src/PlaydateDevice.ts:326
Method
buttonJustReleased
* Equivalent to Playdate SDK's playdate.buttonJustReleased(button)
src/PlaydateDevice.ts:336
Function
bytesToString
(bytes: Uint8Array)
src/utils/bytes.ts:5
Method
close
* Close a device for communication
src/PlaydateDevice.ts:160
Method
close
* Closes the serial device, stopping communication
src/Serial.ts:57
Method
constructor
(port: SerialPort)
src/PlaydateDevice.ts:74
Method
constructor
(port: SerialPort, options: PDSerialOptions)
src/Serial.ts:28
Function
dynamicRequire
(nodeModule: NodeModule, p: string)
src/utils/env.ts:12
Method
evalLuaPayload
* Eval a pre-compiled lua function payload (has to be compiled with pdc) on the device
src/PlaydateDevice.ts:385
Method
flush
(controller: PDStreamController)
src/SerialTransformer.ts:67
Method
getControls
* Get the current controls state, after startPollingControls() has been called
src/PlaydateDevice.ts:308
Method
getCrankPosition
* Equivalent to Playdate SDK's playdate.getCrankPosition()
src/PlaydateDevice.ts:354
Method
getDevices
()
src/PlaydateDevice.ts:88
Method
getScreenIndexed
* Capture a screenshot from the Playdate, and get the unpacked framebuffer * This will return an 8-bit indexed framebuffer as an Uint8Array of pixe
src/PlaydateDevice.ts:235
Method
getSerial
* Get the Playdate's serial number
src/PlaydateDevice.ts:207
Method
getVersion
* Get version information about the Playdate; its OS build info, SDK version, serial number, etc
src/PlaydateDevice.ts:173
Method
isBusy
* Indicates when the Playdate is busy and not able to handle other commands
src/PlaydateDevice.ts:108
Method
isCrankDocked
* Equivalent to Playdate SDK's playdate.isCrankDocked()
src/PlaydateDevice.ts:346
Method
isOpen
* Indicates whether the Playdate is open or close to reading/writing
src/PlaydateDevice.ts:101
Function
isUsbSupported
()
src/index.ts:13
Method
off
* Remove an event callback
src/PlaydateDevice.ts:126
Method
on
(eventType: PlaydateDeviceEvent, callback: PlaydateDeviceEventCallback)
src/PlaydateDevice.ts:119
Method
onData
(callbackFn: (data: Uint8Array) => void)
src/SerialTransformer.ts:25
Method
open
* Open a device for communication
src/PlaydateDevice.ts:143
Method
open
* Open the serial device to start communication
src/Serial.ts:45
Method
readBytesUntilTimeout
* Read bytes until a timeout happens, indicating there's no more bytes to read for now
src/Serial.ts:189
Function
requestConnectPlaydate
()
src/index.ts:29
Method
run
* Launch a .PDX rom at a given path, e.g. '/System/Crayons.pdx'
src/PlaydateDevice.ts:376
Method
sendBitmapIndexed
* Send a indexed bitmap to display on the Playdate's screen * The input bitmap must be an Uint8Array of bytes, each byte in the array will represen
src/PlaydateDevice.ts:272
Function
sleep
(ms: number)
src/utils/promise.ts:4
Function
splitLines
(str: string)
src/utils/fmt.ts:17
Method
start
(controller: PDStreamController)
src/SerialTransformer.ts:53
Method
startPollingControls
* Begin polling for control updates. Can be stopped with `stopPollingControls()` * While this is active, you won't be able to communicate with the
src/PlaydateDevice.ts:296
Method
transform
(chunk: Uint8Array, controller: PDStreamController)
src/SerialTransformer.ts:57
Function
warn
(msg: string)
src/utils/assert.ts:4