本帖最后由 proe533 于 2020-9-27 21:58 编辑
https://bbs.21ic.com/icview-3022876-1-1.html
参考如上设置IAR环境设置,可以编译能,但用STLINk仿真失败,
最终还是无耐装上了KEIL5,现在桌面上,.2,.4.5,三代同桌面。
KEIL5内部设置与STM32基本一样,没难度。
点亮第一个LED灯
/* LED0 Port/Pin definition */
#define LED0_PORT (PortE)// PortE = 4, ///< port group E
#define LED0_PIN (Pin06)//Pin06 = (1 << 6), ///< Pin index 06 of each port group
#define LED1_TOGGLE() (PORT_Toggle(LED0_PORT, LED0_PIN))
en_result_t PORT_Toggle(en_port_t enPort, uint16_t u16Pin)
{
uint16_t *POTRx;
/* parameter check */
DDL_ASSERT(IS_VALID_PORT(enPort));
POTRx = (uint16_t *)((uint32_t)(&M4_PORT->POTRA) + 0x10u * enPort);
*POTRx |= u16Pin;
return Ok;
}
查看手册269页
IO初始化参数
*******************************************************************************
** \brief GPIO init structure definition
******************************************************************************/
typedef struct stc_port_init
{
en_pin_mode_t enPinMode; ///< Set pin mode @ref en_pin_mode_t
en_functional_state_t enLatch; ///< Pin output latch enable
en_functional_state_t enExInt; ///< External int enable
en_functional_state_t enInvert; ///< Pin input/output invert enable
en_functional_state_t enPullUp; ///< Internal pull-up resistor enable
en_pin_drv_t enPinDrv; ///< Drive capacity setting @ref en_pin_drv_t
en_pin_o_type_t enPinOType; ///< Output mode setting @ref en_pin_o_type_t
en_functional_state_t enPinSubFunc; ///< Pin sub-function enable
}stc_port_init_t;
|