Skip to content

Commit

Permalink
regenerate constants
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jul 19, 2023
1 parent c1201f3 commit 2d821e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
9 changes: 5 additions & 4 deletions hid-keyboard/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ namespace modules {
)
)
}

/**
* Types a sequence of characters.
*/
Expand All @@ -335,7 +335,7 @@ namespace modules {
for (let i = 0; i < text.length; ++i) {
const c = text.charCodeAt(i)
const selector = findSelector(c)
if (selector <= 0) break; // unknown letter stop
if (selector <= 0) break // unknown letter stop

entries.push([selector, modifiers, action])
if (entries.length > MAX_ENTRIES) {
Expand All @@ -349,7 +349,8 @@ namespace modules {
entries = []
}
}
if (entries.length) // final packet
if (entries.length)
// final packet
this.sendCommand(
jacdac.JDPacket.jdpacked(
jacdac.HidKeyboardCmd.Key,
Expand Down Expand Up @@ -395,7 +396,7 @@ namespace modules {

function findSelector(code: number) {
// node type.mks to regen
const letters = hex`0000000000000000002b000000000000000000000000000000000000000000002c0034000000000000000000362d3738271e1f202122232425260033002e0000000405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f31`
const letters = hex`0000000000000000002b000000000000000000000000000000000000000000002c0034000000000000000000362d3738271e1f202122232425260033002e0000000405060708090a0b0c0d0e0f101112131415161718191a1b1c1d2f31`
const l = letters[code] || 0
return l
}
Expand Down
9 changes: 4 additions & 5 deletions indexed-screen/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,19 @@ namespace jacdac {
Brightness = 0x1,

/**
* The current palette.
* Read-write. The current palette. The colors are `[r,g,b, padding]` 32bit color entries.
* The color entry repeats `1 << bits_per_pixel` times.
* This register may be write-only.
*
* ```
* const [rest] = jdunpack<[([number, number, number])[]]>(buf, "r: u8 u8 u8 x[1]")
* const [blue, green, red] = rest[0]
* const [color] = jdunpack<[number[]]>(buf, "u32[]")
* ```
*/
Palette = 0x80,

/**
* Constant bit uint8_t. Determines the number of palette entries.
* Typical values are 1, 2, 4, or 8.
* Typical values are 1 or 4.
*
* ```
* const [bitsPerPixel] = jdunpack<[number]>(buf, "u8")
Expand Down Expand Up @@ -131,7 +130,7 @@ namespace jacdac {
/**
* Pack format for 'palette' data.
*/
export const Palette = "r: u8 u8 u8 u8"
export const Palette = "r: u32"

/**
* Pack format for 'bits_per_pixel' data.
Expand Down
2 changes: 1 addition & 1 deletion indexed-screen/pxt.g.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jacdac-indexed-screen",
"version": "0.0.0",
"description": "A screen with indexed colors.\n\nThis is often run over an SPI connection, not regular single-wire Jacdac.",
"description": "A screen with indexed colors from a palette.\n\nThis is often run over an SPI connection or directly on the MCU, not regular single-wire Jacdac.",
"files": [
"constants.ts",
"client.g.ts"
Expand Down

0 comments on commit 2d821e7

Please sign in to comment.