tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/mma8653/registers.go (about)

     1  package mma8653
     2  
     3  // Constants/addresses used for I2C.
     4  
     5  // The I2C address which this device listens to.
     6  const Address = 0x1D
     7  
     8  // Registers. Names, addresses and comments copied from the datasheet.
     9  const (
    10  	STATUS       = 0x00 // Real time status
    11  	OUT_X_MSB    = 0x01 // top 8 bits of 10-bit sample
    12  	OUT_X_LSB    = 0x02 // bottom 2 bits of 10-bit sample
    13  	OUT_Y_MSB    = 0x03 // top 8 bits of 10-bit sample
    14  	OUT_Y_LSB    = 0x04 // bottom 2 bits of 10-bit sample
    15  	OUT_Z_MSB    = 0x05 // top 8 bits of 10-bit sample
    16  	OUT_Z_LSB    = 0x06 // bottom 2 bits of 10-bit sample
    17  	SYSMOD       = 0x0B // Current System Mode
    18  	INT_SOURCE   = 0x0C // Interrupt status
    19  	WHO_AM_I     = 0x0D // Device ID (0x5A)
    20  	XYZ_DATA_CFG = 0x0E // Dynamic Range Settings
    21  	PL_STATUS    = 0x10 // Landscape/Portrait orientation status
    22  	PL_CFG       = 0x11 // Landscape/Portrait configuration
    23  	PL_COUNT     = 0x12 // Landscape/Portrait debouncer counter
    24  	PL_BF_ZCOMP  = 0x13 // Back/Front, Z-Lock Trip threshold
    25  	PL_THS_REG   = 0x14 // Portrait to Landscape Trip angle
    26  	FF_MT_CFG    = 0x15 // Freefall/Motion functional block configuration
    27  	FF_MT_SRC    = 0x16 // Freefall/Motion event source register
    28  	FF_MT_THS    = 0x17 // Freefall/Motion threshold register
    29  	FF_MT_COUNT  = 0x18 // Freefall/Motion debounce counter
    30  	ASLP_COUNT   = 0x29 // Counter setting for Auto-SLEEP/WAKE
    31  	CTRL_REG1    = 0x2A // Data Rates, ACTIVE Mode
    32  	CTRL_REG2    = 0x2B // Sleep Enable, OS Modes, RST, ST
    33  	CTRL_REG3    = 0x2C // Wake from Sleep, IPOL, PP_OD
    34  	CTRL_REG4    = 0x2D // Interrupt enable register
    35  	CTRL_REG5    = 0x2E // Interrupt pin (INT1/INT2) map
    36  	OFF_X        = 0x2F // X-axis offset adjust
    37  	OFF_Y        = 0x30 // Y-axis offset adjust
    38  	OFF_Z        = 0x31 // Z-axis offset adjust
    39  )
    40  
    41  type DataRate uint8
    42  
    43  // Data rate constants.
    44  const (
    45  	DataRate800Hz DataRate = iota // 800Hz,  1.25ms interval
    46  	DataRate400Hz                 // 400Hz,  2.5ms  interval
    47  	DataRate200Hz                 // 200Hz,  5ms    interval
    48  	DataRate100Hz                 // 100Hz,  10ms   interval
    49  	DataRate50Hz                  // 50Hz,   20ms   interval
    50  	DataRate12Hz                  // 12.5Hz, 80ms   interval
    51  	DataRate6Hz                   // 6.25Hz, 160ms  interval
    52  	DataRate2Hz                   // 1.56Hz, 640ms  interval
    53  )
    54  
    55  type Sensitivity uint8
    56  
    57  // Sensitivity constants.
    58  const (
    59  	Sensitivity2G Sensitivity = iota
    60  	Sensitivity4G
    61  	Sensitivity8G
    62  )