Sparklet as Library

Overview

Sparklet is a graphics engine library that transforms embedded hardware into a user experience console. It performs well with any supported hardware and offers an intuitive user experience with its optimized rendering & hardware acceleration.

As mentioned earlier, the Flint builder processes files, validates them and converts them to a binary format that can be read by the Sparklet engine.

  • srec file loaded into the external flash using the Eflash Loader tool. Sparklet consumes the binary file from external flash and updates the hardware.

Process Flow

Process Flow

The High-Level APIs used in User Software are as below:

API

Functionality

int sgui_app_report_error (int error_code, int sub_code, void *ptr_extra_info)

The error callback from Sparklet which needs to be handled by user application

int sgui_cb_is_point_for_touch (INT16U uw_id, INT16S s16_x, INT16S s16_y)

To let know the Sparklet whether to process the mouse events for a particular widget.

int rs_data_info_write_user_callback (RS_DATA_ID detail, void *ptr_value)

A callback thrown from Sparklet before writing to any data bridge/ data info variables

int32_t rs_sgui_ctrl_set_ui_state (uint32_t u32_ctrl_id, int32_t s32_ui_state)

This function is used to set the self UI state of the widget.

int32_t rs_sgui_ctrl_set_internal_state (uint32_t u32_ctrl_id, int32_t s32_internal_state)

This function is used to set the Internal state of the widget.

int32_t rs_hsm_get_current_state(uint32_t id)

This function is used to get the current state of HSM

int32_t rs_sgui_widget_show(uint32_t u32_ctrl_id, int show)

This function is used to show or hide the widget.

int32_t rs_sgui_widget_enable(uint32_t u32_ctrl_id, int enble)

This function is used to enable or disable the widget.

int32_t rs_sgui_post_key_event (uint16_t key) int32_t rs_user_action_callback(uint32_t u32_event, uint32_t u32_id, void *ptr_value2, void *ptr_value3)

This API is used to send a key event to machine

A callback from Sparklet for State change, button actions, swipe actions, custom event completion, etc

int32_t rs_sgui _ctrl_get_internal_state(uint32_t u32_ctrl_id)

This function is used to get the current internal state of the widget.

int32_t rs_send_custom_event (uint16_t u16_event_id)

This function is used to send a custom event to Sparklet

int is_3d_widget (int uw_id)

To let the Sparklet know which are the controls to be drawn in 3D

int32_t rs_sgui_widget_redraw(uint32_t u32_ctrl_id)

This function is used to redraw the image.

int32_t rs_sgui_placeholder_show_view (int32_t view_holder_id, int32_t view_id)

This API is used to set which view to be mapped to the placeholder

int32_t rs_sgui_send _key_down_to_control(uint16_t u16_id, char gch_key)

To send a key up/down/left/right event to scrollview

void sgui_force _pending_transition_completion (void)

This API is used to achieve the end state of any on-going or upcoming transitions immediately

void sgui_reset _force_transition_completion (void)

This API is used to enable normal event flow for upcoming transitions

int sgui_validate_image (void *start_addr, int img_type, int validation_type)

This API is used to validate the available image with start and end or CRC check

int rs_data_read_to_mem_for_type (RS_DATA_ID data_id, void *ptr_value, int target_type)

This API is used to read value from data bridge

void sgui_get_image_version (INT32U *ptr_major, INT32U *ptr_minor, INT32U *ptr_level)

This API is used to get the image version

To access comprehensive information about Sparklet API’s and the compilation process, please follow this link: https://www.embien.com/documentation/sparklet-gui-library/

Runtime Error in Sparklet

This section provides detailed descriptions of runtime errors.

S .No .

Error Code

Value

Sub Code

Value

Description

1

SGUI _ERR_MEM_ALLOC

11

Pool Index

Error while allocating memory of the given pool index

2

SGUI _ERR_FILE_OPEN

12

Error while opening file.

3

SGUI_ERR_MISC

13

Miscellaneous errors not grouped yet.

4

SGUI_ERR _ INSTANTIATE_WIDGET

14

Widget ID

Unable to instantiate the given widget

5

SGUI _ERR_PLACEHOLDER

15

Index to the View

Error while showing the given view in the placeholder

6

SGUI_ERR_SPRITE

16

Sprite size - if size exceeds allocation No. of HW layer - If count of layers needed exceeds allocation

Error related to sprite allocation in targets that support multiple layers.

7

SGUI _ERR_TRANSITION

17

Error related to transition.

8

SGUI_ERR_JPEG

18

Error related to jpeg decoder. The interrupt factor is returned at subcode when error during JCUA callback.

SGUI_ERR _JPEG_INIT

8

Error during JPEG decoder initialization

SGUI_ERR _JPEG_OPEN

9

Error while opening JPEG decoder.

SGUI_ERR _JPEG_CLOSE

10

Error while closing JPEG decoder

SGUI_ERR _JPEG_DEINIT

11

Error during JPEG decoder de initialization

SGUI_ERR _JPEG_START

12

Error while starting JPEG decoder.

SGUI_ERR _JPEG_TIMEOUT

13

JPEG decoder timeout error.

9

SGUI_ERR_GPU_OP

19

GPU Op Code that failed

Error related to GPU operation.

10

SGUI_ERR_MEM_POOL

20

Error during Memory pool i nitialization.

11

SGUI_ERR_DATA

21

Error during internal data conversion from one type to another.

12

SGUI_ERR _MEM_ALLOC_BUF

22

Error related to frame buffer allocation

13

SGUI_ERR _INVALID_VALUE

23

Error due to invalid value in the argument

14

SGUI_ERR_BMALLOC

24

Pool Index

Error related to Bmalloc failure. The Pool index that failed is returned at subcode.

15

SGUI_ERR_MEM_ALLOC _STATE_MACHINE

25

Error while allocating state machine memory.

16

SGUI_ERR _MEM_ALLOC_IMAGES

26

Error while allocating image memory.

SGUI _INVALID_ERR _PIXEL_TYPE

1

Error due to invalid pixel type.

SGUI _INVALID_ERR _PIXEL_POS_X

2

Error due to invalid pixel x position.

SGUI _INVALID_ERR _PIXEL_POS_Y

3

Error due to invalid pixel y position.

SGUI _INVALID_ERR _PIXEL_ALPHA

4

Error due to invalid pixel alpha.

SGUI _INVALID_ERR _ANGLE_TYPE

5

Error due to invalid pixel angle type.

SGUI_DATA_ERR _CONVERSION

6

Error due to invalid data conversion.

17

SGUI_ERR_MEM_ALLOC _WIDGET_LOOKUP

27

Error while allocating lookup table.

18

SGUI_ERR _ INVALID_IMAGE_TYPE

28

Image Type

Error with image type. The image type is returned at subcode.

19

SGUI_ERR _UNKNOWN_BMP_TYPE

100

Unsupported BMP File format