#ifndef __SC7A20_H
#define __SC7A20_H

#include "stm32l4xx_hal.h"


#define SC7A20_ADDR 0x18 

// Register addresses
#define SC7A20_WHO_AM_I_REG       0x0F
#define SC7A20_CTRL_REG1          0x20
#define SC7A20_CTRL_REG2          0x21
#define SC7A20_CTRL_REG3          0x22
#define SC7A20_CTRL_REG4          0x23
#define SC7A20_CTRL_REG5          0x24
#define SC7A20_STATUS_REG         0x27

#define SC7A20_OUT_X_L            0x28
#define SC7A20_OUT_X_H            0x29
#define SC7A20_OUT_Y_L            0x2A
#define SC7A20_OUT_Y_H            0x2B
#define SC7A20_OUT_Z_L            0x2C
#define SC7A20_OUT_Z_H            0x2D

#define SC7A20_INT1_CFG        		0x30
#define SC7A20_INT1_SRC        		0x31
#define SC7A20_INT1_THS        		0x32
#define SC7A20_INT1_DURATION   		0x33
#define SC7A20_WHO_AM_I   				0x0F

#define SC7A20_DATA_OUT   				0xA8//连续读寄存器数值
#define SC7A20_DIG_CTRL   				0x57
// Functions

void SC7A20_Init(void);
void SC7A20_ReadXYZ(int16_t *x, int16_t *y, int16_t *z);
int16_t SC7A20_Class_12bitComplement(uint8_t msb, uint8_t lsb) ;


#endif // __SC7A20_H
