831 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
834 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
839 res = a_pmw3901mb_spi_write(handle, 0x55, (uint8_t *)&cmd, 1);
842 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
847 res = a_pmw3901mb_spi_write(handle, 0x50, (uint8_t *)&cmd, 1);
850 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
855 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
858 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
868 res = a_pmw3901mb_spi_write(handle, 0x43, (uint8_t *)&cmd, 1);
871 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
875 res = a_pmw3901mb_spi_read(handle, 0x47, (uint8_t *)&cmd, 1);
884 if (retry_times != 0)
898 res = a_pmw3901mb_spi_read(handle, 0x67, (uint8_t *)&cmd, 1);
905 if ((cmd & (1 << 7)) != 0)
908 res = a_pmw3901mb_spi_write(handle, 0x48, (uint8_t *)&cmd, 1);
911 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
919 res = a_pmw3901mb_spi_write(handle, 0x48, (uint8_t *)&cmd, 1);
922 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
928 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
931 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
936 res = a_pmw3901mb_spi_write(handle, 0x51, (uint8_t *)&cmd, 1);
939 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
944 res = a_pmw3901mb_spi_write(handle, 0x50, (uint8_t *)&cmd, 1);
947 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
952 res = a_pmw3901mb_spi_write(handle, 0x55, (uint8_t *)&cmd, 1);
955 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
960 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
963 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
967 res = a_pmw3901mb_spi_read(handle, 0x73, (uint8_t *)&cmd, 1);
979 res = a_pmw3901mb_spi_read(handle, 0x70, (uint8_t *)&c1, 1);
998 res = a_pmw3901mb_spi_read(handle, 0x71, (uint8_t *)&c2, 1);
1005 c2 = (uint8_t)(((uint32_t)c2 * 45) / 100);
1007 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1010 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1015 res = a_pmw3901mb_spi_write(handle, 0x61, (uint8_t *)&cmd, 1);
1018 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1023 res = a_pmw3901mb_spi_write(handle, 0x51, (uint8_t *)&cmd, 1);
1026 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1031 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1034 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1039 res = a_pmw3901mb_spi_write(handle, 0x70, (uint8_t *)&cmd, 1);
1042 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1047 res = a_pmw3901mb_spi_write(handle, 0x71, (uint8_t *)&cmd, 1);
1050 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1057 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1060 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1065 res = a_pmw3901mb_spi_write(handle, 0x61, (uint8_t *)&cmd, 1);
1068 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1073 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1076 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1081 res = a_pmw3901mb_spi_write(handle, 0x40, (uint8_t *)&cmd, 1);
1084 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1089 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1092 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1097 res = a_pmw3901mb_spi_write(handle, 0x41, (uint8_t *)&cmd, 1);
1100 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1105 res = a_pmw3901mb_spi_write(handle, 0x43, (uint8_t *)&cmd, 1);
1108 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1113 res = a_pmw3901mb_spi_write(handle, 0x45, (uint8_t *)&cmd, 1);
1116 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1121 res = a_pmw3901mb_spi_write(handle, 0x5B, (uint8_t *)&cmd, 1);
1124 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1129 res = a_pmw3901mb_spi_write(handle, 0x5F, (uint8_t *)&cmd, 1);
1132 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1137 res = a_pmw3901mb_spi_write(handle, 0x7B, (uint8_t *)&cmd, 1);
1140 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1145 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1148 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1153 res = a_pmw3901mb_spi_write(handle, 0x44, (uint8_t *)&cmd, 1);
1156 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1161 res = a_pmw3901mb_spi_write(handle, 0x40, (uint8_t *)&cmd, 1);
1164 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1169 res = a_pmw3901mb_spi_write(handle, 0x4E, (uint8_t *)&cmd, 1);
1172 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1177 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1180 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1185 res = a_pmw3901mb_spi_write(handle, 0x65, (uint8_t *)&cmd, 1);
1188 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1193 res = a_pmw3901mb_spi_write(handle, 0x6A, (uint8_t *)&cmd, 1);
1196 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1201 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1204 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1209 res = a_pmw3901mb_spi_write(handle, 0x4F, (uint8_t *)&cmd, 1);
1212 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1217 res = a_pmw3901mb_spi_write(handle, 0x5F, (uint8_t *)&cmd, 1);
1220 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1225 res = a_pmw3901mb_spi_write(handle, 0x48, (uint8_t *)&cmd, 1);
1228 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1233 res = a_pmw3901mb_spi_write(handle, 0x49, (uint8_t *)&cmd, 1);
1236 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1241 res = a_pmw3901mb_spi_write(handle, 0x57, (uint8_t *)&cmd, 1);
1244 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1249 res = a_pmw3901mb_spi_write(handle, 0x60, (uint8_t *)&cmd, 1);
1252 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1257 res = a_pmw3901mb_spi_write(handle, 0x61, (uint8_t *)&cmd, 1);
1260 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1265 res = a_pmw3901mb_spi_write(handle, 0x62, (uint8_t *)&cmd, 1);
1268 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1273 res = a_pmw3901mb_spi_write(handle, 0x63, (uint8_t *)&cmd, 1);
1276 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1281 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1284 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1289 res = a_pmw3901mb_spi_write(handle, 0x45, (uint8_t *)&cmd, 1);
1292 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1297 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1300 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1305 res = a_pmw3901mb_spi_write(handle, 0x4D, (uint8_t *)&cmd, 1);
1308 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1313 res = a_pmw3901mb_spi_write(handle, 0x55, (uint8_t *)&cmd, 1);
1316 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1321 res = a_pmw3901mb_spi_write(handle, 0x74, (uint8_t *)&cmd, 1);
1324 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1329 res = a_pmw3901mb_spi_write(handle, 0x75, (uint8_t *)&cmd, 1);
1332 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1337 res = a_pmw3901mb_spi_write(handle, 0x4A, (uint8_t *)&cmd, 1);
1340 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1345 res = a_pmw3901mb_spi_write(handle, 0x4B, (uint8_t *)&cmd, 1);
1348 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1353 res = a_pmw3901mb_spi_write(handle, 0x44, (uint8_t *)&cmd, 1);
1356 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1361 res = a_pmw3901mb_spi_write(handle, 0x45, (uint8_t *)&cmd, 1);
1364 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1369 res = a_pmw3901mb_spi_write(handle, 0x64, (uint8_t *)&cmd, 1);
1372 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1377 res = a_pmw3901mb_spi_write(handle, 0x65, (uint8_t *)&cmd, 1);
1380 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1385 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1388 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1393 res = a_pmw3901mb_spi_write(handle, 0x65, (uint8_t *)&cmd, 1);
1396 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1401 res = a_pmw3901mb_spi_write(handle, 0x66, (uint8_t *)&cmd, 1);
1404 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1409 res = a_pmw3901mb_spi_write(handle, 0x63, (uint8_t *)&cmd, 1);
1412 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1417 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1420 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1425 res = a_pmw3901mb_spi_write(handle, 0x48, (uint8_t *)&cmd, 1);
1428 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1433 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1436 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1441 res = a_pmw3901mb_spi_write(handle, 0x41, (uint8_t *)&cmd, 1);
1444 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1449 res = a_pmw3901mb_spi_write(handle, 0x43, (uint8_t *)&cmd, 1);
1452 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1457 res = a_pmw3901mb_spi_write(handle, 0x4B, (uint8_t *)&cmd, 1);
1460 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1465 res = a_pmw3901mb_spi_write(handle, 0x45, (uint8_t *)&cmd, 1);
1468 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1473 res = a_pmw3901mb_spi_write(handle, 0x44, (uint8_t *)&cmd, 1);
1476 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1481 res = a_pmw3901mb_spi_write(handle, 0x4C, (uint8_t *)&cmd, 1);
1484 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1489 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1492 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1497 res = a_pmw3901mb_spi_write(handle, 0x5B, (uint8_t *)&cmd, 1);
1500 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1505 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1508 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1513 res = a_pmw3901mb_spi_write(handle, 0x40, (uint8_t *)&cmd, 1);
1516 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1521 res = a_pmw3901mb_spi_write(handle, 0x70, (uint8_t *)&cmd, 1);
1524 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1530 res = a_pmw3901mb_spi_write(handle, 0x32, (uint8_t *)&cmd, 1);
1533 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1538 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1541 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1546 res = a_pmw3901mb_spi_write(handle, 0x40, (uint8_t *)&cmd, 1);
1549 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1554 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1557 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1562 res = a_pmw3901mb_spi_write(handle, 0x62, (uint8_t *)&cmd, 1);
1565 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1570 res = a_pmw3901mb_spi_write(handle, 0x63, (uint8_t *)&cmd, 1);
1573 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1578 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1581 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1586 res = a_pmw3901mb_spi_write(handle, 0x48, (uint8_t *)&cmd, 1);
1589 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1594 res = a_pmw3901mb_spi_write(handle, 0x6F, (uint8_t *)&cmd, 1);
1597 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1602 res = a_pmw3901mb_spi_write(handle, 0x7F, (uint8_t *)&cmd, 1);
1605 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1610 res = a_pmw3901mb_spi_write(handle, 0x5B, (uint8_t *)&cmd, 1);
1613 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1618 res = a_pmw3901mb_spi_write(handle, 0x4E, (uint8_t *)&cmd, 1);
1621 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1626 res = a_pmw3901mb_spi_write(handle, 0x5A, (uint8_t *)&cmd, 1);
1629 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");
1634 res = a_pmw3901mb_spi_write(handle, 0x40, (uint8_t *)&cmd, 1);
1637 handle->
debug_print(
"pmw3901mb: sent the command failed.\n");