Skip to content

Commit

Permalink
Use logging instead of print
Browse files Browse the repository at this point in the history
  • Loading branch information
tinue committed Oct 14, 2022
1 parent 1218258 commit e963d05
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apa102_pi/driver/apa102.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This is the main driver module for APA102 LEDs"""
from math import ceil
import logging

import adafruit_bitbangio as bitbangio
import board
Expand Down Expand Up @@ -93,6 +94,7 @@ def __init__(self, num_led=8, order='rgb', bus_method='spi', spi_bus=0, mosi=Non
:param global_brightness: This is a 5 bit value, i.e. from 0 to 31.
"""

logging.basicConfig(level=logging.DEBUG)
spi_ports = {}
for id_port, sclk_port, mosi_port, miso_port in spiPorts:
spi_ports[id_port] = {'SCLK': sclk_port, 'MOSI': mosi_port, 'MISO': miso_port}
Expand Down Expand Up @@ -140,11 +142,11 @@ def __init__(self, num_led=8, order='rgb', bus_method='spi', spi_bus=0, mosi=Non
self.spi.unlock()
# Debug
if self.use_ce:
print("Use software chip enable")
logging.debug("Use software chip enable")
if self.use_bitbang:
print("Use bitbang SPI")
logging.debug("Use bitbang SPI")
else:
print("Use hardware SPI")
logging.debug("Use hardware SPI")

@staticmethod
def check_input(bus_method, global_brightness, mosi, num_led, order, sclk, spi_bus, spi_ports):
Expand Down Expand Up @@ -366,5 +368,4 @@ def send_to_spi(self, data):

def dump_array(self):
"""For debug purposes: Dump the LED array onto the console."""

print(self.leds)
logging.debug(self.leds)

0 comments on commit e963d05

Please sign in to comment.