/* This function reads proximity by ap3216c sensor measurement */
uint16_t ap3216c_read_ps_data(void)
/* This function reads proximity by ap3216c sensor measurement */
uint16_t ap3216c_read_ps_data(void)
{
    uint16_t proximity = 0;
    uint32_t read_data;
    read_data = read_low_and_high(AP3216C_PS_DATA_L_REG, 1);
    if (1 == ((read_data >> 6) & 0x01 || (read_data >> 14) & 0x01)) {
        return proximity =
                   55555;
    }
    proximity =
        (read_data & 0x000f) + (((read_data >> 8) & 0x3f)
                                << 4);
    proximity |= read_data & 0x8000;
    return proximity;
}