roam/20230516150136-mcp413x_415x_423x_425x.org

26 lines
680 B
Org Mode
Raw Permalink Normal View History

2023-05-27 18:11:10 +00:00
:PROPERTIES:
:ID: 44750563-aa76-450d-8c72-cba9c0e0f6cd
:END:
#+title: MCP413X/415X/423X/425X
7/8-Bit Single/Dual SPI Digital POT with Volatile Memory
* Commands
#+begin_src python
def cmd(address, command, data=0x0):
command_byte = (address << 4 & 0b11110000
| command << 2 & 0b00001100)
if command in (0b00, 0b11):
# Include data byte
return bytearray([command_byte | (0b11 & data >> 8), data & 0xff])
return bytearray([command_byte])
return [format(b, '#010b') for b in cmd(0x01, 0b11, 0x4ff)]
#+end_src
#+RESULTS:
| 0b00011100 | 0b11111111 |
* Resources :ATTACH:
-[[attachment:22060b.pdf][Data Sheet]]