Exemplo n.º 1
0
// *************************************************************************************************
// @fn          cma_as_get_data
// @brief       Service routine to read acceleration values.
// @param       none
// @return      none
// *************************************************************************************************
void cma_as_get_data(u8 * data)
{
    // Exit if sensor is not powered up
    if ((AS_PWR_OUT & AS_PWR_PIN) != AS_PWR_PIN)
        return;

    // Store X/Y/Z acceleration data in buffer
    *(data + 0) = cma_as_read_register(0x06);
    *(data + 1) = cma_as_read_register(0x07);
    *(data + 2) = cma_as_read_register(0x08);
}
Exemplo n.º 2
0
void cma3000_set_Mode(unsigned char ucMode)
{
	unsigned char ucOldCntrl = cma_as_read_register(CMA3000_CTRL_REG);

	ucOldCntrl &= ~(CMA3000_MODE);		//	Clears up the mode bits
	//	Set up the mode in the right position
	ucMode <<= 2;
	unsigned char ucReg = ucOldCntrl + ucMode;
	cma_as_write_register(CMA3000_CTRL_REG, ucReg);
}
Exemplo n.º 3
0
unsigned char cma3000_get_status()
{
	return cma_as_read_register(CMA3000_STATUS_REG);
}