I think the IR unit sample code was only intended to work between two M5stack ir devices. As frequencies range considerably for each device and each command e.g. play, pause on a media player, it's impossible to have an example IR code that works for all devices.
I'm still unfamiliar with the commands of the IR module, as it is not documented yet, but I suggest playing around with the timer and peripheral functions.
If you are not sure what you are doing you could try some of the arduino ir code as it seems better documented.
perhaps this example could get you started https://www.hackster.io/alessandro-polselli/turn-m5stickc-into-universal-ir-remote-home-automation-d3ec0d