Ev3 touch sensor with lego BB adapter

How would I make a code for the ev3 touch sensor on my raspberry pi? Dexter Industries has already told me that their lego nxt touch sensor code wouldn’t work with my ev3, so how would I make code for it?

No worries. You don’t have to. There are already nxt touch sensor drivers for BrickPi.
Here’s the example.
BrickPi+:

BrickPi3:

Thanks graykevinb, but I do not have the BrickPi, only the Breadboard adapter.

@yousefgomaa: do you want to directly connect the EV3 touch sensor to the Raspberry Pi via the GPIO pins ?