diff --git a/configs/stm32f4discovery/src/Makefile b/configs/stm32f4discovery/src/Makefile index ef0011eb280..84dbb72c041 100644 --- a/configs/stm32f4discovery/src/Makefile +++ b/configs/stm32f4discovery/src/Makefile @@ -60,6 +60,10 @@ ifeq ($(CONFIG_MAX31855),y) CSRCS += stm32_max31855.c endif +ifeq ($(CONFIG_MAX6675),y) +CSRCS += stm32_max6675.c +endif + ifeq ($(CONFIG_STM32_SDIO),y) CSRCS += stm32_sdio.c endif diff --git a/configs/stm32f4discovery/src/stm32_bringup.c b/configs/stm32f4discovery/src/stm32_bringup.c index fe0c7bdef35..c296d1ea77c 100644 --- a/configs/stm32f4discovery/src/stm32_bringup.c +++ b/configs/stm32f4discovery/src/stm32_bringup.c @@ -174,5 +174,8 @@ int stm32_bringup(void) ret = stm32_max31855initialize("/dev/temp0"); #endif +#ifdef CONFIG_MAX6675 + ret = stm32_max6675initialize("/dev/temp0"); +#endif return ret; } diff --git a/configs/stm32f4discovery/src/stm32_spi.c b/configs/stm32f4discovery/src/stm32_spi.c index 7b6ffd950b3..32c7b2a15e1 100644 --- a/configs/stm32f4discovery/src/stm32_spi.c +++ b/configs/stm32f4discovery/src/stm32_spi.c @@ -100,6 +100,9 @@ void weak_function stm32_spiinitialize(void) #if defined(CONFIG_STM32_SPI2) && defined(CONFIG_MAX31855) (void)stm32_configgpio(GPIO_MAX31855_CS); /* MAX31855 chip select */ #endif +#if defined(CONFIG_STM32_SPI2) && defined(CONFIG_MAX6675) + (void)stm32_configgpio(GPIO_MAX6675_CS); /* MAX6675 chip select */ +#endif #if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) || \ defined(CONFIG_LCD_SSD1351) (void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */ @@ -172,6 +175,12 @@ void stm32_spi2select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele stm32_gpiowrite(GPIO_MAX31855_CS, !selected); } #endif +#if defined(CONFIG_MAX6675) + if (devid == SPIDEV_TEMPERATURE) + { + stm32_gpiowrite(GPIO_MAX6675_CS, !selected); + } +#endif } uint8_t stm32_spi2status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) diff --git a/configs/stm32f4discovery/src/stm32f4discovery.h b/configs/stm32f4discovery/src/stm32f4discovery.h index 4b7a91fe00d..b42060dc644 100644 --- a/configs/stm32f4discovery/src/stm32f4discovery.h +++ b/configs/stm32f4discovery/src/stm32f4discovery.h @@ -212,6 +212,9 @@ #define GPIO_MAX31855_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN8) +#define GPIO_MAX6675_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ + GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN8) + /* USB OTG FS * * PA9 OTG_FS_VBUS VBUS sensing (also connected to the green LED) @@ -531,5 +534,17 @@ void weak_function stm32_netinitialize(void); int stm32_zerocross_initialize(void); #endif +/**************************************************************************** + * Name: stm32_max6675initialize + * + * Description: + * Initialize and register the max6675 driver + * + ****************************************************************************/ + +#ifdef CONFIG_MAX6675 +int stm32_max6675initialize(FAR const char *devpath); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_STM32F4DISCOVERY_SRC_STM32F4DISCOVERY_H */