gtk2/linux blmc config tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3KB

  1. #ifndef _I2C_H_
  2. #define _I2C_H_
  3. #include <stdint.h>
  4. void i2c_enumerate_interfaces(void);
  5. void i2c_close(int fd);
  6. int i2c_open(const char *path);
  7. void i2c_set_address(int fd, int address);
  8. int i2c_isconnected(void);
  9. void i2c_cmd_bootloader(int fd);
  10. void i2c_cmd_application(int fd);
  11. void i2c_cmd_getinfo(int fd, char *buf, int size);
  12. void i2c_cmd_getsignature(int fd, unsigned char *buf, int size);
  13. struct blmc_parameter {
  14. uint16_t spinup_ticks;
  15. uint8_t spinup_tick;
  16. uint8_t spinup_step;
  17. uint8_t spinup_wait;
  18. uint8_t spinup_pwm;
  19. uint8_t pwm_min;
  20. uint8_t pwm_max;
  21. uint16_t current_limit;
  22. uint16_t current_max;
  23. uint16_t voltage_min;
  24. uint16_t crc16;
  25. };
  26. void i2c_cmd_getparameters(int fd, struct blmc_parameter *blmc);
  27. void i2c_cmd_setparameters(int fd, struct blmc_parameter *blmc, int persistent);
  28. int i2c_write_flash(int fd, char *data, int size, void (*progress_cb)(int pos, int size));
  29. int i2c_read_flash(int fd, char *data, int size, void (*progress_cb)(int pos, int size));
  30. int i2c_verify_flash(int fd, char *data, int size, void (*progress_cb)(int pos, int size));
  31. void i2c_cmd_setpwm(int fd, int pwm);
  32. struct blmc_status {
  33. uint8_t pwm_real;
  34. uint8_t pwm;
  35. uint16_t rpm;
  36. uint16_t current;
  37. uint16_t voltage;
  38. };
  39. void i2c_cmd_getstatus(int fd, struct blmc_status *status);
  40. #endif /* _I2C_H_ */