roam/20230516150136-mcp413x_415x_423x_425x.org
2023-05-27 14:11:10 -04:00

680 B

MCP413X/415X/423X/425X

7/8-Bit Single/Dual SPI Digital POT with Volatile Memory

Commands

  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)]
0b00011100 0b11111111

Resources   ATTACH