-
Notifications
You must be signed in to change notification settings - Fork 0
I2C Module
alvaoze edited this page Jun 27, 2024
·
1 revision
speed = HardsploitConstant.I2C.KHZ_100
i2c = HardsploitI2c(speed, hardsploit_api)| Parametter | Type | Range |
|---|---|---|
| speed | constant | HardsploitConstant.I2C.KHZ_100 |
| hardsploit_api | instance of HardsploitAPI() |
This function performs an I2C address scan.
i2c.i2c_scan()Return an array with 256 items
I2C_CLK -> A0
SDA -> A1
This function interacts with an I2C device by constructing a packet from a given payload.
i2c.i2c_interact(payload)| Parametter | Type | Range |
|---|---|---|
| payload | array of byte | max 4000 bytes |
I2C_CLK -> A0
SDA -> A1
This function performs a dump of data from an I2C device.
i2c.i2c_generic_dump(i2c_base_address,
start_address,
stop_address,
max_size)
| Parametter | Type | Range |
|---|---|---|
| i2c_base_address | byte | 0 to 255 (write address = base address) |
| start_address | integer | 0 to sizeMax-1 |
| stop_address | integer | 0 to sizeMax-1 |
| max_size | integer | 2^32 about 4giga |
Tips: Number of byte for address is calculatated by sizeMax
Receive data in callback data for each packet and can be stored in database, file etc for large memory is useful.
This allow you to import data into an I2C device.
i2c.i2c_generic_import(i2c_base_address,
start_address,
page_size,
memory_size,
data_file,
write_page_latency)
| Parametter | Type | Range |
|---|---|---|
| i2c_base_address | byte | 0 to 255 (write address = base address) |
| start_address | integer | 0 to sizeMax-1 |
| page_size | integer | 0 to sizeMax-1 |
| memory_size | integer | 2^32 about 4giga |
| data_size | string | Path of file |
| write_page_latency | integer | in second, 2ms = 0.002 |