@@ -74,15 +74,16 @@ int ts_event = false;
7474
7575uint16_t tsX , tsY , tsZ1 ;
7676
77- static uint8_t tsConstructCommand (mxc_ts_cmd_func_t function , mxc_ts_cmd_pdown_t pdown , mxc_ts_cmd_mode_t mode )
77+ static uint8_t tsConstructCommand (mxc_ts_cmd_func_t function , mxc_ts_cmd_pdown_t pdown ,
78+ mxc_ts_cmd_mode_t mode )
7879{
7980 // Bits D7-D4: C3-C0 => converter function select bits
8081 // Bits D3-D2: PD1-PD0 => power-down bits
8182 // Bits D1: M => mode bit
8283 // Bits D0: X => don't care
83- uint8_t command = (uint8_t ) function << 4 ;
84- command |= (uint8_t ) pdown << 2 ;
85- command |= (uint8_t ) mode << 1 ;
84+ uint8_t command = (uint8_t )function << 4 ;
85+ command |= (uint8_t )pdown << 2 ;
86+ command |= (uint8_t )mode << 1 ;
8687 return command ;
8788}
8889
@@ -111,11 +112,12 @@ static int tsGetXY(uint16_t *x, uint16_t *y)
111112
112113 // Wait Release
113114 do {
114- TS_I2C_Transmit (tsConstructCommand (TSC_MEASURE_Z1 , TSC_ADC_ON_IRQ_DIS_0 , TSC_12_BIT ), & tsZ1 );
115+ TS_I2C_Transmit (tsConstructCommand (TSC_MEASURE_Z1 , TSC_ADC_ON_IRQ_DIS_0 , TSC_12_BIT ),
116+ & tsZ1 );
115117 } while (tsZ1 & ADC_Z_THRESHOLD );
116118
117- * x = (((tsX - ADC_X_MIN ) * X_RES_T ) / (ADC_X_MAX - ADC_X_MIN ));
118- * y = (((tsY - ADC_Y_MIN ) * Y_RES_T ) / (ADC_Y_MAX - ADC_Y_MIN ));
119+ * x = (((tsX - ADC_X_MIN ) * X_RES_T ) / (ADC_X_MAX - ADC_X_MIN ));
120+ * y = (((tsY - ADC_Y_MIN ) * Y_RES_T ) / (ADC_Y_MAX - ADC_Y_MIN ));
119121
120122#if (FLIP_SCREEN == 1 )
121123 * x = X_RES_T - * x ;
@@ -159,7 +161,8 @@ static void tsHandler(void)
159161 if (pressed_key == 0 ) { // wait until prev key process
160162 for (i = 0 ; i < TS_MAX_BUTTONS ; i ++ ) {
161163 if (ts_buttons [i ].key_code != TS_INVALID_KEY_CODE ) {
162- if (isInBox (g_x , g_y , ts_buttons [i ].x0 , ts_buttons [i ].y0 , ts_buttons [i ].x1 , ts_buttons [i ].y1 )) {
164+ if (isInBox (g_x , g_y , ts_buttons [i ].x0 , ts_buttons [i ].y0 , ts_buttons [i ].x1 ,
165+ ts_buttons [i ].y1 )) {
163166 // pressed key
164167 pressed_key = ts_buttons [i ].key_code ;
165168 break ;
@@ -273,7 +276,8 @@ void MXC_TS_RemoveButton(int x0, int y0, int x1, int y1)
273276
274277 for (i = 0 ; i < TS_MAX_BUTTONS ; i ++ ) {
275278 if (ts_buttons [i ].key_code != TS_INVALID_KEY_CODE ) {
276- if (isInBox (x0 , y0 , ts_buttons [i ].x0 , ts_buttons [i ].y0 , ts_buttons [i ].x1 , ts_buttons [i ].y1 )) {
279+ if (isInBox (x0 , y0 , ts_buttons [i ].x0 , ts_buttons [i ].y0 , ts_buttons [i ].x1 ,
280+ ts_buttons [i ].y1 )) {
277281 // clear flag
278282 ts_buttons [i ].key_code = TS_INVALID_KEY_CODE ;
279283 }
0 commit comments