@@ -51,7 +51,7 @@ namespace touch
5151 // using Interrupt = modm::platform::GpioA10;
5252}
5353
54- modm::Touch2046<touch::Spi, touch::Cs> touchController;
54+ modm::Touch2046<touch::Spi, touch::Cs, 320 , 240 > touchController;
5555
5656
5757int
@@ -75,12 +75,10 @@ main()
7575 touch::Mosi::Mosi>();
7676 touch::Spi::initialize<SystemClock, 2500_kHz>();
7777 modm::touch2046::Calibration cal{
78- .OffsetX = -11 ,
79- .OffsetY = 335 ,
8078 .FactorX = 22018 ,
79+ .OffsetX = -11 ,
8180 .FactorY = -29358 ,
82- .MaxX = 240 ,
83- .MaxY = 320 ,
81+ .OffsetY = 335 ,
8482 .ThresholdZ = 500 ,
8583 };
8684 touchController.setCalibration (cal);
@@ -107,22 +105,22 @@ main()
107105
108106 int16_t X = 0 ;
109107 int16_t Y = 0 ;
110- int16_t Z = 0 ;
108+ // int16_t Z = 0;
111109
112110 while (true )
113111 {
114112 LedGreen::set ();
115113
116- std::tie (X, Y, Z ) = RF_CALL_BLOCKING (touchController.getRawValues ());
114+ std::tie (X, Y) = RF_CALL_BLOCKING (touchController.getTouchPosition ());
117115 tftController.setColor (Red);
118116 tftController.fillRectangle ({30 , 50 }, 90 , 115 );
119117 tftController.setColor (Black);
120118 tftController.setCursor (0 , 50 );
121119 tftController << " X=" << X;
122120 tftController.setCursor (0 , 90 );
123121 tftController << " Y=" << Y;
124- tftController.setCursor (0 , 130 );
125- tftController << " Z=" << Z;
122+ // tftController.setCursor(0, 130);
123+ // tftController << "Z=" << Z;
126124
127125 tftController.setColor (Red);
128126 tftController.fillRectangle ({30 , 220 }, 120 , 35 );
0 commit comments