]> Repositories - Adafruit_Blinka-hackapet.git/blob - src/adafruit_blinka/microcontroller/fake_mcp2221/fake_mcp2221.py
rm examples
[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
28     def _hid_xfer(self, report, response=True):
29         """Perform HID Transfer"""
30         return None
31
32     # ----------------------------------------------------------------
33     # MISC
34     # ----------------------------------------------------------------
35     def gp_get_mode(self, pin):
36         """Get Current Pin Mode"""
37         pass
38
39     def gp_set_mode(self, pin, mode):
40         """Set Current Pin Mode"""
41         pass
42
43     def _pretty_report(self, register):
44         pass
45
46     def _status_dump(self):
47         pass
48
49     def _sram_dump(self):
50         pass
51
52     def _reset(self):
53         pass
54
55     # ----------------------------------------------------------------
56     # GPIO
57     # ----------------------------------------------------------------
58     def gpio_set_direction(self, pin, mode):
59         """Set Current GPIO Pin Direction"""
60         pass
61
62     def gpio_set_pin(self, pin, value):
63         """Set Current GPIO Pin Value"""
64         pass
65
66     def gpio_get_pin(self, pin):
67         """Get Current GPIO Pin Value"""
68         pass
69
70
71     # ----------------------------------------------------------------
72     # I2C
73     # ----------------------------------------------------------------
74     def _i2c_status(self):
75         pass
76
77     def _i2c_state(self):
78         pass
79
80     def _i2c_cancel(self):
81         pass
82
83     # pylint: disable=too-many-arguments,too-many-branches
84     def _i2c_write(self, cmd, address, buffer, start=0, end=None):
85         pass
86
87     def _i2c_read(self, cmd, address, buffer, start=0, end=None):
88         pass
89
90     # pylint: enable=too-many-arguments
91     def _i2c_configure(self, baudrate=100000):
92         """Configure I2C"""
93         pass
94
95     def i2c_writeto(self, address, buffer, *, start=0, end=None):
96         """Write data from the buffer to an address"""
97         pass
98
99     def i2c_readfrom_into(self, address, buffer, *, start=0, end=None):
100         """Read data from an address and into the buffer"""
101         pass
102
103     def i2c_writeto_then_readfrom(
104         self,
105         address,
106         out_buffer,
107         in_buffer,
108         *,
109         out_start=0,
110         out_end=None,
111         in_start=0,
112         in_end=None,
113     ):
114         """Write data from buffer_out to an address and then
115         read data from an address and into buffer_in
116         """
117         pass
118
119     def i2c_scan(self, *, start=0, end=0x79):
120         """Perform an I2C Device Scan"""
121         pass
122
123
124     # ----------------------------------------------------------------
125     # ADC
126     # ----------------------------------------------------------------
127     def adc_configure(self, vref=0):
128         """Configure the Analog-to-Digital Converter"""
129         pass
130
131     def adc_read(self, pin):
132         """Read from the Analog-to-Digital Converter"""
133         pass
134
135     # ----------------------------------------------------------------
136     # DAC
137     # ----------------------------------------------------------------
138     def dac_configure(self, vref=0):
139         """Configure the Digital-to-Analog Converter"""
140         pass
141
142     # pylint: disable=unused-argument
143     def dac_write(self, pin, value):
144         """Write to the Digital-to-Analog Converter"""
145         pass
146
147     # pylint: enable=unused-argument
148
149
150 mcp2221 = MCP2221()