From 4ac61f7f187467e2020df5db18596400e11cd633 Mon Sep 17 00:00:00 2001 From: Conor Patrick Date: Thu, 9 May 2019 14:53:22 -0400 Subject: [PATCH] slight cleanup --- targets/stm32l432/src/sense.c | 9 +-------- targets/stm32l432/src/sense.h | 2 ++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/targets/stm32l432/src/sense.c b/targets/stm32l432/src/sense.c index ee2a947..de56e0c 100644 --- a/targets/stm32l432/src/sense.c +++ b/targets/stm32l432/src/sense.c @@ -30,11 +30,7 @@ void tsc_init() PA6 ------> sampling cap */ GPIO_InitStruct.Pin = LL_GPIO_PIN_6; - GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE; - GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; - GPIO_InitStruct.Pull = LL_GPIO_PULL_NO; - GPIO_InitStruct.Alternate = LL_GPIO_AF_9; LL_GPIO_Init(GPIOB, &GPIO_InitStruct); // Channel IOs @@ -44,7 +40,7 @@ void tsc_init() TSC->CR = TSC_CR_TSCE; TSC->CR |= (TSC_CTPH_8CYCLES | - TSC_CTPL_8CYCLES | + TSC_CTPL_10CYCLES | (uint32_t)(1 << TSC_CR_SSD_Pos) | TSC_SS_PRESC_DIV1 | TSC_PG_PRESC_DIV16 | @@ -105,8 +101,6 @@ uint32_t tsc_read(uint32_t indx) return TSC->IOGXCR[indx]; } -// Read button 0 or 1 -// Returns 1 if pressed, 0 if not. uint32_t tsc_read_button(uint32_t index) { switch(index) @@ -117,7 +111,6 @@ uint32_t tsc_read_button(uint32_t index) case 1: tsc_set_electrode(ELECTRODE_1); break; - } tsc_start_acq(); tsc_wait_on_acq(); diff --git a/targets/stm32l432/src/sense.h b/targets/stm32l432/src/sense.h index 396aac6..cbf85f3 100644 --- a/targets/stm32l432/src/sense.h +++ b/targets/stm32l432/src/sense.h @@ -7,6 +7,8 @@ void tsc_init(); int tsc_sensor_exists(); +// Read button0 or button1 +// Returns 1 if pressed, 0 if not. uint32_t tsc_read_button(uint32_t index); #endif