tm_i2c.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* - Version 1.0 - */
  2. #define TM_ADDR 0xC0
  3. #define TM_GET_TEMP 0x10
  4. #define TM_GET_CORE0 0x11
  5. #define TM_GET_CORE1 0x12
  6. #define TM_SET_OE 0x20
  7. #define TM_SET_MODE 0x21
  8. #define TM_SET_RED 0x22
  9. #define TM_SET_GREEN 0x23
  10. #define TM_GET_PORTB 0x30
  11. #define TM_SET_PORTB 0x31
  12. #define TM_GET_PINB 0x32
  13. #define TM_GET_PORTD 0x33
  14. #define TM_SET_PORTD 0x34
  15. #define TM_GET_PIND 0x35
  16. #define TM_GET_ADC 0x36
  17. #define TM_MODE_AUTO 0
  18. #define TM_MODE_MANUAL 1
  19. typedef struct {
  20. unsigned char cmd;
  21. unsigned char data_lsb;
  22. unsigned char data_msb;
  23. } tm_struct;
  24. int tm_i2c_init();
  25. void tm_i2c_close();
  26. unsigned int tm_i2c_req(int fd, unsigned char addr, unsigned char cmd, unsigned int data);
  27. float tm_i2c_Data2Temp(unsigned int ans);
  28. float tm_i2c_Data2Core(unsigned int ans);
  29. float tm_i2c_gettemp(unsigned char slot);
  30. float tm_i2c_getcore0(unsigned char slot);
  31. float tm_i2c_getcore1(unsigned char slot);
  32. void tm_i2c_set_oe(unsigned char slot);
  33. void tm_i2c_clear_oe(unsigned char slot);
  34. int tm_i2c_detect(unsigned char slot);
  35. unsigned char tm_i2c_slot2addr(unsigned char slot);