detect os and lsb release
This commit is contained in:
parent
edc636b5be
commit
e33119b119
30
Makefile
30
Makefile
@ -1,28 +1,22 @@
|
||||
# detect OS
|
||||
ifeq ($(OS),Windows_NT)
|
||||
RM = del /q
|
||||
RM := del /q
|
||||
COM := COM3
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
RM = rm -rf
|
||||
RM =: rm -rf
|
||||
|
||||
UNAME_S := $(shell cat /etc/*-release | grep 'DISTRIB_ID' | sed 's/DISTRIB_ID=\(\w*\)/\1/g')
|
||||
ifeq ($(UNAME_S),Ubuntu)
|
||||
CC := sdcc
|
||||
COM := /dev/ttyUSB0
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
RM = rm -rf
|
||||
ifeq ($(UNAME_S),Deepin)
|
||||
CC := ablrun sdcc
|
||||
COM := /dev/ttyUSB0
|
||||
endif
|
||||
# UNAME_P := $(shell uname -p)
|
||||
# ifeq ($(UNAME_P),x86_64)
|
||||
# CCFLAGS += -D AMD64
|
||||
# endif
|
||||
# ifneq ($(filter %86,$(UNAME_P)),)
|
||||
# CCFLAGS += -D IA32
|
||||
# endif
|
||||
# ifneq ($(filter arm%,$(UNAME_P)),)
|
||||
# CCFLAGS += -D ARM
|
||||
# endif
|
||||
endif
|
||||
|
||||
# set CC TOOL
|
||||
CC := sdcc
|
||||
PACKIHX := packihx
|
||||
CFLAGS := -DUSE_FLOATS=1
|
||||
|
||||
@ -54,7 +48,7 @@ uart_temp.hex: $(TARGET)
|
||||
-$(PACKIHX) $(TARGET) > uart_temp.hex
|
||||
|
||||
flash:
|
||||
-stcgal -P stc89 -p COM3 .\uart_temp.hex
|
||||
-stcgal -P stc89 -p $(COM) -d uart_temp.hex
|
||||
|
||||
#led.bin:led.hex
|
||||
# objcopy -I ihex -O binary led.hex led.bin
|
||||
|
12
src/main.c
12
src/main.c
@ -53,14 +53,14 @@ void main(void)
|
||||
smg_display(temp_buf,4);
|
||||
|
||||
// 串口打印
|
||||
if(pre_temp_value != temp_value){
|
||||
pre_temp_value = temp_value;
|
||||
printf("temp = %.1f\n", temp_value/10.0);
|
||||
}
|
||||
// if(pre_temp_value != temp_value){
|
||||
// pre_temp_value = temp_value;
|
||||
// printf("temp = %.1f\n", temp_value/10.0);
|
||||
// }
|
||||
|
||||
// delay
|
||||
// delay_ms(10);
|
||||
// printf("temp = %.1f\n", temp_value/10.0);
|
||||
delay_ms(1000);
|
||||
printf("temp = %.1f\r\n", temp_value/10.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user