code.py
 1  # SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  import board
 6  import busio
 7  
 8  
 9  def is_hardware_SPI(clock_pin, data_pin):
10      try:
11          p = busio.SPI(clock_pin, data_pin)
12          p.deinit()
13          return True
14      except ValueError:
15          return False
16  
17  
18  # Provide the two pins you intend to use.
19  if is_hardware_SPI(board.A1, board.A2):
20      print("This pin combination is hardware SPI!")
21  else:
22      print("This pin combination isn't hardware SPI.")