Skip to content

Commit

Permalink
adjust /src and /examples: x -> x(), y -> y(), z -> z()
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Feb 14, 2022
1 parent f29f697 commit 05f9da5
Show file tree
Hide file tree
Showing 46 changed files with 551 additions and 602 deletions.
4 changes: 2 additions & 2 deletions examples/avr/display/dogm128/benchmark/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ introScreen()
void
drawSpinner(Point center, uint8_t pos)
{
const uint8_t x = center.getX();
const uint8_t y = center.getY();
const uint8_t x = center.x();
const uint8_t y = center.y();

switch(pos % 8)
{
Expand Down
6 changes: 3 additions & 3 deletions examples/nucleo_f042k6/lis3mdl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ main()
if(success)
{
MODM_LOG_INFO << "Magnetic Vector:" << modm::endl;
MODM_LOG_INFO << "X: "<< magVector.x << " gauss" << modm::endl;
MODM_LOG_INFO << "Y: "<< magVector.y << " gauss" << modm::endl;
MODM_LOG_INFO << "Z: "<< magVector.z << " gauss" << modm::endl;
MODM_LOG_INFO << "X: "<< magVector.x() << " gauss" << modm::endl;
MODM_LOG_INFO << "Y: "<< magVector.y() << " gauss" << modm::endl;
MODM_LOG_INFO << "Z: "<< magVector.z() << " gauss" << modm::endl;
MODM_LOG_INFO << modm::endl;
}
else
Expand Down
12 changes: 6 additions & 6 deletions examples/nucleo_f042k6/lsm6ds33/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ main()
if(accSuccess && gyroSuccess)
{
MODM_LOG_INFO << "Acceleration Vector:" << modm::endl;
MODM_LOG_INFO << "X: "<< accVector.x << " g" << modm::endl;
MODM_LOG_INFO << "Y: "<< accVector.y << " g" << modm::endl;
MODM_LOG_INFO << "Z: "<< accVector.z << " g" << modm::endl;
MODM_LOG_INFO << "X: "<< accVector.x() << " g" << modm::endl;
MODM_LOG_INFO << "Y: "<< accVector.y() << " g" << modm::endl;
MODM_LOG_INFO << "Z: "<< accVector.z() << " g" << modm::endl;
MODM_LOG_INFO << modm::endl;

MODM_LOG_INFO << "Spin Rates Vector:" << modm::endl;
MODM_LOG_INFO << "X: "<< gyroVector.x << " deg/s" << modm::endl;
MODM_LOG_INFO << "Y: "<< gyroVector.y << " deg/s" << modm::endl;
MODM_LOG_INFO << "Z: "<< gyroVector.z << " deg/s" << modm::endl;
MODM_LOG_INFO << "X: "<< gyroVector.x() << " deg/s" << modm::endl;
MODM_LOG_INFO << "Y: "<< gyroVector.y() << " deg/s" << modm::endl;
MODM_LOG_INFO << "Z: "<< gyroVector.z() << " deg/s" << modm::endl;
MODM_LOG_INFO << modm::endl;

}
Expand Down
2 changes: 1 addition & 1 deletion examples/nucleo_f429zi/pat9125el/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class Thread : public modm::pt::Protothread
position += sensor.getData();

Board::Leds::write(0b111);
MODM_LOG_INFO << "Position: " << position.x << ", " << position.y << modm::endl;
MODM_LOG_INFO << "Position: " << position << modm::endl;
sensor.resetMoved();
} else {
Board::Leds::write(0b000);
Expand Down
56 changes: 28 additions & 28 deletions examples/stm32_f4ve/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,23 @@ static void
drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center)
{
display.setColor(html::Red);
display.drawLine(center.x - 15, center.y, center.x - 2, center.y);
display.drawLine(center.x + 2, center.y, center.x + 15, center.y);
display.drawLine(center.x, center.y - 15, center.x, center.y - 2);
display.drawLine(center.x, center.y + 2, center.x, center.y + 15);
display.drawLine(center.x() - 15, center.y(), center.x() - 2, center.y());
display.drawLine(center.x() + 2, center.y(), center.x() + 15, center.y());
display.drawLine(center.x(), center.y() - 15, center.x(), center.y() - 2);
display.drawLine(center.x(), center.y() + 2, center.x(), center.y() + 15);

display.setColor(html::White);
display.drawLine(center.x - 15, center.y + 15, center.x - 7, center.y + 15);
display.drawLine(center.x - 15, center.y + 7, center.x - 15, center.y + 15);
display.drawLine(center.x() - 15, center.y() + 15, center.x() - 7, center.y() + 15);
display.drawLine(center.x() - 15, center.y() + 7, center.x() - 15, center.y() + 15);

display.drawLine(center.x - 15, center.y - 15, center.x - 7, center.y - 15);
display.drawLine(center.x - 15, center.y - 7, center.x - 15, center.y - 15);
display.drawLine(center.x() - 15, center.y() - 15, center.x() - 7, center.y() - 15);
display.drawLine(center.x() - 15, center.y() - 7, center.x() - 15, center.y() - 15);

display.drawLine(center.x + 7, center.y + 15, center.x + 15, center.y + 15);
display.drawLine(center.x + 15, center.y + 7, center.x + 15, center.y + 15);
display.drawLine(center.x() + 7, center.y() + 15, center.x() + 15, center.y() + 15);
display.drawLine(center.x() + 15, center.y() + 7, center.x() + 15, center.y() + 15);

display.drawLine(center.x + 7, center.y - 15, center.x + 15, center.y - 15);
display.drawLine(center.x + 15, center.y - 15, center.x + 15, center.y - 7);
display.drawLine(center.x() + 7, center.y() - 15, center.x() + 15, center.y() - 15);
display.drawLine(center.x() + 15, center.y() - 15, center.x() + 15, center.y() - 7);
}

static void
Expand All @@ -211,7 +211,7 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe
// wait until a valid sample can be taken
}

