Edit: sussed it, largely to help below. It turns out, screen X/Y do not have to correlate to touch sensor X/Y and, even more strangely, the touch resolution does not necessarily match screen resolution! The latter was really borking things up due to a fudge in the old screen that was being replaced having higher touch resolution than screen.
Sorry in advance, this is long. I am very experience embedded engineer, done some basic LCD stuff before, but never a touch screen.
I am trying to update a system to use a new capacitive touch screen LCD for which the touch interface was previously SPI and is now I2C.
I should stress, I am successfully driving the screen via the RGB parallel interface - that bit has not changed. I have got the I2C interface up and running and when the screen is pressed I am getting the interrupt from the screen, able to read X1 and Y1 registers quite happily and I can see the values changing as I press different parts of the screen.
The datasheet [for this MI0430H1T-9] says it is 480 x 272 and when I read this touch data back I am getting minimum readings of about 33,9 and maximum of 464, 235. I assume the bezel is preventing me touching the very edges of the screen.
Now, the first issue is that I would expect the X to be reading from 0-480 and the Y from 0 to 272. However, X and Y seem to be the opposite way round to what I would expect.
I am reading registers 3 through to 6 inclusive. Datasheet says 3 and 4 are X position (12 bits plus event flags) and 5 and 6 contain Y position.
What I seem to get though is X data in registers 5 and 6. So, when I touch bottom left of the screen (the long side of the screen and therefore 480 pixels in length), registers 5 and 6 are changing, whereas registers 3 and 4 stay with approximately the same values as I move along the length of the screen.
On top of this, the bottom of the screen gives larger touch values and the top of the screen smaller touch values.
To summarise: bottom left of the screen I would expect to be 0,0, but gives me a touch reading of 259,33, top right gives me 39,458.
So, am I misunderstanding how these things work? The image from the datasheet below: Is that saying that, actually, Y touch data is 1-480?