code: def check_state(self):
          
          if self.dpad:
              x_state, y_state = self.handle_dpad()
          else:
              x_state, y_state = self.handle_abs()
  
          # pylint: disable=no-member
          new_state = set((
              x_state,
              y_state,
              ('Key', 0x130, int(self.microbit.button_a.is_pressed())),
              ('Key', 0x131, int(self.microbit.button_b.is_pressed())),
              ('Key', 0x13a, int(self.microbit.pin0.is_touched())),
              ('Key', 0x133, int(self.microbit.pin1.is_touched())),
              ('Key', 0x134, int(self.microbit.pin2.is_touched())),
          ))
          events = new_state - self.state
          self.state = new_state
          return events
docs: Tracks differences in the device state.