potentiometer.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef POTENTIOMETER_H
  2. #define POTENTIOMETER_H
  3. #include "pci.h"
  4. #define TPL0202_CMD_BITP 12
  5. #define TPL0202_CMD_BITM (0x3 << TPL0202_CMD_BITP)
  6. #define TPL0202_CMD_WR_WIPER_REG_ENUM 0x0
  7. #define TPL0202_CMD_WR_NV_REG_ENUM 0x1
  8. #define TPL0202_CMD_COPY_WIPER_TO_NV_ENUM 0x2
  9. #define TPL0202_CMD_COPY_NV_TO_WIPER_ENUM 0x3
  10. #define TPL0202_ADR_BITP 8
  11. #define TPL0202_ADR_BITM (0x3<<TPL0202_ADR_BITP)
  12. #define TPL0202_ADR_A_ENUM 0x1
  13. #define TPL0202_ADR_B_ENUM 0x2
  14. #define TPL0202_ADR_AB_ENUM 0x3
  15. #define TPL0202_DATA_BITP 0
  16. #define TPL0202_DATA_BITM (0xFF<<TPL0202_DATA_BITP)
  17. extern uint32_t pot_array [2];
  18. extern uint32_t pot_ch_a_file;
  19. extern uint32_t pot_ch_b_file;
  20. void potentiometer_set(reg_addr_pci* pci_bar_1, uint8_t pot_val_ch_a, uint8_t pot_val_ch_b);
  21. void potentiometer_set_qspi(uint8_t pot_offset, uint8_t pot_slope);
  22. void potentiometer_set_offset(reg_addr_pci* pci_bar_1, uint8_t pot_offset);
  23. void potentiometer_set_slope(reg_addr_pci* pci_bar_1, uint8_t pot_slope);
  24. void read_pot_file (const char* filename);
  25. void set_pot_values(double freq);
  26. #endif //POTENTIOMETER_H