m5stack / M5Core2

M5Core2 Arduino Library
MIT License
263 stars 115 forks source link

use std::function callbacks for Button and Gesture events #102

Closed wswag closed 2 years ago

wswag commented 2 years ago

the original callback declarations offer limited usability in terms of instance methods and lambda expressions. furthermore, other parts of M5 lib already rely on functional lib so no new lib deps are added.

existing code is basically backwards compatible, however: delHandlers function won't work anymore if used with the (former) callback pointer. std::function instances cannot be compared concerning their underlying handler in a trivial way.

Tinyu-Zhao commented 2 years ago

Thanks,Merged