سلام
کسی میدونه چیکار کنم این ارور رو نده
ADXL345.h(81): error: #167: argument of type "uint8_t" is incompatible with parameter of type "uint8_t *"
ارور برای این تابع هست
اینم تابع i2c_read
کسی میدونه چیکار کنم این ارور رو نده
ADXL345.h(81): error: #167: argument of type "uint8_t" is incompatible with parameter of type "uint8_t *"
ارور برای این تابع هست
کد:
uint32_t read_i2c(uint8_t BusAddres , uint8_t Reg , uint32_t Ack )
{
uint8_t Data;
I2C_Start();
I2C_Write(BusAddres);
I2C_Write(Reg);
I2C_Start();
I2C_Write(BusAddres + 1);
delay_ms(1);
I2C_Read(Ack,Data); این خط ارور میده
I2C_Stop();
return Data;
}
کد:
uint32_t I2C_Read (uint32_t ack, uint8_t *byte) {
uint32_t stat;
if (ack) LPC_I2C0->I2CONSET = I2C_CONSET_AA;
else LPC_I2C0->I2CONCLR = I2C_CONCLR_AAC;
LPC_I2C0->I2CONCLR = I2C_CONCLR_STAC | I2C_CONCLR_SIC;
stat = (ack) ? (I2C_STAT_DRA) : (I2C_STAT_DRNA);
if (WaitStatus (stat) == 0) {
*byte = LPC_I2C0->I2DAT;
return (0);
}
return (1);
}








دیدگاه