cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE error: two or more data types in declaration specifiers

ngodoanvan
Senior

Hi everyone,

I create a project in STM32CubeIDE. I have a error which show in figure below,

ngodoanvan_0-1690016975690.png

This is my full file code:

#ifndef __SOURCE_SPI_AML_H__ #define __SOURCE_SPI_AML_H__ #include "main.h" #include <stdint.h> #include <stddef.h> #include <stdbool.h> #include "common_aml.h" #define SPI_AML_TIMEOUT 1000U /*!< Timeout for blocking transfer. */ enum _spi_aml_status { kStatus_AML_SPI_Busy = MAKE_STATUS(kStatusGroup_AML_SPI, 0), /*!< SPI transfer is busy.*/ kStatus_AML_SPI_Error = MAKE_STATUS(kStatusGroup_AML_SPI, 1) /*!< Other SPI driver error. */ }; typedef enum { spiBitcount8bit = 0x0U, /*!< 8 bits per frame. */ spiBitcount16bit = 0x1U /*!< 16 bits per frame. */ } spi_aml_bitcount_t; typedef enum { spiClockPhaseFirstEdge = 0x0U, /*!< Data is captured on the leading edge of the SCK and changed on the following edge. */ spiClockPhaseSecondEdge = 0x1U /*!< Data is changed on the leading edge of the SCK and captured on the following edge. */ } spi_aml_clock_phase_t; typedef enum { spiClockPolarityActiveHigh = 0x0U, /*!< Active-high SPI clock (idles low). */ spiClockPolarityActiveLow = 0x1U /*!< Active-low SPI clock (idles high). */ } spi_aml_clock_polarity_t; typedef enum { spiPcsActiveHigh = 0x0U, /*!< Pcs Active High (idles low). */ spiPcsActiveLow = 0x1U /*!< Pcs Active Low (idles high). */ } spi_aml_pcs_polarity_t; typedef struct { uint32_t baudRateHz; /*!< Baudrate in Hz. */ uint16_t bitCount; /*!< Number of bits/frame, minimum is 8-bits. */ spi_aml_clock_phase_t clkPhase; /*!< Clock phase. */ spi_aml_clock_polarity_t clkPolarity; /*!< Clock polarity. */ bool lsbFirst; /*!< true = LSB first, false = MSB first. */ spi_aml_pcs_polarity_t pcsPolarity; /*!< Active level of chip select pin (PCS). */ uint32_t sourceClockHz; /*!< Peripheral source clock frequency in Hz. */ } spi_aml_master_config_t; typedef struct { uint8_t *txBuffer; /*!< Send buffer. */ uint8_t *rxBuffer; /*!< Receive buffer. */ size_t dataSize; /*!< Number of bytes to transfer. */ uint32_t configFlags; /*!< SPI control flags, only for DSPI. */ } spi_aml_transfer_t; #endif
View more

How do I fix this error ?

Thanks.

1 REPLY 1
Pavel A.
Super User

First, understand why the compiler believes that there are two or more type declarations.

Enable output of preprocessed C code (how? google, ask chatgpt)  and see what these two MAKE_STATUS(...)  lines become. Or find definition of MAKE_STATUS and preprocess "on paper".