Lines Matching refs:rc

57 	int rc;  in qenc_emulate_reset_pin()  local
59 rc = gpio_pin_set_dt(gpio_dt, 0); in qenc_emulate_reset_pin()
60 zassert_ok(rc, "%s: pin set failed: %d", gpio_dt->port->name, rc); in qenc_emulate_reset_pin()
65 int rc; in qenc_emulate_setup_pin() local
67 rc = gpio_is_ready_dt(gpio_dt); in qenc_emulate_setup_pin()
68 zassert_true(rc, "%s: device not ready: %d", gpio_dt->port->name, rc); in qenc_emulate_setup_pin()
70 rc = gpio_pin_configure_dt(gpio_dt, GPIO_OUTPUT); in qenc_emulate_setup_pin()
71 zassert_true(rc == 0, "%s: pin configure failed: %d", gpio_dt->port->name, rc); in qenc_emulate_setup_pin()
95 int rc; in qenc_emulate_verify_reading() local
110 rc = sensor_sample_fetch(qdec_dev); in qenc_emulate_verify_reading()
113 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in qenc_emulate_verify_reading()
115 zassert_true(rc == -EOVERFLOW, "Failed to detect overflow"); in qenc_emulate_verify_reading()
118 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); in qenc_emulate_verify_reading()
119 zassert_true(rc == 0, "Failed to get sample (%d)", rc); in qenc_emulate_verify_reading()
131 rc = sensor_sample_fetch(qdec_dev); in qenc_emulate_verify_reading()
132 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in qenc_emulate_verify_reading()
134 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); in qenc_emulate_verify_reading()
135 zassert_true(rc == 0, "Failed to get sample (%d)", rc); in qenc_emulate_verify_reading()
146 int rc; in ZTEST() local
154 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); in ZTEST()
155 zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); in ZTEST()
157 zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); in ZTEST()
162 rc = k_sem_take(&sem, K_MSEC(200)); in ZTEST()
163 zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); in ZTEST()
168 rc = k_sem_take(&sem, K_MSEC(200)); in ZTEST()
175 rc = k_sem_take(&sem, K_MSEC(200)); in ZTEST()
176 zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); in ZTEST()
183 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, NULL); in ZTEST()
184 zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); in ZTEST()
189 rc = k_sem_take(&sem, K_MSEC(200)); in ZTEST()
190 zassert_true(rc == -EAGAIN, "qdec handler should not be triggered (%d)", rc); in ZTEST()
205 int rc; in ZTEST() local
214 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); in ZTEST()
215 zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); in ZTEST()
217 zassert_true(rc == 0, "sensor_trigger_set failed: %d", rc); in ZTEST()
222 rc = k_sem_take(&sem, K_MSEC(200)); in ZTEST()
223 zassert_true(rc == 0, "qdec handler should be triggered (%d)", rc); in ZTEST()
225 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
226 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
228 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); in ZTEST()
229 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
247 int rc; in ZTEST() local
253 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); in ZTEST()
254 zassume_true(rc != -ENOSYS, "sensor_trigger_set not supported"); in ZTEST()
259 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); in ZTEST()
260 zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid trigger type"); in ZTEST()
265 rc = sensor_trigger_set(qdec_dev, &qdec_trigger, qdec_trigger_handler); in ZTEST()
266 zassume_true(rc < 0, "sensor_trigger_set should fail due to invalid channel"); in ZTEST()
304 int rc; in ZTEST() local
314 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
315 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
320 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); in ZTEST()
321 zassert_true(rc == 0, "Failed to get sample (%d)", rc); in ZTEST()
326 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
327 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
330 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val); in ZTEST()
331 zassert_true(rc == 0, "Failed to get sample (%d)", rc); in ZTEST()
348 int rc; in ZTEST() local
361 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
362 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
364 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_first); in ZTEST()
365 zassert_true(rc == 0, "Failed to get sample (%d)", rc); in ZTEST()
371 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_ROTATION, &val_second); in ZTEST()
372 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
401 int rc; in ZTEST() local
413 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
414 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
416 rc = sensor_channel_get(qdec_dev, SENSOR_CHAN_MAX, &val); in ZTEST()
417 zassert_true(rc < 0, "Should failed to get sample (%d)", rc); in ZTEST()
434 int rc; in ZTEST() local
440 rc = sensor_sample_fetch(qdec_dev); in ZTEST()
441 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
443 rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_ROTATION); in ZTEST()
444 zassert_true(rc == 0, "Failed to fetch sample (%d)", rc); in ZTEST()
446 rc = sensor_sample_fetch_chan(qdec_dev, SENSOR_CHAN_MAX); in ZTEST()
447 zassert_true(rc < 0, "Should fail to fetch sample from invalid channel (%d)", rc); in ZTEST()
456 int rc; in setup() local
458 rc = device_is_ready(qdec_dev); in setup()
459 zassert_true(rc, "QDEC device not ready: %d", rc); in setup()