def init(): I2C.set_IO_DIR(port_expand_ALU_addr, 'A', 0x00) # set Port A as output I2C.set_IO_DIR(port_expand_ALU_addr, 'B', 0b11111110) # set C_IN bit as output, C_OUT, OVERFLOW as input I2C.set_IO_POL(port_expand_ALU_addr, 'B', 0x00) # set to non-inverting logic reset_ALU()
def init(): I2C.set_IO_DIR(port_expand_ADD_addr, 'A', 0xFF) # set port A as input I2C.set_IO_POL(port_expand_ADD_addr, 'A', 0x00) # set port A logic to non-inverting I2C.set_IO_DIR(port_expand_ADD_addr, 'B', 0x00) # set port B as output I2C.write_data(port_expand_ADD_addr, 'B', 0b00000011) # disable both buffers, drive clock low