lfrfid-debug-app-scene-tune.cpp 784 B

12345678910111213141516171819202122232425262728
  1. #include "lfrfid-debug-app-scene-tune.h"
  2. void LfRfidDebugAppSceneTune::on_enter(LfRfidDebugApp* app, bool need_restore) {
  3. app->view_controller.switch_to<LfRfidViewTuneVM>();
  4. api_hal_rfid_pins_read();
  5. api_hal_rfid_tim_read(125000, 0.5);
  6. api_hal_rfid_tim_read_start();
  7. }
  8. bool LfRfidDebugAppSceneTune::on_event(LfRfidDebugApp* app, LfRfidDebugApp::Event* event) {
  9. bool consumed = false;
  10. LfRfidViewTuneVM* tune = app->view_controller;
  11. if(tune->is_dirty()) {
  12. api_hal_rfid_set_read_period(tune->get_ARR());
  13. api_hal_rfid_set_read_pulse(tune->get_CCR());
  14. }
  15. return consumed;
  16. }
  17. void LfRfidDebugAppSceneTune::on_exit(LfRfidDebugApp* app) {
  18. api_hal_rfid_tim_read_stop();
  19. api_hal_rfid_tim_reset();
  20. api_hal_rfid_pins_reset();
  21. }