ADRS2040U_i2c.h 649 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _ADRS2040U_I2C_H
  2. #define _ADRS2040U_I2C_H 1
  3. #define DEBUG_PRINT(...) if(_DEBUG){printf(__VA_ARGS__);}
  4. #define _DEBUG 1
  5. // ADRS2040UのSPI GPIO
  6. #define SPI_MOSI 4
  7. #define SPI_SCK 2
  8. #define SPI_MISO 3
  9. #define SPI_CS 5
  10. // ADRS2040U I2Cアドレス
  11. #define I2C0_SLAVE_ADDR 0x41
  12. // I2Cで使うGPIO
  13. #define GPIO_SDA0 0
  14. #define GPIO_SCK0 1
  15. // I2Cコマンド列挙
  16. enum ADRS2040_CMD {
  17. ADRS2040_CMD_INVALID,
  18. ADRS2040_CMD_ADC_START,
  19. ADRS2040_CMD_ADC_STOP,
  20. ADRS2040_CMD_SELECT_INPUT,
  21. ADRS2040_CMD_SET_RATE,
  22. ADRS2040_CMD_GET_INPUT,
  23. ADRS2040_CMD_GET_RATE,
  24. ADRS2040_CMD_GET_COUNT,
  25. };
  26. #endif