#include "bma253_defs.h"

void i2c_check(uint8_t result,uint8_t* res){
    switch(result){
        case HAL_OK:
        printf("HAL_OK : %d Result : %02x\r\n",result,res[0]);
        break;
        case HAL_ERROR:
        printf("HAL_ERROR : %d\r\n",result);
        break;
        case HAL_BUSY:
        printf("HAL_BUSY : %d\r\n",result);
        break;
        case HAL_TIMEOUT:
        printf("HAL_TIMEOUT : %d\r\n",result);
        break;
    }

}
int bma253_get_chip_id(void){
    uint8_t res[1]={0,};
    i2c_check(HAL_I2C_Mem_Read(&hi2c2, (uint16_t)BMA253_DEFAULT_ADDR<<1, BMA253_REG_BGW_CHIPID,I2C_MEMADD_SIZE_8BIT, res, I2C_MEMADD_SIZE_8BIT, 1000 ),res);
}
