A simple text based calibration utility to illustrate the basics of implementing a custom calibration program is available here.
A practical implementation will likely implement a GUI to show calibration targets to be touched.
Comments in the source code describe the implementation in detail.
The program also illustrates the use of event callbacks and setting a updd setting with TBApiSetSettingFromInt