---@meta

-- GENERATED FILE — do not hand-edit.
-- Regenerated by `tools/docs_pipeline.py build` (see docs-system/README.md).
-- To fix API facts: edit the upstream EdgeTX /*luadoc*/ comment, then
-- re-extract and rebuild. To add narrative content: edit
-- docs-system/overlays/<doc_id>.md, then rebuild.

--- LCD line pattern selector such as SOLID or DOTTED.
---@alias pen_type integer
--- Text rendering flags used by legacy LCD number APIs.
---@alias text_flags integer
--- Packed 16-bit RGB color value for color LCD APIs.
---@alias lcd_color_RGB565 integer
--- Font size selector such as XXLSIZE, DBLSIZE, MIDSIZE, or SMLSIZE.
---@alias lcd_font_size integer
--- Bitmask of LCD text rendering flags such as INVERS, BLINK, and SHADOWED.
---@alias lcd_text_flags integer
--- Combined LCD text formatting bitmask covering font size and text flags.
---@alias lcd_text_format integer
--- Signed EdgeTX source value in the normalized range from -1024 to 1024.
---@alias source_range_1024 integer
--- Global timer selector such as all, total, session, throttle, or throttlepct.
---@alias timer_type string
--- Telemetry unit identifier from the EdgeTX unit list.
---@alias unit_type integer
--- Telemetry precision selector controlling decimal places.
---@alias prec_type integer

---@class lcd
lcd = {}

--- Returns a drawing flag with RGB color code
--- @since 2.2.0
---@param r integer a number between 0 and 255 that expresses the amount of red in the color
---@param g integer a number between 0 and 255 that expresses the amount of green in the color
---@param b integer a number between 0 and 255 that expresses the amount of blue in the color
---@param rgb integer a number between 0 and 0xFFFFFF that expresses the RGB value (0xFF000=RED, 0x00FF00=GREEN, 0x0000FF=BLUE)
---@return integer flag
function lcd.RGB(r, g, b, rgb) end

--- Clear the LCD screen
--- @since 2.0.0
---@param color? unknown 
function lcd.clear(color) end

--- Draw an arc
--- @since 2.4.0
---@param x integer coordinates of the center
---@param y integer coordinates of the center
---@param r1 integer radii of the inside and outside of the annulus
---@param r2 integer radii of the inside and outside of the annulus
---@param start integer start and end of the annulus
---@param end integer start and end of the annulus
---@param flags? integer please see the Lcd functions overview
function lcd.drawAnnulus(x, y, r1, r2, start, end, flags) end

--- Draw an arc
--- @since 2.4.0
---@param x integer coordinates of the center
---@param y integer coordinates of the center
---@param r integer radius
---@param start integer start and end of the arc
---@param end integer start and end of the arc
---@param flags? integer please see the Lcd functions overview
function lcd.drawArc(x, y, r, start, end, flags) end

--- Displays a bitmap at (x,y)
--- @since 2.2.0
---@param bitmap pointer point to a bitmap previously opened with Bitmap.open()
---@param x integer starting coordinates
---@param y integer starting coordinates
---@param scale? integer scale in %, 50 divides size by two, 100 is unchanged, 200 doubles size. Omitting scale draws image in 1:1 scale and is faster than specifying 100 for scale.
function lcd.drawBitmap(bitmap, x, y, scale) end

--- Displays a bitmap pattern at (x,y)
--- @since 2.8.0
---@param bitmap pointer point to a bitmap previously opened with Bitmap.open()
---@param x integer starting coordinates
---@param y integer starting coordinates
---@param flags? integer please see the Lcd functions overview
function lcd.drawBitmapPattern(bitmap, x, y, flags) end

--- Displays a bitmap pattern pie at (x,y)
--- @since 2.8.0
---@param bitmap pointer point to a bitmap previously opened with Bitmap.open()
---@param x integer starting coordinates
---@param y integer starting coordinates
---@param startangle unknown Start angle
---@param endangle unknown End angle
---@param flags? integer please see the Lcd functions overview
function lcd.drawBitmapPatternPie(bitmap, x, y, startangle, endangle, flags) end

--- Display a telemetry value at (x,y)
--- @since 2.0.6
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param source integer|string can be a source identifier (number) or a source name (string). See getValue()
---@param flags integer please see the Lcd functions overview
function lcd.drawChannel(x, y, source, flags) end

--- Draw a circle at (x, y) of specified radius
--- @since 2.4.0
---@param x integer center position
---@param y integer center position
---@param r integer radius in pixels
---@param flags? integer please see the Lcd functions overview
function lcd.drawCircle(x, y, r, flags) end

