embedded/projects/osp-steval-mki109v2/sources/app/i2c_slavecomm_t.c
static void SendSensorData( uint32_t sensorId, MsgSensorData *pMsg )
{
    ShMotionSensor_t sensData;

    switch (sensorId)
    {
    case AP_PSENSOR_ACCELEROMETER_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_ACCEL;
        sensData.TimeStamp.timestamp40 = AccelTimeExtend & 0xFF;
        break;

    case AP_PSENSOR_MAGNETIC_FIELD_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_MAG;
        sensData.TimeStamp.timestamp40 = MagTimeExtend & 0xFF;
        break;

    case AP_PSENSOR_GYROSCOPE_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_GYRO;
        sensData.TimeStamp.timestamp40 = GyroTimeExtend & 0xFF;
        break;

    default:
        return; //Unsupported sensor

    }

    sensData.Data[0] = -pMsg->X;
    sensData.Data[1] = pMsg->Y;
    sensData.Data[2] = -pMsg->Z;
    sensData.TimeStamp.timestamp32 = pMsg->timeStamp;

    SlaveRegMap.irq_cause = SH_MSG_IRQCAUSE_NEWMSG;
    SlaveRegMap.read_len = sizeof(sensData) + 1;
    memcpy( &SlaveRegMap.rd_mem[1], &sensData, sizeof(sensData) );
    /*  Assert interrupt request to Host */
    SensorHubIntHigh();
    /* Wait for I2C transfer to finish */
    I2C_Slave_Wait_Completion();
}
/****************************************************************************************************
 * @fn      SendSensorData
 *          Sends 3-axis sensor data over the I2C slave interface
 *
 ***************************************************************************************************/
@fn      SendSensorData
Sends 3-axis sensor data over the I2C slave interface
@fn SendSensorData Sends 3 - axis sensor data over the I2C slave interface
static void SendSensorData( uint32_t sensorId, MsgSensorData *pMsg )
{
    ShMotionSensor_t sensData;
    switch (sensorId)
    {
    case AP_PSENSOR_ACCELEROMETER_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_ACCEL;
        sensData.TimeStamp.timestamp40 = AccelTimeExtend & 0xFF;
        break;
    case AP_PSENSOR_MAGNETIC_FIELD_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_MAG;
        sensData.TimeStamp.timestamp40 = MagTimeExtend & 0xFF;
        break;
    case AP_PSENSOR_GYROSCOPE_RAW:
        SlaveRegMap.rd_mem[0] = SH_MSG_TYPE_ABS_GYRO;
        sensData.TimeStamp.timestamp40 = GyroTimeExtend & 0xFF;
        break;
    default:
        return; 
    }
    sensData.Data[0] = -pMsg->X;
    sensData.Data[1] = pMsg->Y;
    sensData.Data[2] = -pMsg->Z;
    sensData.TimeStamp.timestamp32 = pMsg->timeStamp;
    SlaveRegMap.irq_cause = SH_MSG_IRQCAUSE_NEWMSG;
    SlaveRegMap.read_len = sizeof(sensData) + 1;
    memcpy( &SlaveRegMap.rd_mem[1], &sensData, sizeof(sensData) );
    SensorHubIntHigh();
    I2C_Slave_Wait_Completion();
}
static void SendSensorData ( uint32_t sensorId , MsgSensorData * pMsg ) { ShMotionSensor_t sensData ; switch ( sensorId ) { case AP_PSENSOR_ACCELEROMETER_RAW : SlaveRegMap . rd_mem [ 0 ] = SH_MSG_TYPE_ABS_ACCEL ; sensData . TimeStamp . timestamp40 = AccelTimeExtend & 0xFF ; break ; case AP_PSENSOR_MAGNETIC_FIELD_RAW : SlaveRegMap . rd_mem [ 0 ] = SH_MSG_TYPE_ABS_MAG ; sensData . TimeStamp . timestamp40 = MagTimeExtend & 0xFF ; break ; case AP_PSENSOR_GYROSCOPE_RAW : SlaveRegMap . rd_mem [ 0 ] = SH_MSG_TYPE_ABS_GYRO ; sensData . TimeStamp . timestamp40 = GyroTimeExtend & 0xFF ; break ; default : return ; } sensData . Data [ 0 ] = - pMsg -> X ; sensData . Data [ 1 ] = pMsg -> Y ; sensData . Data [ 2 ] = - pMsg -> Z ; sensData . TimeStamp . timestamp32 = pMsg -> timeStamp ; SlaveRegMap . irq_cause = SH_MSG_IRQCAUSE_NEWMSG ; SlaveRegMap . read_len = sizeof ( sensData ) + 1 ; memcpy ( & SlaveRegMap . rd_mem [ 1 ] , & sensData , sizeof ( sensData ) ) ; SensorHubIntHigh ( ) ; I2C_Slave_Wait_Completion ( ) ; }
@fn      SendSensorData
          Sends 3-axis sensor data over the I2C slave interface
@fn SendSensorData Sends 3 - axis sensor data over the I2C slave interface
//Unsupported sensor /*  Assert interrupt request to Host */ /* Wait for I2C transfer to finish */