mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
22 lines
427 B
Python
22 lines
427 B
Python
# -*- coding:utf-8 -*-
|
|
|
|
'''
|
|
change i2c frequency on raspberry:
|
|
1. edit /etc/modprobe.d
|
|
2. add line:
|
|
options i2c_bcm2708 baudrate=400000
|
|
'''
|
|
|
|
import smbus
|
|
|
|
class I2C:
|
|
|
|
def __init__(self, port):
|
|
self._bus = smbus.SMBus(port)
|
|
|
|
def writeBytes(self, addr, reg, buf):
|
|
self._bus.write_block_data(addr, reg, buf)
|
|
|
|
def readBytes(self, addr, reg, length):
|
|
return self._bus.read_block_data(addr, reg, length)
|