In the search for a good distance sensor for low to medium ranges (a few centimeters to one meter) I stumbled upon a quite new sensor based on ToF (Time of Flight) from STMicroelectronics: VL53L0X. It's in a quite small package and hard to hand solder, but there exists several carrier boards available including the one I am using made by Pololu. The small form factor it's good for integration in a final product.
Okay, so now I've got the hardware, but how to I read the distance? Well, ST made available an API for this sensor but it's quite complicated. Fortunately Pololu ported the API and made an Arduino library for what I needed to get from the sensor: the distance measurement. But, I needed to use it with PSoC not Arduino, so I googled for an PSoC library and found something on an Japanese blog, but it didn't work right away.
After some hours of debugging I managed to make the changes for the code to work. Attached, you'll find an example on my GitHub that uses the PSoC with an sensor attached via I2C and prints the distance value via serial.
If you want to use this sensor in your project all you need to do is include the VL53L0X.c and .h files, an I2C SCB and a timer.
Next I plan to get readings from multiple sensors.