uint8_t myReadHandler(uint8_t index)
{
    switch(index)
    {
        case 0: return getTempSensorReading();
        case 1: return getLEDBrightness();

        default: return 0;
    }
}

void myWriteHandler(uint8_t index,uint8_t value)
{
    switch(index)
    {
        case 0: break; /* Do nothing as the temperature is read-only */
        case 1: setLEDBrightness(value); break;
        default: break;
    }
}

main()
{
    ...
    ...
    MTOUCH_Memory_i2cSetCustomAddrReadHandler(myReadHandler);
    MTOUCH_Memory_i2cSetCustomAddrWriteHandler(myWriteHandler);

    while(1)
    {
        if(MTOUCH_Service_Mainloop())
        {
              ...
         }
             /*Application Code*/
             ...
        }
    }
}