@@ -168,7 +168,7 @@ def init(self, start_on=True):
168
168
self .turn_on (start_on )
169
169
self ._gpiox (True )
170
170
self ._pwm1_config (True , reg .PWM_CLK_DIV1024 )
171
- self ._pwm1_out (255 )
171
+ self .brightness (255 )
172
172
173
173
def pllinit (self ):
174
174
"""Init the Controller PLL"""
@@ -286,11 +286,7 @@ def sleep(self, sleep):
286
286
self .write_reg (reg .PWRR , reg .PWRR_DISPOFF if sleep else (reg .PWRR_DISPOFF | reg .PWRR_SLEEP ))
287
287
288
288
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"""
294
290
self .write_reg (reg .GPIOX , 1 if gpio_on else 0 )
295
291
296
292
def _pwm1_config (self , pwm_on , clock ):
@@ -302,7 +298,7 @@ def _pwm1_config(self, pwm_on, clock):
302
298
"""
303
299
self .write_reg (reg .P1CR , (reg .P1CR_ENABLE if pwm_on else reg .P1CR_DISABLE ) | (clock & 0xF ))
304
300
305
- def _pwm1_out (self , level ):
301
+ def brightness (self , level ):
306
302
"""
307
303
Configure the backlight brightness (0-255)
308
304
@@ -389,20 +385,19 @@ class RA8875Display(RA8875_Device):
389
385
"""
390
386
Drawing Class for the Display. Contains all the basic drawing functionality as well
391
387
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)
392
397
"""
393
398
#pylint: disable-msg=invalid-name,too-many-arguments
394
399
def __init__ (self , spi , cs , rst = None , width = 800 , height = 480 ,
395
400
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
- """
406
401
self ._txt_scale = 0
407
402
super (RA8875Display , self ).__init__ (spi , cs , rst , width , height ,
408
403
baudrate , polarity , phase )
@@ -787,15 +782,7 @@ def fill_round_rect(self, x, y, width, height, radius, color):
787
782
self ._rect_helper (x , y + radius , x + width , y + height - radius , color , True )
788
783
789
784
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"""
799
786
self ._gfx_mode ()
800
787
801
788
# Set X, Y, and Radius
@@ -812,16 +799,7 @@ def _circle_helper(self, x, y, radius, color, filled):
812
799
self .wait_poll (reg .DCR , reg .DCR_CIRC_STATUS )
813
800
814
801
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"""
825
803
self ._gfx_mode ()
826
804
827
805
# Set X and Y
@@ -843,18 +821,7 @@ def _rect_helper(self, x, y, width, height, color, filled):
843
821
self .wait_poll (reg .DCR , reg .DCR_LNSQTR_STATUS )
844
822
845
823
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"""
858
825
self ._gfx_mode ()
859
826
860
827
# Set Point Coordinates
@@ -878,18 +845,7 @@ def _triangle_helper(self, x1, y1, x2, y2, x3, y3, color, filled):
878
845
self .wait_poll (reg .DCR , reg .DCR_LNSQTR_STATUS )
879
846
880
847
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"""
893
849
self ._gfx_mode ()
894
850
895
851
# 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
911
867
self .wait_poll (reg .ELLIPSE , reg .ELLIPSE_STATUS )
912
868
913
869
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"""
924
871
self ._gfx_mode ()
925
872
926
873
# Set X and Y Center
0 commit comments