Public Member Functions | |
| def | __init__ |
| def | cancel |
Public Attributes | |
| bit | |
| byte | |
| cbA | |
| cbB | |
| FALLING | |
| gSCL | |
| gSDA | |
| in_data | |
| oldSCL | |
| oldSDA | |
| pi | |
| RISING | |
| STEADY | |
| transact | |
Private Member Functions | |
| def | _cb |
| def | _parse |
A class to passively monitor activity on an I2C bus. This should work for an I2C bus running at 100kbps or less. You are unlikely to get any usable results for a bus running any faster.
Definition at line 7 of file I2C_sniffer.py.
| def I2C_sniffer.sniffer.__init__ | ( | self, | |
| pi, | |||
| SCL, | |||
| SDA, | |||
set_as_inputs = True |
|||
| ) |
Instantiate with the Pi and the gpios for the I2C clock and data lines. If you are monitoring one of the Raspberry Pi buses you must set set_as_inputs to False so that they remain in I2C mode. The pigpio daemon should have been started with a higher than default sample rate. For an I2C bus rate of 100Kbps sudo pigpiod -s 2 should work. A message is printed for each I2C transaction formatted with "[" for the START "XX" two hex characters for each data byte "+" if the data is ACKd, "-" if the data is NACKd "]" for the STOP E.g. Reading the X, Y, Z values from an ADXL345 gives: [A6+32+] [A7+01+FF+F2+FF+06+00-]
Definition at line 14 of file I2C_sniffer.py.
| def I2C_sniffer.sniffer._cb | ( | self, | |
| gpio, | |||
| level, | |||
| tick | |||
| ) | [private] |
Check which line has altered state (ignoring watchdogs) and call the parser with the new state.
Definition at line 119 of file I2C_sniffer.py.
| def I2C_sniffer.sniffer._parse | ( | self, | |
| SCL, | |||
| SDA | |||
| ) | [private] |
Accumulate all the data between START and STOP conditions into a string and output when STOP is detected.
Definition at line 63 of file I2C_sniffer.py.
| def I2C_sniffer.sniffer.cancel | ( | self | ) |
Cancel the I2C callbacks.
Definition at line 141 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.
Definition at line 37 of file I2C_sniffer.py.