Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add screen and screen---st7735 libs #5848

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion libs/core/_locales/core-jsdoc-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"Array.reduce": "Call the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
"Array.reduce|param|callbackfn": "A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the array.",
"Array.reduce|param|initialValue": "Initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.",
"Array.removeAt": "Remove the element at a certain index.",
"Array.removeAt": "Remove and return the element at a certain index.",
"Array.removeElement": "Remove the first occurence of an object. Returns true if removed.",
"Array.reverse": "Reverse the elements in an array. The first array element becomes the last, and the last array element becomes the first.",
"Array.set": "Store a value at a particular index",
Expand Down Expand Up @@ -554,6 +554,7 @@
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name",
"music.onEvent": "Registers code to run on various melody events",
"music.play": "Play a song, melody, or other sound. The music plays until finished or can play as a\nbackground task.",
"music.playMelody": "Play a melody from the melody editor.",
"music.playMelody|param|melody": "string of up to eight notes [C D E F G A B C5] or rests [-] separated by spaces, which will be played one at a time, ex: \"E D G F B A C5 B \"",
"music.playMelody|param|tempo": "number in beats per minute (bpm), dictating how long each note will play for",
Expand All @@ -563,6 +564,8 @@
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz), eg: Note.C",
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
"music.play|param|playbackMode": "play the song or melody until it's finished or as background task",
"music.play|param|toPlay": "the song or melody to play",
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
"music.rest|param|ms": "rest duration in milliseconds (ms)",
"music.ringTone": "Plays a tone through pin ``P0``.",
Expand All @@ -581,6 +584,9 @@
"music.stopAllSounds": "Stop all sounds and melodies currently playing.",
"music.stopMelody": "Stops the melodies",
"music.stopMelody|param|options": "which melody to stop",
"music.stringPlayable": "Play a melody from the melody editor",
"music.stringPlayable|param|bpm": "number in beats per minute dictating how long each note will play",
"music.stringPlayable|param|melody": "string of up to eight notes [C D E F G A B C5] or rests [-] separated by spaces, which will be played one at a time, ex: \"E D G F B A C5 B \"",
"music.tempo": "Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.",
"music.tonePlayable": "Plays a tone through pin ``P0`` for the given duration.",
"music.tonePlayable|param|duration": "tone duration in milliseconds (ms)",
Expand Down
1 change: 1 addition & 0 deletions libs/core/_locales/core-strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
"SoundExpressionPlayMode.InBackground|block": "in background",
"SoundExpressionPlayMode.UntilDone|block": "until done",
"String.charAt|block": "char from %this=text|at %pos",
"String.charCodeAt|block": "char code from $this=text|at $index",
"String.compare|block": "compare %this=text| to %that",
"String.fromCharCode|block": "text from char code %code",
"String.includes|block": "%this=text|includes %searchValue",
Expand Down
47 changes: 47 additions & 0 deletions libs/screen---st7735/_locales/screen---st7735-jsdoc-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"Bitmap.blit": "Copy a bitmap from a source rectangle to a destination rectangle, stretching or\ncompressing to fit the dimensions of the destination rectangle, if necessary.",
"Bitmap.blitRow": "Scale and copy a row of pixels from a texture.",
"Bitmap.clone": "Return a copy of the current bitmap",
"Bitmap.copyFrom": "Sets all pixels in the current bitmap from the other bitmap, which has to be of the same size and\nbpp.",
"Bitmap.doubled": "Stretches the bitmap in both directions by 100%",
"Bitmap.doubledX": "Stretches the bitmap horizontally by 100%",
"Bitmap.doubledY": "Stretches the bitmap vertically by 100%",
"Bitmap.drawBitmap": "Draw given bitmap on the current bitmap",
"Bitmap.drawCircle": "Draw a circle",
"Bitmap.drawIcon": "Draw an icon (monochromatic bitmap) using given color",
"Bitmap.drawLine": "Draw a line",
"Bitmap.drawRect": "Draw an empty rectangle",
"Bitmap.drawTransparentBitmap": "Draw given bitmap with transparent background on the current bitmap",
"Bitmap.equals": "Returns true if the provided bitmap is the same as this bitmap,\notherwise returns false.",
"Bitmap.fill": "Fill entire bitmap with a given color",
"Bitmap.fillCircle": "Fills a circle",
"Bitmap.fillPolygon4": "Fills a 4-side-polygon",
"Bitmap.fillRect": "Fill a rectangle",
"Bitmap.fillTriangle": "Fills a triangle",
"Bitmap.flipX": "Flips (mirrors) pixels horizontally in the current bitmap",
"Bitmap.flipY": "Flips (mirrors) pixels vertically in the current bitmap",
"Bitmap.getPixel": "Get a pixel color",
"Bitmap.getRows": "Copy row(s) of pixel from bitmap to buffer (8 bit per pixel).",
"Bitmap.height": "Get the height of the bitmap",
"Bitmap.isMono": "True if the bitmap is monochromatic (black and white)",
"Bitmap.mapRect": "Replace colors in a rectangle",
"Bitmap.overlapsWith": "Check if the current bitmap \"collides\" with another",
"Bitmap.replace": "Replaces one color in an bitmap with another",
"Bitmap.rotated": "Returns a bitmap rotated by -90, 0, 90, 180, 270 deg clockwise",
"Bitmap.scroll": "Every pixel in bitmap is moved by (dx,dy)",
"Bitmap.setPixel": "Set pixel color",
"Bitmap.setRows": "Copy row(s) of pixel from buffer to bitmap.",
"Bitmap.transposed": "Returns a transposed bitmap (with X/Y swapped)",
"Bitmap.width": "Get the width of the bitmap",
"ScreenBitmap.brightness": "Gets current screen backlight brightness (0-100)",
"ScreenBitmap.setBrightness": "Sets the screen backlight brightness (10-100)",
"bitmap.create": "Create new empty (transparent) bitmap",
"bitmap.doubledIcon": "Double the size of an icon",
"bitmap.ofBuffer": "Create new bitmap with given content",
"bitmap.screenBitmap": "Get the screen bitmap",
"bitmaps": "Bitmap manipulation blocks",
"bitmaps._bitmap": "An bitmap",
"bitmaps._bitmap|param|bitmap": "the bitmap",
"bmp": "Tagged bitmap literal converter\n\nTagged bitmap literal converter",
"helpers.bitmapRotated": "Returns a bitmap rotated by 90, 180, 270 deg clockwise"
}
39 changes: 39 additions & 0 deletions libs/screen---st7735/_locales/screen---st7735-strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"Bitmap.clone|block": "clone %picture=variables_get",
"Bitmap.drawLine|block": "draw line in %picture=variables_get from x %x0 y %y0 to x %x1 y %y1 %c=colorindexpicker",
"Bitmap.drawRect|block": "draw rectangle in %picture=variables_get at x %x y %y width %w height %h %c=colorindexpicker",
"Bitmap.equals|block": "$this is equal to bitmap $other",
"Bitmap.fillRect|block": "fill rectangle in %picture=variables_get at x %x y %y width %w height %h %c=colorindexpicker",
"Bitmap.fill|block": "fill %picture=variables_get with %c=colorindexpicker",
"Bitmap.flipX|block": "flip %picture=variables_get horizontally",
"Bitmap.flipY|block": "flip %picture=variables_get vertically",
"Bitmap.getPixel|block": "%picture=variables_get color at x %x y %y",
"Bitmap.replace|block": "change color in %picture=variables_get from %from=colorindexpicker to %to=colorindexpicker",
"Bitmap.setPixel|block": "set %picture=variables_get color at x %x y %y to %c=colorindexpicker",
"bitmap.create|block": "create bitmap width %width height %height",
"bitmap.screenBitmap|block": "screen",
"bitmaps._bitmap|block": "$bitmap",
"bitmaps._dialogBitmap|block": "%img",
"bitmaps._screenBitmap|block": "%img",
"bitmaps._spriteBitmap|block": "%img",
"bitmaps._tileBitmap|block": "%img",
"bitmaps._tileMapBitmap|block": "%img",
"bitmaps._tile|block": "%tile",
"bitmaps|block": "bitmaps",
"bitmap|block": "bitmap",
"helpers|block": "helpers",
"{id:category}Bitmap": "Bitmap",
"{id:category}Bitmaps": "Bitmaps",
"{id:category}Control": "Control",
"{id:category}Helpers": "Helpers",
"{id:category}Scene": "Scene",
"{id:category}ScreenBitmap": "ScreenBitmap",
"{id:category}Texteffects": "Texteffects",
"{id:category}_helpers_workaround": "_helpers_workaround",
"{id:category}_screen_internal": "_screen_internal",
"{id:group}Compare": "Compare",
"{id:group}Create": "Create",
"{id:group}Drawing": "Drawing",
"{id:group}Tiles": "Tiles",
"{id:group}Transformations": "Transformations"
}
49 changes: 49 additions & 0 deletions libs/screen---st7735/arcadegamepad.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Autogenerated C header file for Arcade Gamepad
#ifndef _JACDAC_SPEC_ARCADE_GAMEPAD_H
#define _JACDAC_SPEC_ARCADE_GAMEPAD_H 1

