Add board config to support MAX6675

This commit is contained in:
Alan Carvalho de Assis 2015-10-18 07:54:21 +08:00 committed by Gregory Nutt
parent f2d07ad135
commit 82bc95c340
4 changed files with 31 additions and 0 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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)

View File

@ -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 */