diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-02-02 22:09:23 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-02-02 22:09:23 +0100 |
commit | db0aca8ede449258829a8e085e9976172c402861 (patch) | |
tree | 76c37d3caaac1d57caf10ade8dfc5020a279a7fa /src/fsm | |
parent | 96e877a39d73ff535faa0c1d82177646b3e5d696 (diff) | |
download | glutte-o-matic-db0aca8ede449258829a8e085e9976172c402861.tar.gz glutte-o-matic-db0aca8ede449258829a8e085e9976172c402861.tar.bz2 glutte-o-matic-db0aca8ede449258829a8e085e9976172c402861.zip |
Try to access DS18B20 on PA1
Diffstat (limited to 'src/fsm')
l--------- | src/fsm/ds18b20 | 1 | ||||
-rw-r--r-- | src/fsm/main.c | 22 | ||||
-rw-r--r-- | src/fsm/pio.txt | 62 |
3 files changed, 20 insertions, 65 deletions
diff --git a/src/fsm/ds18b20 b/src/fsm/ds18b20 new file mode 120000 index 0000000..aa9ef51 --- /dev/null +++ b/src/fsm/ds18b20 @@ -0,0 +1 @@ +../ds18b20
\ No newline at end of file diff --git a/src/fsm/main.c b/src/fsm/main.c index b6f865e..5eaa065 100644 --- a/src/fsm/main.c +++ b/src/fsm/main.c @@ -41,6 +41,7 @@ #include "fsm.h" #include "common.h" #include "usart.h" +#include "ds18b20.h" #include "vc.h" #define GPIOD_BOARD_LED_GREEN GPIO_Pin_12 @@ -72,7 +73,7 @@ void vApplicationStackOverflowHook( TaskHandle_t xTask, int main(void) { init(); usart_init(); - usart_debug_puts("******* glutt-o-matique version " GIT_VERSION " *******\r\n"); + usart_debug_puts("\r\n******* glutt-o-matique version " GIT_VERSION " *******\r\n"); if (RCC_GetFlagStatus(RCC_FLAG_IWDGRST) != RESET) { @@ -119,6 +120,9 @@ static void launcher_task(void *pvParameters) usart_debug_puts("GPS init\r\n"); gps_init(); + usart_debug_puts("DS18B20 init\r\n"); + ds18b20_init(); + usart_debug_puts("TaskButton init\r\n"); TaskHandle_t task_handle; @@ -190,6 +194,7 @@ static void launcher_task(void *pvParameters) static void detect_button_press(void *pvParameters) { int pin_high_count = 0; + int last_pin_high_count = 0; const int pin_high_thresh = 10; while (1) { if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0) == Bit_SET) { @@ -205,13 +210,24 @@ static void detect_button_press(void *pvParameters) vTaskDelay(10 / portTICK_RATE_MS); /* Debounce Delay */ - if (pin_high_count == pin_high_thresh) { + if (pin_high_count == pin_high_thresh && + last_pin_high_count != pin_high_count) { tm_trigger = 1; usart_debug_puts("Bouton bleu\r\n"); + float temp = 0.0f; + if (ds18b20_gettemp(&temp)) { + usart_debug("Temperature %d\r\n", temp); + } + else { + usart_debug_puts("No temp\r\n"); + } } - else if (pin_high_count == 0) { + else if (pin_high_count == 0 && + last_pin_high_count != pin_high_count) { tm_trigger = 0; } + + last_pin_high_count = pin_high_count; } } diff --git a/src/fsm/pio.txt b/src/fsm/pio.txt deleted file mode 100644 index 85b134e..0000000 --- a/src/fsm/pio.txt +++ /dev/null @@ -1,62 +0,0 @@ -Allocation of PIOs to functions -=============================== - -Connexions Relais ------------------ -- in QRP_n PC1 -- out TX_ON PC2 -- i/o ? PC3 -- in 1750_n PC4 -- out MOD_OFF PC5 -- in SQ_n PC6 -- in U PC8 -- out QRP PC9 -- in D PC11 -- in REPLIE_n PC13 -- in FAX_n PC14 - -- i/o ? PC15 - -- i/o Dallas 1-wire - -TODO Analog signals -------------------- -- in f_0 deviation -- in SWR forward -- in SWR reflected -- in Vcc 12V measurement - -u-blox NEO-M8N GPS module connection ------------------------------------- -Yellow out UART3 TX to GPS RX PD8 -Orange in UART3 RX to GPS TX PD9 -- out GPS RESET_n PD10 - -Debug USART ------------ -- out UART2 TX to PC RX PA2 -- in UART2 RX to PC TX PA3 - -For the little test board with the 3 LEDs and switches ------------------------------------------------------- -Orange out LED grn PC9 - -I2C to Audio Codec ------------------- -- o codec reset PD4 -- - I2S3 MCK PC7 -- - I2S3 CK PC10 -- - I2S3 SD PC12 -- - I2S3 WS PA4 -- i/o I2C1 SDA PB9 -- i/o I2C1 SCL PB6 - -STM32DISCOVERY onboard things ------------------------------ -- out Green LED PD12 -- out Orange LED PD13 -- out Red LED PD14 -- out Blue LED PD15 -- in Blue Push Button PA0 - - |