Emulating synaptic response in n- and p-channel MoS2 transistors by utilizing charge trapping dynamics