mirror of
https://github.com/jayofelony/pwnagotchi.git
synced 2025-07-01 18:37:27 -04:00
DFRobot V2 screen
This commit is contained in:
21
pwnagotchi/ui/hw/libs/dfrobot/v2/i2c.py
Normal file
21
pwnagotchi/ui/hw/libs/dfrobot/v2/i2c.py
Normal file
@ -0,0 +1,21 @@
|
||||
# -*- 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)
|
Reference in New Issue
Block a user