aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx
diff options
context:
space:
mode:
authorbarthess <barthess@yandex.ru>2014-12-18 00:21:28 +0300
committerbarthess <barthess@yandex.ru>2014-12-18 00:21:28 +0300
commit073d4d467f501f99334c43ef5583ae40888aa274 (patch)
tree05f01f08c62b00e33c0be78bea1b6937e2d08e59 /testhal/STM32/STM32F4xx
parent99505cdea68069a3873e670ccc95cdc0f94d2319 (diff)
downloadChibiOS-Contrib-073d4d467f501f99334c43ef5583ae40888aa274.tar.gz
ChibiOS-Contrib-073d4d467f501f99334c43ef5583ae40888aa274.tar.bz2
ChibiOS-Contrib-073d4d467f501f99334c43ef5583ae40888aa274.zip
1-wire. STM32F1xx code tested
Diffstat (limited to 'testhal/STM32/STM32F4xx')
-rw-r--r--testhal/STM32/STM32F4xx/onewire/Makefile3
-rw-r--r--testhal/STM32/STM32F4xx/onewire/main.c7
-rw-r--r--testhal/STM32/STM32F4xx/onewire/onewire_test.c31
3 files changed, 15 insertions, 26 deletions
diff --git a/testhal/STM32/STM32F4xx/onewire/Makefile b/testhal/STM32/STM32F4xx/onewire/Makefile
index ad6e2a6..e82a879 100644
--- a/testhal/STM32/STM32F4xx/onewire/Makefile
+++ b/testhal/STM32/STM32F4xx/onewire/Makefile
@@ -65,7 +65,7 @@ endif
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
ifeq ($(USE_FPU),)
- USE_FPU = hard
+ USE_FPU = softfp
endif
#
@@ -87,7 +87,6 @@ include $(CHIBIOS)/community/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/osal/rt/osal.mk
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/rt/ports/ARMCMx/compilers/GCC/mk/port_stm32f4xx.mk
-include $(CHIBIOS)/test/rt/test.mk
# Define linker script file here
LDSCRIPT= $(PORTLD)/STM32F407xG.ld
diff --git a/testhal/STM32/STM32F4xx/onewire/main.c b/testhal/STM32/STM32F4xx/onewire/main.c
index 5fdbfd9..793bffe 100644
--- a/testhal/STM32/STM32F4xx/onewire/main.c
+++ b/testhal/STM32/STM32F4xx/onewire/main.c
@@ -35,13 +35,6 @@ int main(void) {
chSysInit();
/*
- * Connect PB8 to TIM4 channel 2, set open drain mode
- * and enable internal pullup for slave absence detection.
- */
- palSetPadMode(GPIOB, GPIOB_PIN8,
- PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP);
-
- /*
* Executes infinite onewire test code.
*/
onewireTest();
diff --git a/testhal/STM32/STM32F4xx/onewire/onewire_test.c b/testhal/STM32/STM32F4xx/onewire/onewire_test.c
index 139732d..7d0de69 100644
--- a/testhal/STM32/STM32F4xx/onewire/onewire_test.c
+++ b/testhal/STM32/STM32F4xx/onewire/onewire_test.c
@@ -32,19 +32,23 @@
#if defined(BOARD_ST_STM32F4_DISCOVERY)
#define GPIOB_ONEWIRE GPIOB_PIN8
+#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_off() (palClearPad(GPIOD, GPIOD_LED4))
#define search_led_on() (palSetPad(GPIOD, GPIOD_LED4))
#define ONEWIRE_MASTER_CHANNEL 2
#define ONEWIRE_SAMPLE_CHANNEL 3
#elif defined(BOARD_OLIMEX_STM32_103STK)
#define GPIOB_ONEWIRE 8
-#define search_led_off() (palClearPad(GPIOC, GPIOC_LED))
-#define search_led_on() (palSetPad(GPIOC, GPIOC_LED))
-#define ONEWIRE_MASTER_CHANNEL 3
-#define ONEWIRE_SAMPLE_CHANNEL 2
+#define ONEWIRE_PAD_MODE_IDLE PAL_MODE_INPUT
+#define ONEWIRE_PAD_MODE_ACTIVE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
+#define search_led_on() (palClearPad(GPIOC, GPIOC_LED))
+#define search_led_off() (palSetPad(GPIOC, GPIOC_LED))
+#define ONEWIRE_MASTER_CHANNEL 2
+#define ONEWIRE_SAMPLE_CHANNEL 3
#else
#define GPIOB_ONEWIRE GPIOB_TACHOMETER
#include "pads.h"
+#define ONEWIRE_PAD_MODE_ACTIVE (PAL_MODE_ALTERNATE(2) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUDR_PULLUP)
#define search_led_on red_led_on
#define search_led_off red_led_off
#define ONEWIRE_MASTER_CHANNEL 2
@@ -65,7 +69,6 @@
/*
* Forward declarations
*/
-static uint_fast8_t onewire_read_bit_X(void);
#if ONEWIRE_USE_STRONG_PULLUP
static void strong_pullup_assert(void);
static void strong_pullup_release(void);
@@ -88,7 +91,12 @@ static const onewireConfig ow_cfg = {
&PWMD4,
ONEWIRE_MASTER_CHANNEL,
ONEWIRE_SAMPLE_CHANNEL,
- onewire_read_bit_X,
+ GPIOB,
+ GPIOB_ONEWIRE,
+#if defined(STM32F1XX)
+ ONEWIRE_PAD_MODE_IDLE,
+#endif
+ ONEWIRE_PAD_MODE_ACTIVE,
#if ONEWIRE_USE_STRONG_PULLUP
strong_pullup_assert,
strong_pullup_release
@@ -121,17 +129,6 @@ static void strong_pullup_release(void) {
}
#endif /* ONEWIRE_USE_STRONG_PULLUP */
-/**
- *
- */
-static uint_fast8_t onewire_read_bit_X(void) {
-#if ONEWIRE_SYNTH_SEARCH_TEST
- return _synth_ow_read_bit();
-#else
- return palReadPad(GPIOB, GPIOB_ONEWIRE);
-#endif
-}
-
/*
******************************************************************************
* EXPORTED FUNCTIONS