axis_xyzt
struct axis_xyzt {
int16_t x;
int16_t y;
int16_t z;
uint16_t t;
};get_axis_{x,y,z}_iter()
/*The return type is described as auto&& because it is a long template type name.*/
auto&& get_axis_x_iter(Iter p)
auto&& get_axis_y_iter(Iter p)
auto&& get_axis_z_iter(Iter p)#include <algorithm>
void myfunc() {
// container class
smplbuf_local<axis_xyzt, 10> buf;
// Submit data for testing
buf[0] = { 1, 2, 3, 4 };
buf[1] = { 2, 3, 4, 5 };
...
// Algorithm to obtain maximum and minimum values
auto&& minmax = std::minmax_element(
get_axis_x_iter(buf.begin()),
get_axis_x_iter(buf.end()));
Serial << "min=" << int(*minmax.first)
<< ",max=" << int(*minmax.second) << mwx::crlf;
}get_axis_{x,y,z}()
最終更新