/* get OV5640 camera PCLK, HREF and VSYNC Polarities  */
int32_t OV5640_GetPolarities(OV5640_Object_t *pObj, uint32_t *PclkPolarity, uint32_t *HrefPolarity, uint32_t *VsyncPolarity)
/* get OV5640 camera PCLK, HREF and VSYNC Polarities  */
int32_t OV5640_GetPolarities(OV5640_Object_t *pObj, uint32_t *PclkPolarity, uint32_t *HrefPolarity, uint32_t *VsyncPolarity)
{
  uint8_t tmp;
  int32_t ret = OV5640_OK;
  if ((pObj == NULL) || (PclkPolarity == NULL) || (HrefPolarity == NULL) || (VsyncPolarity == NULL))
  {
    ret = OV5640_ERROR;
  }
  else if (ov5640_read_reg(&pObj->Ctx, OV5640_POLARITY_CTRL, &tmp, 1) != OV5640_OK)
  {
    ret = OV5640_ERROR;
  }
  else
  {
    *PclkPolarity = (tmp >> 5U) & 0x01U;
    *HrefPolarity = (tmp >> 1U) & 0x01U;
    *VsyncPolarity = tmp & 0x01;
  }
  return ret;
}