STM32F30xx Standard Peripheral Library
Variable types
Specific variable types are already defined with a fixed type and size. These types are
defined in the file stm32f30x.h
typedef enum {
RESET = 0,
SET = !RESET
}
FlagStatus, ITStatus;
typedef enum {
DISABLE = 0,
ENABLE = !DISABLE
}
FunctionalState;
typedef enum {
ERROR = 0,
SUCCESS = !ERROR
}
ErrorStatus;
Peripherals
Pointers to peripherals are used to access the peripheral control registers. They point to
data structures that represent the mapping of the peripheral control registers.
Peripheral registers structure
stm32f30x.h contains the definition of all peripheral register structures. The example below
illustrates the SPI register structure declaration:
"/*------------------ Serial Peripheral Interface ---------------*/
typedef struct
{
__IO uint16_t CR1; /*!< SPI control register 1 (not used in
I2S mode), Address offset: 0x00 */
uint16_t RESERVED0;/*!< Reserved, 0x02
*/
__IO uint16_t CR2; /*!< SPI control register 2, Address
offset: 0x04 */
uint16_t RESERVED1;/*!< Reserved, 0x06
*/
__IO uint16_t SR; /*!< SPI status register, Address offset:
0x08 */
uint16_t RESERVED2;/*!< Reserved, 0x0A
*/
__IO uint16_t DR; /*!< SPI data register,Address offset:
0x0C */
uint16_t RESERVED3;/*!< Reserved, 0x0E
*/
__IO uint16_t CRCPR; /*!< SPI CRC polynomial register (not
used in I2S mode), Address offset: 0x10 */
uint16_t RESERVED4;/*!< Reserved, 0x12
*/
__IO uint16_t RXCRCR; /*!< SPI RX CRC register (not used in I2S
mode),Address offset: 0x14 */
uint16_t RESERVED5;/*!< Reserved, 0x16 */