Closed eecharlie closed 7 years ago
Hi eecharlie,
You've edited your post, so you've probably figured out already that reading and writing always goes by 16byte blocks (see §9.7 of the NT3H1101 datasheet).
To my humble knowledge, you have no other option than to read out the 16bytes of the configuration block, change the values you want and write them all back again.
I guess you won't rewrite the configuration block often. Once you do, how big is the chance that a bit will be written incorrectly? If you mess up the I²C-address, you could find it back by using the "Ntag::detectI2cDevices()" function.
You're correct. I learned the hard way that the I2C address is stored in the upper 7 bits of byte 0.
What's frustrating and risky about the operation of rewriting the CONFIG block is that byte 0 reads as a different value than it must be written.
Would you be interested in a contributed utility function that safely rewrites the config block for the purpose of setting a new value for the Container Class? (And a down-the-road wish list item would be the lock bits) There are probably intelligent defaults for the CC as a function of which specific device is being used.
Hi eecharlie,
The reason for creating this repository on github is for other people to benefit from it. If you have suggestions for improvements, you can let me know. I will merge them with this repository if they seem fine. Currently I'm working on another project, so it can take some time to evaluate things...
How is it possible to change the last 2 pages (last 8 bytes) of the configuration block, 0, without rewriting the whole block and incurring the danger of reprogramming the I2C address?