Automatic gain adjustment in contactless communication systems