]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/microcontroller/generic_agnostic_board/i2c.py
a2cbc9c8b6ab8ff7f5dc0d12a65f16033609d75c
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / generic_agnostic_board / i2c.py
1 # SPDX-FileCopyrightText: 2024 Brent Rubell for Adafruit Industries
2 #
3 # SPDX-License-Identifier: MIT
4 """I2C Class for Generic Agnostic Board"""
5 from random import randint
6 #from .generic_agnostic_board.pin import generic_agnostic_board
7
8
9 class I2C:
10     """Custom I2C Class for a Generic Agnostic Board"""
11
12     def __init__(self, *, frequency=100000):
13         #self._generic_agnostic_board = generic_agnostic_board
14         self.freq = frequency
15
16     @staticmethod
17     def scan():
18         """Mocks an I2C scan and returns a list of 3 randomly generated
19         I2C addresses from 0x0 to 0x79.
20         """
21         # Generate a list of 3 randomly generated addresses from 0x0 to 0x79
22         address_list = []
23         for _ in range(3):
24             address_list.append(randint(0x0, 0x79))
25         return address_list