1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef __drv_iic_04_h__
- #define __drv_iic_04_h__
- #include <stdbool.h>
- #include <stdint.h>
- #include <string.h>
- #include "sdk_common.h"
- #include "SEGGER_RTT.h"
- #include "usr_config.h"
- #include "nrf_gpio.h"
- #if SHAREPIN_CONFIG == 1
- #define IIC_04_SCL_SET nrf_gpio_pin_write(PIN_SDA_1,1)
- #define IIC_04_SCL_CLR nrf_gpio_pin_write(PIN_SDA_1,0)
- #define IIC_04_SDA_SET nrf_gpio_pin_write(PIN_SCL_1,1)
- #define IIC_04_SDA_CLR nrf_gpio_pin_write(PIN_SCL_1,0)
- #define IIC_04_SDA_READ nrf_gpio_pin_read(PIN_SCL_1)
- #elif SHAREPIN_CONFIG == 2
- #define IIC_04_SCL_SET nrf_gpio_pin_write(PIN_QMC6310_SCL_01,1)
- #define IIC_04_SCL_CLR nrf_gpio_pin_write(PIN_QMC6310_SCL_01,0)
- #define IIC_04_SDA_SET nrf_gpio_pin_write(PIN_QMC6310_SDA_01,1)
- #define IIC_04_SDA_CLR nrf_gpio_pin_write(PIN_QMC6310_SDA_01,0)
- #define IIC_04_SDA_READ nrf_gpio_pin_read(PIN_QMC6310_SDA_01)
- #elif SHAREPIN_CONFIG == 3
- #define IIC_04_SCL_SET nrf_gpio_pin_write(PIN_SCL_MAG,1)
- #define IIC_04_SCL_CLR nrf_gpio_pin_write(PIN_SCL_MAG,0)
- #define IIC_04_SDA_SET nrf_gpio_pin_write(PIN_SDA_BACK,1)
- #define IIC_04_SDA_CLR nrf_gpio_pin_write(PIN_SDA_BACK,0)
- #define IIC_04_SDA_READ nrf_gpio_pin_read(PIN_SDA_BACK)
- #endif
- void IIC_04_Init(void);
- bool IIC_04_WriteBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
- bool IIC_04_ReadBytes(uint8_t add,uint8_t reg,uint8_t* p,uint8_t len);
- #endif
|