drv_iic.h 669 B

1234567891011121314151617181920212223242526
  1. #ifndef __drv_iic_h__
  2. #define __drv_iic_h__
  3. #include <stdbool.h>
  4. #include <stdint.h>
  5. #include <string.h>
  6. #include "sdk_common.h"
  7. #include "SEGGER_RTT.h"
  8. #include "usr_config.h"
  9. #include "nrf_gpio.h"
  10. #define PIN_SCL 26
  11. #define PIN_SDA 27
  12. #define IIC_SCL_SET nrf_gpio_pin_write(PIN_SCL,1)
  13. #define IIC_SCL_CLR nrf_gpio_pin_write(PIN_SCL,0)
  14. #define IIC_SDA_SET nrf_gpio_pin_write(PIN_SDA,1)
  15. #define IIC_SDA_CLR nrf_gpio_pin_write(PIN_SDA,0)
  16. #define IIC_SDA_READ nrf_gpio_pin_read(PIN_SDA)
  17. void IIC_Init(void);
  18. bool IIC_WriteBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
  19. bool IIC_ReadBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
  20. #endif