ezLCD+103 Driver  0.1
Driver code for the ezLCD+103
 All Files Functions Typedefs Enumerations Groups Pages
Functions
Curves

Functions

void ezLCD_draw_circle (uint16_t radius)
 
void ezLCD_draw_circle_fill (uint16_t radius)
 
void ezLCD_draw_arc (uint16_t radius, uint16_t start_angle, uint16_t end_angle)
 
void ezLCD_draw_pie (uint16_t radius, uint16_t start_angle, uint16_t end_angle)
 
void ezLCD_draw_ellipse (uint16_t semi_major_axis, uint16_t semi_minor_axis)
 
void ezLCD_draw_ellipse_fill (uint16_t semi_major_axis, uint16_t semi_minor_axis)
 
void ezLCD_draw_ellipse_arc (uint16_t semi_major_axis, uint16_t semi_minor_axis, uint16_t start_angle, uint16_t end_angle)
 
void ezLCD_draw_ellipse_pie (uint16_t semi_major_axis, uint16_t semi_minor_axis, uint16_t start_angle, uint16_t end_angle)
 

Detailed Description

This header contains functions which aid in the drawing of curved objects such as circles, ellipses, arcs, and pies.

Like the EA DOGM128, angles are specified rather unconventionally. In this case, the unit circle is flipped along the line y=x, resulting in the following angle placements:

angles.png
Angle placements on the ezLCD+103

Notice that 0 degrees is on the north pole of the Y-axis and 90 degrees is on the east end of the X-axis.

NOTE: The EZLCD+103 only understands positive angles from 0-360 degrees. It does not understand negative angles nor does it understand large angles such as 720 degrees. When supplying an angle to the ezLCD+103, it must be converted to a positive angle between 0 and 360 degrees. Supplying values outside of this range may result in unusual behavior and a sluggish display for some time while the display tries to interpret the angle. IT IS HIGHLY ENCOURAGED TO ONLY SUPPLY THE DISPLAY WITH ANGLES FROM 0-360 DEGREES!

Also similar to the EA DOGM128, angles are not specified in degrees and must be converted before being supplied to any functions in this file which may request angles. However, the ezLCD specifies angles with 16-bit precision rather than 8-bit precision. In order to convert from degrees to LCD angle units the user should use the following formula

LCD Angle Units = degrees * (2048)/45

So, for example:

As was the case previously, fractional results from this equation should be rounded or truncated accordingly.

Function Documentation

void ezLCD_draw_arc ( uint16_t  radius,
uint16_t  start_angle,
uint16_t  end_angle 
)

This function is used to draw an arc as shown below from the current position in the current color at the current pen width and current pen height .

arc.png
Arc
Parameters
  • radius = the radius of the arc in the set [0,65535].
  • start_angle = the angle at which drawing will begin in the set [0,16384].
  • end_angle = the angle at which drawing will end in the set [0,16384].
Assumptions
  • The user does not exceed the angle limits. The ezLCD+103 only understands positive angles from 0 to 360 degrees. Anything greater renders extremely slowly and is undefined.
  • The user has set the current position ,the current color , the current pen width, and the current pen height
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_circle ( uint16_t  radius)

This function is used to draw an unfilled circle as shown below from the current position in the current color at the current pen width and current pen height .

circle_unfilled.png
Unfilled Circle
Parameters
  • radius = the radius of the circle in the set [0,65535].
Assumptions
  • The user has set the current position ,the current color , the current pen width, and the current pen height
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_circle_fill ( uint16_t  radius)

This function is used to draw a filled circle as shown below from the current position in the current color .

circle_filled.png
Filled Circle
Parameters
  • radius = the radius of the circle in the set [0,65535].
Assumptions
  • The user has set the current position and the current color.
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_ellipse ( uint16_t  semi_major_axis,
uint16_t  semi_minor_axis 
)

This function is used to draw an unfilled ellipse as shown below from the current position in the current color at the current pen width and current pen height .

ellipse_unfilled.png
Unfilled Ellipse
Parameters
  • semi_major_axis = length of the semi-major axis (length a in the image above.) in the set [0,65535].
  • semi_minor_axis = length of the semi-minor axis (length b in the image above.) in the set [0,65535].
Assumptions
  • The user has set the current position ,the current color , the current pen width, and the current pen height
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_ellipse_arc ( uint16_t  semi_major_axis,
uint16_t  semi_minor_axis,
uint16_t  start_angle,
uint16_t  end_angle 
)

This function is used to draw a elliptical arc as shown below from the current position in the current color at the current pen width and current pen height .

ellipse_arc.png
Elliptical Arc
Parameters
  • semi_major_axis = length of the semi-major axis (length a in the image above.) in the set [0,65535].
  • semi_minor_axis = length of the semi-minor axis (length b in the image above.) in the set [0,65535].
  • start_angle = the angle at which drawing will begin in the set [0,16384].
  • end_angle = the angle at which drawing will end in the set [0,16384].
Assumptions
  • The user does not exceed the angle limits. The ezLCD+103 only understands positive angles from 0 to 360 degrees. Anything greater renders extremely slowly and is undefined.
  • The user has set the current position ,the current color , the current pen width, and the current pen height
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_ellipse_fill ( uint16_t  semi_major_axis,
uint16_t  semi_minor_axis 
)

This function is used to draw a filled ellipse as shown below from the current position in the current color .

ellipse_filled.png
Filled Ellipse
Parameters
  • semi_major_axis = length of the semi-major axis (length a in the image above.) in the set [0,65535].
  • semi_minor_axis = length of the semi-minor axis (length b in the image above.) in the set [0,65535].
Assumptions
  • The user has set the current position and the current color.
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_ellipse_pie ( uint16_t  semi_major_axis,
uint16_t  semi_minor_axis,
uint16_t  start_angle,
uint16_t  end_angle 
)

This function is used to draw a elliptical pie as shown below from the current position in the current color.

ellipse_pie.png
Elliptical Pie
Parameters
  • semi_major_axis = length of the semi-major axis (length a in the image above.) in the set [0,65535].
  • semi_minor_axis = length of the semi-minor axis (length b in the image above.) in the set [0,65535].
  • start_angle = the angle at which drawing will begin in the set [0,16384].
  • end_angle = the angle at which drawing will end in the set [0,16384].
Assumptions
  • The user does not exceed the angle limits. The ezLCD+103 only understands positive angles from 0 to 360 degrees. Anything greater renders extremely slowly and is undefined.
  • The user has set the current position and the current color.
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT
void ezLCD_draw_pie ( uint16_t  radius,
uint16_t  start_angle,
uint16_t  end_angle 
)

This function is used to draw a pie as shown below from the current position in the current color .

pie.png
Pie
Parameters
  • radius = the radius of the arc in the set [0,65535].
  • start_angle = the angle at which drawing will begin in the set [0,16384].
  • end_angle = the angle at which drawing will end in the set [0,16384].
Assumptions
  • The user does not exceed the angle limits. The ezLCD+103 only understands positive angles from 0 to 360 degrees. Anything greater renders extremely slowly and is undefined.
  • The user has set the current position and the current color.
  • The user has initialized the MCU's SPI interface with the EZLCD_INIT_SPI() macro.
  • The user has set the MCU's SPI pins to inputs and outputs appropriately.

    • SS_BAR = OUTPUT
    • SCK = OUTPUT
    • MOSI = OUTPUT
    • MISO = INPUT