aboutsummaryrefslogtreecommitdiffstats
path: root/src/fsm/pio.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-21 21:31:09 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-01-21 21:31:09 +0100
commit9c7d2bf918da26d65a06f0c6b58f5626ee3d8136 (patch)
treea03c58e6959ebdfd50a4715af624db39bad10c9d /src/fsm/pio.c
parent8cd367276e0a032fb1317a4fea3c406b2d6b3dc1 (diff)
downloadglutte-o-matic-9c7d2bf918da26d65a06f0c6b58f5626ee3d8136.tar.gz
glutte-o-matic-9c7d2bf918da26d65a06f0c6b58f5626ee3d8136.tar.bz2
glutte-o-matic-9c7d2bf918da26d65a06f0c6b58f5626ee3d8136.zip
Distinguish pullup and nonpullup in PIO
Diffstat (limited to 'src/fsm/pio.c')
-rw-r--r--src/fsm/pio.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fsm/pio.c b/src/fsm/pio.c
index a4033a9..fba7ddc 100644
--- a/src/fsm/pio.c
+++ b/src/fsm/pio.c
@@ -57,12 +57,19 @@ void pio_init()
#endif
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
- GPIO_InitStructure.GPIO_Pin = GPIOC_INPUT_PINS;
+ GPIO_InitStructure.GPIO_Pin = GPIOC_INPUT_PU_PINS;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_Init(GPIOC, &GPIO_InitStructure);
+ GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
+ GPIO_InitStructure.GPIO_Pin = GPIOC_INPUT_PINS;
+ GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
+ GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+ GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+ GPIO_Init(GPIOC, &GPIO_InitStructure);
+
xTaskCreate(
read_fsm_input_task,
"TaskPIO",
@@ -81,7 +88,11 @@ void read_fsm_input_task(void *pvParameters)
{
while (1) {
pio_signals.qrp = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_QRP_n) ? 0 : 1;
+#if INVERTED_1750
+ pio_signals.tone_1750 = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_1750) ? 0 : 1;
+#else
pio_signals.tone_1750 = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_1750) ? 1 : 0;
+#endif
pio_signals.carrier = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_RX_n) ? 0 : 1;
pio_signals.discrim_u = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_U_n) ? 0 : 1;
pio_signals.discrim_d = GPIO_ReadInputDataBit(GPIOC, GPIO_PIN_D_n) ? 0 : 1;