megatec.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * megatec.h
  3. *
  4. * Created on: 22.05.2017
  5. * Author: balbekova
  6. */
  7. #ifndef MEGATEC_H_
  8. #define MEGATEC_H_
  9. #include <stdbool.h>
  10. #include <stdint.h>
  11. #include <stdlib.h>
  12. //#define UPS_BUZZER_OFF
  13. #define K_EFFICIENCY 0.9
  14. #define AKB_VOLTAGE 12
  15. #define AKB_NUM_CELL 6
  16. #define VOLTRONIC_MODEL_LENGTH 15
  17. #define KSTAR_MODEL_LENGTH 10
  18. #define VOLTRONIC_VERSION_LENGTH 10
  19. #define VOLTRONIC_SN_LENGTH 14
  20. typedef enum{
  21. ups_status_req,
  22. ups_test_10sec,
  23. ups_test_low_bat,
  24. ups_test_time,
  25. ups_beep,
  26. ups_shutdown,
  27. ups_shutdown_restore,
  28. ups_cancel_shut_down,
  29. ups_cancel_test,
  30. ups_info,
  31. ups_rating_info,
  32. ups_remain_time_reg,
  33. ups_general_status_req,
  34. ups_akb_info,
  35. ups_model_req,
  36. ups_version_req,
  37. ups_version2_req,
  38. ups_serial_req,
  39. ups_protocol_id_req,
  40. ups_offline_status_req,
  41. ups_passw_req,
  42. ups_buzzer_cntrl,
  43. ups_mode_req,
  44. ups_remote_turn_on,
  45. MegaTec_cmd_max
  46. } cmdMegaTecEnums_t;
  47. typedef struct{
  48. float Freq_in;
  49. float VAC_in;
  50. float VAC_out;
  51. float Temp;
  52. float Vakb_curr;
  53. uint8_t Load;
  54. uint8_t SOC;
  55. uint8_t SOC_test;
  56. uint16_t work_time;
  57. uint32_t akb_work_time;
  58. uint32_t Alarm;
  59. uint8_t Status;
  60. uint8_t Mode;
  61. uint8_t Test_Status;
  62. char model[16];
  63. char vertion[22];
  64. char serial[15];
  65. uint8_t cnt_err_ups;
  66. bool Present;
  67. bool Flag_Present;
  68. }UPS_value_t;
  69. extern UPS_value_t UPS;
  70. extern uint16_t TimeParam;
  71. extern uint16_t TimeParam2;
  72. extern float TimeParamFloat;
  73. int ups_metac_service_pdu(cmdMegaTecEnums_t command);
  74. void ups_megatec_init(void);
  75. void UPSReadTestStatus(void);
  76. #endif /* MEGATEC_H_ */