2021-07-26 17:17:04 +08:00
|
|
|
#include "user_main.h"
|
|
|
|
|
2021-12-26 16:53:27 +08:00
|
|
|
int8_t fsmc_buf;
|
2021-12-31 10:57:11 +08:00
|
|
|
uint8_t gpio_buf[16];
|
2021-12-26 16:53:27 +08:00
|
|
|
|
2021-07-27 09:58:57 +08:00
|
|
|
void user_setup()
|
2021-07-26 17:17:04 +08:00
|
|
|
{
|
2021-08-31 17:38:28 +08:00
|
|
|
flash_fpga();
|
|
|
|
// ethernet_init();
|
2021-07-26 17:17:04 +08:00
|
|
|
HAL_TIM_Base_Start_IT(&htim4);
|
2021-08-31 17:38:28 +08:00
|
|
|
HAL_TIM_Base_Start(&htim3);
|
|
|
|
eem_power_init();
|
|
|
|
uint8_t str[10] = "test";
|
|
|
|
HAL_UART_Transmit(&huart4, str, 5, 100);
|
2021-07-26 17:17:04 +08:00
|
|
|
}
|
|
|
|
|
2021-12-31 10:57:11 +08:00
|
|
|
uint8_t dio_ch = 0;
|
|
|
|
uint8_t dio_io = 0;
|
2021-07-27 09:58:57 +08:00
|
|
|
void user_loop()
|
2021-07-26 17:17:04 +08:00
|
|
|
{
|
2021-12-31 10:57:11 +08:00
|
|
|
// fsmc_read(0, (uint8_t*)&fsmc_buf);
|
|
|
|
// gpio_buf[0] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_11);
|
|
|
|
// gpio_buf[1] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_12);
|
|
|
|
// gpio_buf[2] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_13);
|
|
|
|
// gpio_buf[3] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_14);
|
|
|
|
// gpio_buf[4] = HAL_GPIO_ReadPin(GPIOE, GPIO_PIN_15);
|
|
|
|
|
|
|
|
static uint16_t i = 0;
|
|
|
|
i++;
|
|
|
|
fsmc_read(i, (uint8_t*)&fsmc_buf);
|
|
|
|
HAL_Delay(1000);
|
|
|
|
// fsmc_write(i, 0b00001111);
|
|
|
|
// HAL_Delay(1000);
|
2021-08-31 17:38:28 +08:00
|
|
|
key_events();
|
2021-12-31 10:57:11 +08:00
|
|
|
|
|
|
|
HAL_GPIO_WritePin(DIO_CH_SEL0_GPIO_Port, DIO_CH_SEL0_Pin, (dio_ch >> 0) & 0x01);
|
|
|
|
HAL_GPIO_WritePin(DIO_CH_SEL1_GPIO_Port, DIO_CH_SEL1_Pin, (dio_ch >> 1) & 0x01);
|
|
|
|
HAL_GPIO_WritePin(DIO_CH_SEL2_GPIO_Port, DIO_CH_SEL2_Pin, (dio_ch >> 2) & 0x01);
|
|
|
|
|
|
|
|
HAL_GPIO_WritePin(DIO_IO_GPIO_Port, DIO_IO_Pin, dio_io);
|
2021-07-26 17:17:04 +08:00
|
|
|
}
|