Reading data from 1 5v wire - how to?

Hi All

I have one data wire which is 5v. Its a weird custom protocol that i need to read data from depending on pin HIGH for x amount of microseconds.

In python i used the GPIO library and was easily able to read the pin state from pin 24.

Im trying to read the pin state on a D1 mini but im not sure how to do it. I need to be able to print if the state is high or low.

My next step would be to time how long in milliseconds each pin was high or low for. If the pin is HIGH for 0.4ms then the data is a "0" and if the pin is HIGH for 1.2ms then the data is a "1".

Ive been given this documentation that states the timing but i dont see this as accurate according to Piscope. I want to time the pin on the D1 mini to see if thats more accurate.

Thanks!

Here is a link to what i have found and what i need to achieve: