mag_state.h 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <string.h>
  3. #include <stddef.h>
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. #include <furi_hal_resources.h>
  7. #include <furi_hal_rtc.h>
  8. #include <storage/storage.h>
  9. #include <flipper_format/flipper_format.h>
  10. #include "helpers/mag_types.h"
  11. #define MAG_STATE_HEADER "Mag State"
  12. #define MAG_STATE_VER 2
  13. #define MAG_STATE_DIR STORAGE_APP_DATA_PATH_PREFIX
  14. #define MAG_STATE_PATH MAG_STATE_DIR "/mag_state.txt"
  15. typedef struct {
  16. MagTxState tx;
  17. MagTrackState track;
  18. MagReverseState reverse;
  19. uint32_t us_clock;
  20. uint32_t us_interpacket;
  21. MagPin pin_input;
  22. MagPin pin_output;
  23. MagPin pin_enable;
  24. bool allow_uart;
  25. bool is_debug;
  26. uint8_t n_repeats;
  27. bool repeat_mode;
  28. } MagState;
  29. const GpioPin* mag_state_enum_to_pin(MagPin pin);
  30. bool mag_state_gpio_is_valid(MagState* state);
  31. void mag_state_gpio_reset(MagState* state);
  32. bool mag_state_load(MagState* out_state);
  33. void mag_state_save(MagState* state);