--- Draw a combo box
--- @since 2.0.0
---@param x integer top left corner position
---@param y integer top left corner position
---@param w integer width of combo box in pixels
---@param list table combo box elements, each element is a string
---@param idx integer index of entry to highlight
---@param flags? integer drawing flags, the flags can not be combined: * BLINK combo box is expanded * INVERS combo box collapsed, text inversed * 0 or not present combo box collapsed, text normal
function lcd.drawCombobox(x, y, w, list, idx, flags) end

--- Draw a filled circle at (x, y) of specified radius
--- @since 2.4.0
---@param x integer center position
---@param y integer center position
---@param r integer radius in pixels
---@param flags? integer please see the Lcd functions overview
function lcd.drawFilledCircle(x, y, r, flags) end

--- Draw a solid rectangle from top left corner (x,y) of specified width and height
--- @since 2.0.0
---@param x integer top left corner position
---@param y integer top left corner position
---@param w integer width in pixels
---@param h integer height in pixels
---@param flags? integer please see the Lcd functions overview
---@param opacity? integer opacity defaults to 0 (only on radios with color display)
function lcd.drawFilledRectangle(x, y, w, h, flags, opacity) end

--- Draw a filled triangle
--- @since 2.4.0
---@param x1 integer coordinates of the three vertices
---@param y1 integer coordinates of the three vertices
---@param x2 integer coordinates of the three vertices
---@param y2 integer coordinates of the three vertices
---@param x3 integer coordinates of the three vertices
---@param y3 integer coordinates of the three vertices
---@param flags? integer please see the Lcd functions overview
function lcd.drawFilledTriangle(x1, y1, x2, y2, x3, y3, flags) end

--- Draw a simple gauge that is filled based upon fill value
--- @since 2.0.0
---@param x integer top left corner position
---@param y integer top left corner position
---@param w integer width in pixels
---@param h integer height in pixels
---@param fill integer amount of fill to apply
---@param maxfill integer total value of fill
---@param flags? integer please see the Lcd functions overview
function lcd.drawGauge(x, y, w, h, fill, maxfill, flags) end

--- Draw a rectangle in perspective
--- @since 2.4.0
---@param pitch integer pitch and roll to define the orientation of the rectangle
---@param roll integer pitch and roll to define the orientation of the rectangle
---@param xmin integer the limits of the rectangle
---@param xmax integer the limits of the rectangle
---@param ymin integer the limits of the rectangle
---@param ymax integer the limits of the rectangle
---@param flags? integer please see the Lcd functions overview
function lcd.drawHudRectangle(pitch, roll, xmin, xmax, ymin, ymax, flags) end

--- Draw a straight line on LCD
--- @since 2.0.0
---@param x1 integer starting coordinate
---@param y1 integer starting coordinate
---@param x2 integer end coordinate
---@param y2 integer end coordinate
---@param pattern unknown SOLID or DOTTED
---@param flags? integer lcdflags
function lcd.drawLine(x1, y1, x2, y2, pattern, flags) end

--- Draw a line only inside a rectangle
--- @since 2.4.0
---@param x1 integer coordinates of the start and end of the unclipped line
---@param y1 integer coordinates of the start and end of the unclipped line
---@param x2 integer coordinates of the start and end of the unclipped line
---@param y2 integer coordinates of the start and end of the unclipped line
---@param xmin integer the limits of the rectangle inside which the line is drawn
---@param xmax integer the limits of the rectangle inside which the line is drawn
---@param ymin integer the limits of the rectangle inside which the line is drawn
---@param ymax integer the limits of the rectangle inside which the line is drawn
---@param pattern FORCE please see the Lcd functions overview
---@param flags? integer please see the Lcd functions overview
function lcd.drawLineWithClipping(x1, y1, x2, y2, xmin, xmax, ymin, ymax, pattern, flags) end

--- Display a number at (x,y)
--- @since 2.0.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param value integer value to display
---@param flags? integer please see the Lcd functions overview
---@param inverscolor? unknown overrides the inverse text color for INVERS
function lcd.drawNumber(x, y, value, flags, inverscolor) end

--- Draw a pie slice
--- @since 2.4.0
---@param x integer coordinates of the center
---@param y integer coordinates of the center
---@param r integer radius
---@param start integer start and end of the pie slice
---@param end integer start and end of the pie slice
---@param flags? integer please see the Lcd functions overview
function lcd.drawPie(x, y, r, start, end, flags) end

--- Draw a bitmap at (x,y)
--- @since 2.0.0
---@param x integer starting coordinates
---@param y integer starting coordinates
---@param name string full path to the bitmap on SD card (i.e. “/IMAGES/test.bmp”)
function lcd.drawPixmap(x, y, name) end

