17 changed files with 12412 additions and 10776 deletions
-
BINapp/Output/atk_f407.axf
-
12app/Output/atk_f407.build_log.htm
-
11327app/Output/atk_f407.hex
-
5543app/Output/atk_f407.htm
-
11app/Output/atk_f407.lnp
-
4519app/Output/atk_f407.map
-
1094app/Output/atk_f407_lwIP.dep
-
160app/Projects/MDK-ARM/atk_f407.uvguix.29643
-
148app/Projects/MDK-ARM/atk_f407.uvoptx
-
67app/Projects/MDK-ARM/atk_f407.uvprojx
-
6src/config.c
-
24src/hardware_main.c
-
71src/main.h
-
32src/usermain.c
-
154src/zport.c
-
4src/zport.h
-
16src/zthread.c
11327
app/Output/atk_f407.hex
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
5543
app/Output/atk_f407.htm
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
4519
app/Output/atk_f407.map
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1094
app/Output/atk_f407_lwIP.dep
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
160
app/Projects/MDK-ARM/atk_f407.uvguix.29643
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,71 @@ |
|||
/* USER CODE BEGIN Header */ |
|||
/** |
|||
****************************************************************************** |
|||
* @file : main.h |
|||
* @brief : Header for main.c file. |
|||
* This file contains the common defines of the application. |
|||
****************************************************************************** |
|||
* @attention |
|||
* |
|||
* <h2><center>© Copyright (c) 2021 STMicroelectronics. |
|||
* All rights reserved.</center></h2> |
|||
* |
|||
* This software component is licensed by ST under BSD 3-Clause license, |
|||
* the "License"; You may not use this file except in compliance with the |
|||
* License. You may obtain a copy of the License at: |
|||
* opensource.org/licenses/BSD-3-Clause |
|||
* |
|||
****************************************************************************** |
|||
*/ |
|||
/* USER CODE END Header */ |
|||
|
|||
/* Define to prevent recursive inclusion -------------------------------------*/ |
|||
#ifndef __MAIN_H |
|||
#define __MAIN_H |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
/* Includes ------------------------------------------------------------------*/ |
|||
#include "stm32f4xx_hal.h" |
|||
|
|||
/* Private includes ----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Includes */ |
|||
|
|||
/* USER CODE END Includes */ |
|||
|
|||
/* Exported types ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN ET */ |
|||
|
|||
/* USER CODE END ET */ |
|||
|
|||
/* Exported constants --------------------------------------------------------*/ |
|||
/* USER CODE BEGIN EC */ |
|||
|
|||
/* USER CODE END EC */ |
|||
|
|||
/* Exported macro ------------------------------------------------------------*/ |
|||
/* USER CODE BEGIN EM */ |
|||
|
|||
/* USER CODE END EM */ |
|||
|
|||
/* Exported functions prototypes ---------------------------------------------*/ |
|||
void Error_Handler(void); |
|||
|
|||
/* USER CODE BEGIN EFP */ |
|||
|
|||
/* USER CODE END EFP */ |
|||
|
|||
/* Private defines -----------------------------------------------------------*/ |
|||
/* USER CODE BEGIN Private defines */ |
|||
|
|||
/* USER CODE END Private defines */ |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* __MAIN_H */ |
|||
|
|||
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
@ -1,84 +1,84 @@ |
|||
#include "zport.h" |
|||
//#include "zport.h" |
|||
|
|||
#include <stdint.h> |
|||
#include <stdio.h> |
|||
//#include <stdint.h> |
|||
//#include <stdio.h> |
|||
|
|||
#include "main.h" |
|||
// #include "modbus_processer.h" |
|||
#include "tim.h" |
|||
#include "usart.h" |
|||
//#include "main.h" |
|||
//// #include "modbus_processer.h" |
|||
////#include "tim.h" |
|||
////#include "usart.h" |
|||
|
|||
// |
|||
#include "../../../iflytop_microcontroller/sdk/stm32/pwm.h" |
|||
#include "../../../iflytop_microcontroller/sdk/stm32/stm32sdk.h" |
|||
//// |
|||
//#include "../../../iflytop_microcontroller/sdk/stm32/pwm.h" |
|||
//#include "../../../iflytop_microcontroller/sdk/stm32/stm32sdk.h" |
|||
|
|||
/********************************************************************************************************************** |
|||
* ===================================================printf重定向=================================================== * |
|||
**********************************************************************************************************************/ |
|||
int fputc(int ch, FILE* stream) { |
|||
uint8_t c = ch; |
|||
HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100); |
|||
return ch; |
|||
} |
|||
/*********************************************************************************************************************** |
|||
* ====================================================调试指示灯===================================================== * |
|||
***********************************************************************************************************************/ |
|||
void port_do_debug_light_state(void) { |
|||
static uint32_t lastprocess = 0; |
|||
if (sys_haspassedms(lastprocess) > 300) { |
|||
lastprocess = HAL_GetTick(); |
|||
HAL_GPIO_TogglePin(DEBUG_LIGHT_PORT, DEBUG_LIGHT_PIN); |
|||
} |
|||
} |
|||
/*********************************************************************************************************************** |
|||
* =====================================================串口相关====================================================== * |
|||
***********************************************************************************************************************/ |
|||
///********************************************************************************************************************** |
|||
// * ===================================================printf重定向=================================================== * |
|||
// **********************************************************************************************************************/ |
|||
//int fputc(int ch, FILE* stream) { |
|||
// uint8_t c = ch; |
|||
// HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100); |
|||
// return ch; |
|||
//} |
|||
///*********************************************************************************************************************** |
|||
// * ====================================================调试指示灯===================================================== * |
|||
// ***********************************************************************************************************************/ |
|||
//void port_do_debug_light_state(void) { |
|||
// static uint32_t lastprocess = 0; |
|||
// if (sys_haspassedms(lastprocess) > 300) { |
|||
// lastprocess = HAL_GetTick(); |
|||
// HAL_GPIO_TogglePin(DEBUG_LIGHT_PORT, DEBUG_LIGHT_PIN); |
|||
// } |
|||
//} |
|||
///*********************************************************************************************************************** |
|||
// * =====================================================串口相关====================================================== * |
|||
// ***********************************************************************************************************************/ |
|||
|
|||
static uart_t m_uarts[] = { |
|||
{&DEBUG_UART, 0}, |
|||
// {&MODBUS_UART, 0}, |
|||
}; |
|||
__weak void port_mock_on_uart_rx(uart_t* uart) {} |
|||
static void uarts_start_receive(uart_t* uart) { HAL_UART_Receive_IT(uart->uarthandler, &uart->rxbuf, 1); } |
|||
void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart) { |
|||
for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
if (m_uarts[i].uarthandler == huart) { |
|||
port_mock_on_uart_rx(&m_uarts[i]); |
|||
uarts_start_receive(&m_uarts[i]); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
void HAL_UART_ErrorCallback(UART_HandleTypeDef* huart) { |
|||
for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
if (m_uarts[i].uarthandler == huart) { |
|||
uarts_start_receive(&m_uarts[i]); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
// export |
|||
void port_uart_start_all_uart_receive(void) { |
|||
for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
uarts_start_receive(&m_uarts[i]); |
|||
} |
|||
} |
|||
//static uart_t m_uarts[] = { |
|||
// {&DEBUG_UART, 0}, |
|||
// // {&MODBUS_UART, 0}, |
|||
//}; |
|||
//__weak void port_mock_on_uart_rx(uart_t* uart) {} |
|||
//static void uarts_start_receive(uart_t* uart) { HAL_UART_Receive_IT(uart->uarthandler, &uart->rxbuf, 1); } |
|||
//void HAL_UART_RxCpltCallback(UART_HandleTypeDef* huart) { |
|||
// for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
// if (m_uarts[i].uarthandler == huart) { |
|||
// port_mock_on_uart_rx(&m_uarts[i]); |
|||
// uarts_start_receive(&m_uarts[i]); |
|||
// return; |
|||
// } |
|||
// } |
|||
//} |
|||
//void HAL_UART_ErrorCallback(UART_HandleTypeDef* huart) { |
|||
// for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
// if (m_uarts[i].uarthandler == huart) { |
|||
// uarts_start_receive(&m_uarts[i]); |
|||
// return; |
|||
// } |
|||
// } |
|||
//} |
|||
//// export |
|||
//void port_uart_start_all_uart_receive(void) { |
|||
// for (size_t i = 0; i < sizeof(m_uarts) / sizeof(uart_t); i++) { |
|||
// uarts_start_receive(&m_uarts[i]); |
|||
// } |
|||
//} |
|||
|
|||
bool port_electric_relay_get_state(int relayindex) { |
|||
/* |
|||
example: |
|||
if (relayindex == 1) { |
|||
return GPIO_GET(C, 8, !!); |
|||
} |
|||
*/ |
|||
//bool port_electric_relay_get_state(int relayindex) { |
|||
// /* |
|||
// example: |
|||
// if (relayindex == 1) { |
|||
// return GPIO_GET(C, 8, !!); |
|||
// } |
|||
// */ |
|||
|
|||
return false; |
|||
} |
|||
void port_electric_relay_set_state(int relayindex, bool state) { |
|||
/* |
|||
example: |
|||
if (relayindex == 1) { |
|||
GPIO_SET(C, 8, !!, state); |
|||
} |
|||
*/ |
|||
} |
|||
// return false; |
|||
//} |
|||
//void port_electric_relay_set_state(int relayindex, bool state) { |
|||
// /* |
|||
// example: |
|||
// if (relayindex == 1) { |
|||
// GPIO_SET(C, 8, !!, state); |
|||
// } |
|||
// */ |
|||
//} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue