From daf2770d2848f08282afd14c64c39310b220666c Mon Sep 17 00:00:00 2001 From: thirdr Date: Tue, 20 Dec 2022 15:00:24 +0000 Subject: [PATCH] updated button LEDs --- .../inky_frame/inkylauncher/inky_helper.py | 34 +++---------------- .../examples/inky_frame/inkylauncher/main.py | 10 +++--- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/micropython/examples/inky_frame/inkylauncher/inky_helper.py b/micropython/examples/inky_frame/inkylauncher/inky_helper.py index 0a5f5fbc..7c2db56a 100644 --- a/micropython/examples/inky_frame/inkylauncher/inky_helper.py +++ b/micropython/examples/inky_frame/inkylauncher/inky_helper.py @@ -18,12 +18,6 @@ I2C_SCL_PIN = 5 i2c = PimoroniI2C(I2C_SDA_PIN, I2C_SCL_PIN, 100000) rtc = PCF85063A(i2c) -# set up the button LEDs -button_a_led = Pin(11, Pin.OUT) -button_b_led = Pin(12, Pin.OUT) -button_c_led = Pin(13, Pin.OUT) -button_d_led = Pin(14, Pin.OUT) -button_e_led = Pin(15, Pin.OUT) led_warn = Pin(6, Pin.OUT) # set up for the network LED @@ -65,23 +59,6 @@ def stop_network_led(): network_led_timer.deinit() network_led_pwm.duty_u16(0) - -# returns the id of the button that is currently pressed or -# None if none are -def pressed(): - if inky_frame.button_a.read(): - return inky_frame.button_a - if inky_frame.button_b.read(): - return inky_frame.button_b - if inky_frame.button_c.read(): - return inky_frame.button_c - if inky_frame.button_d.read(): - return inky_frame.button_d - if inky_frame.button_e.read(): - return inky_frame.button_e - return None - - def sleep(t): # Time to have a little nap until the next update rtc.clear_timer_flag() @@ -98,12 +75,11 @@ def sleep(t): # Turns off the button LEDs def clear_button_leds(): - button_a_led.off() - button_b_led.off() - button_c_led.off() - button_d_led.off() - button_e_led.off() - + inky_frame.button_a.led_off() + inky_frame.button_b.led_off() + inky_frame.button_c.led_off() + inky_frame.button_d.led_off() + inky_frame.button_e.led_off() def network_connect(SSID, PSK): # Enable the Wireless diff --git a/micropython/examples/inky_frame/inkylauncher/main.py b/micropython/examples/inky_frame/inkylauncher/main.py index 27dabce5..0d6ac90b 100644 --- a/micropython/examples/inky_frame/inkylauncher/main.py +++ b/micropython/examples/inky_frame/inkylauncher/main.py @@ -72,27 +72,27 @@ def launcher(): while True: if ih.inky_frame.button_a.read(): - ih.button_a_led.on() + ih.inky_frame.button_a.led_on() ih.update_state("nasa_apod") time.sleep(0.5) reset() if ih.inky_frame.button_b.read(): - ih.button_b_led.on() + ih.inky_frame.button_b.led_on() ih.update_state("word_clock") time.sleep(0.5) reset() if ih.inky_frame.button_c.read(): - ih.button_c_led.on() + ih.inky_frame.button_c.led_on() ih.update_state("daily_activity") time.sleep(0.5) reset() if ih.inky_frame.button_d.read(): - ih.button_d_led.on() + ih.inky_frame.button_d.led_on() ih.update_state("news_headlines") time.sleep(0.5) reset() if ih.inky_frame.button_e.read(): - ih.button_e_led.on() + ih.inky_frame.button_e.led_on() ih.update_state("random_joke") time.sleep(0.5) reset()