コード例 #1
0
/*******************************************************************************
* Function Name   : LIS3MDL_MAG_WriteReg
* Description   : Generic Writing function. It must be fullfilled with either
*         : I2C or SPI writing function
* Input       : Register Address, Data to be written
* Output      : None
* Return      : None
*******************************************************************************/
static status_t LIS3MDL_MAG_WriteReg( void *handle, u8_t Reg, u8_t Data )
{

  if ( Sensor_IO_Write( handle, Reg, &Data, 1 ) )
    return MEMS_ERROR;
  else
    return MEMS_SUCCESS;
}
コード例 #2
0
/*******************************************************************************
* Function Name   : HTS221_WriteReg
* Description   : Generic Writing function. It must be fullfilled with either
*         : I2C or SPI writing function
* Input       : Register Address, Data to be written
* Output      : None
* Return      : None
*******************************************************************************/
HTS221_Error_et HTS221_WriteReg( void *handle, uint8_t RegAddr, uint16_t NumByteToWrite, uint8_t *Data )
{

  if ( NumByteToWrite > 1 ) RegAddr |= 0x80;

  if ( Sensor_IO_Write( handle, RegAddr, Data, NumByteToWrite ) )
    return HTS221_ERROR;
  else
    return HTS221_OK;
}