MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / peripheral_on_accel

Method peripheral_on_accel

src/board_controller/muse/muse.cpp:729–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727}
728
729void Muse::peripheral_on_accel (simpleble_peripheral_t peripheral, simpleble_uuid_t service,
730 simpleble_uuid_t characteristic, const uint8_t *data, size_t size)
731{
732 std::lock_guard<std::mutex> callback_guard (callback_lock);
733 if (size != 20)
734 {
735 safe_logger (spdlog::level::warn, "unknown size for accel callback: {}", size);
736 return;
737 }
738
739 for (int i = 0; i < 3; i++)
740 {
741 double accel_valx = (double)cast_16bit_to_int32 ((unsigned char *)&data[2 + i * 6]) / 16384;
742 double accel_valy = (double)cast_16bit_to_int32 ((unsigned char *)&data[4 + i * 6]) / 16384;
743 double accel_valz = (double)cast_16bit_to_int32 ((unsigned char *)&data[6 + i * 6]) / 16384;
744 current_aux_buf[i][board_descr["auxiliary"]["accel_channels"][0].get<int> ()] = accel_valx;
745 current_aux_buf[i][board_descr["auxiliary"]["accel_channels"][1].get<int> ()] = accel_valy;
746 current_aux_buf[i][board_descr["auxiliary"]["accel_channels"][2].get<int> ()] = accel_valz;
747 }
748}
749
750void Muse::peripheral_on_gyro (simpleble_peripheral_t peripheral, simpleble_uuid_t service,
751 simpleble_uuid_t characteristic, const uint8_t *data, size_t size)

Callers 1

peripheral_on_accelFunction · 0.80

Calls 1

cast_16bit_to_int32Function · 0.85

Tested by

no test coverage detected