stm: Put TARGET in mpconfigport.h; support PYBv4.
This commit is contained in:
parent
8517bce6b1
commit
eb380d7261
|
@ -17,7 +17,6 @@ STMSRC=lib
|
|||
FATFSSRC=fatfs
|
||||
CC3KSRC=cc3k
|
||||
DFU=../tools/dfu.py
|
||||
TARGET=PYBOARD
|
||||
OSC_VALUE=8000000
|
||||
|
||||
AS = arm-none-eabi-as
|
||||
|
@ -27,7 +26,7 @@ OBJCOPY = arm-none-eabi-objcopy
|
|||
SIZE = arm-none-eabi-size
|
||||
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion -DSTM32F40_41xxx -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=$(OSC_VALUE)
|
||||
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(CMSIS) -I$(STMSRC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4) -D$(TARGET)
|
||||
CFLAGS = -I. -I$(PY_SRC) -I$(FATFSSRC) -I$(CMSIS) -I$(STMSRC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4)
|
||||
#CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE
|
||||
|
||||
#Debugging/Optimization
|
||||
|
|
18
stm/led.c
18
stm/led.c
|
@ -32,6 +32,24 @@
|
|||
#define PYB_LED_ON(port, pin) (port->BSRRH = pin)
|
||||
#define PYB_LED_OFF(port, pin) (port->BSRRL = pin)
|
||||
|
||||
#elif defined(PYBOARD4)
|
||||
#define PYB_LED1_PORT (GPIOA)
|
||||
#define PYB_LED1_PIN (GPIO_Pin_13)
|
||||
|
||||
#define PYB_LED2_PORT (GPIOA)
|
||||
#define PYB_LED2_PIN (GPIO_Pin_14)
|
||||
|
||||
#define PYB_LED3_PORT (GPIOA)
|
||||
#define PYB_LED3_PIN (GPIO_Pin_15)
|
||||
|
||||
#define PYB_LED4_PORT (GPIOB)
|
||||
#define PYB_LED4_PIN (GPIO_Pin_4)
|
||||
|
||||
#define PYB_OTYPE (GPIO_OType_PP)
|
||||
|
||||
#define PYB_LED_ON(port, pin) (port->BSRRL = pin)
|
||||
#define PYB_LED_OFF(port, pin) (port->BSRRH = pin)
|
||||
|
||||
#elif defined(STM32F4DISC)
|
||||
#define PYB_LED1_PORT (GPIOD)
|
||||
#define PYB_LED1_PIN (GPIO_Pin_14)
|
||||
|
|
|
@ -41,124 +41,6 @@
|
|||
#include "stm324x7i_eval.h"
|
||||
//#include "stm32f4xx_i2c.h"
|
||||
|
||||
/** @addtogroup Utilities
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32_EVAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL
|
||||
* @brief This file provides firmware functions to manage Leds, push-buttons,
|
||||
* COM ports, SD card on SDIO and serial EEPROM (sEE) available on
|
||||
* STM324x7I-EVAL evaluation board from STMicroelectronics.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_TypesDefinitions
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Defines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Variables
|
||||
* @{
|
||||
*/
|
||||
#if 0
|
||||
GPIO_TypeDef* GPIO_PORT[LEDn] = {LED1_GPIO_PORT, LED2_GPIO_PORT, LED3_GPIO_PORT,
|
||||
LED4_GPIO_PORT};
|
||||
const uint16_t GPIO_PIN[LEDn] = {LED1_PIN, LED2_PIN, LED3_PIN,
|
||||
LED4_PIN};
|
||||
const uint32_t GPIO_CLK[LEDn] = {LED1_GPIO_CLK, LED2_GPIO_CLK, LED3_GPIO_CLK,
|
||||
LED4_GPIO_CLK};
|
||||
|
||||
GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {WAKEUP_BUTTON_GPIO_PORT, TAMPER_BUTTON_GPIO_PORT,
|
||||
KEY_BUTTON_GPIO_PORT};
|
||||
|
||||
const uint16_t BUTTON_PIN[BUTTONn] = {WAKEUP_BUTTON_PIN, TAMPER_BUTTON_PIN,
|
||||
KEY_BUTTON_PIN};
|
||||
|
||||
const uint32_t BUTTON_CLK[BUTTONn] = {WAKEUP_BUTTON_GPIO_CLK, TAMPER_BUTTON_GPIO_CLK,
|
||||
KEY_BUTTON_GPIO_CLK};
|
||||
|
||||
const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {WAKEUP_BUTTON_EXTI_LINE,
|
||||
TAMPER_BUTTON_EXTI_LINE,
|
||||
KEY_BUTTON_EXTI_LINE};
|
||||
|
||||
const uint16_t BUTTON_PORT_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PORT_SOURCE,
|
||||
TAMPER_BUTTON_EXTI_PORT_SOURCE,
|
||||
KEY_BUTTON_EXTI_PORT_SOURCE};
|
||||
|
||||
const uint16_t BUTTON_PIN_SOURCE[BUTTONn] = {WAKEUP_BUTTON_EXTI_PIN_SOURCE,
|
||||
TAMPER_BUTTON_EXTI_PIN_SOURCE,
|
||||
KEY_BUTTON_EXTI_PIN_SOURCE};
|
||||
const uint16_t BUTTON_IRQn[BUTTONn] = {WAKEUP_BUTTON_EXTI_IRQn, TAMPER_BUTTON_EXTI_IRQn,
|
||||
KEY_BUTTON_EXTI_IRQn};
|
||||
|
||||
GPIO_TypeDef* COM_TX_PORT[COMn] = {EVAL_COM1_TX_GPIO_PORT};
|
||||
|
||||
GPIO_TypeDef* COM_RX_PORT[COMn] = {EVAL_COM1_RX_GPIO_PORT};
|
||||
|
||||
const uint32_t COM_TX_PORT_CLK[COMn] = {EVAL_COM1_TX_GPIO_CLK};
|
||||
|
||||
const uint32_t COM_RX_PORT_CLK[COMn] = {EVAL_COM1_RX_GPIO_CLK};
|
||||
|
||||
const uint16_t COM_TX_PIN[COMn] = {EVAL_COM1_TX_PIN};
|
||||
|
||||
const uint16_t COM_RX_PIN[COMn] = {EVAL_COM1_RX_PIN};
|
||||
|
||||
const uint16_t COM_TX_PIN_SOURCE[COMn] = {EVAL_COM1_TX_SOURCE};
|
||||
|
||||
const uint16_t COM_RX_PIN_SOURCE[COMn] = {EVAL_COM1_RX_SOURCE};
|
||||
|
||||
const uint16_t COM_TX_AF[COMn] = {EVAL_COM1_TX_AF};
|
||||
|
||||
const uint16_t COM_RX_AF[COMn] = {EVAL_COM1_RX_AF};
|
||||
|
||||
DMA_InitTypeDef sEEDMA_InitStructure;
|
||||
NVIC_InitTypeDef NVIC_InitStructure;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_FunctionPrototypes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Private_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief DeInitializes the SDIO interface.
|
||||
* @param None
|
||||
|
@ -240,12 +122,21 @@ void SD_LowLevel_Init(void)
|
|||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
|
||||
/*!< Configure SD_SPI_DETECT_PIN pin: SD Card detect pin */
|
||||
// dpgeorge: switch is normally open, connected to VDD when card inserted
|
||||
#if defined(PYBOARD)
|
||||
// dpgeorge: PYBv2-v3: switch is normally open, connected to VDD when card inserted
|
||||
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz; // needs to be 2MHz due to restrictions on PC13
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
|
||||
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
#elif defined(PYBOARD4)
|
||||
// dpgeorge: PYBv4: switch is normally open, connected to GND when card inserted
|
||||
GPIO_InitStructure.GPIO_Pin = SD_DETECT_PIN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(SD_DETECT_GPIO_PORT, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
/* Enable the SDIO APB2 Clock */
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SDIO, ENABLE);
|
||||
|
@ -337,26 +228,4 @@ void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize)
|
|||
DMA_Cmd(SD_SDIO_DMA_STREAM, ENABLE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __STM324x7I_EVAL_H
|
||||
#define __STM324x7I_EVAL_H
|
||||
|
@ -36,189 +36,21 @@
|
|||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
/** @addtogroup Utilities
|
||||
* @{
|
||||
*/
|
||||
#include "mpconfig.h"
|
||||
|
||||
/** @addtogroup STM32_EVAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Exported_Types
|
||||
* @{
|
||||
*/
|
||||
#if 0
|
||||
typedef enum
|
||||
{
|
||||
LED1 = 0,
|
||||
LED2 = 1,
|
||||
LED3 = 2,
|
||||
LED4 = 3
|
||||
} Led_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_WAKEUP = 0,
|
||||
BUTTON_TAMPER = 1,
|
||||
BUTTON_KEY = 2,
|
||||
BUTTON_RIGHT = 3,
|
||||
BUTTON_LEFT = 4,
|
||||
BUTTON_UP = 5,
|
||||
BUTTON_DOWN = 6,
|
||||
BUTTON_SEL = 7
|
||||
} Button_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BUTTON_MODE_GPIO = 0,
|
||||
BUTTON_MODE_EXTI = 1
|
||||
} ButtonMode_TypeDef;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
JOY_NONE = 0,
|
||||
JOY_SEL = 1,
|
||||
JOY_DOWN = 2,
|
||||
JOY_LEFT = 3,
|
||||
JOY_RIGHT = 4,
|
||||
JOY_UP = 5
|
||||
} JOYState_TypeDef
|
||||
;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
COM1 = 0,
|
||||
COM2 = 1
|
||||
} COM_TypeDef;
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define for STM324x7I_EVAL board
|
||||
*/
|
||||
#if !defined (USE_STM324x7I_EVAL)
|
||||
#define USE_STM324x7I_EVAL
|
||||
#endif
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL_LED
|
||||
* @{
|
||||
*/
|
||||
#define LEDn 4
|
||||
|
||||
#define LED1_PIN GPIO_Pin_6
|
||||
#define LED1_GPIO_PORT GPIOG
|
||||
#define LED1_GPIO_CLK RCC_AHB1Periph_GPIOG
|
||||
|
||||
#define LED2_PIN GPIO_Pin_8
|
||||
#define LED2_GPIO_PORT GPIOG
|
||||
#define LED2_GPIO_CLK RCC_AHB1Periph_GPIOG
|
||||
|
||||
#define LED3_PIN GPIO_Pin_9
|
||||
#define LED3_GPIO_PORT GPIOI
|
||||
#define LED3_GPIO_CLK RCC_AHB1Periph_GPIOI
|
||||
|
||||
#define LED4_PIN GPIO_Pin_7
|
||||
#define LED4_GPIO_PORT GPIOC
|
||||
#define LED4_GPIO_CLK RCC_AHB1Periph_GPIOC
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL_BUTTON
|
||||
* @{
|
||||
*/
|
||||
#define BUTTONn 3 /*!< Joystick pins are connected to
|
||||
an IO Expander (accessible through
|
||||
I2C1 interface) */
|
||||
|
||||
/**
|
||||
* @brief Wakeup push-button
|
||||
*/
|
||||
#define WAKEUP_BUTTON_PIN GPIO_Pin_0
|
||||
#define WAKEUP_BUTTON_GPIO_PORT GPIOA
|
||||
#define WAKEUP_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA
|
||||
#define WAKEUP_BUTTON_EXTI_LINE EXTI_Line0
|
||||
#define WAKEUP_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA
|
||||
#define WAKEUP_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0
|
||||
#define WAKEUP_BUTTON_EXTI_IRQn EXTI0_IRQn
|
||||
|
||||
/**
|
||||
* @brief Tamper push-button
|
||||
*/
|
||||
#define TAMPER_BUTTON_PIN GPIO_Pin_13
|
||||
#define TAMPER_BUTTON_GPIO_PORT GPIOC
|
||||
#define TAMPER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOC
|
||||
#define TAMPER_BUTTON_EXTI_LINE EXTI_Line13
|
||||
#define TAMPER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
|
||||
#define TAMPER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource13
|
||||
#define TAMPER_BUTTON_EXTI_IRQn EXTI15_10_IRQn
|
||||
|
||||
/**
|
||||
* @brief Key push-button
|
||||
*/
|
||||
#define KEY_BUTTON_PIN GPIO_Pin_15
|
||||
#define KEY_BUTTON_GPIO_PORT GPIOG
|
||||
#define KEY_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOG
|
||||
#define KEY_BUTTON_EXTI_LINE EXTI_Line15
|
||||
#define KEY_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOG
|
||||
#define KEY_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource15
|
||||
#define KEY_BUTTON_EXTI_IRQn EXTI15_10_IRQn
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL_COM
|
||||
* @{
|
||||
*/
|
||||
#define COMn 1
|
||||
|
||||
/**
|
||||
* @brief Definition for COM port1, connected to USART3
|
||||
*/
|
||||
#define EVAL_COM1 USART3
|
||||
#define EVAL_COM1_CLK RCC_APB1Periph_USART3
|
||||
#define EVAL_COM1_TX_PIN GPIO_Pin_10
|
||||
#define EVAL_COM1_TX_GPIO_PORT GPIOC
|
||||
#define EVAL_COM1_TX_GPIO_CLK RCC_AHB1Periph_GPIOC
|
||||
#define EVAL_COM1_TX_SOURCE GPIO_PinSource10
|
||||
#define EVAL_COM1_TX_AF GPIO_AF_USART3
|
||||
#define EVAL_COM1_RX_PIN GPIO_Pin_11
|
||||
#define EVAL_COM1_RX_GPIO_PORT GPIOC
|
||||
#define EVAL_COM1_RX_GPIO_CLK RCC_AHB1Periph_GPIOC
|
||||
#define EVAL_COM1_RX_SOURCE GPIO_PinSource11
|
||||
#define EVAL_COM1_RX_AF GPIO_AF_USART3
|
||||
#define EVAL_COM1_IRQn USART3_IRQn
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL_SD_FLASH
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief SD FLASH SDIO Interface
|
||||
*/
|
||||
#if defined(PYBOARD)
|
||||
#define SD_DETECT_PIN GPIO_Pin_13 /* PC.13 */
|
||||
#define SD_DETECT_GPIO_PORT GPIOC /* GPIOC */
|
||||
#define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOC
|
||||
|
||||
#elif defined(PYBOARD4)
|
||||
#define SD_DETECT_PIN GPIO_Pin_8 /* PA..8 */
|
||||
#define SD_DETECT_GPIO_PORT GPIOA /* GPIOA */
|
||||
#define SD_DETECT_GPIO_CLK RCC_AHB1Periph_GPIOA
|
||||
#endif
|
||||
|
||||
#define SDIO_FIFO_ADDRESS ((uint32_t)0x40012C80)
|
||||
/**
|
||||
* @brief SDIO Intialization Frequency (400KHz max)
|
||||
|
@ -257,78 +89,6 @@ typedef enum
|
|||
#define SD_SDIO_DMA_IRQHANDLER DMA2_Stream6_IRQHandler
|
||||
#endif /* SD_SDIO_DMA_STREAM3 */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM324x7I_EVAL_LOW_LEVEL_I2C_EE
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief I2C EEPROM Interface pins
|
||||
*/
|
||||
#if 0
|
||||
#define sEE_I2C I2C1
|
||||
#define sEE_I2C_CLK RCC_APB1Periph_I2C1
|
||||
#define sEE_I2C_SCL_PIN GPIO_Pin_6 /* PB.06 */
|
||||
#define sEE_I2C_SCL_GPIO_PORT GPIOB /* GPIOB */
|
||||
#define sEE_I2C_SCL_GPIO_CLK RCC_AHB1Periph_GPIOB
|
||||
#define sEE_I2C_SCL_SOURCE GPIO_PinSource6
|
||||
#define sEE_I2C_SCL_AF GPIO_AF_I2C1
|
||||
#define sEE_I2C_SDA_PIN GPIO_Pin_9 /* PB.09 */
|
||||
#define sEE_I2C_SDA_GPIO_PORT GPIOB /* GPIOB */
|
||||
#define sEE_I2C_SDA_GPIO_CLK RCC_AHB1Periph_GPIOB
|
||||
#define sEE_I2C_SDA_SOURCE GPIO_PinSource9
|
||||
#define sEE_I2C_SDA_AF GPIO_AF_I2C1
|
||||
#define sEE_M24C64_32
|
||||
|
||||
#define sEE_I2C_DMA DMA1
|
||||
#define sEE_I2C_DMA_CHANNEL DMA_Channel_1
|
||||
#define sEE_I2C_DMA_STREAM_TX DMA1_Stream6
|
||||
#define sEE_I2C_DMA_STREAM_RX DMA1_Stream0
|
||||
#define sEE_I2C_DMA_CLK RCC_AHB1Periph_DMA1
|
||||
#define sEE_I2C_DR_Address ((uint32_t)0x40005410)
|
||||
#define sEE_USE_DMA
|
||||
|
||||
#define sEE_I2C_DMA_TX_IRQn DMA1_Stream6_IRQn
|
||||
#define sEE_I2C_DMA_RX_IRQn DMA1_Stream0_IRQn
|
||||
#define sEE_I2C_DMA_TX_IRQHandler DMA1_Stream6_IRQHandler
|
||||
#define sEE_I2C_DMA_RX_IRQHandler DMA1_Stream0_IRQHandler
|
||||
#define sEE_I2C_DMA_PREPRIO 0
|
||||
#define sEE_I2C_DMA_SUBPRIO 0
|
||||
|
||||
#define sEE_TX_DMA_FLAG_FEIF DMA_FLAG_FEIF6
|
||||
#define sEE_TX_DMA_FLAG_DMEIF DMA_FLAG_DMEIF6
|
||||
#define sEE_TX_DMA_FLAG_TEIF DMA_FLAG_TEIF6
|
||||
#define sEE_TX_DMA_FLAG_HTIF DMA_FLAG_HTIF6
|
||||
#define sEE_TX_DMA_FLAG_TCIF DMA_FLAG_TCIF6
|
||||
#define sEE_RX_DMA_FLAG_FEIF DMA_FLAG_FEIF0
|
||||
#define sEE_RX_DMA_FLAG_DMEIF DMA_FLAG_DMEIF0
|
||||
#define sEE_RX_DMA_FLAG_TEIF DMA_FLAG_TEIF0
|
||||
#define sEE_RX_DMA_FLAG_HTIF DMA_FLAG_HTIF0
|
||||
#define sEE_RX_DMA_FLAG_TCIF DMA_FLAG_TCIF0
|
||||
|
||||
#define sEE_DIRECTION_TX 0
|
||||
#define sEE_DIRECTION_RX 1
|
||||
|
||||
/* Time constant for the delay caclulation allowing to have a millisecond
|
||||
incrementing counter. This value should be equal to (System Clock / 1000).
|
||||
ie. if system clock = 168MHz then sEE_TIME_CONST should be 168. */
|
||||
#define sEE_TIME_CONST 168
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @defgroup STM324x7I_EVAL_LOW_LEVEL_Exported_Functions
|
||||
* @{
|
||||
|
@ -337,34 +97,11 @@ void SD_LowLevel_DeInit(void);
|
|||
void SD_LowLevel_Init(void);
|
||||
void SD_LowLevel_DMA_TxConfig(uint32_t *BufferSRC, uint32_t BufferSize);
|
||||
void SD_LowLevel_DMA_RxConfig(uint32_t *BufferDST, uint32_t BufferSize);
|
||||
#if 0
|
||||
void sEE_LowLevel_DeInit(void);
|
||||
void sEE_LowLevel_Init(void);
|
||||
void sEE_LowLevel_DMAConfig(uint32_t pBuffer, uint32_t BufferSize, uint32_t Direction);
|
||||
#endif
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STM324x7I_EVAL_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
|
|
@ -518,7 +518,11 @@ uint8_t SD_Detect(void)
|
|||
__IO uint8_t status = SD_PRESENT;
|
||||
|
||||
/*!< Check GPIO to detect SD */
|
||||
#if defined(PYBOARD)
|
||||
if (GPIO_ReadInputDataBit(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != Bit_SET)
|
||||
#elif defined(PYBOARD4)
|
||||
if (GPIO_ReadInputDataBit(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == Bit_SET)
|
||||
#endif
|
||||
{
|
||||
status = SD_NOT_PRESENT;
|
||||
}
|
||||
|
|
|
@ -19,3 +19,9 @@ typedef const void *machine_const_ptr_t; // must be of pointer size
|
|||
typedef float machine_float_t;
|
||||
|
||||
machine_float_t machine_sqrt(machine_float_t x);
|
||||
|
||||
// board specific definitions
|
||||
|
||||
//#define PYBOARD
|
||||
#define PYBOARD4
|
||||
//#define STM32F4DISC
|
||||
|
|
11
stm/usrsw.c
11
stm/usrsw.c
|
@ -19,6 +19,15 @@
|
|||
#define USRSW_EXTI_LINE (EXTI_Line13)
|
||||
#define USRSW_EXTI_IRQN (EXTI15_10_IRQn)
|
||||
#define USRSW_EXTI_EDGE (EXTI_Trigger_Rising)
|
||||
#elif defined (PYBOARD4)
|
||||
#define USRSW_PORT (GPIOB)
|
||||
#define USRSW_PIN (GPIO_Pin_3)
|
||||
#define USRSW_PUPD (GPIO_PuPd_UP)
|
||||
#define USRSW_EXTI_PIN (EXTI_PinSource3)
|
||||
#define USRSW_EXTI_PORT (EXTI_PortSourceGPIOB)
|
||||
#define USRSW_EXTI_LINE (EXTI_Line3)
|
||||
#define USRSW_EXTI_IRQN (EXTI15_10_IRQn)
|
||||
#define USRSW_EXTI_EDGE (EXTI_Trigger_Rising)
|
||||
#elif defined (STM32F4DISC)
|
||||
#define USRSW_PORT (GPIOA)
|
||||
#define USRSW_PIN (GPIO_Pin_0)
|
||||
|
@ -64,7 +73,7 @@ void switch_init(void) {
|
|||
}
|
||||
|
||||
int switch_get(void) {
|
||||
#if defined (PYBOARD)
|
||||
#if defined (PYBOARD) || defined (PYBOARD4)
|
||||
if (USRSW_PORT->IDR & USRSW_PIN) {
|
||||
// pulled high, so switch is not pressed
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue