Skip to content

Commit 02dd37e

Browse files
author
Melissa LeBlanc-Williams
committed
Reduced comments on private funcs. Made brightness public
1 parent 96cfc96 commit 02dd37e

File tree

1 file changed

+17
-70
lines changed

1 file changed

+17
-70
lines changed

adafruit_ra8875/ra8875.py

Lines changed: 17 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def init(self, start_on=True):
168168
self.turn_on(start_on)
169169
self._gpiox(True)
170170
self._pwm1_config(True, reg.PWM_CLK_DIV1024)
171-
self._pwm1_out(255)
171+
self.brightness(255)
172172

173173
def pllinit(self):
174174
"""Init the Controller PLL"""
@@ -286,11 +286,7 @@ def sleep(self, sleep):
286286
self.write_reg(reg.PWRR, reg.PWRR_DISPOFF if sleep else (reg.PWRR_DISPOFF | reg.PWRR_SLEEP))
287287

288288
def _gpiox(self, gpio_on):
289-
"""
290-
Enable or Disable the RA8875 GPIOs
291-
292-
:param bool gpio_on: Should we enable the GPIOs
293-
"""
289+
"""Enable or Disable the RA8875 GPIOs"""
294290
self.write_reg(reg.GPIOX, 1 if gpio_on else 0)
295291

296292
def _pwm1_config(self, pwm_on, clock):
@@ -302,7 +298,7 @@ def _pwm1_config(self, pwm_on, clock):
302298
"""
303299
self.write_reg(reg.P1CR, (reg.P1CR_ENABLE if pwm_on else reg.P1CR_DISABLE) | (clock & 0xF))
304300

305-
def _pwm1_out(self, level):
301+
def brightness(self, level):
306302
"""
307303
Configure the backlight brightness (0-255)
308304
@@ -389,20 +385,19 @@ class RA8875Display(RA8875_Device):
389385
"""
390386
Drawing Class for the Display. Contains all the basic drawing functionality as well
391387
as the text functions. Valid display sizes are currently 800x480 and 480x272.
388+
389+
:param SPI spi: The spi peripheral to use
390+
:param DigitalInOut cs: The chip-select pin to use (sometimes labeled "SS")
391+
:param DigitalInOut rst: (optional) The reset pin if it exists (default=None)
392+
:param int width: (optional) The width of the display in pixels (default=800)
393+
:param int height: (optional) The height of the display in pixels (default=480)
394+
:param int baudrate: (optional) The spi speed (default=6000000)
395+
:param int phase: (optional) The spi phase (default=0)
396+
:param int polarity: (optional) The spi polarity (default=0)
392397
"""
393398
#pylint: disable-msg=invalid-name,too-many-arguments
394399
def __init__(self, spi, cs, rst=None, width=800, height=480,
395400
baudrate=6000000, polarity=0, phase=0):
396-
"""
397-
:param SPI spi: The spi peripheral to use
398-
:param DigitalInOut cs: The chip-select pin to use (sometimes labeled "SS")
399-
:param DigitalInOut rst: (optional) The reset pin if it exists (default=None)
400-
:param int width: (optional) The width of the display in pixels (default=800)
401-
:param int height: (optional) The height of the display in pixels (default=480)
402-
:param int baudrate: (optional) The spi speed (default=6000000)
403-
:param int phase: (optional) The spi phase (default=0)
404-
:param int polarity: (optional) The spi polarity (default=0)
405-
"""
406401
self._txt_scale = 0
407402
super(RA8875Display, self).__init__(spi, cs, rst, width, height,
408403
baudrate, polarity, phase)
@@ -787,15 +782,7 @@ def fill_round_rect(self, x, y, width, height, radius, color):
787782
self._rect_helper(x, y + radius, x + width, y + height - radius, color, True)
788783

789784
def _circle_helper(self, x, y, radius, color, filled):
790-
"""
791-
General Circle Drawing Function (HW Accelerated)
792-
793-
:param int x_center: The X coordinate of the center of the circle
794-
:param int y_center: The Y coordinate of the center of the circle
795-
:param int radius: The radius of the circle
796-
:param int color: The color of the circle
797-
:param bool filled: If the shape is filled
798-
"""
785+
"""General Circle Drawing Helper"""
799786
self._gfx_mode()
800787

801788
# Set X, Y, and Radius
@@ -812,16 +799,7 @@ def _circle_helper(self, x, y, radius, color, filled):
812799
self.wait_poll(reg.DCR, reg.DCR_CIRC_STATUS)
813800

814801
def _rect_helper(self, x, y, width, height, color, filled):
815-
"""
816-
General Rectangle Drawing Function (HW Accelerated)
817-
818-
:param int x: The X coordinate of the left side of the rectangle
819-
:param int y: The Y coordinate of the top side of the rectangle
820-
:param int width: The width of the rectangle
821-
:param int height: The height of the rectangle
822-
:param int color: The color of the rectangle
823-
:param bool filled: If the shape is filled
824-
"""
802+
"""General Rectangle Drawing Helper"""
825803
self._gfx_mode()
826804

827805
# Set X and Y
@@ -843,18 +821,7 @@ def _rect_helper(self, x, y, width, height, color, filled):
843821
self.wait_poll(reg.DCR, reg.DCR_LNSQTR_STATUS)
844822

845823
def _triangle_helper(self, x1, y1, x2, y2, x3, y3, color, filled):
846-
"""
847-
General Triangle Drawing Function (HW Accelerated)
848-
849-
:param int x1: The X coordinate of the first point of the triangle
850-
:param int y1: The Y coordinate of the first point of the triangle
851-
:param int x2: The X coordinate of the second point of the triangle
852-
:param int y2: The Y coordinate of the second point of the triangle
853-
:param int x3: The X coordinate of the third point of the triangle
854-
:param int y3: The Y coordinate of the third point of the triangle
855-
:param int color: The color of the triangle
856-
:param bool filled: If the shape is filled
857-
"""
824+
"""General Triangle Drawing Helper"""
858825
self._gfx_mode()
859826

860827
# Set Point Coordinates
@@ -878,18 +845,7 @@ def _triangle_helper(self, x1, y1, x2, y2, x3, y3, color, filled):
878845
self.wait_poll(reg.DCR, reg.DCR_LNSQTR_STATUS)
879846

880847
def _curve_helper(self, x_center, y_center, h_axis, v_axis, curve_part, color, filled):
881-
"""
882-
General Curve Drawing Function (HW Accelerated)
883-
This is basically a quarter of an ellipse.
884-
885-
:param int x_center: The X coordinate of the focal point of the curve
886-
:param int y_center: The Y coordinate of the focal point of the curve
887-
:param int h_axis: The length of the horizontal axis of the full ellipse
888-
:param int v_axis: The length of the vertical axis of the full ellipse
889-
:param byte curve_part: A number between 0-3 specifying the quarter section
890-
:param int color: The color of the curve
891-
:param bool filled: If the shape is filled
892-
"""
848+
"""General Curve Drawing Helper"""
893849
self._gfx_mode()
894850

895851
# Set X and Y Center
@@ -911,16 +867,7 @@ def _curve_helper(self, x_center, y_center, h_axis, v_axis, curve_part, color, f
911867
self.wait_poll(reg.ELLIPSE, reg.ELLIPSE_STATUS)
912868

913869
def _ellipse_helper(self, x_center, y_center, h_axis, v_axis, color, filled):
914-
"""
915-
General Ellipse Drawing Function (HW Accelerated)
916-
917-
:param int x_center: The X coordinate of the center of the ellipse
918-
:param int y_center: The Y coordinate of the center of the ellipse
919-
:param int h_axis: The length of the horizontal axis
920-
:param int v_axis: The length of the vertical axis
921-
:param int color: The color of the ellipse
922-
:param bool filled: If the shape is filled
923-
"""
870+
"""General Ellipse Drawing Helper"""
924871
self._gfx_mode()
925872

926873
# Set X and Y Center

0 commit comments

Comments
 (0)