Hi Rohan,
I can suggest you a way to get code for Schmitt trigger. There is feature called Code generation in MATLAB , with this you can get a C code for the Schmitt trigger block available in SIMULINK.
With this way you cannot get the code completely but you can get the logic how it is implemented and start writing your own code which may serve your purpose.