stm32: Rename MICROPY_HW_HAS_SDCARD to MICROPY_HW_ENABLE_SDCARD.
For consistency with the majority of other MICROPY_HW_ENABLE_xxx macros.
This commit is contained in:
parent
7b5bf5f6fd
commit
9670b26526
|
@ -3,10 +3,10 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 8MHz
|
||||
#define MICROPY_HW_CLK_PLLM (8)
|
||||
|
|
|
@ -10,7 +10,7 @@ void NETDUINO_PLUS_2_board_early_init(void) {
|
|||
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStructure.Pull = GPIO_PULLUP;
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
// Turn on the power enable for the sdcard (PB1)
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_1;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
// On the netuino, the sdcard appears to be wired up as a 1-bit
|
||||
// SPI, so the driver needs to be converted to support that before
|
||||
// we can turn this on.
|
||||
#define MICROPY_HW_HAS_SDCARD (0)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (0)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#define MICROPY_HW_ENABLE_ADC (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
|
||||
#define MICROPY_BOARD_EARLY_INIT NUCLEO_H743ZI_board_early_init
|
||||
void NUCLEO_H743ZI_board_early_init(void);
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 12MHz
|
||||
#define MICROPY_HW_CLK_PLLM (12)
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_MMA7660 (1)
|
||||
#define MICROPY_HW_HAS_LCD (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 12MHz
|
||||
#define MICROPY_HW_CLK_PLLM (12)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_MMA7660 (1)
|
||||
#define MICROPY_HW_HAS_LCD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
|
@ -11,6 +10,7 @@
|
|||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 8MHz
|
||||
#define MICROPY_HW_CLK_PLLM (8)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_MMA7660 (1)
|
||||
#define MICROPY_HW_HAS_LCD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
|
@ -11,6 +10,7 @@
|
|||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 12MHz
|
||||
#define MICROPY_HW_CLK_PLLM (12)
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_MMA7660 (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 8MHz
|
||||
#define MICROPY_HW_CLK_PLLM (8)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_HAS_MMA7660 (1)
|
||||
#define MICROPY_HW_HAS_LCD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
|
@ -11,6 +10,7 @@
|
|||
#define MICROPY_HW_ENABLE_SERVO (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
// HSE is 8MHz
|
||||
#define MICROPY_HW_CLK_PLLM (8)
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
#define MICROPY_HW_MCU_NAME "STM32F439"
|
||||
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1) //works with no SD card too
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_DAC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1) // works with no SD card too
|
||||
|
||||
// SD card detect switch
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
#define MICROPY_HW_SDCARD_DETECT_PIN (pin_A8)
|
||||
#define MICROPY_HW_SDCARD_DETECT_PULL (GPIO_PULLUP)
|
||||
#define MICROPY_HW_SDCARD_DETECT_PRESENT (1)
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
#define MICROPY_BOARD_EARLY_INIT board_early_init
|
||||
void board_early_init(void);
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
|
||||
#define MICROPY_HW_HAS_SWITCH (1)
|
||||
#define MICROPY_HW_HAS_FLASH (1)
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ENABLE_USB (1)
|
||||
#define MICROPY_HW_ENABLE_SDCARD (1)
|
||||
|
||||
#define MICROPY_BOARD_EARLY_INIT STM32F7DISC_board_early_init
|
||||
void STM32F7DISC_board_early_init(void);
|
||||
|
|
|
@ -100,7 +100,7 @@ static const DMA_InitTypeDef dma_init_struct_spi_i2c = {
|
|||
#endif
|
||||
};
|
||||
|
||||
#if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD && !defined(STM32H7)
|
||||
#if MICROPY_HW_ENABLE_SDCARD && !defined(STM32H7)
|
||||
// Parameters to dma_init() for SDIO tx and rx.
|
||||
static const DMA_InitTypeDef dma_init_struct_sdio = {
|
||||
#if defined(STM32F4) || defined(STM32F7)
|
||||
|
@ -256,7 +256,7 @@ const dma_descr_t dma_I2C_1_TX = { DMA1_Stream6, DMA_CHANNEL_1, dma_id_6, &dma
|
|||
*/
|
||||
|
||||
// DMA2 streams
|
||||
#if defined(STM32F7) && defined(SDMMC2) && MICROPY_HW_HAS_SDCARD
|
||||
#if defined(STM32F7) && defined(SDMMC2) && MICROPY_HW_ENABLE_SDCARD
|
||||
const dma_descr_t dma_SDMMC_2 = { DMA2_Stream0, DMA_CHANNEL_11, dma_id_8, &dma_init_struct_sdio };
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_DCMI
|
||||
|
@ -264,7 +264,7 @@ const dma_descr_t dma_DCMI_0 = { DMA2_Stream1, DMA_CHANNEL_1, dma_id_9, &dma_in
|
|||
#endif
|
||||
const dma_descr_t dma_SPI_1_RX = { DMA2_Stream2, DMA_CHANNEL_3, dma_id_10, &dma_init_struct_spi_i2c };
|
||||
const dma_descr_t dma_SPI_5_RX = { DMA2_Stream3, DMA_CHANNEL_2, dma_id_11, &dma_init_struct_spi_i2c };
|
||||
#if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
const dma_descr_t dma_SDIO_0 = { DMA2_Stream3, DMA_CHANNEL_4, dma_id_11, &dma_init_struct_sdio };
|
||||
#endif
|
||||
const dma_descr_t dma_SPI_4_RX = { DMA2_Stream3, DMA_CHANNEL_5, dma_id_11, &dma_init_struct_spi_i2c };
|
||||
|
@ -272,11 +272,11 @@ const dma_descr_t dma_SPI_5_TX = { DMA2_Stream4, DMA_CHANNEL_2, dma_id_12, &dma
|
|||
const dma_descr_t dma_SPI_4_TX = { DMA2_Stream4, DMA_CHANNEL_5, dma_id_12, &dma_init_struct_spi_i2c };
|
||||
const dma_descr_t dma_SPI_6_TX = { DMA2_Stream5, DMA_CHANNEL_1, dma_id_13, &dma_init_struct_spi_i2c };
|
||||
const dma_descr_t dma_SPI_1_TX = { DMA2_Stream5, DMA_CHANNEL_3, dma_id_13, &dma_init_struct_spi_i2c };
|
||||
//#if defined(STM32F7) && defined(SDMMC2) && MICROPY_HW_HAS_SDCARD
|
||||
//#if defined(STM32F7) && defined(SDMMC2) && MICROPY_HW_ENABLE_SDCARD
|
||||
//const dma_descr_t dma_SDMMC_2 = { DMA2_Stream5, DMA_CHANNEL_11, dma_id_13, &dma_init_struct_sdio };
|
||||
//#endif
|
||||
const dma_descr_t dma_SPI_6_RX = { DMA2_Stream6, DMA_CHANNEL_1, dma_id_14, &dma_init_struct_spi_i2c };
|
||||
//#if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD
|
||||
//#if MICROPY_HW_ENABLE_SDCARD
|
||||
//const dma_descr_t dma_SDIO_0 = { DMA2_Stream6, DMA_CHANNEL_4, dma_id_14, &dma_init_struct_sdio };
|
||||
//#endif
|
||||
/* not preferred streams
|
||||
|
@ -352,7 +352,7 @@ const dma_descr_t dma_ADC_2_RX = { DMA2_Channel4, DMA_REQUEST_0, dma_id_10, NUL
|
|||
const dma_descr_t dma_DAC_1_TX = { DMA2_Channel4, DMA_REQUEST_3, dma_id_10, &dma_init_struct_dac };
|
||||
const dma_descr_t dma_SPI_1_TX = { DMA2_Channel4, DMA_REQUEST_4, dma_id_10, &dma_init_struct_spi_i2c };
|
||||
*/
|
||||
#if defined(MICROPY_HW_HAS_SDCARD) && MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
const dma_descr_t dma_SDIO_0 = { DMA2_Channel4, DMA_REQUEST_7, dma_id_10, &dma_init_struct_sdio };
|
||||
#endif
|
||||
/* not preferred streams
|
||||
|
|
|
@ -539,7 +539,7 @@ void stm32_main(uint32_t reset_mode) {
|
|||
#if MICROPY_PY_PYB_LEGACY && MICROPY_HW_ENABLE_HW_I2C
|
||||
i2c_init0();
|
||||
#endif
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
sdcard_init();
|
||||
#endif
|
||||
#if MICROPY_HW_ENABLE_STORAGE
|
||||
|
|
|
@ -194,7 +194,7 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_Flash), MP_ROM_PTR(&pyb_flash_type) },
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
#if MICROPY_PY_PYB_LEGACY
|
||||
{ MP_ROM_QSTR(MP_QSTR_SD), MP_ROM_PTR(&pyb_sdcard_obj) }, // now obsolete
|
||||
#endif
|
||||
|
|
|
@ -93,13 +93,13 @@
|
|||
#endif
|
||||
|
||||
// Whether to enable the SD card interface, exposed as pyb.SDCard
|
||||
#ifndef MICROPY_HW_HAS_SDCARD
|
||||
#define MICROPY_HW_HAS_SDCARD (0)
|
||||
#ifndef MICROPY_HW_ENABLE_SDCARD
|
||||
#define MICROPY_HW_ENABLE_SDCARD (0)
|
||||
#endif
|
||||
|
||||
// Whether to automatically mount (and boot from) the SD card if it's present
|
||||
#ifndef MICROPY_HW_SDCARD_MOUNT_AT_BOOT
|
||||
#define MICROPY_HW_SDCARD_MOUNT_AT_BOOT (MICROPY_HW_HAS_SDCARD)
|
||||
#define MICROPY_HW_SDCARD_MOUNT_AT_BOOT (MICROPY_HW_ENABLE_SDCARD)
|
||||
#endif
|
||||
|
||||
// Whether to enable the MMA7660 driver, exposed as pyb.Accel
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "dma.h"
|
||||
#include "irq.h"
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
|
||||
#if defined(STM32F7) || defined(STM32H7) || defined(STM32L4)
|
||||
|
||||
|
@ -602,4 +602,4 @@ void sdcard_init_vfs(fs_user_mount_t *vfs, int part) {
|
|||
vfs->u.ioctl[1] = MP_OBJ_FROM_PTR(&pyb_sdcard_obj);
|
||||
}
|
||||
|
||||
#endif // MICROPY_HW_HAS_SDCARD
|
||||
#endif // MICROPY_HW_ENABLE_SDCARD
|
||||
|
|
|
@ -147,11 +147,11 @@ bool pyb_usb_dev_init(uint16_t vid, uint16_t pid, usb_device_mode_t mode, USBD_H
|
|||
}
|
||||
|
||||
switch (pyb_usb_storage_medium) {
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
case PYB_USB_STORAGE_MEDIUM_SDCARD:
|
||||
USBD_MSC_RegisterStorage(&usb_dev->usbd_cdc_msc_hid_state, (USBD_StorageTypeDef*)&USBD_SDCARD_STORAGE_fops);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
USBD_MSC_RegisterStorage(&usb_dev->usbd_cdc_msc_hid_state, (USBD_StorageTypeDef*)&USBD_FLASH_STORAGE_fops);
|
||||
break;
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
// can be unmounted, and won't be remounted automatically.
|
||||
static uint8_t flash_started = 0;
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
static uint8_t sdcard_started = 0;
|
||||
#endif
|
||||
|
||||
|
@ -175,7 +175,7 @@ const USBD_StorageTypeDef USBD_FLASH_STORAGE_fops = {
|
|||
/******************************************************************************/
|
||||
// Callback functions for when the SD card is the mass storage device
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#if MICROPY_HW_ENABLE_SDCARD
|
||||
|
||||
static const int8_t SDCARD_STORAGE_Inquirydata[] = { // 36 bytes
|
||||
// LUN 0
|
||||
|
@ -303,4 +303,4 @@ const USBD_StorageTypeDef USBD_SDCARD_STORAGE_fops = {
|
|||
(int8_t *)SDCARD_STORAGE_Inquirydata,
|
||||
};
|
||||
|
||||
#endif // MICROPY_HW_HAS_SDCARD
|
||||
#endif // MICROPY_HW_ENABLE_SDCARD
|
||||
|
|
Loading…
Reference in New Issue