openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.

25 lines
507 B

6 years ago
#!/usr/bin/env python3
# pylint: skip-file
6 years ago
import time
from smbus2 import SMBus
def setup_leon_fan():
bus = SMBus(7, force=True)
# https://www.nxp.com/docs/en/data-sheet/PTN5150.pdf
j = 0
for i in [0x1, 0x3 | 0, 0x3 | 0x08, 0x3 | 0x10]:
print("FAN SPEED", j)
ret = bus.read_i2c_block_data(0x3d, 0, 4)
print(ret)
ret = bus.write_i2c_block_data(0x3d, 0, [i])
time.sleep(1)
ret = bus.read_i2c_block_data(0x3d, 0, 4)
print(ret)
j += 1
bus.close()
setup_leon_fan()