MODM_LOG_DEBUG << "calibration point: (" << sample[i].x << " | " << sample[i].y << ")" << modm::endl;
MODM_LOG_DEBUG << "calibration point: (" << sample[i].x() << " | " << sample[i].y() << ")" << modm::endl;
}

touchscreen.calibrate(calibrationPoint, sample);
Expand All @@ -227,14 +227,14 @@ void
drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point)
{
MODM_LOG_DEBUG << __PRETTY_FUNCTION__ << modm::endl;
if (point.x < 0 || point.y < 0) {
if (point.x() < 0 || point.y() < 0) {
return;
}

display.setPixel(point.x, point.y);
display.setPixel(point.x + 1, point.y);
display.setPixel(point.x, point.y + 1);
display.setPixel(point.x + 1, point.y + 1);
display.setPixel(point.x(), point.y());
display.setPixel(point.x() + 1, point.y());
display.setPixel(point.x(), point.y() + 1);
display.setPixel(point.x() + 1, point.y() + 1);
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -286,8 +286,8 @@ debounceTouch(modm::glcd::Point *out, modm::glcd::Point *old)
// translate point according to calibration
touchscreen.translate(&raw, &point);

if(abs(point.x - old->x) < TP_TOLERANCE &&
abs(point.y - old->y) < TP_TOLERANCE
if(abs(point.x() - old->x()) < TP_TOLERANCE &&
abs(point.y() - old->y()) < TP_TOLERANCE
)
{
// point is within area of last touch
Expand Down Expand Up @@ -321,8 +321,8 @@ touchUp(void* data)
modm::gui::InputEvent* ev = static_cast<modm::gui::InputEvent*>(data);

MODM_LOG_DEBUG << "asynchronous UP-event:" << modm::endl;
MODM_LOG_DEBUG << "x: " << ev->coord.x << modm::endl;
MODM_LOG_DEBUG << "y: " << ev->coord.y << modm::endl;
MODM_LOG_DEBUG << "x: " << ev->coord.x() << modm::endl;
MODM_LOG_DEBUG << "y: " << ev->coord.y() << modm::endl;

// queue UP-event as new input event
input_queue.push(ev);
Expand Down Expand Up @@ -351,8 +351,8 @@ gatherInput()
auto async_ev = new modm::gui::AsyncEvent(500, &touchUp, (void*)(ev_up));
async_events.append(async_ev);

MODM_LOG_DEBUG << "touch down x: " << point.x << modm::endl;
MODM_LOG_DEBUG << "touch down y: " << point.y << modm::endl;
MODM_LOG_DEBUG << "touch down x: " << point.x() << modm::endl;
MODM_LOG_DEBUG << "touch down y: " << point.y() << modm::endl;

}
}
Expand Down Expand Up @@ -492,11 +492,11 @@ main()
/*
* display an arbitrary image
*/
// if(pixPos.x < 0 || (pixPos.x + pix[0]) > tft.getWidth()){
// pixDeltaPos.x *= -1;
// if(pixPos.x() < 0 || (pixPos.x() + pix[0]) > tft.getWidth()){
// pixDeltaPos.x() *= -1;
// }
// if(pixPos.y < 0 || (pixPos.y + pix[1]) > tft.getHeight()){
// pixDeltaPos.y *= -1;
// if(pixPos.y() < 0 || (pixPos.y() + pix[1]) > tft.getHeight()){
// pixDeltaPos.y() *= -1;
// }
// pixPos += pixDeltaPos;
// tft.drawImage(pixPos, pix);
Expand Down
44 changes: 22 additions & 22 deletions examples/stm32_f4ve/gui/touchscreen_calibrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,34 @@ modm::TouchscreenCalibrator::calibrate(
modm::glcd::Point * display, modm::glcd::Point * sample)
{
// K��(X0��X2) (Y1��Y2)��(X1��X2) (Y0��Y2)
scale = ((sample[0].x - sample[2].x) * (sample[1].y - sample[2].y)) -
((sample[1].x - sample[2].x) * (sample[0].y - sample[2].y));
scale = ((sample[0].x() - sample[2].x()) * (sample[1].y() - sample[2].y())) -
((sample[1].x() - sample[2].x()) * (sample[0].y() - sample[2].y()));

if (scale == 0) {
return false;
}

// A��((XD0��XD2) (Y1��Y2)��(XD1��XD2) (Y0��Y2))��K
An = ((display[0].x - display[2].x) * (sample[1].y - sample[2].y)) -
((display[1].x - display[2].x) * (sample[0].y - sample[2].y));
An = ((display[0].x() - display[2].x()) * (sample[1].y() - sample[2].y())) -
((display[1].x() - display[2].x()) * (sample[0].y() - sample[2].y()));
// B��((X0��X2) (XD1��XD2)��(XD0��XD2) (X1��X2))��K */
Bn = ((sample[0].x - sample[2].x) * (display[1].x - display[2].x)) -
((display[0].x - display[2].x) * (sample[1].x - sample[2].x));
Bn = ((sample[0].x() - sample[2].x()) * (display[1].x() - display[2].x())) -
((display[0].x() - display[2].x()) * (sample[1].x() - sample[2].x()));
// C��(Y0(X2XD1��X1XD2)+Y1(X0XD2��X2XD0)+Y2(X1XD0��X0XD1))��K */
Cn = (sample[2].x * display[1].x - sample[1].x * display[2].x) * sample[0].y +
(sample[0].x * display[2].x - sample[2].x * display[0].x) * sample[1].y +
(sample[1].x * display[0].x - sample[0].x * display[1].x) * sample[2].y;
Cn = (sample[2].x() * display[1].x() - sample[1].x() * display[2].x()) * sample[0].y() +
(sample[0].x() * display[2].x() - sample[2].x() * display[0].x()) * sample[1].y() +
(sample[1].x() * display[0].x() - sample[0].x() * display[1].x()) * sample[2].y();

// D��((YD0��YD2) (Y1��Y2)��(YD1��YD2) (Y0��Y2))��K */
Dn = ((display[0].y - display[2].y) * (sample[1].y - sample[2].y)) -
((display[1].y - display[2].y) * (sample[0].y - sample[2].y));
Dn = ((display[0].y() - display[2].y()) * (sample[1].y() - sample[2].y())) -
((display[1].y() - display[2].y()) * (sample[0].y() - sample[2].y()));
// E��((X0��X2) (YD1��YD2)��(YD0��YD2) (X1��X2))��K */
En = ((sample[0].x - sample[2].x) * (display[1].y - display[2].y)) -
((display[0].y - display[2].y) * (sample[1].x - sample[2].x));
En = ((sample[0].x() - sample[2].x()) * (display[1].y() - display[2].y())) -
((display[0].y() - display[2].y()) * (sample[1].x() - sample[2].x()));
// F��(Y0(X2YD1��X1YD2)+Y1(X0YD2��X2YD0)+Y2(X1YD0��X0YD1))��K */
Fn = (sample[2].x * display[1].y - sample[1].x * display[2].y) * sample[0].y +
(sample[0].x * display[2].y - sample[2].x * display[0].y) * sample[1].y +
(sample[1].x * display[0].y - sample[0].x * display[1].y) * sample[2].y;
Fn = (sample[2].x() * display[1].y() - sample[1].x() * display[2].y()) * sample[0].y() +
(sample[0].x() * display[2].y() - sample[2].x() * display[0].y()) * sample[1].y() +
(sample[1].x() * display[0].y() - sample[0].x() * display[1].y()) * sample[2].y();

return true;
}
Expand All @@ -94,12 +94,12 @@ modm::TouchscreenCalibrator::translate(modm::glcd::Point * raw, modm::glcd::Poin
if (scale != 0)
{
/* XD = AX+BY+C */
translated->x =
((An * raw->x) +
(Bn * raw->y) + Cn) / scale;
translated->x() =
((An * raw->x()) +
(Bn * raw->y()) + Cn) / scale;
/* YD = DX+EY+F */
translated->y =
((Dn * raw->x) +
(En * raw->y) + Fn) / scale;
translated->y() =
((Dn * raw->x()) +
(En * raw->y()) + Fn) / scale;
}
}
48 changes: 24 additions & 24 deletions examples/stm32f4_discovery/open407v-d/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,23 +178,23 @@ static void
drawCross(modm::ColorGraphicDisplay& display, modm::glcd::Point center)
{
display.setColor(Red);
display.drawLine(center.x - 15, center.y, center.x - 2, center.y);
display.drawLine(center.x + 2, center.y, center.x + 15, center.y);
display.drawLine(center.x, center.y - 15, center.x, center.y - 2);
display.drawLine(center.x, center.y + 2, center.x, center.y + 15);
display.drawLine(center.x() - 15, center.y(), center.x() - 2, center.y());
display.drawLine(center.x() + 2, center.y(), center.x() + 15, center.y());
display.drawLine(center.x(), center.y() - 15, center.x(), center.y() - 2);
display.drawLine(center.x(), center.y() + 2, center.x(), center.y() + 15);

display.setColor(White);
display.drawLine(center.x - 15, center.y + 15, center.x - 7, center.y + 15);
display.drawLine(center.x - 15, center.y + 7, center.x - 15, center.y + 15);
display.drawLine(center.x() - 15, center.y() + 15, center.x() - 7, center.y() + 15);
display.drawLine(center.x() - 15, center.y() + 7, center.x() - 15, center.y() + 15);

display.drawLine(center.x - 15, center.y - 15, center.x - 7, center.y - 15);
display.drawLine(center.x - 15, center.y - 7, center.x - 15, center.y - 15);
display.drawLine(center.x() - 15, center.y() - 15, center.x() - 7, center.y() - 15);
display.drawLine(center.x() - 15, center.y() - 7, center.x() - 15, center.y() - 15);

display.drawLine(center.x + 7, center.y + 15, center.x + 15, center.y + 15);
display.drawLine(center.x + 15, center.y + 7, center.x + 15, center.y + 15);
display.drawLine(center.x() + 7, center.y() + 15, center.x() + 15, center.y() + 15);
display.drawLine(center.x() + 15, center.y() + 7, center.x() + 15, center.y() + 15);

display.drawLine(center.x + 7, center.y - 15, center.x + 15, center.y - 15);
display.drawLine(center.x + 15, center.y - 15, center.x + 15, center.y - 7);
display.drawLine(center.x() + 7, center.y() - 15, center.x() + 15, center.y() - 15);
display.drawLine(center.x() + 15, center.y() - 15, center.x() + 15, center.y() - 7);
}

static void
Expand All @@ -219,7 +219,7 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe
// wait until a valid sample can be taken
}

MODM_LOG_DEBUG << "calibration point: (" << sample[i].x << " | " << sample[i].y << ")" << modm::endl;
MODM_LOG_DEBUG << "calibration point: (" << sample[i].x() << " | " << sample[i].y() << ")" << modm::endl;
}

