DotMatrix
This service is rc and may change in the future.
A rectangular dot matrix display, made of monochrome LEDs or Braille pins.
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
Registers
dots
The state of the screen where dot on/off state is stored as a bit, column by column. The column should be byte aligned.
For example, if the display has no more than 8 rows in each column, then each byte contains bits corresponding to a single column. Least-significant bit is on top. If display has 10 rows, then each column is represented by two bytes. The top-most 8 rows sit in the first byte (with the least significant bit being on top), and the remainign 2 row sit in the second byte.
The following C expression can be used to check if a given column, row
coordinate is set:
dots[column * column_size + (row >> 3)] & (1 << (row & 7))
, where
column_size
is (number_of_rows + 7) >> 3
(note that if number of rows is 8 or less then column_size
is 1
),
and dots
is of uint8_t*
type.
The size of this register is number_of_columns * column_size
bytes.
type:
Register<Buffer>
(packing formatb
)track incoming values
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
dotMatrix.dots.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
intensity
Reads the general brightness of the display, brightness for LEDs. 0
when the screen is off.
type:
Register<number>
(packing formatu0.8
)optional: this register may not be implemented
read and write
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.intensity.read()
await dotMatrix.intensity.write(value)
- track incoming values
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
dotMatrix.intensity.subscribe(async (value) => {
...
})
write
and read
will block until a server is bound to the client.
rows
Number of rows on the screen
type:
Register<number>
(packing formatu16
)constant: the register value will not change (until the next reset)
read only
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.rows.read()
write
and read
will block until a server is bound to the client.
columns
Number of columns on the screen
type:
Register<number>
(packing formatu16
)constant: the register value will not change (until the next reset)
read only
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.columns.read()
write
and read
will block until a server is bound to the client.
variant
Describes the type of matrix used.
type:
Register<number>
(packing formatu8
)optional: this register may not be implemented
constant: the register value will not change (until the next reset)
read only
import { DotMatrix } from "@devicescript/core"
const dotMatrix = new DotMatrix()
// ...
const value = await dotMatrix.variant.read()
write
and read
will block until a server is bound to the client.