gpio: [examples] update to use closures