drv_iic_05.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef __drv_iic_05_h__
  2. #define __drv_iic_05_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. #if SHAREPIN_CONFIG == 1 || SHAREPIN_CONFIG == 2
  11. #define IIC_05_SCL_SET nrf_gpio_pin_write(PIN_SCL_1,1)
  12. #define IIC_05_SCL_CLR nrf_gpio_pin_write(PIN_SCL_1,0)
  13. #define IIC_05_SDA_SET nrf_gpio_pin_write(PIN_SDA_1,1)
  14. #define IIC_05_SDA_CLR nrf_gpio_pin_write(PIN_SDA_1,0)
  15. #define IIC_05_SDA_READ nrf_gpio_pin_read(PIN_SDA_1)
  16. #elif SHAREPIN_CONFIG == 3
  17. #define IIC_05_SCL_SET nrf_gpio_pin_write(PIN_SCL_MAG,1)
  18. #define IIC_05_SCL_CLR nrf_gpio_pin_write(PIN_SCL_MAG,0)
  19. #define IIC_05_SDA_SET nrf_gpio_pin_write(PIN_SDA_FRONT,1)
  20. #define IIC_05_SDA_CLR nrf_gpio_pin_write(PIN_SDA_FRONT,0)
  21. #define IIC_05_SDA_READ nrf_gpio_pin_read(PIN_SDA_FRONT)
  22. #endif
  23. void IIC_05_Init(void);
  24. bool IIC_05_WriteBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
  25. bool IIC_05_ReadBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
  26. #endif