hw/drivers/sensors/si1133/src/si1133.c
uint32_t
si1133_waitUntilSleep(struct si1133 *dev)
{
    uint32_t ret;
    uint8_t response;
    uint8_t count = 0;
    uint32_t retval;

    retval = SI1133_OK;

    /* This loops until the si1133 is known to be in its sleep state  */
    /* or if an i2c error occurs                                      */
    while (count < 5) {
        ret = si1133_registerRead(dev, SI1133_REG_RESPONSE0, &response);
        if ((response & SI1133_RSP0_CHIPSTAT_MASK) == SI1133_RSP0_SLEEP) {
            break;
        }

        if (ret != SI1133_OK) {
            retval = SI1133_ERROR_SLEEP_FAILED;
            SI1133_ERR("Failed to sleep \n");
            STATS_INC(g_si1133_stats, write_errors);
            break;
        }

        count++;
    }

    return retval;
}
/**
 * @brief Wait until si1133 is knwon ro be in sleep state
 * 
 * @return 0x0000 if ok
 */
@brief Wait until si1133 is knwon ro be in sleep state


@brief Wait until si1133 is knwon ro be in sleep state
uint32_t
si1133_waitUntilSleep(struct si1133 *dev)
{
    uint32_t ret;
    uint8_t response;
    uint8_t count = 0;
    uint32_t retval;
    retval = SI1133_OK;
    while (count < 5) {
        ret = si1133_registerRead(dev, SI1133_REG_RESPONSE0, &response);
        if ((response & SI1133_RSP0_CHIPSTAT_MASK) == SI1133_RSP0_SLEEP) {
            break;
        }
        if (ret != SI1133_OK) {
            retval = SI1133_ERROR_SLEEP_FAILED;
            SI1133_ERR("Failed to sleep \n");
            STATS_INC(g_si1133_stats, write_errors);
            break;
        }
        count++;
    }
    return retval;
}
uint32_t si1133_waitUntilSleep ( struct si1133 * dev ) { uint32_t ret ; uint8_t response ; uint8_t count = 0 ; uint32_t retval ; retval = SI1133_OK ; while ( count < 5 ) { ret = si1133_registerRead ( dev , SI1133_REG_RESPONSE0 , & response ) ; if ( ( response & SI1133_RSP0_CHIPSTAT_MASK ) == SI1133_RSP0_SLEEP ) { break ; } if ( ret != SI1133_OK ) { retval = SI1133_ERROR_SLEEP_FAILED ; SI1133_ERR ( " \n " ) ; STATS_INC ( g_si1133_stats , write_errors ) ; break ; } count ++ ; } return retval ; }
@brief Wait until si1133 is knwon ro be in sleep state
@brief Wait until si1133 is knwon ro be in sleep state
/* This loops until the si1133 is known to be in its sleep state  */ /* or if an i2c error occurs                                      */