generated from hulk/gd32e23x_template
Compare commits
No commits in common. "742ede30d4ad9232c5a003cabda7bca8af5854a5" and "6c51f0203a7c9cb497ffb03b55f3044d77be8d96" have entirely different histories.
742ede30d4
...
6c51f0203a
@ -9,7 +9,7 @@
|
||||
|
||||
// #define DEBUG_VERBOES
|
||||
|
||||
// #define RS485_MAX13487
|
||||
#define RS485_MAX13487
|
||||
|
||||
// #define DEBUG_VOFA_TOOL
|
||||
|
||||
|
@ -36,7 +36,6 @@ OF SUCH DAMAGE.
|
||||
#define MAIN_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "gd32e23x.h"
|
||||
#include "systick.h"
|
||||
#include "gd32e23x_libopt.h"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "gd32e23x.h"
|
||||
#include "systick.h"
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "ldc1612.h"
|
||||
#include "tmp112.h"
|
||||
#include "fwdgt.h"
|
||||
|
@ -6,8 +6,6 @@
|
||||
*/
|
||||
#include "main.h"
|
||||
|
||||
bool g_statusSwitch = false;
|
||||
|
||||
/*!
|
||||
\brief main function
|
||||
\param[in] none
|
||||
@ -42,10 +40,9 @@ int main(void) {
|
||||
|
||||
while (1) {
|
||||
|
||||
delay_ms(10);
|
||||
delay_ms(50);
|
||||
fwdgt_counter_reload();
|
||||
if (g_statusSwitch)
|
||||
{eddy_current_value_report();}
|
||||
eddy_current_value_report();
|
||||
}
|
||||
}
|
||||
|
||||
|
12
src/rs485.c
12
src/rs485.c
@ -7,8 +7,6 @@
|
||||
uint8_t package_header[3] = {0xB5, 0xF0, 0x04};
|
||||
uint8_t package_data[4] = {0};
|
||||
|
||||
extern bool g_statusSwitch;
|
||||
|
||||
void rs485_config(void) {
|
||||
#ifndef RS485_MAX13487
|
||||
rcu_periph_clock_enable(RS485_GPIO_RCU);
|
||||
@ -89,10 +87,12 @@ void process_command(uint8_t *cmd, size_t length) {
|
||||
// printf("%d", length);
|
||||
sprintf(combined_str, "%c%c", cmd[3], cmd[4]);
|
||||
if (strcmp(combined_str, "M1") == 0) {
|
||||
g_statusSwitch = true;
|
||||
} else if (strcmp(combined_str, "M2") == 0) {
|
||||
g_statusSwitch = false;
|
||||
} else if (strcmp(combined_str, "M3") == 0) {
|
||||
eddy_current_value_report();
|
||||
} else if (strcmp(combined_str, "M2") == 0)
|
||||
{
|
||||
tempture_value_report();
|
||||
} else if (strcmp(combined_str, "M3") == 0)
|
||||
{
|
||||
printf("%c%c%c%c%c%c", 0xB5, 0xF1, 0x02, 0x6F, 0x6B, 0xCC);
|
||||
fwdgt_reset_mcu();
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user