pub fn lock<R>(&self, f: impl FnOnce() -> R) -> R {
        let _token = LockGuard::new(self);
        f()
    }
Runs the callback with this lock locked.

Note that this function is not reentrant, calling it reentrantly will
panic.
esp-hal/src/sync.rs