#define JD_SERVICE_CLASS_ARCADE_GAMEPAD 0x1deaa06e

// enum Button (uint8_t)
#define JD_ARCADE_GAMEPAD_BUTTON_LEFT 0x1
#define JD_ARCADE_GAMEPAD_BUTTON_UP 0x2
#define JD_ARCADE_GAMEPAD_BUTTON_RIGHT 0x3
#define JD_ARCADE_GAMEPAD_BUTTON_DOWN 0x4
#define JD_ARCADE_GAMEPAD_BUTTON_A 0x5
#define JD_ARCADE_GAMEPAD_BUTTON_B 0x6
#define JD_ARCADE_GAMEPAD_BUTTON_MENU 0x7
#define JD_ARCADE_GAMEPAD_BUTTON_SELECT 0x8
#define JD_ARCADE_GAMEPAD_BUTTON_RESET 0x9
#define JD_ARCADE_GAMEPAD_BUTTON_EXIT 0xa

/**
* Indicates which buttons are currently active (pressed).
* `pressure` should be `0xff` for digital buttons, and proportional for analog ones.
*/
#define JD_ARCADE_GAMEPAD_REG_BUTTONS JD_REG_READING
typedef struct jd_arcade_gamepad_buttons {
uint8_t button; // Button
uint8_t pressure; // ratio u0.8
} jd_arcade_gamepad_buttons_t;


