Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix to make buttons and leds compatible with pca10056 #8037

Merged
merged 3 commits into from
Jun 8, 2023

Conversation

jpconstantineau
Copy link

Minor updates to make code for buttons and LEDs running on the PCA10056 compatible with the PCA10100. Focus was to make this code snippet portable between the two boards (They are practically identical...):

import board
from digitalio import DigitalInOut, Direction, Pull
import time

# LED setup.

led1 = DigitalInOut(board.LED1)
led2 = DigitalInOut(board.LED2)
led3 = DigitalInOut(board.LED3)
led4 = DigitalInOut(board.LED4)
led1.direction = Direction.OUTPUT
led2.direction = Direction.OUTPUT
led3.direction = Direction.OUTPUT
led4.direction = Direction.OUTPUT

# Button setup.

button1 = DigitalInOut(board.BUTTON1)
button2 = DigitalInOut(board.BUTTON2)
button3 = DigitalInOut(board.BUTTON3)
button4 = DigitalInOut(board.BUTTON4)

button1.pull = Pull.UP
button2.pull = Pull.UP
button3.pull = Pull.UP
button4.pull = Pull.UP

while True:
    led1.value = button1.value
    led2.value = button2.value
    led3.value = button3.value
    led4.value = button4.value

    time.sleep(0.1)

changes:

  • Remove conflicting LED usage as these should be left for user (just like the pca10056)
  • Add button definition for Button1 and button2 to be identical to pca10056.

Notes
Did not remove redundant "Default" definitions for backward compatibility
Did not update data pins definitions to match the structure of the PCA10056.

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion. Otherwise good. Thanks!

ports/nrf/boards/pca10100/mpconfigboard.h Show resolved Hide resolved
Copy link
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requested change done -- thanks!

@dhalbert dhalbert merged commit 6cf7e45 into adafruit:main Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants