TimJTi commented on code in PR #7702:
URL: https://github.com/apache/nuttx/pull/7702#discussion_r1032815416


##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -1551,21 +1628,44 @@ static void sam_tsd_initialize(struct sam_tsd_s *priv)
 
   /* Enable pen contact detection */
 
+  regval  = sam_adc_getreg(priv->adc, SAM_ADC_TSMR);
   regval |= ADC_TSMR_PENDET;
   sam_adc_putreg(priv->adc, SAM_ADC_TSMR, regval);
 
   /* Set up pen debounce time */
 
   sam_tsd_debounce(priv, BOARD_TSD_DEBOUNCE);
 
+  /* configure pen sensitivity */
+
+  regval = sam_adc_getreg(priv->adc, SAM_ADC_ACR);
+  regval &= ~ADC_ACR_PENDETSENS_MASK;
+  regval |= ADC_ACR_PENDETSENS(BOARD_TSD_PENDETSENS);
+#if defined(ATSAMA5D2)
+  regval &= ~ADC_ACR_IBCTL_MASK;
+  regval |= ADC_ACR_IBCTL(BOARD_TSD_IBCTL);
+#endif
+  sam_adc_putreg(priv->adc, SAM_ADC_ACR, regval);
+
+#ifdef SAMA5_TSD_PENDET_TRIG_ALLOWED
   /* Configure pen interrupt generation */
 
   regval  = sam_adc_getreg(priv->adc, SAM_ADC_TRGR);
   regval &= ~ADC_TRGR_TRGMOD_MASK;
   regval |= ADC_TRGR_TRGMOD_PEN;
   sam_adc_putreg(priv->adc, SAM_ADC_TRGR, regval);
+#endif
 
   sam_adc_putreg(priv->adc, SAM_ADC_IER, ADC_INT_PEN);
+
+#ifdef CONFIG_SAMA5_TSD_AUTOCALIB
+  /* perform a ts calibration */

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to