/**
* Constant. Indicates number of players supported and which buttons are present on the controller.
*/
#define JD_ARCADE_GAMEPAD_REG_AVAILABLE_BUTTONS 0x180
typedef struct jd_arcade_gamepad_available_buttons {
uint8_t button[0]; // Button
} jd_arcade_gamepad_available_buttons_t;


/**
* Argument: button Button (uint8_t). Emitted when button goes from inactive to active.
*/
#define JD_ARCADE_GAMEPAD_EV_DOWN JD_EV_ACTIVE

/**
* Argument: button Button (uint8_t). Emitted when button goes from active to inactive.
*/
#define JD_ARCADE_GAMEPAD_EV_UP JD_EV_INACTIVE

#endif
31 changes: 31 additions & 0 deletions libs/screen---st7735/arcadesound.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Autogenerated C header file for Arcade sound
#ifndef _JACDAC_SPEC_ARCADE_SOUND_H
#define _JACDAC_SPEC_ARCADE_SOUND_H 1

#define JD_SERVICE_CLASS_ARCADE_SOUND 0x1fc63606

/**
* Argument: samples bytes. Play samples, which are single channel, signed 16-bit little endian values.
*/
#define JD_ARCADE_SOUND_CMD_PLAY 0x80

/**
* Read-write Hz u22.10 (uint32_t). Get or set playback sample rate (in samples per second).
* If you set it, read it back, as the value may be rounded up or down.
*/
#define JD_ARCADE_SOUND_REG_SAMPLE_RATE 0x80

