]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/microcontroller/fake_mcp2221/fake_mcp2221.py
blacken
[Adafruit_Blinka-hackapet.git] / src / adafruit_blinka / microcontroller / fake_mcp2221 / fake_mcp2221.py
1 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
2 #
3 # SPDX-License-Identifier: MIT
4 """Chip Definition for MCP2221"""
5
6 import os
7 import time
8 import atexit
9
10 import hid
11
12
13 class MCP2221:
14     """MCP2221 Device Class Definition"""
15
16     def __init__(self):
17         pass  # This is a "fake" implementation
18
19     def close(self):
20         """Close the hid device. Does nothing if the device is not open."""
21         pass
22
23     def __del__(self):
24         # try to close the device before destroying the instance
25         pass
26
27     def _hid_xfer(self, report, response=True):
28         """Perform HID Transfer"""
29         return None
30
31     # ----------------------------------------------------------------
32     # MISC
33     # ----------------------------------------------------------------
34     def gp_get_mode(self, pin):
35         """Get Current Pin Mode"""
36         pass
37
38     def gp_set_mode(self, pin, mode):
39         """Set Current Pin Mode"""
40         pass
41
42     def _pretty_report(self, register):
43         pass
44
45     def _status_dump(self):
46         pass
47
48     def _sram_dump(self):
49         pass
50
51     def _reset(self):
52         pass
53
54     # ----------------------------------------------------------------
55     # GPIO
56     # ----------------------------------------------------------------
57     def gpio_set_direction(self, pin, mode):
58         """Set Current GPIO Pin Direction"""
59         pass
60
61     def gpio_set_pin(self, pin, value):
62         """Set Current GPIO Pin Value"""
63         pass
64
65     def gpio_get_pin(self, pin):
66         """Get Current GPIO Pin Value"""
67         pass
68
69     # ----------------------------------------------------------------
70     # I2C
71     # ----------------------------------------------------------------
72     def _i2c_status(self):
73         pass
74
75     def _i2c_state(self):
76         pass
77
78     def _i2c_cancel(self):
79         pass
80
81     # pylint: disable=too-many-arguments,too-many-branches
82     def _i2c_write(self, cmd, address, buffer, start=0, end=None):
83         pass
84
85     def _i2c_read(self, cmd, address, buffer, start=0, end=None):
86         pass
87
88     # pylint: enable=too-many-arguments
89     def _i2c_configure(self, baudrate=100000):
90         """Configure I2C"""
91         pass
92
93     def i2c_writeto(self, address, buffer, *, start=0, end=None):
94         """Write data from the buffer to an address"""
95         pass
96
97     def i2c_readfrom_into(self, address, buffer, *, start=0, end=None):
98         """Read data from an address and into the buffer"""
99         pass
100
101     def i2c_writeto_then_readfrom(
102         self,
103         address,
104         out_buffer,
105         in_buffer,
106         *,
107         out_start=0,
108         out_end=None,
109         in_start=0,
110         in_end=None,
111     ):
112         """Write data from buffer_out to an address and then
113         read data from an address and into buffer_in
114         """
115         pass
116
117     def i2c_scan(self, *, start=0, end=0x79):
118         """Perform an I2C Device Scan"""
119         pass
120
121     # ----------------------------------------------------------------
122     # ADC
123     # ----------------------------------------------------------------
124     def adc_configure(self, vref=0):
125         """Configure the Analog-to-Digital Converter"""
126         pass
127
128     def adc_read(self, pin):
129         """Read from the Analog-to-Digital Converter"""
130         pass
131
132     # ----------------------------------------------------------------
133     # DAC
134     # ----------------------------------------------------------------
135     def dac_configure(self, vref=0):
136         """Configure the Digital-to-Analog Converter"""
137         pass
138
139     # pylint: disable=unused-argument
140     def dac_write(self, pin, value):
141         """Write to the Digital-to-Analog Converter"""
142         pass
143
144     # pylint: enable=unused-argument
145
146
147 mcp2221 = MCP2221()