ADRS2040U_i2c.h 771 B

12345678910111213141516171819202122232425262728293031
  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, // ADCフリーラン開始
  19. ADRS2040_CMD_ADC_STOP, // ADCフリーラン停止
  20. ADRS2040_CMD_SET_RATE, // サンプリングレート設定
  21. ADRS2040_CMD_GET_COUNT, // バッファデータ数
  22. ADRS2040_CMD_GET_VALUE, // ADCデータ読み取り
  23. };
  24. #endif