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


##########
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:
   ditto



##########
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 */

Review Comment:
   Please capitalized text as all other comments on this file 



##########
arch/arm/src/sama5/sam_tsd.h:
##########
@@ -36,10 +36,15 @@
 
 /* Configuration ************************************************************/
 
-#ifdef CONFIG_SAMA_TSD_RXP
+#ifndef CONFIG_SAMA_TSD_RXP
 #  define CONFIG_SAMA_TSD_RXP 6
 #endif
 
+/* Only allow Pendet triggering in limited circumstances */

Review Comment:
   Add space after comment



##########
arch/arm/src/sama5/sam_tsd.c:
##########
@@ -630,7 +680,7 @@ static void sam_tsd_bottomhalf(void *arg)
       pressr = sam_adc_getreg(priv->adc, SAM_ADC_PRESSR);
 #endif
       /* Discard any bad readings.  This check may not be necessary. */
-
+#if 1

Review Comment:
   Why to keep this "#if 1" ? Was it a test that succeed and you forgot to 
remove of #if 1? 



-- 
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