Please let me know if I have understood your requirement:
You have a master device and a slave PSoC 5 (EZI2C). You need to find out to which location the master writing to in the slave and also perform tasks every time based on what is written.
"my small embedded system needs to be able to trigger functions upon the read and write of certain locations in memory".
Which memory are you talking about?
1 of 1 people found this helpful
Can you try this following implementation?
EZI2C_GetActivity(void) : use this API and check if a write has been done, by checking the return value of this API. If it is EZI2C_STATUS_WRITE1, it means a write has been completed. Now inside this condition block, check if the buffer value equals your variable that points to the memory location and perform your application accordingly.
If at all there any many other similar variables in your design which the master can write to, then you can send one more control byte from the master something like if data is 01 then it is motor command, and then send your actual data. You can implement this using normal I2C also.
Also sub addressing means, the maximum data buffer size that can be accessed by the master. If it is 8 bits, it means the master can access 256 locations in the slave. If it is 16 bits, then it means it can access 65536 locations in the slave.
I recommend you to read functional description in the EZI2C component datasheet for more information on the buffers.
That is essentially what I ended up implementing. I set a default value to the written arrays and just checked whether it had changed. I initially thought that was a bit inelegant, but it seemed to be the only direction to go.
A small point about the EZI2C though: when the flag queried by GetActivity() is raised, that does not mean that the data has been fully copied into the buffer. There is a small amount of delay during which the data is moved into the buffer. This means that trying to read the data in the buffer as soon as the GetActivity() flag is raised will result in reading old data. Unfortunate that this is not listed as part of the data sheet.