/**
* Constant B uint32_t. The size of the internal audio buffer.
*/
#define JD_ARCADE_SOUND_REG_BUFFER_SIZE 0x180

/**
* Read-only B uint32_t. How much data is still left in the buffer to play.
* Clients should not send more data than `buffer_size - buffer_pending`,
* but can keep the `buffer_pending` as low as they want to ensure low latency
* of audio playback.
*/
#define JD_ARCADE_SOUND_REG_BUFFER_PENDING 0x181

#endif
85 changes: 85 additions & 0 deletions libs/screen---st7735/indexedscreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Autogenerated C header file for Indexed screen
#ifndef _JACDAC_SPEC_INDEXED_SCREEN_H
#define _JACDAC_SPEC_INDEXED_SCREEN_H 1

#define JD_SERVICE_CLASS_INDEXED_SCREEN 0x16fa36e5

/**
* Sets the update window for subsequent `set_pixels` commands.
*/
#define JD_INDEXED_SCREEN_CMD_START_UPDATE 0x81
typedef struct jd_indexed_screen_start_update {
uint16_t x; // px
uint16_t y; // px
uint16_t width; // px
uint16_t height; // px
} jd_indexed_screen_start_update_t;


/**
* Argument: pixels bytes. Set pixels in current window, according to current palette.
* Each "line" of data is aligned to a byte.
*/
#define JD_INDEXED_SCREEN_CMD_SET_PIXELS 0x83

/**
* Read-write ratio u0.8 (uint8_t). Set backlight brightness.
* If set to `0` the display may go to sleep.
*/
#define JD_INDEXED_SCREEN_REG_BRIGHTNESS JD_REG_INTENSITY

/**
* The current palette.
* The color entry repeats `1 << bits_per_pixel` times.
* This register may be write-only.
*/
#define JD_INDEXED_SCREEN_REG_PALETTE 0x80
typedef struct jd_indexed_screen_palette {
uint8_t blue;
uint8_t green;
uint8_t red;
uint8_t padding;
} jd_indexed_screen_palette_t;


/**
* Constant bit uint8_t. Determines the number of palette entries.
* Typical values are 1, 2, 4, or 8.
*/
#define JD_INDEXED_SCREEN_REG_BITS_PER_PIXEL 0x180

/**
* Constant px uint16_t. Screen width in "natural" orientation.
*/
#define JD_INDEXED_SCREEN_REG_WIDTH 0x181

/**
* Constant px uint16_t. Screen height in "natural" orientation.
*/
#define JD_INDEXED_SCREEN_REG_HEIGHT 0x182

/**
* Read-write bool (uint8_t). If true, consecutive pixels in the "width" direction are sent next to each other (this is typical for graphics cards).
* If false, consecutive pixels in the "height" direction are sent next to each other.
* For embedded screen controllers, this is typically true iff `width < height`
* (in other words, it's only true for portrait orientation screens).
* Some controllers may allow the user to change this (though the refresh order may not be optimal then).
* This is independent of the `rotation` register.
*/
#define JD_INDEXED_SCREEN_REG_WIDTH_MAJOR 0x81

/**
* Read-write px uint8_t. Every pixel sent over wire is represented by `up_sampling x up_sampling` square of physical pixels.
* Some displays may allow changing this (which will also result in changes to `width` and `height`).
* Typical values are 1 and 2.
*/
#define JD_INDEXED_SCREEN_REG_UP_SAMPLING 0x82

/**
* Read-write ° uint16_t. Possible values are 0, 90, 180 and 270 only.
* Write to this register do not affect `width` and `height` registers,
* and may be ignored by some screens.
*/
#define JD_INDEXED_SCREEN_REG_ROTATION 0x83

#endif
Loading
Loading