Lines Matching refs:i2c
18 i2c = I2C(0, I2C.MASTER, baudrate=400000) variable
20 i2c = I2C() variable
21 print(i2c)
22 i2c = I2C(mode=I2C.MASTER, baudrate=50000, pins=i2c_pins) variable
23 print(i2c)
25 i2c = I2C(0, I2C.MASTER, baudrate=100000) variable
26 print(i2c)
27 i2c = I2C(0, mode=I2C.MASTER, baudrate=400000) variable
28 print(i2c)
29 i2c = I2C(0, mode=I2C.MASTER, baudrate=400000, pins=i2c_pins) variable
30 print(i2c)
32 addr = i2c.scan()[0]
41 print(1 == i2c.writeto_mem(addr, 107, reg))
44 print(1 == i2c.readfrom_mem_into(addr, 107, reg)) # read the power management register 1
48 data = i2c.readfrom_mem(addr, 117, 1) # read the "who am I?" register
51 print(1 == i2c.readfrom_mem_into(addr, 117, reg)) # read the "who am I?" register again
55 data = i2c.readfrom_mem(addr, 116, 2) # read the "who am I?" register
59 print(2 == i2c.readfrom_mem_into(addr, 116, reg2)) # read the "who am I?" register again
63 print(1 == i2c.readfrom_mem_into(addr, 107, reg)) # read the power management register 1
67 print(1 == i2c.writeto_mem(addr, 107, reg))
69 i2c.readfrom_mem_into(addr, 107, reg)
74 print(1 == i2c.writeto_mem(addr, 107, reg))
76 i2c.readfrom_mem_into(addr, 107, reg)
81 print(1 == i2c.writeto_mem(addr, 107, reg))
85 print(2 == i2c.readfrom_mem_into(addr, 107, reg2))
92 print(2 == i2c.writeto_mem(addr, 107, reg2))
94 i2c.readfrom_mem_into(addr, 107, reg2_r)
99 print(1 == i2c.writeto_mem(addr, 107, reg))
104 print(1 == i2c.writeto(addr, reg, stop=False)) # just write the register address
106 print(1 == i2c.readfrom_into(addr, reg))
109 print(1 == i2c.writeto(addr, reg, stop=False)) # just write the register address
111 print(0x68 == i2c.readfrom(addr, 1)[0])
113 i2c.readfrom_mem_into(addr, 107, reg2)
119 print(2 == i2c.writeto(addr, reg2, stop=True)) # write the register address and the data
120 i2c.readfrom_mem_into(addr, 107, reg) # check it back
125 i2c = I2C(0, I2C.MASTER, baudrate=100000) variable
128 i2c = I2C(0, I2C.MASTER, baudrate=100000) variable
129 i2c.deinit()
130 print(i2c)
134 i2c.scan()
139 i2c.readfrom(addr, 1)
144 i2c.readfrom_into(addr, reg)
149 i2c.readfrom_mem_into(addr, 107, reg)
154 i2c.writeto(addr, reg, stop=False)
159 i2c.writeto_mem(addr, 107, reg)
164 i2c.readfrom_mem(addr, 116, 2)
174 i2c.init(baudrate=400000)
175 print(i2c)