--- Draw a single pixel at (x,y) position
--- @since 2.0.0
---@param x integer x position
---@param y integer y position
---@param flags? integer please see the Lcd functions overview
function lcd.drawPoint(x, y, flags) end

--- Draw a rectangle from top left corner (x,y) of specified width and height
--- @since 2.0.0
---@param x integer top left corner position
---@param y integer top left corner position
---@param w integer width in pixels
---@param h integer height in pixels
---@param flags? integer please see the Lcd functions overview
---@param t? integer thickness in pixels, defaults to 1 (only on radios with color display)
---@param opacity? integer opacity defaults to 0 (only on radios with color display)
function lcd.drawRectangle(x, y, w, h, flags, t, opacity) end

--- Draw a title bar
--- @since 2.0.0
---@param title string text for the title
---@param page integer page number
---@param pages integer total number of pages. Only used as indicator on the right side of title bar. (i.e. idx=2, cnt=5, display 2/5)
function lcd.drawScreenTitle(title, page, pages) end

--- Displays the name of the corresponding input as defined by the source at (x,y)
--- @since 2.0.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param source integer source index
---@param flags? integer please see the Lcd functions overview
function lcd.drawSource(x, y, source, flags) end

--- Draw a text representation of switch at (x,y)
--- @since 2.0.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param switch integer number of switch to display, negative number displays negated switch
---@param flags integer please see the Lcd functions overview, only SMLSIZE, BLINK and INVERS.
function lcd.drawSwitch(x, y, switch, flags) end

--- Draw a text beginning at (x,y)
--- @since 2.0.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param text string text to display
---@param flags? integer please see the Lcd functions overview for drawing flags and colors, and the Appendix for available characters in each font set.
---@param inverscolor? unknown overrides the inverse text color for INVERS
function lcd.drawText(x, y, text, flags, inverscolor) end

--- Draw text inside rectangle (x,y,w,h) with line breaks
--- @since 2.5.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param w integer width and height of bounding rectangle
---@param h integer width and height of bounding rectangle
---@param text string text to display
---@param flags? integer please see the Lcd functions overview for drawing flags and colors, and the Appendix for available characters in each font set. RIGHT, CENTER and VCENTER are not implemented.
---@return integer x_y
function lcd.drawTextLines(x, y, w, h, text, flags) end

--- Display a value formatted as time at (x,y)
--- @since 2.0.0
---@param x integer starting coordinate
---@param y integer starting coordinate
---@param value integer time in seconds
---@param flags? integer please see the Lcd functions overview
---@param inverscolor? unknown overrides the inverse text color for INVERS
function lcd.drawTimer(x, y, value, flags, inverscolor) end

--- Draw a triangle
--- @since 2.4.0
---@param x1 integer coordinates of the three vertices
---@param y1 integer coordinates of the three vertices
---@param x2 integer coordinates of the three vertices
---@param y2 integer coordinates of the three vertices
---@param x3 integer coordinates of the three vertices
---@param y3 integer coordinates of the three vertices
---@param flags? integer please see the Lcd functions overview
function lcd.drawTriangle(x1, y1, x2, y2, x3, y3, flags) end

--- Exit full screen widget mode.
--- @since 2.5.0
function lcd.exitFullScreen() end

--- Get the color value from flags
--- @since 2.3.11
---@param flags integer please see the Lcd functions overview
---@return integer color
function lcd.getColor(flags) end

--- Returns the leftmost x position from previous drawtext or drawNumber output
--- @since 2.2.0
---@return integer number
function lcd.getLastLeftPos() end

--- Returns the rightmost x position from previous output
--- @since 2.0.0
---@return integer number
function lcd.getLastPos() end

--- Returns the rightest x position from previous drawtext or drawNumber output
--- @since 2.2.0
---@return integer number
function lcd.getLastRightPos() end

--- Invert a rectangle zone from top left corner (x,y) of specified width and height
--- @since 2.8.0
---@param x integer top left corner position
---@param y integer top left corner position
---@param w integer width in pixels
---@param h integer height in pixels
---@param flags? integer please see the Lcd functions overview
function lcd.invertRect(x, y, w, h, flags) end

--- Refresh the LCD screen
--- @since 2.2.0
function lcd.refresh() end

--- Reset the backlight timeout
--- @since 2.3.6
function lcd.resetBacklightTimeout() end

--- Change an indexed color (theme colors and CUSTOM_COLOR). Please see the Lcd functions overview for indexed color constants
--- @since 2.2.0
function lcd.setColor() end

--- Get the width and height of a text string drawn with flags
--- @since 2.5.0
---@param text string 
---@param flags? integer please see the Lcd functions overview
---@return integer w_h
function lcd.sizeText(text, flags) end
