backup
parent
24f2105fd6
commit
68e32687b2
|
@ -3,15 +3,15 @@
|
||||||
|
|
||||||
bool is_coulomb_ready()
|
bool is_coulomb_ready()
|
||||||
{
|
{
|
||||||
HAL_I2C_IsDeviceReady(hi2c1,COULOMB_ADDR);
|
// HAL_I2C_IsDeviceReady(hi2c1,COULOMB_ADDR);
|
||||||
}
|
}
|
||||||
coulomb_write_reg()
|
void coulomb_write_reg(uint8_t reg_addr,uint8_t *data)
|
||||||
{
|
{
|
||||||
HAL_I2C_IsDeviceReady(COULOMB_ADDR);
|
HAL_I2C_Master_Transmit(&hi2c1,((COULOMB_ADDR<<1) | COULOMB_WRITE_CMD), data, 1, 100);
|
||||||
}
|
}
|
||||||
coulomb_read_reg()
|
void coulomb_read_reg(uint8_t reg_addr,uint8_t *data)
|
||||||
{
|
{
|
||||||
|
HAL_I2C_Master_Receive(&hi2c1,((COULOMB_ADDR<<1) | COULOMB_READ_CMD), data, 1, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,17 @@
|
||||||
#ifndef _COULOMB_H_
|
#ifndef _COULOMB_H_
|
||||||
#define _COULOMB_H_
|
#define _COULOMB_H_
|
||||||
|
|
||||||
|
#include "stdbool.h"
|
||||||
|
|
||||||
#define COULOMB_ADDR 0x64 //device address
|
#define COULOMB_ADDR 0x64 //device address
|
||||||
#define COULOMB_WRITE_CMD 0x00 //coulomb write command
|
#define COULOMB_WRITE_CMD 0x00 //coulomb write command
|
||||||
#define COULOMB_READ_CMD 0x01 //coulomb read command
|
#define COULOMB_READ_CMD 0x01 //coulomb read command
|
||||||
|
|
||||||
|
|
||||||
|
bool is_coulomb_ready();
|
||||||
|
void coulomb_write_reg(uint8_t reg_addr,uint8_t *data);
|
||||||
|
void coulomb_read_reg(uint8_t reg_addr,uint8_t *data);
|
||||||
|
|
||||||
|
bool coulomb_read_alcc()
|
||||||
|
|
||||||
#endif /* _COULOMB_H_ */
|
#endif /* _COULOMB_H_ */
|
||||||
|
|
Loading…
Reference in New Issue