touchscreen.calibrate(calibrationPoint, sample);
Expand All @@ -234,14 +234,14 @@ calibrateTouchscreen(modm::ColorGraphicDisplay& display, modm::glcd::Point *fixe
void
drawPoint(modm::GraphicDisplay& display, modm::glcd::Point point)
{
if (point.x < 0 || point.y < 0) {
if (point.x() < 0 || point.y() < 0) {
return;
}

display.setPixel(point.x, point.y);
display.setPixel(point.x + 1, point.y);
display.setPixel(point.x, point.y + 1);
display.setPixel(point.x + 1, point.y + 1);
display.setPixel(point.x(), point.y());
display.setPixel(point.x() + 1, point.y());
display.setPixel(point.x(), point.y() + 1);
display.setPixel(point.x() + 1, point.y() + 1);
}

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -293,8 +293,8 @@ debounceTouch(modm::glcd::Point *out, modm::glcd::Point *old)
// translate point according to calibration
touchscreen.translate(&raw, &point);

if(abs(point.x - old->x) < TP_TOLERANCE &&
abs(point.y - old->y) < TP_TOLERANCE
if(abs(point.x() - old->x()) < TP_TOLERANCE &&
abs(point.y() - old->y()) < TP_TOLERANCE
)
{
// point is within area of last touch
Expand Down Expand Up @@ -327,8 +327,8 @@ touchUp(void* data)
modm::gui::InputEvent* ev = static_cast<modm::gui::InputEvent*>(data);

MODM_LOG_DEBUG << "asynchronous UP-event:" << modm::endl;
MODM_LOG_DEBUG << "x: " << ev->coord.x << modm::endl;
MODM_LOG_DEBUG << "y: " << ev->coord.y << modm::endl;
MODM_LOG_DEBUG << "x: " << ev->coord.x() << modm::endl;
MODM_LOG_DEBUG << "y: " << ev->coord.y() << modm::endl;

// queue UP-event as new input event
input_queue.push(ev);
Expand Down Expand Up @@ -358,8 +358,8 @@ gatherInput()
auto async_ev = new modm::gui::AsyncEvent(500, &touchUp, (void*)(ev_up));
async_events.append(async_ev);

MODM_LOG_DEBUG << "touch down x: " << point.x << modm::endl;
MODM_LOG_DEBUG << "touch down y: " << point.y << modm::endl;
MODM_LOG_DEBUG << "touch down x: " << point.x() << modm::endl;
MODM_LOG_DEBUG << "touch down y: " << point.y() << modm::endl;

}
}
Expand Down
Loading

0 comments on commit 05f9da5

Please sign in to comment.