Compare commits
178 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1740583ccc | ||
|
|
b12244e352 | ||
|
|
e6ac0d1d8d | ||
|
|
eda199d47a | ||
|
|
012c375f2e | ||
|
|
4a96dfa6ce | ||
|
|
ec10aec0c4 | ||
|
|
49c2c6b405 | ||
|
|
38b1e5cbaa | ||
|
|
9a64a18010 | ||
|
|
72eddd009b | ||
|
|
77d58eb8f5 | ||
|
|
856dbe083d | ||
|
|
50cc34ad9b | ||
|
|
c996577a0b | ||
|
|
e877820594 | ||
|
|
8ab123c927 | ||
|
|
a510b89c6a | ||
|
|
8b41a1fa66 | ||
|
|
99fc8a8311 | ||
|
|
5c3eea2fcb | ||
|
|
ffb26a1f86 | ||
|
|
a8ae1b7739 | ||
|
|
b59df11bd6 | ||
|
|
146c8dede4 | ||
|
|
c2090676d8 | ||
|
|
b29bae88f1 | ||
|
|
c55a40481d | ||
|
|
a37a1ca6ef | ||
|
|
8629b1b867 | ||
|
|
f7c0d4149b | ||
|
|
87fd5c19d0 | ||
|
|
d132969c91 | ||
|
|
a5fa0b1e4b | ||
|
|
a21c8a62ac | ||
|
|
9fd3701f46 | ||
|
|
1d95737088 | ||
|
|
2f7042056a | ||
|
|
13b41abce6 | ||
|
|
b9f9566158 | ||
|
|
710a417e12 | ||
|
|
f11d0fbcda | ||
|
|
96144af9e9 | ||
|
|
4dd2445833 | ||
|
|
6172d942be | ||
|
|
0c0cbb232c | ||
|
|
298ff29cf4 | ||
|
|
f70707e17f | ||
|
|
f1fc04591c | ||
|
|
a26c397417 | ||
|
|
d3a2a7bee9 | ||
|
|
d817ff7e6a | ||
|
|
ec4bec5b1f | ||
|
|
d7c458839c | ||
|
|
cff2f25e56 | ||
|
|
63ac84883e | ||
|
|
f8252df281 | ||
|
|
be00bb99ad | ||
|
|
7e6a78ab6c | ||
|
|
06c2ddf543 | ||
|
|
47f1e80252 | ||
|
|
64bc29d362 | ||
|
|
8d17f5922c | ||
|
|
063dc61e65 | ||
|
|
60ccd3372f | ||
|
|
149a0f5bdc | ||
|
|
c7da7cf725 | ||
|
|
4b9147327a | ||
|
|
43f4790f5b | ||
|
|
43ccce33da | ||
|
|
b2839de2a5 | ||
|
|
5397b3ee88 | ||
|
|
9a0a75446a | ||
|
|
f25e0230f0 | ||
|
|
16c908f0bf | ||
|
|
9c7d6a38e5 | ||
|
|
ec5e9dde66 | ||
|
|
5c346c8466 | ||
|
|
40d09591b3 | ||
|
|
bd9f337a5b | ||
|
|
cb05a5881f | ||
|
|
6b44659419 | ||
|
|
81f18aa281 | ||
|
|
410c0e47cb | ||
|
|
2372949eb9 | ||
|
|
0cf4e1fe36 | ||
|
|
9b2ce88a72 | ||
|
|
a23f359735 | ||
|
|
b343993a72 | ||
|
|
4d8db8f0b9 | ||
|
|
609df5f279 | ||
|
|
e042b21e65 | ||
|
|
d632698428 | ||
|
|
eba4bf9c80 | ||
|
|
56fc929921 | ||
|
|
2cff29e6db | ||
|
|
ced053ba63 | ||
|
|
a6324ffcf8 | ||
|
|
6e7f8b1877 | ||
|
|
74a9adcdbd | ||
|
|
4a05e69e19 | ||
|
|
1cfb59fa38 | ||
|
|
bee4a8c41a | ||
|
|
fe949d2ae3 | ||
|
|
292181a9a6 | ||
|
|
654145bd07 | ||
|
|
5900d46edb | ||
|
|
1dbe874240 | ||
|
|
eea1756dc0 | ||
|
|
32fad129cc | ||
|
|
6a8c7d5b37 | ||
|
|
efca16088b | ||
|
|
814e5edb07 | ||
|
|
abfcf15aca | ||
|
|
a113d41c1a | ||
|
|
b26b1fab95 | ||
|
|
2242c4097a | ||
|
|
74c37451bf | ||
|
|
59c4c4dcd3 | ||
|
|
eec8e22e41 | ||
|
|
429ac36ffe | ||
|
|
567b0cfa83 | ||
|
|
f4b637b51a | ||
|
|
5f2e069437 | ||
|
|
9d990f7e67 | ||
|
|
eaccdab1d4 | ||
|
|
6e2ba5c214 | ||
|
|
4d808de2ac | ||
|
|
8fb9825ad8 | ||
|
|
4b17aa6d3f | ||
|
|
6d0aea4587 | ||
|
|
ec2d6e4a74 | ||
|
|
b301a8d21e | ||
|
|
339e280a27 | ||
|
|
f8aaf47374 | ||
|
|
84e174544d | ||
|
|
ac05207ef0 | ||
|
|
9d5d36cc1f | ||
|
|
c5c86d0ad0 | ||
|
|
010ea0308a | ||
|
|
b3ca095af1 | ||
|
|
6a3a26c470 | ||
|
|
2551077cef | ||
|
|
2397e3950b | ||
|
|
d11e7863dc | ||
|
|
35c7530036 | ||
|
|
87d1cf7c86 | ||
|
|
bf2564b9f5 | ||
|
|
c59e0ea06c | ||
|
|
9ac3525683 | ||
|
|
3ac330ddee | ||
|
|
af342cf904 | ||
|
|
ec33203403 | ||
|
|
3c7f496f3e | ||
|
|
174c06dfbf | ||
|
|
d86ccaafcd | ||
|
|
d826ecb0ae | ||
|
|
e0aa1a83be | ||
|
|
e64bf6bbd6 | ||
|
|
aafc93c2ee | ||
|
|
58eced120e | ||
|
|
bbf8a7061e | ||
|
|
aea80cb046 | ||
|
|
4333fdeb3a | ||
|
|
a9aa37e043 | ||
|
|
1fc1a102ea | ||
|
|
86d2dade7a | ||
|
|
6f7bb75b52 | ||
|
|
82b8f6755f | ||
|
|
8caff25b7c | ||
|
|
c644b30b2f | ||
|
|
de174d072c | ||
|
|
c3c344daec | ||
|
|
fc1bc8791c | ||
|
|
fa4ae2caa6 | ||
|
|
b45043aab2 | ||
|
|
ba3decad78 | ||
|
|
7df7461d31 |
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
firmware
|
firmware
|
||||||
/firmware.packed.bin
|
/firmware.packed.bin
|
||||||
/firmware.bin
|
/firmware.bin
|
||||||
|
/compiled-firmware
|
||||||
|
|||||||
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM archlinux:latest
|
||||||
|
RUN pacman -Syyu base-devel --noconfirm
|
||||||
|
RUN pacman -Syyu arm-none-eabi-gcc --noconfirm
|
||||||
|
RUN pacman -Syyu arm-none-eabi-newlib --noconfirm
|
||||||
|
RUN pacman -Syyu git --noconfirm
|
||||||
|
RUN pacman -Syyu python-pip --noconfirm
|
||||||
|
RUN pacman -Syyu python-crcmod --noconfirm
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN git submodule update --init --recursive
|
||||||
|
#RUN make && cp firmware* compiled-firmware/
|
||||||
152
Makefile
@@ -3,38 +3,55 @@
|
|||||||
# 0 = disable
|
# 0 = disable
|
||||||
# 1 = enable
|
# 1 = enable
|
||||||
#
|
#
|
||||||
|
ENABLE_CLANG := 0
|
||||||
ENABLE_SWD := 0
|
ENABLE_SWD := 0
|
||||||
ENABLE_OVERLAY := 1
|
ENABLE_OVERLAY := 0
|
||||||
|
ENABLE_LTO := 1
|
||||||
ENABLE_UART := 1
|
ENABLE_UART := 1
|
||||||
ENABLE_AIRCOPY := 0
|
ENABLE_AIRCOPY := 0
|
||||||
ENABLE_FMRADIO := 0
|
ENABLE_FMRADIO := 1
|
||||||
ENABLE_NOAA := 0
|
ENABLE_NOAA := 0
|
||||||
ENABLE_VOICE := 0
|
ENABLE_VOICE := 0
|
||||||
|
ENABLE_VOX := 1
|
||||||
ENABLE_ALARM := 0
|
ENABLE_ALARM := 0
|
||||||
|
ENABLE_TX1750 := 0
|
||||||
|
ENABLE_PWRON_PASSWORD := 0
|
||||||
ENABLE_BIG_FREQ := 1
|
ENABLE_BIG_FREQ := 1
|
||||||
ENABLE_SMALL_BOLD := 1
|
ENABLE_SMALL_BOLD := 1
|
||||||
ENABLE_KEEP_MEM_NAME := 1
|
ENABLE_KEEP_MEM_NAME := 1
|
||||||
ENABLE_WIDE_RX := 1
|
ENABLE_WIDE_RX := 1
|
||||||
ENABLE_TX_WHEN_AM := 0
|
ENABLE_TX_WHEN_AM := 0
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1
|
ENABLE_F_CAL_MENU := 0
|
||||||
ENABLE_MAIN_KEY_HOLD := 1
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 0
|
||||||
ENABLE_BOOT_BEEPS := 0
|
ENABLE_BOOT_BEEPS := 0
|
||||||
ENABLE_COMPANDER := 1
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 1
|
ENABLE_SHOW_CHARGE_LEVEL := 1
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1
|
ENABLE_REVERSE_BAT_SYMBOL := 0
|
||||||
ENABLE_NO_SCAN_TIMEOUT := 1
|
ENABLE_CODE_SCAN_TIMEOUT := 0
|
||||||
ENABLE_AM_FIX := 1
|
ENABLE_AM_FIX := 1
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1
|
ENABLE_AM_FIX_SHOW_DATA := 0
|
||||||
ENABLE_SQUELCH_LOWER := 1
|
ENABLE_SQUELCH_MORE_SENSITIVE := 1
|
||||||
|
ENABLE_FASTER_CHANNEL_SCAN := 1
|
||||||
ENABLE_RSSI_BAR := 1
|
ENABLE_RSSI_BAR := 1
|
||||||
ENABLE_AUDIO_BAR := 1
|
ENABLE_AUDIO_BAR := 1
|
||||||
|
ENABLE_COPY_CHAN_TO_VFO := 1
|
||||||
ENABLE_SPECTRUM := 1
|
ENABLE_SPECTRUM := 1
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1
|
#ENABLE_SINGLE_VFO_CHAN := 1
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1
|
#ENABLE_BAND_SCOPE := 1
|
||||||
#ENABLE_BAND_SCOPE := 1
|
|
||||||
|
#############################################################
|
||||||
|
|
||||||
TARGET = firmware
|
TARGET = firmware
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_CLANG),1)
|
||||||
|
# GCC's linker, ld, doesn't understand LLVM's generated bytecode
|
||||||
|
ENABLE_LTO := 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),1)
|
||||||
|
# can't have LTO and OVERLAY enabled at same time
|
||||||
|
ENABLE_OVERLAY := 0
|
||||||
|
endif
|
||||||
|
|
||||||
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
BSP_DEFINITIONS := $(wildcard hardware/*/*.def)
|
||||||
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
BSP_HEADERS := $(patsubst hardware/%,bsp/%,$(BSP_DEFINITIONS))
|
||||||
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
BSP_HEADERS := $(patsubst %.def,%.h,$(BSP_HEADERS))
|
||||||
@@ -87,6 +104,7 @@ ifeq ($(ENABLE_FMRADIO),1)
|
|||||||
OBJS += app/fm.o
|
OBJS += app/fm.o
|
||||||
endif
|
endif
|
||||||
OBJS += app/generic.o
|
OBJS += app/generic.o
|
||||||
|
OBJS += app/common.o
|
||||||
OBJS += app/main.o
|
OBJS += app/main.o
|
||||||
OBJS += app/menu.o
|
OBJS += app/menu.o
|
||||||
ifeq ($(ENABLE_SPECTRUM), 1)
|
ifeq ($(ENABLE_SPECTRUM), 1)
|
||||||
@@ -96,7 +114,9 @@ OBJS += app/scanner.o
|
|||||||
ifeq ($(ENABLE_UART),1)
|
ifeq ($(ENABLE_UART),1)
|
||||||
OBJS += app/uart.o
|
OBJS += app/uart.o
|
||||||
endif
|
endif
|
||||||
OBJS += am_fix.o
|
ifeq ($(ENABLE_AM_FIX), 1)
|
||||||
|
OBJS += am_fix.o
|
||||||
|
endif
|
||||||
OBJS += audio.o
|
OBJS += audio.o
|
||||||
OBJS += bitmaps.o
|
OBJS += bitmaps.o
|
||||||
OBJS += board.o
|
OBJS += board.o
|
||||||
@@ -119,7 +139,9 @@ ifeq ($(ENABLE_FMRADIO),1)
|
|||||||
endif
|
endif
|
||||||
OBJS += ui/helper.o
|
OBJS += ui/helper.o
|
||||||
OBJS += ui/inputbox.o
|
OBJS += ui/inputbox.o
|
||||||
OBJS += ui/lock.o
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||||
|
OBJS += ui/lock.o
|
||||||
|
endif
|
||||||
OBJS += ui/main.o
|
OBJS += ui/main.o
|
||||||
OBJS += ui/menu.o
|
OBJS += ui/menu.o
|
||||||
OBJS += ui/scanner.o
|
OBJS += ui/scanner.o
|
||||||
@@ -129,15 +151,28 @@ OBJS += ui/welcome.o
|
|||||||
OBJS += version.o
|
OBJS += version.o
|
||||||
OBJS += main.o
|
OBJS += main.o
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS), Windows_NT)
|
||||||
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
TOP := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
else
|
else
|
||||||
TOP := $(shell pwd)
|
TOP := $(shell pwd)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AS = arm-none-eabi-gcc
|
AS = arm-none-eabi-gcc
|
||||||
CC = arm-none-eabi-gcc
|
|
||||||
|
CC =
|
||||||
LD = arm-none-eabi-gcc
|
LD = arm-none-eabi-gcc
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
|
CC += arm-none-eabi-gcc
|
||||||
|
# Use GCC's linker to avoid undefined symbol errors
|
||||||
|
# LD += arm-none-eabi-gcc
|
||||||
|
else
|
||||||
|
# May need to adjust this to match your system
|
||||||
|
CC += clang --sysroot=/usr/arm-none-eabi --target=arm-none-eabi
|
||||||
|
# Bloats binaries to 512MB
|
||||||
|
# LD = ld.lld
|
||||||
|
endif
|
||||||
|
|
||||||
OBJCOPY = arm-none-eabi-objcopy
|
OBJCOPY = arm-none-eabi-objcopy
|
||||||
SIZE = arm-none-eabi-size
|
SIZE = arm-none-eabi-size
|
||||||
|
|
||||||
@@ -153,10 +188,29 @@ ifeq ($(ENABLE_OVERLAY),1)
|
|||||||
ASFLAGS += -DENABLE_OVERLAY
|
ASFLAGS += -DENABLE_OVERLAY
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
CFLAGS =
|
||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||||
#CFLAGS = -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c99 -MMD
|
||||||
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu99 -MMD
|
||||||
|
#CFLAGS += -Os -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=gnu11 -MMD
|
||||||
|
else
|
||||||
|
# Oz needed to make it fit on flash
|
||||||
|
CFLAGS += -Oz -Wall -Werror -mcpu=cortex-m0 -fno-builtin -fshort-enums -fno-delete-null-pointer-checks -std=c11 -MMD
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),1)
|
||||||
|
CFLAGS += -flto=2
|
||||||
|
else
|
||||||
|
# We get most of the space savings if LTO creates problems
|
||||||
|
CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
endif
|
||||||
|
|
||||||
|
# May cause unhelpful build failures
|
||||||
|
#CFLAGS += -Wpadded
|
||||||
|
|
||||||
|
# catch any and all warnings
|
||||||
|
CFLAGS += -Wextra
|
||||||
|
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
CFLAGS += -DGIT_HASH=\"$(GIT_HASH)\"
|
||||||
@@ -167,15 +221,15 @@ endif
|
|||||||
ifeq ($(ENABLE_SWD),1)
|
ifeq ($(ENABLE_SWD),1)
|
||||||
CFLAGS += -DENABLE_SWD
|
CFLAGS += -DENABLE_SWD
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_OVERLAY),1)
|
||||||
|
CFLAGS += -DENABLE_OVERLAY
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_AIRCOPY),1)
|
ifeq ($(ENABLE_AIRCOPY),1)
|
||||||
CFLAGS += -DENABLE_AIRCOPY
|
CFLAGS += -DENABLE_AIRCOPY
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_FMRADIO),1)
|
ifeq ($(ENABLE_FMRADIO),1)
|
||||||
CFLAGS += -DENABLE_FMRADIO
|
CFLAGS += -DENABLE_FMRADIO
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_OVERLAY),1)
|
|
||||||
CFLAGS += -DENABLE_OVERLAY
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_UART),1)
|
ifeq ($(ENABLE_UART),1)
|
||||||
CFLAGS += -DENABLE_UART
|
CFLAGS += -DENABLE_UART
|
||||||
endif
|
endif
|
||||||
@@ -191,11 +245,20 @@ endif
|
|||||||
ifeq ($(ENABLE_VOICE),1)
|
ifeq ($(ENABLE_VOICE),1)
|
||||||
CFLAGS += -DENABLE_VOICE
|
CFLAGS += -DENABLE_VOICE
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_VOX),1)
|
||||||
|
CFLAGS += -DENABLE_VOX
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_ALARM),1)
|
ifeq ($(ENABLE_ALARM),1)
|
||||||
CFLAGS += -DENABLE_ALARM
|
CFLAGS += -DENABLE_ALARM
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_TX1750),1)
|
||||||
|
CFLAGS += -DENABLE_TX1750
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_PWRON_PASSWORD),1)
|
||||||
|
CFLAGS += -DENABLE_PWRON_PASSWORD
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
ifeq ($(ENABLE_KEEP_MEM_NAME),1)
|
||||||
CFLAGS += -DKEEP_MEM_NAME
|
CFLAGS += -DENABLE_KEEP_MEM_NAME
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_WIDE_RX),1)
|
ifeq ($(ENABLE_WIDE_RX),1)
|
||||||
CFLAGS += -DENABLE_WIDE_RX
|
CFLAGS += -DENABLE_WIDE_RX
|
||||||
@@ -203,26 +266,23 @@ endif
|
|||||||
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
ifeq ($(ENABLE_TX_WHEN_AM),1)
|
||||||
CFLAGS += -DENABLE_TX_WHEN_AM
|
CFLAGS += -DENABLE_TX_WHEN_AM
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(ENABLE_F_CAL_MENU),1)
|
||||||
|
CFLAGS += -DENABLE_F_CAL_MENU
|
||||||
|
endif
|
||||||
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
ifeq ($(ENABLE_CTCSS_TAIL_PHASE_SHIFT),1)
|
||||||
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
CFLAGS += -DENABLE_CTCSS_TAIL_PHASE_SHIFT
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_MAIN_KEY_HOLD),1)
|
|
||||||
CFLAGS += -DENABLE_MAIN_KEY_HOLD
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
ifeq ($(ENABLE_BOOT_BEEPS),1)
|
||||||
CFLAGS += -DENABLE_BOOT_BEEPS
|
CFLAGS += -DENABLE_BOOT_BEEPS
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_COMPANDER),1)
|
|
||||||
CFLAGS += -DENABLE_COMPANDER
|
|
||||||
endif
|
|
||||||
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
ifeq ($(ENABLE_SHOW_CHARGE_LEVEL),1)
|
||||||
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
CFLAGS += -DENABLE_SHOW_CHARGE_LEVEL
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
ifeq ($(ENABLE_REVERSE_BAT_SYMBOL),1)
|
||||||
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
CFLAGS += -DENABLE_REVERSE_BAT_SYMBOL
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_NO_SCAN_TIMEOUT),1)
|
ifeq ($(ENABLE_CODE_SCAN_TIMEOUT),1)
|
||||||
CFLAGS += -DENABLE_NO_SCAN_TIMEOUT
|
CFLAGS += -DENABLE_CODE_SCAN_TIMEOUT
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_AM_FIX),1)
|
ifeq ($(ENABLE_AM_FIX),1)
|
||||||
CFLAGS += -DENABLE_AM_FIX
|
CFLAGS += -DENABLE_AM_FIX
|
||||||
@@ -233,8 +293,14 @@ endif
|
|||||||
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
ifeq ($(ENABLE_AM_FIX_TEST1),1)
|
||||||
CFLAGS += -DENABLE_AM_FIX_TEST1
|
CFLAGS += -DENABLE_AM_FIX_TEST1
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_SQUELCH_LOWER),1)
|
ifeq ($(ENABLE_SQUELCH_MORE_SENSITIVE),1)
|
||||||
CFLAGS += -DENABLE_SQUELCH_LOWER
|
CFLAGS += -DENABLE_SQUELCH_MORE_SENSITIVE
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_FASTER_CHANNEL_SCAN),1)
|
||||||
|
CFLAGS += -DENABLE_FASTER_CHANNEL_SCAN
|
||||||
|
endif
|
||||||
|
ifeq ($(ENABLE_BACKLIGHT_ON_RX),1)
|
||||||
|
CFLAGS += -DENABLE_BACKLIGHT_ON_RX
|
||||||
endif
|
endif
|
||||||
ifeq ($(ENABLE_RSSI_BAR),1)
|
ifeq ($(ENABLE_RSSI_BAR),1)
|
||||||
CFLAGS += -DENABLE_RSSI_BAR
|
CFLAGS += -DENABLE_RSSI_BAR
|
||||||
@@ -252,11 +318,25 @@ ifeq ($(ENABLE_BAND_SCOPE),1)
|
|||||||
CFLAGS += -DENABLE_BAND_SCOPE
|
CFLAGS += -DENABLE_BAND_SCOPE
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDFLAGS = -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
LDFLAGS =
|
||||||
|
ifeq ($(ENABLE_CLANG),0)
|
||||||
|
LDFLAGS += -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
else
|
||||||
|
# Fix warning about implied executable stack
|
||||||
|
LDFLAGS += -z noexecstack -mcpu=cortex-m0 -nostartfiles -Wl,-T,firmware.ld
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Use newlib-nano instead of newlib
|
||||||
|
LDFLAGS += --specs=nano.specs
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_LTO),0)
|
||||||
|
# Throw away unneeded func/data sections like LTO does
|
||||||
|
LDFLAGS += -Wl,--gc-sections
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
ASFLAGS += -g
|
ASFLAGS += -g
|
||||||
CFLAGS += -g
|
CFLAGS += -g
|
||||||
LDFLAGS += -g
|
LDFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
136
README.md
@@ -1,9 +1,9 @@
|
|||||||
# Main features:
|
# Main features:
|
||||||
- OneOfEleven mods, including AM fix
|
- many of OneOfEleven mods, including AM fix
|
||||||
- fagci spectrum analyzer (**F+5** to turn on)
|
- fagci spectrum analyzer (**F+5** to turn on)
|
||||||
- better battery percentage calculation (based on real measurement, battery calibration recommended)
|
- some other smaller mods introduced by me
|
||||||
- battery calibration option available available in the menu (instructions below)
|
|
||||||
- there is no FM radio nor Aircopy, not enough memory space
|
Go to [Wiki](https://github.com/egzumer/uv-k5-firmware-custom/wiki) to learn more.
|
||||||
|
|
||||||
<img src="images/main.jpg" width=300 /><img src="images/spectrum.jpg" width=300 /><img src="images/audiobar.jpg" width=300 /><img src="images/rssibar.jpg" width=300 />
|
<img src="images/main.jpg" width=300 /><img src="images/spectrum.jpg" width=300 /><img src="images/audiobar.jpg" width=300 /><img src="images/rssibar.jpg" width=300 />
|
||||||
|
|
||||||
@@ -13,12 +13,10 @@
|
|||||||
|
|
||||||
To enter the calibration:
|
To enter the calibration:
|
||||||
|
|
||||||
1. turn the radio on holding PTT and the first side button
|
1. turn the radio on while holding PTT and the first side button
|
||||||
2. imediately go to BATVOL option and adjust the voltage with UP/DOWN buttons
|
2. go to BATCAL option and adjust the voltage with UP/DOWN buttons
|
||||||
3. confirm the setting, calibration will be saved to EEPROM
|
3. confirm the setting, calibration will be saved to EEPROM
|
||||||
|
|
||||||
The calibration option becomes unavailable if you leave the menu screen and you have to repeat from step 1.
|
|
||||||
|
|
||||||
|
|
||||||
# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
|
# Open reimplementation of the Quan Sheng UV-K5 v2.1.27 firmware
|
||||||
|
|
||||||
@@ -36,51 +34,72 @@ Anyway, have fun.
|
|||||||
|
|
||||||
# Radio performance
|
# Radio performance
|
||||||
|
|
||||||
Please note that the Quansheng uv-k radios are not professional quality transceivers, their
|
Please note that the Quansheng UV-Kx radios are not professional quality transceivers, their
|
||||||
performance is strictly limited, somewhat below that of a decent transceiver. The RX front
|
performance is strictly limited. The RX front end has no track-tuned band pass filtering
|
||||||
end has no track-tuned band pass filtering at all, and so are wide band/wide open to any
|
at all, and so are wide band/wide open to any and all signals over a large frequency range.
|
||||||
and all signals over a wide frequency range. Using the radio in high intensity RF environments
|
|
||||||
will nearly always destroy your reception, the receiver simply doesn't have a great dynamic
|
|
||||||
range, though are quite sensitive (weak signal wise).
|
|
||||||
|
|
||||||
Saying that, they are nice toys for the price, fun to play with.
|
Using the radio in high intensity RF environments will most likely make reception anything but
|
||||||
|
easy (AM mode will suffer far more than FM ever will), the receiver simply doesn't have a
|
||||||
|
great dynamic range, which results in distorted AM audio with stronger RX'ed signals.
|
||||||
|
There is nothing more anyone can do in firmware/software to improve that, once the RX gain
|
||||||
|
adjustment I do (AM fix) reaches the hardwares limit, your AM RX audio will be all but
|
||||||
|
non-existant (just like Quansheng's firmware).
|
||||||
|
On the other hand, FM RX audio will/should be fine.
|
||||||
|
|
||||||
|
But, they are nice toys for the price, fun to play with.
|
||||||
|
|
||||||
# User customization
|
# User customization
|
||||||
|
|
||||||
You can customize the firmware by enabling/disabling various compile options.
|
You can customize the firmware by enabling/disabling various compile options, this allows
|
||||||
|
us to remove certain firmware features in order to make room in the flash for others.
|
||||||
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
You'll find the options at the top of "Makefile" ('0' = disable, '1' = enable) ..
|
||||||
|
|
||||||
```
|
```
|
||||||
|
ENABLE_CLANG := 0 **experimental, builds with clang instead of gcc (LTO will be disabled if you enable this)
|
||||||
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
ENABLE_SWD := 0 only needed if using CPU's SWD port (debugging/programming)
|
||||||
ENABLE_OVERLAY := 1 cpu FLASH stuff
|
ENABLE_OVERLAY := 0 cpu FLASH stuff, not needed
|
||||||
ENABLE_UART := 1 without this you can't configure radio via PC
|
ENABLE_LTO := 0 **experimental, reduces size of compiled firmware but might break EEPROM reads (OVERLAY will be disabled if you enable this)
|
||||||
ENABLE_AIRCOPY := 0 easier to just enter frequency
|
ENABLE_UART := 1 without this you can't configure radio via PC !
|
||||||
ENABLE_FMRADIO := 1 WBFM VHF band 2 RX
|
ENABLE_AIRCOPY := 0 easier to just enter frequency with butts
|
||||||
ENABLE_NOAA := 0 everything NOAA
|
ENABLE_FMRADIO := 0 WBFM VHF broadcast band receiver
|
||||||
|
ENABLE_NOAA := 0 everything NOAA (only of any use in the USA)
|
||||||
ENABLE_VOICE := 0 want to hear voices ?
|
ENABLE_VOICE := 0 want to hear voices ?
|
||||||
|
ENABLE_VOX := 0
|
||||||
ENABLE_ALARM := 0 TX alarms
|
ENABLE_ALARM := 0 TX alarms
|
||||||
ENABLE_BIG_FREQ := 0 big font frequencies
|
ENABLE_1750HZ := 0 side key 1750Hz TX tone (older style repeater access)
|
||||||
|
ENABLE_PWRON_PASSWORD := 1 power-on password stuff
|
||||||
|
ENABLE_BIG_FREQ := 0 big font frequencies (like original QS firmware)
|
||||||
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
ENABLE_SMALL_BOLD := 1 bold channel name/no. (when name + freq channel display mode)
|
||||||
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
ENABLE_KEEP_MEM_NAME := 1 maintain channel name when (re)saving memory channel
|
||||||
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though frontend not tuned over full range)
|
ENABLE_WIDE_RX := 1 full 18MHz to 1300MHz RX (though front-end/PA not designed for full range)
|
||||||
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
ENABLE_TX_WHEN_AM := 0 allow TX (always FM) when RX is set to AM
|
||||||
|
ENABLE_F_CAL_MENU := 0 enable/disable the radios hidden frequency calibration menu
|
||||||
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
ENABLE_CTCSS_TAIL_PHASE_SHIFT := 1 standard CTCSS tail phase shift rather than QS's own 55Hz tone method
|
||||||
ENABLE_MAIN_KEY_HOLD := 1 initial F-key press not needed, instead hold down keys 0-9 to access the functions
|
ENABLE_BOOT_BEEPS := 0 gives user audio feedback on volume knob position at boot-up
|
||||||
ENABLE_BOOT_BEEPS := 0 give user audio feedback on volume knob position at boot-up
|
|
||||||
ENABLE_COMPANDER := 1 compander option (per channel)
|
|
||||||
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
ENABLE_SHOW_CHARGE_LEVEL := 0 show the charge level when the radio is on charge
|
||||||
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
ENABLE_REVERSE_BAT_SYMBOL := 1 mirror the battery symbol on the status bar (+ pole on the right)
|
||||||
ENABLE_NO_SCAN_TIMEOUT := 1 remove the 32 sec timeout from the CTCSS/DCS scan (press exit butt to end scan)
|
ENABLE_CODE_SCAN_TIMEOUT := 0 enable/disable 32-sec CTCSS/DCS scan timeout (press exit butt instead of time-out to end scan)
|
||||||
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation - ignore the on-screen RSSI (for now)
|
ENABLE_AM_FIX := 1 dynamically adjust the front end gains when in AM mode to helo prevent AM demodulator saturation, ignore the on-screen RSSI level (for now)
|
||||||
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix
|
ENABLE_AM_FIX_SHOW_DATA := 1 show debug data for the AM fix (still tweaking it)
|
||||||
ENABLE_SQUELCH_LOWER := 1 squelch settings more sensitive - plan to let user adjust it in the menu
|
ENABLE_SQUELCH_MORE_SENSITIVE := 0 make squelch levels a little bit more sensitive - I plan to let user adjust the values themselves
|
||||||
ENABLE_RSSI_BAR := 1 enable a dBm/Sx RSSI bar graph level
|
ENABLE_FASTER_CHANNEL_SCAN := 0 increases the channel scan speed, but the squelch is also made more twitchy
|
||||||
|
ENABLE_RSSI_BAR := 1 enable a dBm/Sn RSSI bar graph level inplace of the little antenna symbols
|
||||||
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
ENABLE_AUDIO_BAR := 0 experimental, display an audo bar level when TX'ing
|
||||||
#ENABLE_COPY_CHAN_TO_VFO := 1 not yet implemented - copy the channel into the VFO
|
ENABLE_COPY_CHAN_TO_VFO := 1 copy current channel into the other VFO. Long press Menu key ('M')
|
||||||
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
#ENABLE_SINGLE_VFO_CHAN := 1 not yet implemented - single VFO on display when possible
|
||||||
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
#ENABLE_BAND_SCOPE := 1 not yet implemented - spectrum/pan-adapter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# New/modified function keys
|
||||||
|
|
||||||
|
* Long-press 'M' .. Copy selected channel into same VFO, then switch VFO to frequency mode
|
||||||
|
*
|
||||||
|
* Long-press '7' .. Toggle selected channel scanlist setting .. if VOX is disabled in Makefile
|
||||||
|
* or
|
||||||
|
* Long-press '5' .. Toggle selected channel scanlist setting .. if NOAA is disabled in Makefile
|
||||||
|
*
|
||||||
|
* Long-press '*' .. Start scanning, then toggles the scanning between scanlists 1, 2 or ALL channels
|
||||||
|
|
||||||
# Some changes made from the Quansheng firmware
|
# Some changes made from the Quansheng firmware
|
||||||
|
|
||||||
* Various Quansheng firmware bugs fixed
|
* Various Quansheng firmware bugs fixed
|
||||||
@@ -100,28 +119,38 @@ arm-none-eabi GCC version 10.3.1 is recommended, which is the current version on
|
|||||||
Other versions may generate a flash file that is too big.
|
Other versions may generate a flash file that is too big.
|
||||||
You can get an appropriate version from: https://developer.arm.com/downloads/-/gnu-rm
|
You can get an appropriate version from: https://developer.arm.com/downloads/-/gnu-rm
|
||||||
|
|
||||||
|
clang may be used but isn't fully supported. Resulting binaries may also be bigger.
|
||||||
|
You can get it from: https://releases.llvm.org/download.html
|
||||||
|
|
||||||
# Building
|
# Building
|
||||||
|
|
||||||
To build the firmware, you need to fetch the submodules and then run make:
|
If you have docker installed you can use `compile-with-docker.bat`, the output files are created in `compiled-firmware` folder. This method gives significantly smaller binaries, I've seen differences up to 1kb, so it can fit more functionalities this way. The challange can be (or not) installing the docker itself.
|
||||||
```
|
|
||||||
git submodule update --init --recursive --depth=1
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
To compile directly in windows without the need of a linux virtual machine:
|
|
||||||
|
|
||||||
```
|
To compile directly in windows:
|
||||||
1. Download and install "gcc-arm-none-eabi-10.3-2021.10-win32.exe" from https://developer.arm.com/downloads/-/gnu-rm
|
|
||||||
2. Download and install "gnu_make-3.81.exe" from https://gnuwin32.sourceforge.net/packages/make.htm
|
|
||||||
|
|
||||||
3. You may (or not) need to manualy add gcc path to you OS environment PATH.
|
1. Open windows command line and run:
|
||||||
ie add C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2021.10\bin
|
```
|
||||||
|
winget install -e -h git.git Python.Python.3.8 GnuWin32.Make
|
||||||
4. You may (or not) need to reboot your PC after installing the above
|
winget install -e -h Arm.GnuArmEmbeddedToolchain -v "10 2021.10"
|
||||||
```
|
```
|
||||||
|
2. Close command line, open a new one and run:
|
||||||
Then you can run 'win_make.bat' from the directory you saved this source code too.
|
```
|
||||||
You may need to edit the bat file (path to make.exe) depending on where you installed the above two packages too.
|
pip install --user --upgrade pip
|
||||||
|
pip install crcmod
|
||||||
|
mkdir c:\projects & cd /D c:/projects
|
||||||
|
git clone https://github.com/egzumer/uv-k5-firmware-custom.git
|
||||||
|
```
|
||||||
|
3. From now on you can build the firmware by going to `c:\projects\uv-k5-firmware-custom` and running `win_make.bat` or by running a command line:
|
||||||
|
```
|
||||||
|
cd /D c:\projects\uv-k5-firmware-custom
|
||||||
|
win_make.bat
|
||||||
|
```
|
||||||
|
4. To reset the repository and pull new changes run (!!! it will delete all your changes !!!):
|
||||||
|
```
|
||||||
|
cd /D c:\projects\uv-k5-firmware-custom
|
||||||
|
git reset --hard & git clean -fd & git pull
|
||||||
|
```
|
||||||
|
|
||||||
I've left some notes in the win_make.bat file to maybe help with stuff.
|
I've left some notes in the win_make.bat file to maybe help with stuff.
|
||||||
|
|
||||||
@@ -129,6 +158,7 @@ I've left some notes in the win_make.bat file to maybe help with stuff.
|
|||||||
|
|
||||||
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
Many thanks to various people on Telegram for putting up with me during this effort and helping:
|
||||||
|
|
||||||
|
* [OneOfEleven](https://github.com/OneOfEleven)
|
||||||
* [DualTachyon](https://github.com/DualTachyon)
|
* [DualTachyon](https://github.com/DualTachyon)
|
||||||
* [Mikhail](https://github.com/fagci)
|
* [Mikhail](https://github.com/fagci)
|
||||||
* [Andrej](https://github.com/Tunas1337)
|
* [Andrej](https://github.com/Tunas1337)
|
||||||
@@ -162,13 +192,13 @@ You may obtain a copy of the License at
|
|||||||
# Example changes/updates
|
# Example changes/updates
|
||||||
|
|
||||||
<p float="left">
|
<p float="left">
|
||||||
<img src="/image1.png" width=300 />
|
<img src="/images/image1.png" width=300 />
|
||||||
<img src="/image2.png" width=300 />
|
<img src="/images/image2.png" width=300 />
|
||||||
<img src="/image3.png" width=300 />
|
<img src="/images/image3.png" width=300 />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
Video showing the AM fix working ..
|
Video showing the AM fix working ..
|
||||||
|
|
||||||
<video src="/AM_fix.mp4"></video>
|
<video src="/images/AM_fix.mp4"></video>
|
||||||
|
|
||||||
<video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video>
|
<video src="https://github.com/OneOfEleven/uv-k5-firmware-custom/assets/51590168/2a3a9cdc-97da-4966-bf0d-1ce6ad09779c"></video>
|
||||||
|
|||||||
332
am_fix.c
@@ -30,30 +30,13 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
// original QS front end register settings
|
|
||||||
const uint8_t orig_lna_short = 3; // 0dB
|
|
||||||
const uint8_t orig_lna = 2; // -14dB
|
|
||||||
const uint8_t orig_mixer = 3; // 0dB
|
|
||||||
const uint8_t orig_pga = 6; // -3dB
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if 1
|
uint16_t reg_val;
|
||||||
// bitfields take up less flash bytes
|
int8_t gain_dB;
|
||||||
uint8_t lna_short:2; // 0 ~ 3
|
} __attribute__((packed)) t_gain_table;
|
||||||
uint8_t lna:3; // 0 ~ 7
|
|
||||||
uint8_t mixer:2; // 0 ~ 3
|
|
||||||
uint8_t pga:3; // 0 ~ 7
|
|
||||||
#else
|
|
||||||
uint8_t lna_short; // 0 ~ 3
|
|
||||||
uint8_t lna; // 0 ~ 7
|
|
||||||
uint8_t mixer; // 0 ~ 3
|
|
||||||
uint8_t pga; // 0 ~ 7
|
|
||||||
#endif
|
|
||||||
} t_gain_table;
|
|
||||||
//} __attribute__((packed)) t_gain_table;
|
|
||||||
|
|
||||||
// REG_10 AGC gain table
|
// REG_10 AGC gain table
|
||||||
//
|
//
|
||||||
@@ -68,10 +51,10 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
// <7:5> = LNA Gain
|
// <7:5> = LNA Gain
|
||||||
// 7 = 0dB
|
// 7 = 0dB
|
||||||
// 6 = -2dB
|
// 6 = -2dB
|
||||||
// 5 = -4dB
|
// 5 = -4dB < original value
|
||||||
// 4 = -6dB
|
// 4 = -6dB
|
||||||
// 3 = -9dB
|
// 3 = -9dB
|
||||||
// 2 = -14dB < original value
|
// 2 = -14dB
|
||||||
// 1 = -19dB
|
// 1 = -19dB
|
||||||
// 0 = -24dB
|
// 0 = -24dB
|
||||||
//
|
//
|
||||||
@@ -103,141 +86,140 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
// if I don't add the brackets, reading the table returns unexpected/different values !!!
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
//// static const int16_t lna_short_dB[] = { -19, -16, -11, 0}; // was (but wrong)
|
||||||
static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
// static const int16_t lna_short_dB[] = { (-33), (-30), (-24), 0}; // corrected'ish
|
||||||
static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
// static const int16_t lna_dB[] = { (-24), (-19), (-14), ( -9), (-6), (-4), (-2), 0};
|
||||||
static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
// static const int16_t mixer_dB[] = { ( -8), ( -6), ( -3), 0};
|
||||||
static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
// static const int16_t pga_dB[] = { (-33), (-27), (-21), (-15), (-9), (-6), (-3), 0};
|
||||||
|
|
||||||
// lookup table is hugely easier than writing code to do the same
|
// lookup table is hugely easier than writing code to do the same
|
||||||
//
|
//
|
||||||
static const t_gain_table gain_table[] =
|
static const t_gain_table gain_table[] =
|
||||||
{
|
{
|
||||||
{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original
|
{0x035E, -17}, // 0 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
|
|
||||||
// test table that lets me manually set the lna-short register
|
// test table that lets me manually set the lna-short register
|
||||||
// to measure it's actual dB change using an RF signal generator
|
// to measure it's actual dB change using an RF signal generator
|
||||||
|
|
||||||
{0, 2, 3, 6}, // 1 .. -33dB -14dB 0dB -3dB .. -50dB
|
{0x005E, -50}, // 1 .. 0 2 3 6 .. -33dB -14dB 0dB -3dB .. -50dB
|
||||||
{1, 2, 3, 6}, // 2 .. -30dB -14dB 0dB -3dB .. -47dB
|
{0x015E, -47}, // 2 .. 1 2 3 6 .. -30dB -14dB 0dB -3dB .. -47dB
|
||||||
{2, 2, 3, 6}, // 3 .. -24dB -14dB 0dB -3dB .. -41dB
|
{0x025E, -41}, // 3 .. 2 2 3 6 .. -24dB -14dB 0dB -3dB .. -41dB
|
||||||
{3, 2, 3, 6} // 4 .. 0dB -14dB 0dB -3dB .. -17dB
|
{0x035E, -17} // 4 .. 3 2 3 6 .. 0dB -14dB 0dB -3dB .. -17dB original
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 1;
|
static const unsigned int original_index = 1;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
{0, 0, 0, 0}, // 1 .. -33dB -24dB -8dB -33dB .. -98dB
|
{0x0000, -98}, // 1 .. 0 0 0 0 .. -33dB -24dB -8dB -33dB .. -98dB
|
||||||
{0, 0, 1, 0}, // 2 .. -33dB -24dB -6dB -33dB .. -96dB
|
{0x0008, -96}, // 2 .. 0 0 1 0 .. -33dB -24dB -6dB -33dB .. -96dB
|
||||||
{1, 0, 0, 0}, // 3 .. -30dB -24dB -8dB -33dB .. -95dB
|
{0x0100, -95}, // 3 .. 1 0 0 0 .. -30dB -24dB -8dB -33dB .. -95dB
|
||||||
{0, 1, 0, 0}, // 4 .. -33dB -19dB -8dB -33dB .. -93dB
|
{0x0020, -93}, // 4 .. 0 1 0 0 .. -33dB -19dB -8dB -33dB .. -93dB
|
||||||
{0, 0, 0, 1}, // 5 .. -33dB -24dB -8dB -27dB .. -92dB
|
{0x0001, -92}, // 5 .. 0 0 0 1 .. -33dB -24dB -8dB -27dB .. -92dB
|
||||||
{0, 1, 1, 0}, // 6 .. -33dB -19dB -6dB -33dB .. -91dB
|
{0x0028, -91}, // 6 .. 0 1 1 0 .. -33dB -19dB -6dB -33dB .. -91dB
|
||||||
{0, 0, 1, 1}, // 7 .. -33dB -24dB -6dB -27dB .. -90dB
|
{0x0009, -90}, // 7 .. 0 0 1 1 .. -33dB -24dB -6dB -27dB .. -90dB
|
||||||
{1, 0, 0, 1}, // 8 .. -30dB -24dB -8dB -27dB .. -89dB
|
{0x0101, -89}, // 8 .. 1 0 0 1 .. -30dB -24dB -8dB -27dB .. -89dB
|
||||||
{0, 1, 2, 0}, // 9 .. -33dB -19dB -3dB -33dB .. -88dB
|
{0x0030, -88}, // 9 .. 0 1 2 0 .. -33dB -19dB -3dB -33dB .. -88dB
|
||||||
{1, 0, 3, 0}, // 10 .. -30dB -24dB 0dB -33dB .. -87dB
|
{0x0118, -87}, // 10 .. 1 0 3 0 .. -30dB -24dB 0dB -33dB .. -87dB
|
||||||
{0, 0, 0, 2}, // 11 .. -33dB -24dB -8dB -21dB .. -86dB
|
{0x0002, -86}, // 11 .. 0 0 0 2 .. -33dB -24dB -8dB -21dB .. -86dB
|
||||||
{1, 1, 2, 0}, // 12 .. -30dB -19dB -3dB -33dB .. -85dB
|
{0x0130, -85}, // 12 .. 1 1 2 0 .. -30dB -19dB -3dB -33dB .. -85dB
|
||||||
{0, 0, 3, 1}, // 13 .. -33dB -24dB 0dB -27dB .. -84dB
|
{0x0019, -84}, // 13 .. 0 0 3 1 .. -33dB -24dB 0dB -27dB .. -84dB
|
||||||
{0, 3, 0, 0}, // 14 .. -33dB -9dB -8dB -33dB .. -83dB
|
{0x0060, -83}, // 14 .. 0 3 0 0 .. -33dB -9dB -8dB -33dB .. -83dB
|
||||||
{1, 1, 3, 0}, // 15 .. -30dB -19dB 0dB -33dB .. -82dB
|
{0x0138, -82}, // 15 .. 1 1 3 0 .. -30dB -19dB 0dB -33dB .. -82dB
|
||||||
{1, 0, 3, 1}, // 16 .. -30dB -24dB 0dB -27dB .. -81dB
|
{0x0119, -81}, // 16 .. 1 0 3 1 .. -30dB -24dB 0dB -27dB .. -81dB
|
||||||
{0, 2, 3, 0}, // 17 .. -33dB -14dB 0dB -33dB .. -80dB
|
{0x0058, -80}, // 17 .. 0 2 3 0 .. -33dB -14dB 0dB -33dB .. -80dB
|
||||||
{1, 2, 0, 1}, // 18 .. -30dB -14dB -8dB -27dB .. -79dB
|
{0x0141, -79}, // 18 .. 1 2 0 1 .. -30dB -14dB -8dB -27dB .. -79dB
|
||||||
{0, 3, 2, 0}, // 19 .. -33dB -9dB -3dB -33dB .. -78dB
|
{0x0070, -78}, // 19 .. 0 3 2 0 .. -33dB -9dB -3dB -33dB .. -78dB
|
||||||
{1, 4, 0, 0}, // 20 .. -30dB -6dB -8dB -33dB .. -77dB
|
{0x0180, -77}, // 20 .. 1 4 0 0 .. -30dB -6dB -8dB -33dB .. -77dB
|
||||||
{1, 1, 3, 1}, // 21 .. -30dB -19dB 0dB -27dB .. -76dB
|
{0x0139, -76}, // 21 .. 1 1 3 1 .. -30dB -19dB 0dB -27dB .. -76dB
|
||||||
{0, 0, 2, 3}, // 22 .. -33dB -24dB -3dB -15dB .. -75dB
|
{0x0013, -75}, // 22 .. 0 0 2 3 .. -33dB -24dB -3dB -15dB .. -75dB
|
||||||
{1, 3, 0, 1}, // 23 .. -30dB -9dB -8dB -27dB .. -74dB
|
{0x0161, -74}, // 23 .. 1 3 0 1 .. -30dB -9dB -8dB -27dB .. -74dB
|
||||||
{1, 6, 0, 0}, // 24 .. -30dB -2dB -8dB -33dB .. -73dB
|
{0x01C0, -73}, // 24 .. 1 6 0 0 .. -30dB -2dB -8dB -33dB .. -73dB
|
||||||
{0, 7, 1, 0}, // 25 .. -33dB 0dB -6dB -33dB .. -72dB
|
{0x00E8, -72}, // 25 .. 0 7 1 0 .. -33dB 0dB -6dB -33dB .. -72dB
|
||||||
{0, 6, 2, 0}, // 26 .. -33dB -2dB -3dB -33dB .. -71dB
|
{0x00D0, -71}, // 26 .. 0 6 2 0 .. -33dB -2dB -3dB -33dB .. -71dB
|
||||||
{2, 1, 3, 1}, // 27 .. -24dB -19dB 0dB -27dB .. -70dB
|
{0x0239, -70}, // 27 .. 2 1 3 1 .. -24dB -19dB 0dB -27dB .. -70dB
|
||||||
{0, 3, 1, 2}, // 28 .. -33dB -9dB -6dB -21dB .. -69dB
|
{0x006A, -69}, // 28 .. 0 3 1 2 .. -33dB -9dB -6dB -21dB .. -69dB
|
||||||
{0, 0, 0, 6}, // 29 .. -33dB -24dB -8dB -3dB .. -68dB
|
{0x0006, -68}, // 29 .. 0 0 0 6 .. -33dB -24dB -8dB -3dB .. -68dB
|
||||||
{0, 5, 2, 1}, // 30 .. -33dB -4dB -3dB -27dB .. -67dB
|
{0x00B1, -67}, // 30 .. 0 5 2 1 .. -33dB -4dB -3dB -27dB .. -67dB
|
||||||
{0, 0, 1, 6}, // 31 .. -33dB -24dB -6dB -3dB .. -66dB
|
{0x000E, -66}, // 31 .. 0 0 1 6 .. -33dB -24dB -6dB -3dB .. -66dB
|
||||||
{1, 2, 3, 2}, // 32 .. -30dB -14dB 0dB -21dB .. -65dB
|
{0x015A, -65}, // 32 .. 1 2 3 2 .. -30dB -14dB 0dB -21dB .. -65dB
|
||||||
{2, 1, 1, 3}, // 33 .. -24dB -19dB -6dB -15dB .. -64dB
|
{0x022B, -64}, // 33 .. 2 1 1 3 .. -24dB -19dB -6dB -15dB .. -64dB
|
||||||
{1, 7, 3, 0}, // 34 .. -30dB 0dB 0dB -33dB .. -63dB
|
{0x01F8, -63}, // 34 .. 1 7 3 0 .. -30dB 0dB 0dB -33dB .. -63dB
|
||||||
{1, 3, 0, 3}, // 35 .. -30dB -9dB -8dB -15dB .. -62dB
|
{0x0163, -62}, // 35 .. 1 3 0 3 .. -30dB -9dB -8dB -15dB .. -62dB
|
||||||
{0, 1, 2, 5}, // 36 .. -33dB -19dB -3dB -6dB .. -61dB
|
{0x0035, -61}, // 36 .. 0 1 2 5 .. -33dB -19dB -3dB -6dB .. -61dB
|
||||||
{2, 0, 2, 4}, // 37 .. -24dB -24dB -3dB -9dB .. -60dB
|
{0x0214, -60}, // 37 .. 2 0 2 4 .. -24dB -24dB -3dB -9dB .. -60dB
|
||||||
{1, 6, 3, 1}, // 38 .. -30dB -2dB 0dB -27dB .. -59dB
|
{0x01D9, -59}, // 38 .. 1 6 3 1 .. -30dB -2dB 0dB -27dB .. -59dB
|
||||||
{1, 2, 0, 5}, // 39 .. -30dB -14dB -8dB -6dB .. -58dB
|
{0x0145, -58}, // 39 .. 1 2 0 5 .. -30dB -14dB -8dB -6dB .. -58dB
|
||||||
{2, 5, 0, 2}, // 40 .. -24dB -4dB -8dB -21dB .. -57dB
|
{0x02A2, -57}, // 40 .. 2 5 0 2 .. -24dB -4dB -8dB -21dB .. -57dB
|
||||||
{2, 6, 2, 1}, // 41 .. -24dB -2dB -3dB -27dB .. -56dB
|
{0x02D1, -56}, // 41 .. 2 6 2 1 .. -24dB -2dB -3dB -27dB .. -56dB
|
||||||
{0, 5, 2, 3}, // 42 .. -33dB -4dB -3dB -15dB .. -55dB
|
{0x00B3, -55}, // 42 .. 0 5 2 3 .. -33dB -4dB -3dB -15dB .. -55dB
|
||||||
{2, 0, 2, 6}, // 43 .. -24dB -24dB -3dB -3dB .. -54dB
|
{0x0216, -54}, // 43 .. 2 0 2 6 .. -24dB -24dB -3dB -3dB .. -54dB
|
||||||
{0, 3, 0, 6}, // 44 .. -33dB -9dB -8dB -3dB .. -53dB
|
{0x0066, -53}, // 44 .. 0 3 0 6 .. -33dB -9dB -8dB -3dB .. -53dB
|
||||||
{0, 6, 0, 4}, // 45 .. -33dB -2dB -8dB -9dB .. -52dB
|
{0x00C4, -52}, // 45 .. 0 6 0 4 .. -33dB -2dB -8dB -9dB .. -52dB
|
||||||
{0, 3, 1, 6}, // 46 .. -33dB -9dB -6dB -3dB .. -51dB
|
{0x006E, -51}, // 46 .. 0 3 1 6 .. -33dB -9dB -6dB -3dB .. -51dB
|
||||||
{1, 2, 3, 5}, // 47 .. -30dB -14dB 0dB -6dB .. -50dB
|
{0x015D, -50}, // 47 .. 1 2 3 5 .. -30dB -14dB 0dB -6dB .. -50dB
|
||||||
{0, 5, 1, 5}, // 48 .. -33dB -4dB -6dB -6dB .. -49dB
|
{0x00AD, -49}, // 48 .. 0 5 1 5 .. -33dB -4dB -6dB -6dB .. -49dB
|
||||||
{0, 3, 3, 5}, // 49 .. -33dB -9dB 0dB -6dB .. -48dB
|
{0x007D, -48}, // 49 .. 0 3 3 5 .. -33dB -9dB 0dB -6dB .. -48dB
|
||||||
{0, 6, 2, 4}, // 50 .. -33dB -2dB -3dB -9dB .. -47dB
|
{0x00D4, -47}, // 50 .. 0 6 2 4 .. -33dB -2dB -3dB -9dB .. -47dB
|
||||||
{1, 5, 2, 4}, // 51 .. -30dB -4dB -3dB -9dB .. -46dB
|
{0x01B4, -46}, // 51 .. 1 5 2 4 .. -30dB -4dB -3dB -9dB .. -46dB
|
||||||
{3, 0, 1, 3}, // 52 .. 0dB -24dB -6dB -15dB .. -45dB
|
{0x030B, -45}, // 52 .. 3 0 1 3 .. 0dB -24dB -6dB -15dB .. -45dB
|
||||||
{0, 6, 1, 6}, // 53 .. -33dB -2dB -6dB -3dB .. -44dB
|
{0x00CE, -44}, // 53 .. 0 6 1 6 .. -33dB -2dB -6dB -3dB .. -44dB
|
||||||
{1, 5, 2, 5}, // 54 .. -30dB -4dB -3dB -6dB .. -43dB
|
{0x01B5, -43}, // 54 .. 1 5 2 5 .. -30dB -4dB -3dB -6dB .. -43dB
|
||||||
{0, 4, 2, 7}, // 55 .. -33dB -6dB -3dB 0dB .. -42dB
|
{0x0097, -42}, // 55 .. 0 4 2 7 .. -33dB -6dB -3dB 0dB .. -42dB
|
||||||
{2, 2, 2, 7}, // 56 .. -24dB -14dB -3dB 0dB .. -41dB
|
{0x0257, -41}, // 56 .. 2 2 2 7 .. -24dB -14dB -3dB 0dB .. -41dB
|
||||||
{2, 5, 2, 4}, // 57 .. -24dB -4dB -3dB -9dB .. -40dB
|
{0x02B4, -40}, // 57 .. 2 5 2 4 .. -24dB -4dB -3dB -9dB .. -40dB
|
||||||
{2, 3, 3, 5}, // 58 .. -24dB -9dB 0dB -6dB .. -39dB
|
{0x027D, -39}, // 58 .. 2 3 3 5 .. -24dB -9dB 0dB -6dB .. -39dB
|
||||||
{1, 6, 3, 5}, // 59 .. -30dB -2dB 0dB -6dB .. -38dB
|
{0x01DD, -38}, // 59 .. 1 6 3 5 .. -30dB -2dB 0dB -6dB .. -38dB
|
||||||
{2, 5, 1, 6}, // 60 .. -24dB -4dB -6dB -3dB .. -37dB
|
{0x02AE, -37}, // 60 .. 2 5 1 6 .. -24dB -4dB -6dB -3dB .. -37dB
|
||||||
{3, 3, 3, 1}, // 61 .. 0dB -9dB 0dB -27dB .. -36dB
|
{0x0379, -36}, // 61 .. 3 3 3 1 .. 0dB -9dB 0dB -27dB .. -36dB
|
||||||
{3, 2, 3, 2}, // 62 .. 0dB -14dB 0dB -21dB .. -35dB
|
{0x035A, -35}, // 62 .. 3 2 3 2 .. 0dB -14dB 0dB -21dB .. -35dB
|
||||||
{2, 5, 2, 6}, // 63 .. -24dB -4dB -3dB -3dB .. -34dB
|
{0x02B6, -34}, // 63 .. 2 5 2 6 .. -24dB -4dB -3dB -3dB .. -34dB
|
||||||
{3, 0, 1, 6}, // 64 .. 0dB -24dB -6dB -3dB .. -33dB
|
{0x030E, -33}, // 64 .. 3 0 1 6 .. 0dB -24dB -6dB -3dB .. -33dB
|
||||||
{3, 0, 0, 7}, // 65 .. 0dB -24dB -8dB 0dB .. -32dB
|
{0x0307, -32}, // 65 .. 3 0 0 7 .. 0dB -24dB -8dB 0dB .. -32dB
|
||||||
{2, 5, 3, 6}, // 66 .. -24dB -4dB 0dB -3dB .. -31dB
|
{0x02BE, -31}, // 66 .. 2 5 3 6 .. -24dB -4dB 0dB -3dB .. -31dB
|
||||||
{3, 3, 3, 2}, // 67 .. 0dB -9dB 0dB -21dB .. -30dB
|
{0x037A, -30}, // 67 .. 3 3 3 2 .. 0dB -9dB 0dB -21dB .. -30dB
|
||||||
{2, 6, 3, 6}, // 68 .. -24dB -2dB 0dB -3dB .. -29dB
|
{0x02DE, -29}, // 68 .. 2 6 3 6 .. -24dB -2dB 0dB -3dB .. -29dB
|
||||||
{3, 2, 0, 5}, // 69 .. 0dB -14dB -8dB -6dB .. -28dB
|
{0x0345, -28}, // 69 .. 3 2 0 5 .. 0dB -14dB -8dB -6dB .. -28dB
|
||||||
{3, 5, 0, 3}, // 70 .. 0dB -4dB -8dB -15dB .. -27dB
|
{0x03A3, -27}, // 70 .. 3 5 0 3 .. 0dB -4dB -8dB -15dB .. -27dB
|
||||||
{3, 3, 0, 4}, // 71 .. 0dB -9dB -8dB -9dB .. -26dB
|
{0x0364, -26}, // 71 .. 3 3 0 4 .. 0dB -9dB -8dB -9dB .. -26dB
|
||||||
{3, 1, 1, 7}, // 72 .. 0dB -19dB -6dB 0dB .. -25dB
|
{0x032F, -25}, // 72 .. 3 1 1 7 .. 0dB -19dB -6dB 0dB .. -25dB
|
||||||
{3, 4, 2, 3}, // 73 .. 0dB -6dB -3dB -15dB .. -24dB
|
{0x0393, -24}, // 73 .. 3 4 2 3 .. 0dB -6dB -3dB -15dB .. -24dB
|
||||||
{3, 4, 0, 4}, // 74 .. 0dB -6dB -8dB -9dB .. -23dB
|
{0x0384, -23}, // 74 .. 3 4 0 4 .. 0dB -6dB -8dB -9dB .. -23dB
|
||||||
{3, 2, 0, 7}, // 75 .. 0dB -14dB -8dB 0dB .. -22dB
|
{0x0347, -22}, // 75 .. 3 2 0 7 .. 0dB -14dB -8dB 0dB .. -22dB
|
||||||
{3, 7, 1, 3}, // 76 .. 0dB 0dB -6dB -15dB .. -21dB
|
{0x03EB, -21}, // 76 .. 3 7 1 3 .. 0dB 0dB -6dB -15dB .. -21dB
|
||||||
{3, 6, 2, 3}, // 77 .. 0dB -2dB -3dB -15dB .. -20dB
|
{0x03D3, -20}, // 77 .. 3 6 2 3 .. 0dB -2dB -3dB -15dB .. -20dB
|
||||||
{3, 5, 3, 3}, // 78 .. 0dB -4dB 0dB -15dB .. -19dB
|
{0x03BB, -19}, // 78 .. 3 5 3 3 .. 0dB -4dB 0dB -15dB .. -19dB
|
||||||
{3, 3, 3, 4}, // 79 .. 0dB -9dB 0dB -9dB .. -18dB
|
{0x037C, -18}, // 79 .. 3 3 3 4 .. 0dB -9dB 0dB -9dB .. -18dB
|
||||||
{3, 2, 3, 6}, // 80 .. 0dB -14dB 0dB -3dB .. -17dB original
|
{0x03CC, -17}, // 80 .. 3 6 1 4 .. 0dB -2dB -6dB -9dB .. -17dB
|
||||||
{3, 6, 0, 5}, // 81 .. 0dB -2dB -8dB -6dB .. -16dB
|
{0x03C5, -16}, // 81 .. 3 6 0 5 .. 0dB -2dB -8dB -6dB .. -16dB
|
||||||
{3, 7, 1, 4}, // 82 .. 0dB 0dB -6dB -9dB .. -15dB
|
{0x03EC, -15}, // 82 .. 3 7 1 4 .. 0dB 0dB -6dB -9dB .. -15dB
|
||||||
{3, 2, 3, 7}, // 83 .. 0dB -14dB 0dB 0dB .. -14dB
|
{0x035F, -14}, // 83 .. 3 2 3 7 .. 0dB -14dB 0dB 0dB .. -14dB
|
||||||
{3, 6, 0, 6}, // 84 .. 0dB -2dB -8dB -3dB .. -13dB
|
{0x03BC, -13}, // 84 .. 3 5 3 4 .. 0dB -4dB 0dB -9dB .. -13dB
|
||||||
{3, 3, 2, 7}, // 85 .. 0dB -9dB -3dB 0dB .. -12dB
|
{0x038F, -12}, // 85 .. 3 4 1 7 .. 0dB -6dB -6dB 0dB .. -12dB
|
||||||
{3, 7, 0, 6}, // 86 .. 0dB 0dB -8dB -3dB .. -11dB
|
{0x03E6, -11}, // 86 .. 3 7 0 6 .. 0dB 0dB -8dB -3dB .. -11dB
|
||||||
{3, 5, 3, 5}, // 87 .. 0dB -4dB 0dB -6dB .. -10dB
|
{0x03AF, -10}, // 87 .. 3 5 1 7 .. 0dB -4dB -6dB 0dB .. -10dB
|
||||||
{3, 7, 2, 5}, // 88 .. 0dB 0dB -3dB -6dB .. -9dB
|
{0x03F5, -9 }, // 88 .. 3 7 2 5 .. 0dB 0dB -3dB -6dB .. -9dB
|
||||||
{3, 6, 3, 5}, // 89 .. 0dB -2dB 0dB -6dB .. -8dB
|
{0x03D6, -8 }, // 89 .. 3 6 2 6 .. 0dB -2dB -3dB -3dB .. -8dB
|
||||||
{3, 5, 2, 7}, // 90 .. 0dB -4dB -3dB 0dB .. -7dB
|
{0x03BE, -7 }, // 90 .. 3 5 3 6 .. 0dB -4dB 0dB -3dB .. -7dB original
|
||||||
{3, 7, 2, 6}, // 91 .. 0dB 0dB -3dB -3dB .. -6dB
|
{0x03F6, -6 }, // 91 .. 3 7 2 6 .. 0dB 0dB -3dB -3dB .. -6dB
|
||||||
{3, 6, 2, 7}, // 92 .. 0dB -2dB -3dB 0dB .. -5dB
|
{0x03DE, -5 }, // 92 .. 3 6 3 6 .. 0dB -2dB 0dB -3dB .. -5dB
|
||||||
{3, 5, 3, 7}, // 93 .. 0dB -4dB 0dB 0dB .. -4dB
|
{0x03BF, -4 }, // 93 .. 3 5 3 7 .. 0dB -4dB 0dB 0dB .. -4dB
|
||||||
{3, 7, 2, 7}, // 94 .. 0dB 0dB -3dB 0dB .. -3dB
|
{0x03F7, -3 }, // 94 .. 3 7 2 7 .. 0dB 0dB -3dB 0dB .. -3dB
|
||||||
{3, 6, 3, 7}, // 95 .. 0dB -2dB 0dB 0dB .. -2dB
|
{0x03DF, -2 }, // 95 .. 3 6 3 7 .. 0dB -2dB 0dB 0dB .. -2dB
|
||||||
{3, 7, 3, 7} // 96 .. 0dB 0dB 0dB 0dB .. 0dB
|
{0x03FF, 0 }, // 96 .. 3 7 3 7 .. 0dB 0dB 0dB 0dB .. 0dB
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int original_index = 80;
|
static const unsigned int original_index = 90;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// total RF gain for each table index
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
int8_t gain_dB[ARRAY_SIZE(gain_table)] = {0};
|
// display update rate
|
||||||
|
static const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
||||||
// display update rate
|
unsigned int counter = 0;
|
||||||
const unsigned int display_update_rate = 250 / 10; // max 250ms display update rate
|
#endif
|
||||||
unsigned int counter = 0;
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user manually sets the table index .. used to calibrate the desired dB gain table
|
// user manually sets the table index .. used to calibrate the desired dB gain table
|
||||||
@@ -280,13 +262,6 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// pre-compute the total gain for each table index .. saves doing it in real time
|
|
||||||
for (i = 0; i < ARRAY_SIZE(gain_table); i++)
|
|
||||||
{
|
|
||||||
const t_gain_table gains = gain_table[i];
|
|
||||||
gain_dB[i] = lna_short_dB[gains.lna_short] + lna_dB[gains.lna] + mixer_dB[gains.mixer] + pga_dB[gains.pga];
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{ // set a maximum gain to use
|
{ // set a maximum gain to use
|
||||||
// const int16_t max_gain_dB = gain_dB[original_index];
|
// const int16_t max_gain_dB = gain_dB[original_index];
|
||||||
@@ -294,7 +269,8 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
|
|
||||||
max_index = ARRAY_SIZE(gain_table);
|
max_index = ARRAY_SIZE(gain_table);
|
||||||
while (--max_index > 1)
|
while (--max_index > 1)
|
||||||
if (gain_dB[max_index] <= max_gain_dB)
|
// if (gain_dB[max_index] <= max_gain_dB)
|
||||||
|
if (gain_table[max_index].gain_dB <= max_gain_dB)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@@ -306,7 +282,9 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
void AM_fix_reset(const int vfo)
|
void AM_fix_reset(const int vfo)
|
||||||
{ // reset the AM fixer upper
|
{ // reset the AM fixer upper
|
||||||
|
|
||||||
counter = 0;
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
prev_rssi[vfo] = 0;
|
prev_rssi[vfo] = 0;
|
||||||
|
|
||||||
@@ -340,7 +318,9 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
counter = display_update_rate; // queue up a display update as soon as we switch to RX mode
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// only adjust stuff if we're in one of these modes
|
// only adjust stuff if we're in one of these modes
|
||||||
@@ -351,14 +331,16 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter > 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter > 0)
|
||||||
if (++counter >= display_update_rate)
|
{
|
||||||
{ // trigger a display update
|
if (++counter >= display_update_rate)
|
||||||
counter = 0;
|
{ // trigger a display update
|
||||||
gUpdateDisplay = true;
|
counter = 0;
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
{ // sample the current RSSI level
|
{ // sample the current RSSI level
|
||||||
// average it with the previous rssi (a bit of noise/spike immunity)
|
// average it with the previous rssi (a bit of noise/spike immunity)
|
||||||
@@ -367,11 +349,14 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
prev_rssi[vfo] = new_rssi;
|
prev_rssi[vfo] = new_rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
{
|
||||||
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
const int16_t new_rssi = rssi - rssi_gain_diff[vfo];
|
||||||
if (gCurrentRSSI[vfo] != new_rssi)
|
if (gCurrentRSSI[vfo] != new_rssi)
|
||||||
{
|
{
|
||||||
gCurrentRSSI[vfo] = new_rssi;
|
gCurrentRSSI[vfo] = new_rssi;
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
{ // trigger a display update
|
{ // trigger a display update
|
||||||
counter = 1;
|
counter = 1;
|
||||||
@@ -379,6 +364,9 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
// user is manually adjusting a gain register - don't do anything automatically
|
// user is manually adjusting a gain register - don't do anything automatically
|
||||||
@@ -411,10 +399,12 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
if (diff_dB >= 10)
|
if (diff_dB >= 10)
|
||||||
{ // jump immediately to a new gain setting
|
{ // jump immediately to a new gain setting
|
||||||
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
// this greatly speeds up initial gain reduction (but reduces noise/spike immunity)
|
||||||
const int16_t desired_gain_dB = (int16_t)gain_dB[index] - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
|
||||||
|
const int16_t desired_gain_dB = (int16_t)gain_table[index].gain_dB - diff_dB + 8; // get no closer than 8dB (bit of noise/spike immunity)
|
||||||
|
|
||||||
// scan the table to see what index to jump straight too
|
// scan the table to see what index to jump straight too
|
||||||
while (index > 1)
|
while (index > 1)
|
||||||
if (gain_dB[--index] <= desired_gain_dB)
|
if (gain_table[--index].gain_dB <= desired_gain_dB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
//index = (gain_table_index[vfo] + index) / 2; // easy does it
|
||||||
@@ -438,7 +428,7 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff_dB >= -4) // 4dB hysterisis (help reduce gain hunting)
|
if (diff_dB >= -6) // 6dB hysterisis (help reduce gain hunting)
|
||||||
hold_counter[vfo] = 30; // 300ms hold
|
hold_counter[vfo] = 30; // 300ms hold
|
||||||
|
|
||||||
if (hold_counter[vfo] == 0)
|
if (hold_counter[vfo] == 0)
|
||||||
@@ -447,8 +437,10 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
gain_table_index[vfo] = (index <= max_index) ? index : max_index; // limit the gain index
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
#if 0
|
||||||
return; // no gain change
|
if (gain_table_index[vfo] == gain_table_index_prev[vfo])
|
||||||
|
return; // no gain change - this is to reduce writing to the BK chip on ever call
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -459,33 +451,35 @@ const uint8_t orig_pga = 6; // -3dB
|
|||||||
// remember the new table index
|
// remember the new table index
|
||||||
gain_table_index_prev[vfo] = index;
|
gain_table_index_prev[vfo] = index;
|
||||||
|
|
||||||
const t_gain_table gains = gain_table[index];
|
BK4819_WriteRegister(BK4819_REG_13, gain_table[index].reg_val);
|
||||||
BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
|
||||||
|
|
||||||
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
// offset the RSSI reading to the rest of the firmware to cancel out the gain adjustments we make
|
||||||
|
|
||||||
// RF gain difference from original QS setting
|
// RF gain difference from original QS setting
|
||||||
rssi_gain_diff[vfo] = ((int16_t)gain_dB[index] - gain_dB[original_index]) * 2;
|
rssi_gain_diff[vfo] = ((int16_t)gain_table[index].gain_dB - gain_table[original_index].gain_dB) * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save the corrected RSSI level
|
// save the corrected RSSI level
|
||||||
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
gCurrentRSSI[vfo] = rssi - rssi_gain_diff[vfo];
|
||||||
|
|
||||||
if (counter == 0)
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
{
|
if (counter == 0)
|
||||||
counter = 1;
|
{
|
||||||
gUpdateDisplay = true;
|
counter = 1;
|
||||||
}
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
#ifdef ENABLE_AM_FIX_SHOW_DATA
|
||||||
|
|
||||||
void AM_fix_print_data(const int vfo, char *s)
|
void AM_fix_print_data(const int vfo, char *s)
|
||||||
{
|
{
|
||||||
if (s != NULL)
|
if (s != NULL && vfo >= 0 && vfo < (int)ARRAY_SIZE(gain_table_index))
|
||||||
{
|
{
|
||||||
const unsigned int index = gain_table_index[vfo];
|
const unsigned int index = gain_table_index[vfo];
|
||||||
sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_dB[index], prev_rssi[vfo]);
|
// sprintf(s, "%2u.%u %4ddB %3u", index, ARRAY_SIZE(gain_table) - 1, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
|
sprintf(s, "%2u %4ddB %3u", index, gain_table[index].gain_dB, prev_rssi[vfo]);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
am_fix.h
@@ -20,11 +20,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern const uint8_t orig_lna_short;
|
|
||||||
extern const uint8_t orig_lna;
|
|
||||||
extern const uint8_t orig_mixer;
|
|
||||||
extern const uint8_t orig_pga;
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
extern int16_t rssi_gain_diff[2];
|
extern int16_t rssi_gain_diff[2];
|
||||||
|
|
||||||
|
|||||||
300
app/action.c
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
#include "app/action.h"
|
#include "app/action.h"
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/common.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
#include "app/fm.h"
|
#include "app/fm.h"
|
||||||
@@ -45,6 +46,7 @@ static void ACTION_FlashLight(void)
|
|||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_FLASHLIGHT);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
case 2:
|
||||||
gFlashLightState++;
|
gFlashLightState++;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -84,11 +86,11 @@ void ACTION_Monitor(void)
|
|||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
gScanPauseMode = true;
|
gScanPauseMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
@@ -109,60 +111,58 @@ void ACTION_Monitor(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
gRequestDisplayScreen = gScreenToDisplay;
|
gRequestDisplayScreen = gScreenToDisplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_Scan(bool bRestart)
|
void ACTION_Scan(bool bRestart)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
|
{
|
||||||
|
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
||||||
|
gCurrentFunction != FUNCTION_MONITOR &&
|
||||||
|
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
if (gCurrentFunction != FUNCTION_RECEIVE &&
|
GUI_SelectNextDisplay(DISPLAY_FM);
|
||||||
gCurrentFunction != FUNCTION_MONITOR &&
|
|
||||||
gCurrentFunction != FUNCTION_TRANSMIT)
|
gMonitor = false;
|
||||||
|
|
||||||
|
if (gFM_ScanState != FM_SCAN_OFF)
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_FM);
|
FM_PlayAndUpdate();
|
||||||
|
|
||||||
gMonitor = false;
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint16_t Frequency;
|
||||||
|
|
||||||
if (gFM_ScanState != FM_SCAN_OFF)
|
if (bRestart)
|
||||||
{
|
{
|
||||||
FM_PlayAndUpdate();
|
gFM_AutoScan = true;
|
||||||
|
gFM_ChannelPosition = 0;
|
||||||
#ifdef ENABLE_VOICE
|
FM_EraseChannels();
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
Frequency = gEeprom.FM_LowerLimit;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint16_t Frequency;
|
gFM_AutoScan = false;
|
||||||
|
gFM_ChannelPosition = 0;
|
||||||
if (bRestart)
|
Frequency = gEeprom.FM_FrequencyPlaying;
|
||||||
{
|
|
||||||
gFM_AutoScan = true;
|
|
||||||
gFM_ChannelPosition = 0;
|
|
||||||
FM_EraseChannels();
|
|
||||||
Frequency = gEeprom.FM_LowerLimit;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gFM_AutoScan = false;
|
|
||||||
gFM_ChannelPosition = 0;
|
|
||||||
Frequency = gEeprom.FM_FrequencyPlaying;
|
|
||||||
}
|
|
||||||
|
|
||||||
BK1080_GetFrequencyDeviation(Frequency);
|
|
||||||
FM_Tune(Frequency, 1, bRestart);
|
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
BK1080_GetFrequencyDeviation(Frequency);
|
||||||
|
FM_Tune(Frequency, 1, bRestart);
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_BEGIN;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
if (gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
{ // not scanning
|
{ // not scanning
|
||||||
@@ -176,23 +176,42 @@ void ACTION_Scan(bool bRestart)
|
|||||||
|
|
||||||
RADIO_SelectVfos();
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
if (gScanStateDir != SCAN_OFF)
|
||||||
{
|
{ // already scanning
|
||||||
SCANNER_Stop();
|
|
||||||
|
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||||
|
{ // channel mode
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
// keep scanning but toggle between scan lists
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||||
#endif
|
|
||||||
|
// jump to the next channel
|
||||||
|
SCANNER_ScanChannels(false, gScanStateDir);
|
||||||
|
gScanPauseDelayIn_10ms = 1;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // stop scanning
|
||||||
|
|
||||||
|
SCANNER_Stop();
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // start scanning
|
||||||
CHANNEL_Next(true, 1);
|
|
||||||
|
SCANNER_ScanChannels(true, SCAN_FWD);
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
AUDIO_SetVoiceID(0, VOICE_ID_SCANNING_BEGIN);
|
||||||
@@ -200,7 +219,7 @@ void ACTION_Scan(bool bRestart)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clear the other vfo's rssi level (to hide the antenna symbol)
|
// clear the other vfo's rssi level (to hide the antenna symbol)
|
||||||
gVFO_RSSI_bar_level[gEeprom.RX_CHANNEL == 0] = 0;
|
gVFO_RSSI_bar_level[(gEeprom.RX_VFO + 1) & 1u] = 0;
|
||||||
|
|
||||||
// let the user see DW is not active
|
// let the user see DW is not active
|
||||||
gDualWatchActive = false;
|
gDualWatchActive = false;
|
||||||
@@ -209,43 +228,68 @@ void ACTION_Scan(bool bRestart)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!bRestart)
|
// if (!bRestart)
|
||||||
{ // scanning
|
if (!bRestart && IS_MR_CHANNEL(gNextMrChannel))
|
||||||
|
{ // channel mode, keep scanning but toggle between scan lists
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = (gEeprom.SCAN_LIST_DEFAULT + 1) % 3;
|
||||||
|
|
||||||
|
// jump to the next channel
|
||||||
|
SCANNER_ScanChannels(false, gScanStateDir);
|
||||||
|
gScanPauseDelayIn_10ms = 1;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // stop scanning
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
SCANNER_Stop();
|
SCANNER_Stop();
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ACTION_Vox(void)
|
#ifdef ENABLE_VOX
|
||||||
{
|
void ACTION_Vox(void)
|
||||||
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
|
||||||
gRequestSaveSettings = true;
|
|
||||||
gFlagReconfigureVfos = true;
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = VOICE_ID_VOX;
|
|
||||||
#endif
|
|
||||||
gUpdateStatus = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
|
||||||
static void ACTION_AlarmOr1750(bool b1750)
|
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gEeprom.VOX_SWITCH = !gEeprom.VOX_SWITCH;
|
||||||
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
gRequestSaveSettings = true;
|
||||||
gAlarmRunningCounter = 0;
|
gFlagReconfigureVfos = true;
|
||||||
gFlagPrepareTX = true;
|
#ifdef ENABLE_VOICE
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gAnotherVoiceID = VOICE_ID_VOX;
|
||||||
|
#endif
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
|
static void ACTION_AlarmOr1750(const bool b1750)
|
||||||
|
{
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
|
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||||
|
gAlarmState = b1750 ? ALARM_STATE_TX1750 : ALARM_STATE_TXALARM;
|
||||||
|
gAlarmRunningCounter = 0;
|
||||||
|
#elif defined(ENABLE_ALARM)
|
||||||
|
gAlarmState = ALARM_STATE_TXALARM;
|
||||||
|
gAlarmRunningCounter = 0;
|
||||||
|
#else
|
||||||
|
gAlarmState = ALARM_STATE_TX1750;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gFlagPrepareTX = true;
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
void ACTION_FM(void)
|
void ACTION_FM(void)
|
||||||
{
|
{
|
||||||
@@ -256,8 +300,11 @@ void ACTION_Vox(void)
|
|||||||
FM_TurnOff();
|
FM_TurnOff();
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -269,7 +316,8 @@ void ACTION_Vox(void)
|
|||||||
|
|
||||||
FM_Start();
|
FM_Start();
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,18 +325,16 @@ void ACTION_Vox(void)
|
|||||||
|
|
||||||
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
uint8_t Short = ACTION_OPT_NONE;
|
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode) // entering DTMF code
|
||||||
uint8_t Long = ACTION_OPT_NONE;
|
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN && gDTMF_InputMode)
|
|
||||||
{
|
{
|
||||||
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed)
|
if (Key == KEY_SIDE1 && !bKeyHeld && bKeyPressed) // side1 btn pressed
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
if (gDTMF_InputIndex > 0)
|
|
||||||
|
if (gDTMF_InputBox_Index > 0) // DTMF codes are in the input box
|
||||||
{
|
{
|
||||||
gDTMF_InputBox[--gDTMF_InputIndex] = '-';
|
gDTMF_InputBox[--gDTMF_InputBox_Index] = '-'; // delete one code
|
||||||
if (gDTMF_InputIndex > 0)
|
if (gDTMF_InputBox_Index > 0)
|
||||||
{
|
{
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
@@ -301,43 +347,52 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false; // turn off DTMF input box if no codes left
|
||||||
}
|
}
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Key == KEY_SIDE1)
|
uint8_t funcShort = ACTION_OPT_NONE;
|
||||||
{
|
uint8_t funcLong = ACTION_OPT_NONE;
|
||||||
Short = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
switch(Key) {
|
||||||
Long = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
case KEY_SIDE1:
|
||||||
}
|
funcShort = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||||
else
|
funcLong = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||||
if (Key == KEY_SIDE2)
|
break;
|
||||||
{
|
case KEY_SIDE2:
|
||||||
Short = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
funcShort = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||||
Long = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
funcLong = gEeprom.KEY_2_LONG_PRESS_ACTION;
|
||||||
|
break;
|
||||||
|
case KEY_MENU:
|
||||||
|
funcLong = gEeprom.KEY_M_LONG_PRESS_ACTION;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed) // button pushed
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || bKeyPressed)
|
// held or released beyond this point
|
||||||
|
|
||||||
|
if(!(bKeyHeld && !bKeyPressed)) // don't beep on released after hold
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
if (bKeyHeld || bKeyPressed) // held
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
funcShort = funcLong;
|
||||||
return;
|
|
||||||
|
|
||||||
Short = Long;
|
if (!bKeyPressed) //ignore release if held
|
||||||
|
|
||||||
if (!bKeyPressed)
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Short)
|
// held or released after short press beyond this point
|
||||||
|
|
||||||
|
switch (funcShort)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case ACTION_OPT_NONE:
|
case ACTION_OPT_NONE:
|
||||||
@@ -355,22 +410,33 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
ACTION_Scan(true);
|
ACTION_Scan(true);
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_VOX:
|
case ACTION_OPT_VOX:
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
ACTION_Vox();
|
ACTION_Vox();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case ACTION_OPT_ALARM:
|
case ACTION_OPT_ALARM:
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
ACTION_AlarmOr1750(false);
|
ACTION_AlarmOr1750(false);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
case ACTION_OPT_FM:
|
case ACTION_OPT_FM:
|
||||||
ACTION_FM();
|
ACTION_FM();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case ACTION_OPT_1750:
|
case ACTION_OPT_1750:
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_TX1750
|
||||||
ACTION_AlarmOr1750(true);
|
ACTION_AlarmOr1750(true);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
case ACTION_OPT_KEYLOCK:
|
||||||
|
COMMON_KeypadLockToggle();
|
||||||
|
break;
|
||||||
|
case ACTION_OPT_A_B:
|
||||||
|
COMMON_SwitchVFOs();
|
||||||
|
break;
|
||||||
|
case ACTION_OPT_VFO_MR:
|
||||||
|
COMMON_SwitchVFOMode();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,10 @@
|
|||||||
//static void ACTION_FlashLight(void)
|
//static void ACTION_FlashLight(void)
|
||||||
void ACTION_Power(void);
|
void ACTION_Power(void);
|
||||||
void ACTION_Monitor(void);
|
void ACTION_Monitor(void);
|
||||||
void ACTION_Scan(bool bFlag);
|
void ACTION_Scan(bool bRestart);
|
||||||
void ACTION_Vox(void);
|
#ifdef ENABLE_VOX
|
||||||
|
void ACTION_Vox(void);
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
//static void ACTION_AlarmOr1750(bool b1750)
|
//static void ACTION_AlarmOr1750(bool b1750)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ void AIRCOPY_SendMessage(void)
|
|||||||
|
|
||||||
BK4819_SendFSKData(g_FSK_Buffer);
|
BK4819_SendFSKData(g_FSK_Buffer);
|
||||||
BK4819_SetupPowerAmplifier(0, 0);
|
BK4819_SetupPowerAmplifier(0, 0);
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
|
||||||
gAircopySendCountdown = 30;
|
gAircopySendCountdown = 30;
|
||||||
}
|
}
|
||||||
@@ -131,19 +131,17 @@ static void AIRCOPY_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
Frequency = StrToUL(INPUTBOX_GetAscii()) * 100;
|
||||||
|
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
for (i = 0; i < ARRAY_SIZE(frequencyBandTable); i++)
|
||||||
|
|
||||||
for (i = 0; i < 7; i++)
|
|
||||||
{
|
{
|
||||||
if (Frequency >= LowerLimitFrequencyBandTable[i] && Frequency <= UpperLimitFrequencyBandTable[i])
|
if (Frequency >= frequencyBandTable[i].lower && Frequency < frequencyBandTable[i].upper)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
gRxVfo->Band = i;
|
gRxVfo->Band = i;
|
||||||
Frequency += 75;
|
Frequency = FREQUENCY_RoundToStep(Frequency, gRxVfo->StepFrequency);
|
||||||
Frequency = FREQUENCY_FloorToStep(Frequency, gRxVfo->StepFrequency, 0);
|
|
||||||
gRxVfo->freq_config_RX.Frequency = Frequency;
|
gRxVfo->freq_config_RX.Frequency = Frequency;
|
||||||
gRxVfo->freq_config_TX.Frequency = Frequency;
|
gRxVfo->freq_config_TX.Frequency = Frequency;
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|||||||
@@ -20,12 +20,12 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "frequencies.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
void APP_EndTransmission(void);
|
void APP_EndTransmission(void);
|
||||||
void CHANNEL_Next(bool bFlag, int8_t Direction);
|
|
||||||
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
void APP_StartListening(FUNCTION_Type_t Function, const bool reset_am_fix);
|
||||||
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t Step);
|
uint32_t APP_SetFrequencyByStep(VFO_Info_t *pInfo, int8_t direction);
|
||||||
void APP_Update(void);
|
void APP_Update(void);
|
||||||
void APP_TimeSlice10ms(void);
|
void APP_TimeSlice10ms(void);
|
||||||
void APP_TimeSlice500ms(void);
|
void APP_TimeSlice500ms(void);
|
||||||
|
|||||||
73
app/common.c
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
#include "audio.h"
|
||||||
|
#include "functions.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
void COMMON_KeypadLockToggle()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU &&
|
||||||
|
gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
|
{ // toggle the keyboad lock
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
||||||
|
|
||||||
|
gRequestSaveSettings = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void COMMON_SwitchVFOs()
|
||||||
|
{
|
||||||
|
gEeprom.TX_VFO ^= 1;
|
||||||
|
|
||||||
|
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF)
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = gEeprom.TX_VFO + 1;
|
||||||
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
|
gEeprom.DUAL_WATCH = gEeprom.TX_VFO + 1;
|
||||||
|
|
||||||
|
gRequestSaveSettings = 1;
|
||||||
|
gFlagReconfigureVfos = true;
|
||||||
|
gScheduleDualWatch = true;
|
||||||
|
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COMMON_SwitchVFOMode()
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_NOAA
|
||||||
|
if (gEeprom.VFO_OPEN && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
#else
|
||||||
|
if (gEeprom.VFO_OPEN)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
{ // swap to frequency mode
|
||||||
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||||
|
#endif
|
||||||
|
gRequestSaveVFO = true;
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 0);
|
||||||
|
if (Channel != 0xFF)
|
||||||
|
{ // swap to channel mode
|
||||||
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||||
|
AUDIO_SetDigitVoice(1, Channel + 1);
|
||||||
|
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||||
|
#endif
|
||||||
|
gRequestSaveVFO = true;
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/common.h
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
#ifndef APP_COMMON_H
|
||||||
|
#define APP_COMMON_H
|
||||||
|
|
||||||
|
#include "functions.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
|
void COMMON_KeypadLockToggle();
|
||||||
|
void COMMON_SwitchVFOs();
|
||||||
|
void COMMON_SwitchVFOMode();
|
||||||
|
|
||||||
|
#endif
|
||||||
98
app/dtmf.c
@@ -36,9 +36,9 @@
|
|||||||
char gDTMF_String[15];
|
char gDTMF_String[15];
|
||||||
|
|
||||||
char gDTMF_InputBox[15];
|
char gDTMF_InputBox[15];
|
||||||
uint8_t gDTMF_InputIndex = 0;
|
uint8_t gDTMF_InputBox_Index = 0;
|
||||||
bool gDTMF_InputMode = false;
|
bool gDTMF_InputMode = false;
|
||||||
uint8_t gDTMF_PreviousIndex = 0;
|
uint8_t gDTMF_PreviousIndex = 0;
|
||||||
|
|
||||||
char gDTMF_RX[17];
|
char gDTMF_RX[17];
|
||||||
uint8_t gDTMF_RX_index = 0;
|
uint8_t gDTMF_RX_index = 0;
|
||||||
@@ -54,8 +54,8 @@ char gDTMF_Caller[4];
|
|||||||
char gDTMF_Callee[4];
|
char gDTMF_Callee[4];
|
||||||
DTMF_State_t gDTMF_State;
|
DTMF_State_t gDTMF_State;
|
||||||
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
uint8_t gDTMFChosenContact;
|
uint8_t gDTMF_chosen_contact;
|
||||||
uint8_t gDTMF_AUTO_RESET_TIME;
|
uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
DTMF_CallState_t gDTMF_CallState;
|
DTMF_CallState_t gDTMF_CallState;
|
||||||
DTMF_ReplyState_t gDTMF_ReplyState;
|
DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
DTMF_CallMode_t gDTMF_CallMode;
|
DTMF_CallMode_t gDTMF_CallMode;
|
||||||
@@ -133,8 +133,26 @@ bool DTMF_FindContact(const char *pContact, char *pResult)
|
|||||||
|
|
||||||
char DTMF_GetCharacter(const unsigned int code)
|
char DTMF_GetCharacter(const unsigned int code)
|
||||||
{
|
{
|
||||||
const char list[] = "0123456789ABCD*#";
|
switch (code)
|
||||||
return (code < ARRAY_SIZE(list)) ? list[code] : 0xFF;
|
{
|
||||||
|
case KEY_0: return '0';
|
||||||
|
case KEY_1: return '1';
|
||||||
|
case KEY_2: return '2';
|
||||||
|
case KEY_3: return '3';
|
||||||
|
case KEY_4: return '4';
|
||||||
|
case KEY_5: return '5';
|
||||||
|
case KEY_6: return '6';
|
||||||
|
case KEY_7: return '7';
|
||||||
|
case KEY_8: return '8';
|
||||||
|
case KEY_9: return '9';
|
||||||
|
case KEY_MENU: return 'A';
|
||||||
|
case KEY_UP: return 'B';
|
||||||
|
case KEY_DOWN: return 'C';
|
||||||
|
case KEY_EXIT: return 'D';
|
||||||
|
case KEY_STAR: return '*';
|
||||||
|
case KEY_F: return '#';
|
||||||
|
default: return 0xff;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
bool DTMF_CompareMessage(const char *pMsg, const char *pTemplate, const unsigned int size, const bool bCheckGroup)
|
||||||
@@ -159,37 +177,44 @@ DTMF_CallMode_t DTMF_CheckGroupCall(const char *pMsg, const unsigned int size)
|
|||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
if (pMsg[i] == gEeprom.DTMF_GROUP_CALL_CODE)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
return (i < size) ? DTMF_CALL_MODE_GROUP : DTMF_CALL_MODE_NOT_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DTMF_clear_input_box(void)
|
||||||
|
{
|
||||||
|
memset(gDTMF_InputBox, 0, sizeof(gDTMF_InputBox));
|
||||||
|
gDTMF_InputBox_Index = 0;
|
||||||
|
gDTMF_InputMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
void DTMF_Append(const char code)
|
void DTMF_Append(const char code)
|
||||||
{
|
{
|
||||||
if (gDTMF_InputIndex == 0)
|
if (gDTMF_InputBox_Index == 0)
|
||||||
{
|
{
|
||||||
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox));
|
memset(gDTMF_InputBox, '-', sizeof(gDTMF_InputBox) - 1);
|
||||||
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
gDTMF_InputBox[sizeof(gDTMF_InputBox) - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_InputIndex < sizeof(gDTMF_InputBox))
|
if (gDTMF_InputBox_Index < (sizeof(gDTMF_InputBox) - 1))
|
||||||
gDTMF_InputBox[gDTMF_InputIndex++] = code;
|
gDTMF_InputBox[gDTMF_InputBox_Index++] = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DTMF_HandleRequest(void)
|
void DTMF_HandleRequest(void)
|
||||||
{ // proccess the RX'ed DTMF characters
|
{ // proccess the RX'ed DTMF characters
|
||||||
|
|
||||||
char String[20];
|
char String[21];
|
||||||
unsigned int Offset;
|
unsigned int Offset;
|
||||||
|
|
||||||
if (!gDTMF_RX_pending)
|
if (!gDTMF_RX_pending)
|
||||||
return; // nothing new received
|
return; // nothing new received
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
{ // we're busy scanning
|
{ // we're busy scanning
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
{ // D-DCD is disabled or we're alive
|
{ // D-DCD is disabled or we're alive
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
@@ -207,7 +232,7 @@ void DTMF_HandleRequest(void)
|
|||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
{ // bugger
|
{ // bugger
|
||||||
|
|
||||||
if (gEeprom.PERMIT_REMOTE_KILL)
|
if (gEeprom.PERMIT_REMOTE_KILL)
|
||||||
{
|
{
|
||||||
gSetting_KILLED = true; // oooerr !
|
gSetting_KILLED = true; // oooerr !
|
||||||
@@ -238,17 +263,17 @@ void DTMF_HandleRequest(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gDTMF_RX_index >= 9)
|
if (gDTMF_RX_index >= 9)
|
||||||
{ // look for the REVIVE code
|
{ // look for the REVIVE code
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, gEeprom.REVIVE_CODE);
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
{ // shit, we're back !
|
{ // shit, we're back !
|
||||||
|
|
||||||
gSetting_KILLED = false;
|
gSetting_KILLED = false;
|
||||||
|
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
@@ -268,7 +293,7 @@ void DTMF_HandleRequest(void)
|
|||||||
{ // look for ACK reply
|
{ // look for ACK reply
|
||||||
|
|
||||||
strcpy(String, "AB");
|
strcpy(String, "AB");
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
|
|
||||||
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
if (DTMF_CompareMessage(gDTMF_RX + Offset, String, strlen(String), true))
|
||||||
@@ -290,7 +315,7 @@ void DTMF_HandleRequest(void)
|
|||||||
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
gDTMF_CallMode == DTMF_CALL_MODE_NOT_GROUP &&
|
||||||
gDTMF_RX_index >= 9)
|
gDTMF_RX_index >= 9)
|
||||||
{ // waiting for a reply
|
{ // waiting for a reply
|
||||||
|
|
||||||
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
sprintf(String, "%s%c%s", gDTMF_String, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||||
|
|
||||||
Offset = gDTMF_RX_index - strlen(String);
|
Offset = gDTMF_RX_index - strlen(String);
|
||||||
@@ -335,6 +360,7 @@ void DTMF_HandleRequest(void)
|
|||||||
{
|
{
|
||||||
case DTMF_DEC_RESPONSE_BOTH:
|
case DTMF_DEC_RESPONSE_BOTH:
|
||||||
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
gDTMF_DecodeRingCountdown_500ms = DTMF_decode_ring_countdown_500ms;
|
||||||
|
[[fallthrough]];
|
||||||
case DTMF_DEC_RESPONSE_REPLY:
|
case DTMF_DEC_RESPONSE_REPLY:
|
||||||
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
gDTMF_ReplyState = DTMF_REPLY_AAAAA;
|
||||||
break;
|
break;
|
||||||
@@ -357,14 +383,11 @@ void DTMF_HandleRequest(void)
|
|||||||
void DTMF_Reply(void)
|
void DTMF_Reply(void)
|
||||||
{
|
{
|
||||||
uint16_t Delay;
|
uint16_t Delay;
|
||||||
char String[20];
|
char String[23];
|
||||||
const char *pString = NULL;
|
const char *pString = NULL;
|
||||||
|
|
||||||
switch (gDTMF_ReplyState)
|
switch (gDTMF_ReplyState)
|
||||||
{
|
{
|
||||||
case DTMF_REPLY_NONE:
|
|
||||||
return;
|
|
||||||
|
|
||||||
case DTMF_REPLY_ANI:
|
case DTMF_REPLY_ANI:
|
||||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||||
{
|
{
|
||||||
@@ -376,22 +399,28 @@ void DTMF_Reply(void)
|
|||||||
pString = String;
|
pString = String;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTMF_REPLY_AB:
|
case DTMF_REPLY_AB:
|
||||||
pString = "AB";
|
pString = "AB";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DTMF_REPLY_AAAAA:
|
case DTMF_REPLY_AAAAA:
|
||||||
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
sprintf(String, "%s%c%s", gEeprom.ANI_DTMF_ID, gEeprom.DTMF_SEPARATE_CODE, "AAAAA");
|
||||||
pString = String;
|
pString = String;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (gDTMF_CallState != DTMF_CALL_STATE_NONE || (gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOT && gCurrentVfo->DTMF_PTT_ID_TX_MODE != PTT_ID_BOTH))
|
case DTMF_REPLY_NONE:
|
||||||
|
if (gDTMF_CallState != DTMF_CALL_STATE_NONE ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_OFF ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN)
|
||||||
{
|
{
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send TX-UP DTMF
|
||||||
pString = gEeprom.DTMF_UP_CODE;
|
pString = gEeprom.DTMF_UP_CODE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -400,16 +429,15 @@ void DTMF_Reply(void)
|
|||||||
|
|
||||||
if (pString == NULL)
|
if (pString == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Delay = gEeprom.DTMF_PRELOAD_TIME;
|
Delay = (gEeprom.DTMF_PRELOAD_TIME < 200) ? 200 : gEeprom.DTMF_PRELOAD_TIME;
|
||||||
|
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{ // the will also hear the transmitted tones
|
{ // the user will also hear the transmitted tones
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gEnableSpeaker = true;
|
gEnableSpeaker = true;
|
||||||
Delay = (gEeprom.DTMF_PRELOAD_TIME < 60) ? 60 : gEeprom.DTMF_PRELOAD_TIME;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEM_DelayMs(Delay);
|
SYSTEM_DelayMs(Delay);
|
||||||
|
|
||||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|||||||
15
app/dtmf.h
@@ -33,7 +33,8 @@ typedef enum DTMF_State_t DTMF_State_t;
|
|||||||
enum DTMF_CallState_t {
|
enum DTMF_CallState_t {
|
||||||
DTMF_CALL_STATE_NONE = 0,
|
DTMF_CALL_STATE_NONE = 0,
|
||||||
DTMF_CALL_STATE_CALL_OUT,
|
DTMF_CALL_STATE_CALL_OUT,
|
||||||
DTMF_CALL_STATE_RECEIVED
|
DTMF_CALL_STATE_RECEIVED,
|
||||||
|
DTMF_CALL_STATE_RECEIVED_STAY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DTMF_DecodeResponse_t {
|
enum DTMF_DecodeResponse_t {
|
||||||
@@ -60,12 +61,17 @@ enum DTMF_CallMode_t {
|
|||||||
DTMF_CALL_MODE_DTMF
|
DTMF_CALL_MODE_DTMF
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum { // seconds
|
||||||
|
DTMF_HOLD_MIN = 5,
|
||||||
|
DTMF_HOLD_MAX = 60
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
typedef enum DTMF_CallMode_t DTMF_CallMode_t;
|
||||||
|
|
||||||
extern char gDTMF_String[15];
|
extern char gDTMF_String[15];
|
||||||
|
|
||||||
extern char gDTMF_InputBox[15];
|
extern char gDTMF_InputBox[15];
|
||||||
extern uint8_t gDTMF_InputIndex;
|
extern uint8_t gDTMF_InputBox_Index;
|
||||||
extern bool gDTMF_InputMode;
|
extern bool gDTMF_InputMode;
|
||||||
extern uint8_t gDTMF_PreviousIndex;
|
extern uint8_t gDTMF_PreviousIndex;
|
||||||
|
|
||||||
@@ -83,8 +89,8 @@ extern char gDTMF_Caller[4];
|
|||||||
extern char gDTMF_Callee[4];
|
extern char gDTMF_Callee[4];
|
||||||
extern DTMF_State_t gDTMF_State;
|
extern DTMF_State_t gDTMF_State;
|
||||||
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
extern uint8_t gDTMF_DecodeRingCountdown_500ms;
|
||||||
extern uint8_t gDTMFChosenContact;
|
extern uint8_t gDTMF_chosen_contact;
|
||||||
extern uint8_t gDTMF_AUTO_RESET_TIME;
|
extern uint8_t gDTMF_auto_reset_time_500ms;
|
||||||
extern DTMF_CallState_t gDTMF_CallState;
|
extern DTMF_CallState_t gDTMF_CallState;
|
||||||
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
extern DTMF_ReplyState_t gDTMF_ReplyState;
|
||||||
extern DTMF_CallMode_t gDTMF_CallMode;
|
extern DTMF_CallMode_t gDTMF_CallMode;
|
||||||
@@ -98,6 +104,7 @@ bool DTMF_FindContact(const char *pContact, char *pResult);
|
|||||||
char DTMF_GetCharacter(const unsigned int code);
|
char DTMF_GetCharacter(const unsigned int code);
|
||||||
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag);
|
bool DTMF_CompareMessage(const char *pDTMF, const char *pTemplate, const unsigned int size, const bool bFlag);
|
||||||
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
DTMF_CallMode_t DTMF_CheckGroupCall(const char *pDTMF, const unsigned int size);
|
||||||
|
void DTMF_clear_input_box(void);
|
||||||
void DTMF_Append(const char vode);
|
void DTMF_Append(const char vode);
|
||||||
void DTMF_HandleRequest(void);
|
void DTMF_HandleRequest(void);
|
||||||
void DTMF_Reply(void);
|
void DTMF_Reply(void);
|
||||||
|
|||||||
4
app/fm.c
@@ -45,7 +45,6 @@ bool gFM_AutoScan;
|
|||||||
uint8_t gFM_ChannelPosition;
|
uint8_t gFM_ChannelPosition;
|
||||||
bool gFM_FoundFrequency;
|
bool gFM_FoundFrequency;
|
||||||
bool gFM_AutoScan;
|
bool gFM_AutoScan;
|
||||||
uint8_t gFM_ResumeCountdown_500ms;
|
|
||||||
uint16_t gFM_RestoreCountdown_10ms;
|
uint16_t gFM_RestoreCountdown_10ms;
|
||||||
|
|
||||||
bool FM_CheckValidChannel(uint8_t Channel)
|
bool FM_CheckValidChannel(uint8_t Channel)
|
||||||
@@ -278,8 +277,7 @@ static void FM_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
Frequency = StrToUL(INPUTBOX_GetAscii());
|
||||||
Frequency /= 10000;
|
|
||||||
|
|
||||||
if (Frequency < gEeprom.FM_LowerLimit || gEeprom.FM_UpperLimit < Frequency)
|
if (Frequency < gEeprom.FM_LowerLimit || gEeprom.FM_UpperLimit < Frequency)
|
||||||
{
|
{
|
||||||
|
|||||||
1
app/fm.h
@@ -39,7 +39,6 @@ extern uint8_t gFM_ChannelPosition;
|
|||||||
extern uint16_t gFM_FrequencyDeviation;
|
extern uint16_t gFM_FrequencyDeviation;
|
||||||
extern bool gFM_FoundFrequency;
|
extern bool gFM_FoundFrequency;
|
||||||
extern bool gFM_AutoScan;
|
extern bool gFM_AutoScan;
|
||||||
extern uint8_t gFM_ResumeCountdown_500ms;
|
|
||||||
extern uint16_t gFM_RestoreCountdown_10ms;
|
extern uint16_t gFM_RestoreCountdown_10ms;
|
||||||
|
|
||||||
bool FM_CheckValidChannel(uint8_t Channel);
|
bool FM_CheckValidChannel(uint8_t Channel);
|
||||||
|
|||||||
289
app/generic.c
@@ -17,9 +17,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/common.h"
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
#include "app/fm.h"
|
#include "app/fm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "app/generic.h"
|
#include "app/generic.h"
|
||||||
#include "app/menu.h"
|
#include "app/menu.h"
|
||||||
#include "app/scanner.h"
|
#include "app/scanner.h"
|
||||||
@@ -37,29 +40,24 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed) // short pressed
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed) // held or released
|
||||||
{
|
{
|
||||||
if (bKeyHeld || bKeyPressed)
|
if (bKeyHeld || bKeyPressed) // held or pressed (cannot be held and not pressed I guess, so it checks only if HELD?)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld) // won't ever pass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed) // won't ever pass
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
COMMON_KeypadLockToggle();
|
||||||
gAnotherVoiceID = gEeprom.KEY_LOCK ? VOICE_ID_UNLOCK : VOICE_ID_LOCK;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gEeprom.KEY_LOCK = !gEeprom.KEY_LOCK;
|
|
||||||
gRequestSaveSettings = true;
|
|
||||||
}
|
}
|
||||||
else
|
else // released
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
if ((gFmRadioMode || gScreenToDisplay != DISPLAY_MAIN) && gScreenToDisplay != DISPLAY_FM)
|
||||||
@@ -69,7 +67,10 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gWasFKeyPressed = !gWasFKeyPressed;
|
gWasFKeyPressed = !gWasFKeyPressed; // toggle F function
|
||||||
|
|
||||||
|
if (gWasFKeyPressed)
|
||||||
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (!gWasFKeyPressed)
|
if (!gWasFKeyPressed)
|
||||||
@@ -79,16 +80,16 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else // short pressed
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != DISPLAY_FM)
|
if (gScreenToDisplay != DISPLAY_FM)
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFM_ScanState == FM_SCAN_OFF)
|
if (gFM_ScanState == FM_SCAN_OFF) // not scanning
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
@@ -96,6 +97,7 @@ void GENERIC_Key_F(bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gBeepToPlay = BEEP_440HZ_500MS;
|
gBeepToPlay = BEEP_440HZ_500MS;
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,154 +106,153 @@ void GENERIC_Key_PTT(bool bKeyPressed)
|
|||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
if (!bKeyPressed)
|
if (!bKeyPressed || gSerialConfigCountDown_500ms > 0)
|
||||||
{
|
{ // PTT released
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
{
|
{ // we are transmitting .. stop
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
|
||||||
|
if (gFlagEndTransmission)
|
||||||
{
|
{
|
||||||
if (gFlagEndTransmission)
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
{
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
APP_EndTransmission();
|
|
||||||
|
|
||||||
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
|
||||||
{
|
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
gFlagEndTransmission = false;
|
|
||||||
gVOX_NoiseDetected = false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
APP_EndTransmission();
|
||||||
|
|
||||||
|
if (gEeprom.REPEATER_TAIL_TONE_ELIMINATION == 0)
|
||||||
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
else
|
||||||
|
gRTTECountdown = gEeprom.REPEATER_TAIL_TONE_ELIMINATION * 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
gFlagEndTransmission = false;
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVOX_NoiseDetected = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
RADIO_SetVfoState(VFO_STATE_NORMAL);
|
||||||
|
|
||||||
// beep when you release the PTT
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
//gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL; // 1of11
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF)
|
// PTT pressed
|
||||||
{
|
|
||||||
SCANNER_Stop();
|
|
||||||
|
|
||||||
gPttDebounceCounter = 0;
|
if (gScanStateDir != SCAN_OFF || // frequency/channel scanning
|
||||||
gPttIsPressed = false;
|
gScreenToDisplay == DISPLAY_SCANNER || // CTCSS/CDCSS scanning
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gCssScanMode != CSS_SCAN_MODE_OFF) // " "
|
||||||
return;
|
{ // we're scanning .. stop
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
if (gScreenToDisplay == DISPLAY_SCANNER)
|
||||||
if (gFM_ScanState == FM_SCAN_OFF)
|
{ // CTCSS/CDCSS scanning .. stop
|
||||||
#endif
|
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||||
{
|
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
|
||||||
{
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU || gScreenToDisplay == DISPLAY_FM)
|
|
||||||
#else
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gPttIsPressed = false;
|
|
||||||
gPttDebounceCounter = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
|
||||||
{
|
|
||||||
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
|
||||||
{
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gFlagPrepareTX = true;
|
|
||||||
|
|
||||||
if (gDTMF_InputMode)
|
|
||||||
{
|
|
||||||
if (gDTMF_InputIndex > 0 || gDTMF_PreviousIndex > 0)
|
|
||||||
{
|
|
||||||
if (gDTMF_InputIndex == 0)
|
|
||||||
gDTMF_InputIndex = gDTMF_PreviousIndex;
|
|
||||||
|
|
||||||
gDTMF_InputBox[gDTMF_InputIndex] = 0;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long
|
|
||||||
if (gDTMF_InputIndex == 3)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
#else
|
|
||||||
// append our DTMF ID to the inputted DTMF code -
|
|
||||||
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
|
||||||
if (gDTMF_InputIndex == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
|
||||||
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
|
||||||
|
|
||||||
strcpy(gDTMF_String, gDTMF_InputBox);
|
|
||||||
|
|
||||||
gDTMF_PreviousIndex = gDTMF_InputIndex;
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
|
||||||
gDTMF_State = DTMF_STATE_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gFlagPrepareTX = true;
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
gFlagResetVfos = true;
|
gFlagResetVfos = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
if (gScanStateDir != SCAN_OFF)
|
||||||
MENU_StopCssScan();
|
{ // frequency/channel scanning . .stop
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
SCANNER_Stop();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
else
|
else
|
||||||
{
|
if (gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
FM_PlayAndUpdate();
|
{ // CTCSS/CDCSS scanning .. stop
|
||||||
gRequestDisplayScreen = DISPLAY_FM;
|
MENU_StopCssScan();
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
goto cancel_tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gFM_ScanState != FM_SCAN_OFF)
|
||||||
|
{ // FM radio is scanning .. stop
|
||||||
|
FM_PlayAndUpdate();
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
||||||
|
#endif
|
||||||
|
gRequestDisplayScreen = DISPLAY_FM;
|
||||||
|
goto cancel_tx;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gScreenToDisplay == DISPLAY_FM)
|
||||||
|
goto start_tx; // listening to the FM radio .. start TX'ing
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT && gRTTECountdown == 0)
|
||||||
|
{ // already transmitting
|
||||||
|
gInputBoxIndex = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
|
if (!gDTMF_InputMode && gDTMF_InputBox_Index == 0)
|
||||||
|
goto start_tx; // wasn't entering a DTMF code .. start TX'ing (maybe)
|
||||||
|
|
||||||
|
// was entering a DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index > 0 || gDTMF_PreviousIndex > 0)
|
||||||
|
{ // going to transmit a DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index == 0 && gDTMF_PreviousIndex > 0)
|
||||||
|
gDTMF_InputBox_Index = gDTMF_PreviousIndex; // use the previous DTMF string
|
||||||
|
|
||||||
|
if (gDTMF_InputBox_Index < sizeof(gDTMF_InputBox))
|
||||||
|
gDTMF_InputBox[gDTMF_InputBox_Index] = 0; // NULL term the string
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// append our DTMF ID to the inputted DTMF code -
|
||||||
|
// IF the user inputted code is exactly 3 digits long
|
||||||
|
if (gDTMF_InputBox_Index == 3)
|
||||||
|
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||||
|
else
|
||||||
|
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||||
|
#else
|
||||||
|
// append our DTMF ID to the inputted DTMF code -
|
||||||
|
// IF the user inputted code is exactly 3 digits long and D-DCD is enabled
|
||||||
|
if (gDTMF_InputBox_Index == 3 && gTxVfo->DTMF_DECODING_ENABLE > 0)
|
||||||
|
gDTMF_CallMode = DTMF_CheckGroupCall(gDTMF_InputBox, 3);
|
||||||
|
else
|
||||||
|
gDTMF_CallMode = DTMF_CALL_MODE_DTMF;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// remember the DTMF string
|
||||||
|
gDTMF_PreviousIndex = gDTMF_InputBox_Index;
|
||||||
|
strcpy(gDTMF_String, gDTMF_InputBox);
|
||||||
|
|
||||||
|
gDTMF_ReplyState = DTMF_REPLY_ANI;
|
||||||
|
gDTMF_State = DTMF_STATE_0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DTMF_clear_input_box();
|
||||||
|
|
||||||
|
start_tx:
|
||||||
|
// request start TX
|
||||||
|
gFlagPrepareTX = true;
|
||||||
|
goto done;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
cancel_tx:
|
||||||
gAnotherVoiceID = VOICE_ID_SCANNING_STOP;
|
if (gPttIsPressed)
|
||||||
#endif
|
{
|
||||||
|
gPttWasPressed = true;
|
||||||
|
}
|
||||||
|
|
||||||
gPttWasPressed = true;
|
done:
|
||||||
|
gPttDebounceCounter = 0;
|
||||||
|
if (gScreenToDisplay != DISPLAY_MENU && gRequestDisplayScreen != DISPLAY_FM) // 1of11 .. don't close the menu
|
||||||
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
555
app/main.c
@@ -18,16 +18,20 @@
|
|||||||
|
|
||||||
#include "app/action.h"
|
#include "app/action.h"
|
||||||
#include "app/app.h"
|
#include "app/app.h"
|
||||||
|
#include "app/common.h"
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
#include "app/fm.h"
|
#include "app/fm.h"
|
||||||
#endif
|
#endif
|
||||||
#include "app/generic.h"
|
#include "app/generic.h"
|
||||||
#include "app/main.h"
|
#include "app/main.h"
|
||||||
#include "app/scanner.h"
|
#include "app/scanner.h"
|
||||||
|
|
||||||
#ifdef ENABLE_SPECTRUM
|
#ifdef ENABLE_SPECTRUM
|
||||||
#include "app/spectrum.h"
|
#include "app/spectrum.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
#include "board.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "dtmf.h"
|
#include "dtmf.h"
|
||||||
#include "frequencies.h"
|
#include "frequencies.h"
|
||||||
@@ -36,11 +40,49 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
void toggle_chan_scanlist(void)
|
||||||
|
{ // toggle the selected channels scanlist setting
|
||||||
|
|
||||||
|
if (gScreenToDisplay == DISPLAY_SCANNER || !IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
||||||
|
{
|
||||||
|
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||||
|
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
||||||
|
else
|
||||||
|
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
||||||
|
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
||||||
|
else
|
||||||
|
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||||
|
|
||||||
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
|
gFlagResetVfos = true;
|
||||||
|
}
|
||||||
|
|
||||||
static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
||||||
{
|
{
|
||||||
uint8_t Band;
|
uint8_t Band;
|
||||||
uint8_t Vfo = gEeprom.TX_CHANNEL;
|
uint8_t Vfo = gEeprom.TX_VFO;
|
||||||
|
|
||||||
|
if (gScreenToDisplay == DISPLAY_MENU)
|
||||||
|
{
|
||||||
|
// if (beep)
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (beep)
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
switch (Key)
|
switch (Key)
|
||||||
{
|
{
|
||||||
@@ -50,36 +92,82 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
||||||
// TODO: do something useful with the key
|
// TODO: make use of this function key
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_1:
|
case KEY_1:
|
||||||
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (!IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE)) {
|
||||||
{
|
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
|
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
||||||
|
if (gEeprom.VFO_OPEN && gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (gScanStateDir != SCAN_OFF)
|
||||||
|
{
|
||||||
|
if (gCurrentFunction != FUNCTION_INCOMING ||
|
||||||
|
gRxReceptionMode == RX_MODE_NONE ||
|
||||||
|
gScanPauseDelayIn_10ms == 0)
|
||||||
|
{ // scan is running (not paused)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const uint8_t vfo = gEeprom.TX_VFO;
|
||||||
|
|
||||||
|
if (IS_MR_CHANNEL(gEeprom.ScreenChannel[vfo]))
|
||||||
|
{ // copy channel to VFO, then swap to the VFO
|
||||||
|
|
||||||
|
const unsigned int channel = FREQ_CHANNEL_FIRST + gEeprom.VfoInfo[vfo].Band;
|
||||||
|
|
||||||
|
gEeprom.ScreenChannel[vfo] = channel;
|
||||||
|
gEeprom.VfoInfo[vfo].CHANNEL_SAVE = channel;
|
||||||
|
|
||||||
|
RADIO_SelectVfos();
|
||||||
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
|
//SETTINGS_SaveChannel(channel, gEeprom.RX_VFO, gRxVfo, 1);
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Band = gTxVfo->Band + 1;
|
if(gTxVfo->Band == 6 && gTxVfo->pRX->Frequency < 100000000) {
|
||||||
if (gSetting_350EN || Band != BAND5_350MHz)
|
gTxVfo->pRX->Frequency = 100000000;
|
||||||
{
|
return;
|
||||||
if (Band > BAND7_470MHz)
|
|
||||||
Band = BAND1_50MHz;
|
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
Band = BAND6_400MHz;
|
Band = gTxVfo->Band + 1;
|
||||||
gTxVfo->Band = Band;
|
if (gSetting_350EN || Band != BAND5_350MHz) {
|
||||||
|
if (Band > BAND7_470MHz)
|
||||||
|
Band = BAND1_50MHz;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Band = BAND6_400MHz;
|
||||||
|
|
||||||
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
gTxVfo->Band = Band;
|
||||||
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
|
||||||
|
gEeprom.ScreenChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||||
|
gEeprom.FreqChannel[Vfo] = FREQ_CHANNEL_FIRST + Band;
|
||||||
|
}
|
||||||
|
|
||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
if (beep)
|
if (beep)
|
||||||
@@ -88,63 +176,14 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_2:
|
case KEY_2:
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
COMMON_SwitchVFOs();
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_B;
|
|
||||||
else
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_CHAN_A;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_B;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_CHAN_A;
|
|
||||||
else
|
|
||||||
gEeprom.TX_CHANNEL = (Vfo == 0);
|
|
||||||
|
|
||||||
gRequestSaveSettings = 1;
|
|
||||||
gFlagReconfigureVfos = true;
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
|
|
||||||
if (beep)
|
if (beep)
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_3:
|
case KEY_3:
|
||||||
#ifdef ENABLE_NOAA
|
COMMON_SwitchVFOMode();
|
||||||
if (gEeprom.VFO_OPEN && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
#else
|
|
||||||
if (gEeprom.VFO_OPEN)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
uint8_t Channel;
|
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
{
|
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
|
||||||
#endif
|
|
||||||
gRequestSaveVFO = true;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Channel = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 0);
|
|
||||||
if (Channel != 0xFF)
|
|
||||||
{
|
|
||||||
gEeprom.ScreenChannel[Vfo] = Channel;
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
|
||||||
AUDIO_SetDigitVoice(1, Channel + 1);
|
|
||||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
|
||||||
#endif
|
|
||||||
gRequestSaveVFO = true;
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (beep)
|
if (beep)
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@@ -155,7 +194,7 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gFlagStartScan = true;
|
gFlagStartScan = true;
|
||||||
gScanSingleFrequency = false;
|
gScanSingleFrequency = false;
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
@@ -165,46 +204,33 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_5:
|
case KEY_5:
|
||||||
#ifdef ENABLE_NOAA
|
if(beep) {
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
#ifdef ENABLE_NOAA
|
||||||
|
|
||||||
|
if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.NoaaChannel[gEeprom.TX_VFO];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_CHANNEL];
|
gEeprom.ScreenChannel[Vfo] = gEeprom.FreqChannel[gEeprom.TX_VFO];
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
gAnotherVoiceID = VOICE_ID_FREQUENCY_MODE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
#elif defined(ENABLE_SPECTRUM)
|
#elif defined(ENABLE_SPECTRUM)
|
||||||
APP_RunSpectrum();
|
APP_RunSpectrum();
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
#else
|
#endif
|
||||||
// toggle scanlist-1 and scanlist 2
|
}
|
||||||
if (gScreenToDisplay != DISPLAY_SCANNER)
|
else {
|
||||||
{
|
#ifdef ENABLE_VOX
|
||||||
if (gTxVfo->SCANLIST1_PARTICIPATION)
|
toggle_chan_scanlist();
|
||||||
{
|
#endif
|
||||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
}
|
||||||
gTxVfo->SCANLIST1_PARTICIPATION = 0;
|
|
||||||
else
|
|
||||||
gTxVfo->SCANLIST2_PARTICIPATION = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (gTxVfo->SCANLIST2_PARTICIPATION)
|
|
||||||
gTxVfo->SCANLIST2_PARTICIPATION = 0;
|
|
||||||
else
|
|
||||||
gTxVfo->SCANLIST1_PARTICIPATION = 1;
|
|
||||||
}
|
|
||||||
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
|
||||||
gVfoConfigureMode = VFO_CONFIGURE;
|
|
||||||
gFlagResetVfos = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_6:
|
case KEY_6:
|
||||||
@@ -212,7 +238,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_7:
|
case KEY_7:
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
ACTION_Vox();
|
ACTION_Vox();
|
||||||
|
#else
|
||||||
|
toggle_chan_scanlist();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_8:
|
case KEY_8:
|
||||||
@@ -225,11 +255,11 @@ static void processFKeyFunction(const KEY_Code_t Key, const bool beep)
|
|||||||
{
|
{
|
||||||
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
gEeprom.MrChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||||
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
gEeprom.ScreenChannel[Vfo] = gEeprom.CHAN_1_CALL;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
AUDIO_SetVoiceID(0, VOICE_ID_CHANNEL_MODE);
|
||||||
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
AUDIO_SetDigitVoice(1, gEeprom.CHAN_1_CALL + 1);
|
||||||
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
gAnotherVoiceID = (VOICE_ID_t)0xFE;
|
||||||
#endif
|
#endif
|
||||||
gRequestSaveVFO = true;
|
gRequestSaveVFO = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
break;
|
break;
|
||||||
@@ -254,45 +284,36 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
{ // key held down
|
{ // key held down
|
||||||
|
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
if (bKeyPressed)
|
||||||
if (bKeyPressed)
|
{
|
||||||
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gInputBoxIndex > 0)
|
||||||
{
|
{ // delete any inputted chars
|
||||||
if (gInputBoxIndex > 0)
|
gInputBoxIndex = 0;
|
||||||
{ // delete any inputted chars
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
processFKeyFunction(Key, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
processFKeyFunction(Key, false);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MAIN_KEY_HOLD
|
if (bKeyPressed)
|
||||||
if (bKeyPressed)
|
{ // key is pressed
|
||||||
{ // key is pressed
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; // beep when key is pressed
|
return; // don't use the key till it's released
|
||||||
return; // don't use the key till it's released
|
}
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (!bKeyPressed)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!gWasFKeyPressed)
|
if (!gWasFKeyPressed)
|
||||||
{ // F-key wasn't pressed
|
{ // F-key wasn't pressed
|
||||||
|
|
||||||
const uint8_t Vfo = gEeprom.TX_CHANNEL;
|
const uint8_t Vfo = gEeprom.TX_VFO;
|
||||||
|
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
@@ -302,7 +323,7 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering channel number
|
{ // user is entering channel number
|
||||||
|
|
||||||
uint16_t Channel;
|
uint16_t Channel;
|
||||||
|
|
||||||
if (gInputBoxIndex != 3)
|
if (gInputBoxIndex != 3)
|
||||||
@@ -337,14 +358,14 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// #ifdef ENABLE_NOAA
|
// #ifdef ENABLE_NOAA
|
||||||
// if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
// if (!IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
// #endif
|
// #endif
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering frequency
|
{ // user is entering a frequency
|
||||||
|
|
||||||
uint32_t Frequency;
|
|
||||||
|
|
||||||
if (gInputBoxIndex < 6)
|
uint32_t Frequency;
|
||||||
|
bool isGigaF = gTxVfo->pRX->Frequency >= 100000000;
|
||||||
|
if (gInputBoxIndex < 6 + isGigaF)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
@@ -354,26 +375,25 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
Frequency = StrToUL(INPUTBOX_GetAscii()) * 100;
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
|
||||||
|
|
||||||
// clamp the frequency entered to some valid value
|
// clamp the frequency entered to some valid value
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
if (Frequency < frequencyBandTable[0].lower)
|
||||||
{
|
{
|
||||||
Frequency = LowerLimitFrequencyBandTable[0];
|
Frequency = frequencyBandTable[0].lower;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
{
|
{
|
||||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||||
Frequency = (Frequency < center) ? bx_stop1_Hz : bx_start2_Hz;
|
Frequency = (Frequency < center) ? BX4819_band1.upper : BX4819_band2.lower;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (Frequency > UpperLimitFrequencyBandTable[6])
|
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
{
|
{
|
||||||
Frequency = UpperLimitFrequencyBandTable[6];
|
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
const FREQUENCY_Band_t band = FREQUENCY_GetBand(Frequency);
|
||||||
|
|
||||||
@@ -386,35 +406,32 @@ static void MAIN_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gTxVfo->Band = band;
|
gTxVfo->Band = band;
|
||||||
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
gEeprom.ScreenChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||||
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
gEeprom.FreqChannel[Vfo] = band + FREQ_CHANNEL_FIRST;
|
||||||
|
|
||||||
SETTINGS_SaveVfoIndices();
|
SETTINGS_SaveVfoIndices();
|
||||||
|
|
||||||
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(Vfo, VFO_CONFIGURE_RELOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frequency += 75; // is this meant to be rounding ?
|
Frequency = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
|
||||||
Frequency += gTxVfo->StepFrequency / 2; // no idea, but this is
|
|
||||||
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
Frequency = FREQUENCY_FloorToStep(Frequency, gTxVfo->StepFrequency, LowerLimitFrequencyBandTable[gTxVfo->Band]);
|
|
||||||
|
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
|
||||||
{ // clamp the frequency to the limit
|
{ // clamp the frequency to the limit
|
||||||
const uint32_t center = (bx_stop1_Hz + bx_start2_Hz) / 2;
|
const uint32_t center = (BX4819_band1.upper + BX4819_band2.lower) / 2;
|
||||||
Frequency = (Frequency < center) ? bx_stop1_Hz - gTxVfo->StepFrequency : bx_start2_Hz;
|
Frequency = (Frequency < center) ? BX4819_band1.upper - gTxVfo->StepFrequency : BX4819_band2.lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->freq_config_RX.Frequency = Frequency;
|
gTxVfo->freq_config_RX.Frequency = Frequency;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{ // user is entering NOAA channel
|
{ // user is entering NOAA channel
|
||||||
|
|
||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
if (gInputBoxIndex != 2)
|
if (gInputBoxIndex != 2)
|
||||||
@@ -473,7 +490,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (!gFmRadioMode)
|
if (!gFmRadioMode)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
return;
|
return;
|
||||||
@@ -488,6 +505,7 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gScanKeepResult = false;
|
||||||
SCANNER_Stop();
|
SCANNER_Stop();
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -509,10 +527,10 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (bKeyHeld && bKeyPressed)
|
if (bKeyHeld && bKeyPressed)
|
||||||
{ // exit key held down
|
{ // exit key held down
|
||||||
|
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0 || gDTMF_InputBox_Index > 0 || gDTMF_InputMode)
|
||||||
{ // cancel key input mode (channel/frequency entry)
|
{ // cancel key input mode (channel/frequency entry)
|
||||||
gDTMF_InputMode = false;
|
gDTMF_InputMode = false;
|
||||||
gDTMF_InputIndex = 0;
|
gDTMF_InputBox_Index = 0;
|
||||||
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
memset(gDTMF_String, 0, sizeof(gDTMF_String));
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
@@ -523,11 +541,18 @@ static void MAIN_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
||||||
{
|
{
|
||||||
|
if (bKeyPressed && !bKeyHeld)
|
||||||
|
// menu key pressed
|
||||||
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (bKeyHeld)
|
if (bKeyHeld)
|
||||||
{ // menu key held down (long press)
|
{ // menu key held down (long press)
|
||||||
|
|
||||||
if (bKeyPressed)
|
if (bKeyPressed)
|
||||||
{
|
{ // long press MENU key
|
||||||
|
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MAIN)
|
if (gScreenToDisplay == DISPLAY_MAIN)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex > 0)
|
if (gInputBoxIndex > 0)
|
||||||
@@ -539,54 +564,7 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
|
ACTION_Handle(KEY_MENU, bKeyPressed, bKeyHeld);
|
||||||
|
|
||||||
// TODO: long press M-key
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_COPY_CHAN_TO_VFO
|
|
||||||
{ // copy channel to VFO
|
|
||||||
int channel = -1;
|
|
||||||
int vfo = -1;
|
|
||||||
//int selected = -1;
|
|
||||||
|
|
||||||
if (IS_FREQ_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
|
||||||
{ // VFO mode
|
|
||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
{ // other VFO is in channel mode
|
|
||||||
channel = gTxVfo->CHANNEL_SAVE;
|
|
||||||
vfo = gRxVfo->CHANNEL_SAVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (IS_FREQ_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
|
||||||
{ // VFO mode
|
|
||||||
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
|
||||||
{ // other VFO is in channel mode
|
|
||||||
channel = gRxVfo->CHANNEL_SAVE;
|
|
||||||
vfo = gTxVfo->CHANNEL_SAVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channel >= 0 && vfo >= 0)
|
|
||||||
{ // copy the channel into the VFO
|
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: finish this
|
|
||||||
|
|
||||||
//gEeprom.RX_CHANNEL = () & 1; // swap to the VFO
|
|
||||||
|
|
||||||
|
|
||||||
// gRequestSaveVFO = true;
|
|
||||||
// gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
|
||||||
// gRequestDisplayScreen = DISPLAY_MAIN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,11 +576,14 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
const bool bFlag = (gInputBoxIndex == 0);
|
const bool bFlag = (gInputBoxIndex == 0);
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
|
|
||||||
if (bFlag)
|
if (bFlag)
|
||||||
{
|
{
|
||||||
gFlagRefreshSetting = true;
|
if (gScanStateDir != SCAN_OFF) {
|
||||||
|
SCANNER_Stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gFlagRefreshSetting = true;
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_MENU;
|
gAnotherVoiceID = VOICE_ID_MENU;
|
||||||
@@ -617,6 +598,9 @@ static void MAIN_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
return;
|
||||||
|
|
||||||
if (gInputBoxIndex)
|
if (gInputBoxIndex)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
@@ -624,72 +608,72 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld && !gWasFKeyPressed) // long press
|
||||||
{
|
{
|
||||||
if (bKeyHeld || bKeyPressed)
|
if (!bKeyPressed) // released
|
||||||
{
|
return;
|
||||||
if (!bKeyHeld)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!bKeyPressed)
|
ACTION_Scan(false);// toggle scanning
|
||||||
return;
|
|
||||||
|
|
||||||
ACTION_Scan(false);
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bKeyPressed) // just pressed
|
||||||
|
{
|
||||||
|
// gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
gBeepToPlay = BEEP_880HZ_40MS_OPTIONAL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// just released
|
||||||
|
|
||||||
|
if (!gWasFKeyPressed) // pressed without the F-key
|
||||||
|
{
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (gScanState == SCAN_OFF && IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (gScanStateDir == SCAN_OFF && !IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
#else
|
#else
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{ // start entering a DTMF string
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
|
||||||
|
memmove(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
|
||||||
|
gDTMF_InputBox_Index = 0;
|
||||||
gDTMF_InputMode = true;
|
gDTMF_InputMode = true;
|
||||||
memmove(gDTMF_InputBox, gDTMF_String, sizeof(gDTMF_InputBox));
|
|
||||||
gDTMF_InputIndex = 0;
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // with the F-key
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
if (!gWasFKeyPressed)
|
|
||||||
{
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
gWasFKeyPressed = false;
|
gWasFKeyPressed = false;
|
||||||
gUpdateStatus = true;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
|
||||||
gFlagStartScan = true;
|
|
||||||
gScanSingleFrequency = true;
|
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
}
|
return;
|
||||||
#else
|
}
|
||||||
gFlagStartScan = true;
|
|
||||||
gScanSingleFrequency = true;
|
|
||||||
gBackupCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gPttWasReleased = true;
|
// scan the CTCSS/DCS code
|
||||||
|
gFlagStartScan = true;
|
||||||
|
gScanSingleFrequency = true;
|
||||||
|
gBackup_CROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gPttWasReleased = true;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
||||||
{
|
{
|
||||||
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
uint8_t Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
|
|
||||||
if (bKeyHeld || !bKeyPressed)
|
if (bKeyHeld || !bKeyPressed)
|
||||||
{
|
{
|
||||||
@@ -723,10 +707,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF)
|
if (gScanStateDir == SCAN_OFF)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
if (!IS_NOAA_CHANNEL(Channel))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uint8_t Next;
|
uint8_t Next;
|
||||||
@@ -735,14 +719,14 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
{ // step/down in frequency
|
{ // step/down in frequency
|
||||||
const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction);
|
const uint32_t frequency = APP_SetFrequencyByStep(gTxVfo, Direction);
|
||||||
|
|
||||||
if (RX_FREQUENCY_Check(frequency) < 0)
|
if (RX_freq_check(frequency) < 0)
|
||||||
{ // frequency not allowed
|
{ // frequency not allowed
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->freq_config_RX.Frequency = frequency;
|
gTxVfo->freq_config_RX.Frequency = frequency;
|
||||||
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -754,8 +738,8 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
if (Channel == Next)
|
if (Channel == Next)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Next;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = Next;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Next;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Next;
|
||||||
|
|
||||||
if (!bKeyHeld)
|
if (!bKeyHeld)
|
||||||
{
|
{
|
||||||
@@ -768,9 +752,9 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
Channel = NOAA_CHANNEL_FIRST + NUMBER_AddWithWraparound(gEeprom.ScreenChannel[gEeprom.TX_VFO] - NOAA_CHANNEL_FIRST, Direction, 0, 9);
|
||||||
gEeprom.NoaaChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.NoaaChannel[gEeprom.TX_VFO] = Channel;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -779,7 +763,10 @@ static void MAIN_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHANNEL_Next(false, Direction);
|
// jump to the next channel
|
||||||
|
SCANNER_ScanChannels(false, Direction);
|
||||||
|
gScanPauseDelayIn_10ms = 1;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
|
||||||
gPttWasReleased = true;
|
gPttWasReleased = true;
|
||||||
}
|
}
|
||||||
@@ -795,29 +782,25 @@ void MAIN_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_InputMode && bKeyPressed)
|
if (gDTMF_InputMode && bKeyPressed && !bKeyHeld)
|
||||||
{
|
{
|
||||||
if (!bKeyHeld)
|
const char Character = DTMF_GetCharacter(Key);
|
||||||
{
|
if (Character != 0xFF)
|
||||||
const char Character = DTMF_GetCharacter(Key);
|
{ // add key to DTMF string
|
||||||
if (Character != 0xFF)
|
DTMF_Append(Character);
|
||||||
{ // add key to DTMF string
|
gKeyInputCountdown = key_input_timeout_500ms;
|
||||||
DTMF_Append(Character);
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
gPttWasReleased = true;
|
||||||
gKeyInputCountdown = key_input_timeout_500ms;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
return;
|
||||||
gPttWasReleased = true;
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: ???
|
// TODO: ???
|
||||||
if (Key > KEY_PTT)
|
// if (Key > KEY_PTT)
|
||||||
{
|
// {
|
||||||
Key = KEY_SIDE2;
|
// Key = KEY_SIDE2; // what's this doing ???
|
||||||
}
|
// }
|
||||||
|
|
||||||
switch (Key)
|
switch (Key)
|
||||||
{
|
{
|
||||||
|
|||||||
497
app/menu.c
@@ -47,6 +47,34 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
void writeXtalFreqCal(const int32_t value, const bool update_eeprom)
|
||||||
|
{
|
||||||
|
BK4819_WriteRegister(BK4819_REG_3B, 22656 + value);
|
||||||
|
|
||||||
|
if (update_eeprom)
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int16_t BK4819_XtalFreqLow;
|
||||||
|
uint16_t EEPROM_1F8A;
|
||||||
|
uint16_t EEPROM_1F8C;
|
||||||
|
uint8_t VOLUME_GAIN;
|
||||||
|
uint8_t DAC_GAIN;
|
||||||
|
} __attribute__((packed)) misc;
|
||||||
|
|
||||||
|
gEeprom.BK4819_XTAL_FREQ_LOW = value;
|
||||||
|
|
||||||
|
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
||||||
|
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
||||||
|
//
|
||||||
|
EEPROM_ReadBuffer(0x1F88, &misc, 8);
|
||||||
|
misc.BK4819_XtalFreqLow = value;
|
||||||
|
EEPROM_WriteBuffer(0x1F88, &misc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void MENU_StartCssScan(int8_t Direction)
|
void MENU_StartCssScan(int8_t Direction)
|
||||||
{
|
{
|
||||||
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
gCssScanMode = CSS_SCAN_MODE_SCANNING;
|
||||||
@@ -58,8 +86,8 @@ void MENU_StartCssScan(int8_t Direction)
|
|||||||
|
|
||||||
MENU_SelectNextCode();
|
MENU_SelectNextCode();
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||||
gScheduleScanListen = false;
|
gScheduleScanListen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MENU_StopCssScan(void)
|
void MENU_StopCssScan(void)
|
||||||
@@ -70,9 +98,9 @@ void MENU_StopCssScan(void)
|
|||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax)
|
||||||
{
|
{
|
||||||
switch (Cursor)
|
switch (menu_id)
|
||||||
{
|
{
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
@@ -89,6 +117,16 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MIN:
|
||||||
|
*pMin = 0;
|
||||||
|
*pMax = 9;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MAX:
|
||||||
|
*pMin = 1;
|
||||||
|
*pMax = 10;
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_F_LOCK:
|
case MENU_F_LOCK:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_F_LOCK) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_F_LOCK) - 1;
|
||||||
@@ -111,12 +149,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_CHAN) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RXMode) - 1;
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_XB:
|
|
||||||
*pMin = 0;
|
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_XB) - 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -171,12 +204,11 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RESET) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_Compand) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_RX_TX) - 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
@@ -224,7 +256,9 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_TOT) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
|
case MENU_VOX:
|
||||||
|
#endif
|
||||||
case MENU_RP_STE:
|
case MENU_RP_STE:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = 10;
|
*pMax = 10;
|
||||||
@@ -255,7 +289,7 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
*pMin = 1;
|
*pMin = 0;
|
||||||
*pMax = 2;
|
*pMax = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -269,11 +303,6 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_PTT_ID) - 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
*pMin = 0;
|
|
||||||
*pMax = 2300;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
*pMin = 0;
|
*pMin = 0;
|
||||||
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
*pMax = ARRAY_SIZE(gSubMenu_BAT_TXT) - 1;
|
||||||
@@ -294,9 +323,25 @@ int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax)
|
|||||||
*pMax = 16;
|
*pMax = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
*pMin = -50;
|
case MENU_F_CALI:
|
||||||
*pMax = +50;
|
*pMin = -50;
|
||||||
|
*pMax = +50;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case MENU_BATCAL:
|
||||||
|
*pMin = 1600; // 0
|
||||||
|
*pMax = 2200; // 2300
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_F1SHRT:
|
||||||
|
case MENU_F1LONG:
|
||||||
|
case MENU_F2SHRT:
|
||||||
|
case MENU_F2LONG:
|
||||||
|
case MENU_MLONG:
|
||||||
|
*pMin = 0;
|
||||||
|
*pMax = gSubMenu_SIDEFUNCTIONS_size-1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -313,14 +358,14 @@ void MENU_AcceptSetting(void)
|
|||||||
uint8_t Code;
|
uint8_t Code;
|
||||||
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
FREQ_Config_t *pConfig = &gTxVfo->freq_config_RX;
|
||||||
|
|
||||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||||
{
|
{
|
||||||
if (gSubMenuSelection < Min) gSubMenuSelection = Min;
|
if (gSubMenuSelection < Min) gSubMenuSelection = Min;
|
||||||
else
|
else
|
||||||
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
|
if (gSubMenuSelection > Max) gSubMenuSelection = Max;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (gMenuCursor)
|
switch (GetCurrentMenuId())
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
@@ -378,9 +423,7 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_T_CTCS:
|
case MENU_T_CTCS:
|
||||||
pConfig = &gTxVfo->freq_config_TX;
|
pConfig = &gTxVfo->freq_config_TX;
|
||||||
|
[[fallthrough]];
|
||||||
// Fallthrough
|
|
||||||
|
|
||||||
case MENU_R_CTCS:
|
case MENU_R_CTCS:
|
||||||
if (gSubMenuSelection == 0)
|
if (gSubMenuSelection == 0)
|
||||||
{
|
{
|
||||||
@@ -390,14 +433,20 @@ void MENU_AcceptSetting(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Code = 0;
|
Code = 0;
|
||||||
|
pConfig->Code = Code;
|
||||||
pConfig->CodeType = CODE_TYPE_OFF;
|
pConfig->CodeType = CODE_TYPE_OFF;
|
||||||
|
|
||||||
|
BK4819_ExitSubAu();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||||
Code = gSubMenuSelection - 1;
|
Code = gSubMenuSelection - 1;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||||
}
|
}
|
||||||
pConfig->Code = Code;
|
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -418,6 +467,12 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
gTxVfo->SCRAMBLING_TYPE = gSubMenuSelection;
|
||||||
|
#if 0
|
||||||
|
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||||
|
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||||
|
else
|
||||||
|
BK4819_DisableScramble();
|
||||||
|
#endif
|
||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -431,7 +486,7 @@ void MENU_AcceptSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gEeprom.MrChannel[0] = gSubMenuSelection;
|
gEeprom.MrChannel[0] = gSubMenuSelection;
|
||||||
#else
|
#else
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = gSubMenuSelection;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = gSubMenuSelection;
|
||||||
#endif
|
#endif
|
||||||
gRequestSaveChannel = 2;
|
gRequestSaveChannel = 2;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
@@ -451,7 +506,7 @@ void MENU_AcceptSetting(void)
|
|||||||
// save the channel name
|
// save the channel name
|
||||||
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
memset(gTxVfo->Name, 0, sizeof(gTxVfo->Name));
|
||||||
memmove(gTxVfo->Name, edit, 10);
|
memmove(gTxVfo->Name, edit, 10);
|
||||||
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_CHANNEL, gTxVfo, 3);
|
SETTINGS_SaveChannel(gSubMenuSelection, gEeprom.TX_VFO, gTxVfo, 3);
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -459,38 +514,43 @@ void MENU_AcceptSetting(void)
|
|||||||
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
gEeprom.BATTERY_SAVE = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
case MENU_VOX:
|
||||||
if (gEeprom.VOX_SWITCH)
|
gEeprom.VOX_SWITCH = gSubMenuSelection != 0;
|
||||||
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
if (gEeprom.VOX_SWITCH)
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
gEeprom.VOX_LEVEL = gSubMenuSelection - 1;
|
||||||
gFlagReconfigureVfos = true;
|
BOARD_EEPROM_LoadCalibration();
|
||||||
gUpdateStatus = true;
|
gFlagReconfigureVfos = true;
|
||||||
break;
|
gUpdateStatus = true;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gEeprom.BACKLIGHT = gSubMenuSelection;
|
gEeprom.BACKLIGHT_TIME = gSubMenuSelection;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MIN:
|
||||||
|
gEeprom.BACKLIGHT_MIN = gSubMenuSelection;
|
||||||
|
gEeprom.BACKLIGHT_MAX = MAX(gSubMenuSelection + 1 , gEeprom.BACKLIGHT_MAX);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MAX:
|
||||||
|
gEeprom.BACKLIGHT_MAX = gSubMenuSelection;
|
||||||
|
gEeprom.BACKLIGHT_MIN = MIN(gSubMenuSelection - 1, gEeprom.BACKLIGHT_MIN);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_ON_TX_RX:
|
||||||
|
gSetting_backlight_on_tx_rx = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
gEeprom.DUAL_WATCH = gSubMenuSelection;
|
gEeprom.DUAL_WATCH = (gEeprom.TX_VFO + 1) * (gSubMenuSelection & 1);
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = (gEeprom.TX_VFO + 1) * ((gSubMenuSelection & 2) > 0);
|
||||||
|
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_XB:
|
|
||||||
#ifdef ENABLE_NOAA
|
|
||||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
|
||||||
return;
|
|
||||||
if (IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = gSubMenuSelection;
|
|
||||||
gFlagReconfigureVfos = true;
|
|
||||||
gUpdateStatus = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
gEeprom.BEEP_CONTROL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -543,7 +603,7 @@ void MENU_AcceptSetting(void)
|
|||||||
|
|
||||||
case MENU_MIC:
|
case MENU_MIC:
|
||||||
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
gEeprom.MIC_SENSITIVITY = gSubMenuSelection;
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
BOARD_EEPROM_LoadCalibration();
|
||||||
gFlagReconfigureVfos = true;
|
gFlagReconfigureVfos = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -552,20 +612,21 @@ void MENU_AcceptSetting(void)
|
|||||||
gSetting_mic_bar = gSubMenuSelection;
|
gSetting_mic_bar = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gTxVfo->Compander = gSubMenuSelection;
|
||||||
gTxVfo->Compander = gSubMenuSelection;
|
SETTINGS_UpdateChannel(gTxVfo->CHANNEL_SAVE, gTxVfo, true);
|
||||||
gRequestSaveChannel = 1;
|
gVfoConfigureMode = VFO_CONFIGURE;
|
||||||
return;
|
gFlagResetVfos = true;
|
||||||
#endif
|
// gRequestSaveChannel = 1;
|
||||||
|
return;
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
gEeprom.CHAN_1_CALL = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection - 1;
|
gEeprom.SCAN_LIST_DEFAULT = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -583,7 +644,7 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = gSubMenuSelection;
|
gEeprom.DTMF_auto_reset_time = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -595,12 +656,6 @@ void MENU_AcceptSetting(void)
|
|||||||
gRequestSaveChannel = 1;
|
gRequestSaveChannel = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
if(gF_LOCK) {
|
|
||||||
EEPROM_WriteBuffer(0x1F40, gBatteryCalibration);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSetting_battery_text = gSubMenuSelection;
|
gSetting_battery_text = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
@@ -622,12 +677,12 @@ void MENU_AcceptSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gDTMFChosenContact = gSubMenuSelection - 1;
|
gDTMF_chosen_contact = gSubMenuSelection - 1;
|
||||||
if (gIsDtmfContactValid)
|
if (gIsDtmfContactValid)
|
||||||
{
|
{
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
gDTMF_InputMode = true;
|
gDTMF_InputMode = true;
|
||||||
gDTMF_InputIndex = 3;
|
gDTMF_InputBox_Index = 3;
|
||||||
memmove(gDTMF_InputBox, gDTMF_ID, 4);
|
memmove(gDTMF_InputBox, gDTMF_ID, 4);
|
||||||
gRequestDisplayScreen = DISPLAY_INVALID;
|
gRequestDisplayScreen = DISPLAY_INVALID;
|
||||||
}
|
}
|
||||||
@@ -710,26 +765,40 @@ void MENU_AcceptSetting(void)
|
|||||||
gSetting_TX_EN = gSubMenuSelection;
|
gSetting_TX_EN = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection;
|
case MENU_F_CALI:
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, 22656 + gEeprom.BK4819_XTAL_FREQ_LOW);
|
writeXtalFreqCal(gSubMenuSelection, true);
|
||||||
{
|
return;
|
||||||
struct
|
#endif
|
||||||
{
|
|
||||||
int16_t BK4819_XtalFreqLow;
|
|
||||||
uint16_t EEPROM_1F8A;
|
|
||||||
uint16_t EEPROM_1F8C;
|
|
||||||
uint8_t VOLUME_GAIN;
|
|
||||||
uint8_t DAC_GAIN;
|
|
||||||
} __attribute__((packed)) Misc;
|
|
||||||
|
|
||||||
// radio 1 .. 04 00 46 00 50 00 2C 0E
|
case MENU_BATCAL:
|
||||||
// radio 2 .. 05 00 46 00 50 00 2C 0E
|
{
|
||||||
EEPROM_ReadBuffer(0x1F88, &Misc, 8);
|
gBatteryCalibration[0] = (520ul * gSubMenuSelection) / 760; // 5.20V empty, blinking above this value, reduced functionality below
|
||||||
Misc.BK4819_XtalFreqLow = gEeprom.BK4819_XTAL_FREQ_LOW;
|
gBatteryCalibration[1] = (700ul * gSubMenuSelection) / 760; // 7.00V, ~5%, 1 bars above this value
|
||||||
EEPROM_WriteBuffer(0x1F88, &Misc);
|
gBatteryCalibration[2] = (745ul * gSubMenuSelection) / 760; // 7.45V, ~17%, 2 bars above this value
|
||||||
}
|
gBatteryCalibration[3] = gSubMenuSelection; // 7.6V, ~29%, 3 bars above this value
|
||||||
|
gBatteryCalibration[4] = (788ul * gSubMenuSelection) / 760; // 7.88V, ~65%, 4 bars above this value
|
||||||
|
gBatteryCalibration[5] = 2300;
|
||||||
|
SETTINGS_SaveBatteryCalibration(gBatteryCalibration);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MENU_F1SHRT:
|
||||||
|
case MENU_F1LONG:
|
||||||
|
case MENU_F2SHRT:
|
||||||
|
case MENU_F2LONG:
|
||||||
|
case MENU_MLONG:
|
||||||
|
{
|
||||||
|
uint8_t * fun[]= {
|
||||||
|
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||||
|
*fun[GetCurrentMenuId()-MENU_F1SHRT] = gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gRequestSaveSettings = true;
|
gRequestSaveSettings = true;
|
||||||
@@ -739,18 +808,17 @@ void MENU_SelectNextCode(void)
|
|||||||
{
|
{
|
||||||
int32_t UpperLimit;
|
int32_t UpperLimit;
|
||||||
|
|
||||||
if (gMenuCursor == MENU_R_DCS)
|
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||||
UpperLimit = 208;
|
UpperLimit = 208;
|
||||||
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
//UpperLimit = ARRAY_SIZE(DCS_Options);
|
||||||
else
|
else if (GetCurrentMenuId() == MENU_R_CTCS)
|
||||||
if (gMenuCursor == MENU_R_CTCS)
|
|
||||||
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
UpperLimit = ARRAY_SIZE(CTCSS_Options) - 1;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
|
gSubMenuSelection = NUMBER_AddWithWraparound(gSubMenuSelection, gMenuScrollDirection, 1, UpperLimit);
|
||||||
|
|
||||||
if (gMenuCursor == MENU_R_DCS)
|
if (GetCurrentMenuId() == MENU_R_DCS)
|
||||||
{
|
{
|
||||||
if (gSubMenuSelection > 104)
|
if (gSubMenuSelection > 104)
|
||||||
{
|
{
|
||||||
@@ -772,7 +840,7 @@ void MENU_SelectNextCode(void)
|
|||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
ScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
gScanPauseDelayIn_10ms = (gSelectedCodeType == CODE_TYPE_CONTINUOUS_TONE) ? scan_pause_delay_in_3_10ms : scan_pause_delay_in_4_10ms;
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
@@ -782,7 +850,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
|||||||
int32_t Min;
|
int32_t Min;
|
||||||
int32_t Max;
|
int32_t Max;
|
||||||
|
|
||||||
if (!MENU_GetLimits(gMenuCursor, &Min, &Max))
|
if (!MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||||
{
|
{
|
||||||
int32_t Selection = gSubMenuSelection;
|
int32_t Selection = gSubMenuSelection;
|
||||||
if (Selection < Min) Selection = Min;
|
if (Selection < Min) Selection = Min;
|
||||||
@@ -794,7 +862,7 @@ static void MENU_ClampSelection(int8_t Direction)
|
|||||||
|
|
||||||
void MENU_ShowCurrentSetting(void)
|
void MENU_ShowCurrentSetting(void)
|
||||||
{
|
{
|
||||||
switch (gMenuCursor)
|
switch (GetCurrentMenuId())
|
||||||
{
|
{
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
gSubMenuSelection = gEeprom.SQUELCH_LEVEL;
|
||||||
@@ -874,35 +942,42 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = gEeprom.MrChannel[0];
|
gSubMenuSelection = gEeprom.MrChannel[0];
|
||||||
#else
|
#else
|
||||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_MEM_NAME:
|
case MENU_MEM_NAME:
|
||||||
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_CHANNEL];
|
gSubMenuSelection = gEeprom.MrChannel[gEeprom.TX_VFO];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SAVE:
|
case MENU_SAVE:
|
||||||
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
gSubMenuSelection = gEeprom.BATTERY_SAVE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
case MENU_VOX:
|
case MENU_VOX:
|
||||||
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
gSubMenuSelection = gEeprom.VOX_SWITCH ? gEeprom.VOX_LEVEL + 1 : 0;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
gSubMenuSelection = gEeprom.BACKLIGHT;
|
gSubMenuSelection = gEeprom.BACKLIGHT_TIME;
|
||||||
|
break;
|
||||||
|
|
||||||
gBacklightCountdown = 0;
|
case MENU_ABR_MIN:
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON while in backlight menu
|
gSubMenuSelection = gEeprom.BACKLIGHT_MIN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MAX:
|
||||||
|
gSubMenuSelection = gEeprom.BACKLIGHT_MAX;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_ON_TX_RX:
|
||||||
|
gSubMenuSelection = gSetting_backlight_on_tx_rx;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
gSubMenuSelection = gEeprom.DUAL_WATCH;
|
gSubMenuSelection = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_XB:
|
|
||||||
gSubMenuSelection = gEeprom.CROSS_BAND_RX_TX;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_BEEP:
|
case MENU_BEEP:
|
||||||
@@ -913,11 +988,11 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
gSubMenuSelection = gEeprom.TX_TIMEOUT_TIMER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
case MENU_VOICE:
|
case MENU_VOICE:
|
||||||
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
gSubMenuSelection = gEeprom.VOICE_PROMPT;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MENU_SC_REV:
|
case MENU_SC_REV:
|
||||||
gSubMenuSelection = gEeprom.SCAN_RESUME_MODE;
|
gSubMenuSelection = gEeprom.SCAN_RESUME_MODE;
|
||||||
@@ -951,24 +1026,22 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gEeprom.MIC_SENSITIVITY;
|
gSubMenuSelection = gEeprom.MIC_SENSITIVITY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
case MENU_MIC_BAR:
|
case MENU_MIC_BAR:
|
||||||
gSubMenuSelection = gSetting_mic_bar;
|
gSubMenuSelection = gSetting_mic_bar;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
gSubMenuSelection = gTxVfo->Compander;
|
||||||
gSubMenuSelection = gTxVfo->Compander;
|
return;
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
gSubMenuSelection = gEeprom.CHAN_1_CALL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT + 1;
|
gSubMenuSelection = gEeprom.SCAN_LIST_DEFAULT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_SLIST1:
|
case MENU_SLIST1:
|
||||||
@@ -994,7 +1067,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_HOLD:
|
case MENU_D_HOLD:
|
||||||
gSubMenuSelection = gEeprom.DTMF_AUTO_RESET_TIME;
|
gSubMenuSelection = gEeprom.DTMF_auto_reset_time;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_PRE:
|
case MENU_D_PRE:
|
||||||
@@ -1005,10 +1078,6 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
gSubMenuSelection = gTxVfo->DTMF_PTT_ID_TX_MODE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
|
||||||
gSubMenuSelection = gBatteryCalibration[3];
|
|
||||||
return;
|
|
||||||
|
|
||||||
case MENU_BAT_TXT:
|
case MENU_BAT_TXT:
|
||||||
gSubMenuSelection = gSetting_battery_text;
|
gSubMenuSelection = gSetting_battery_text;
|
||||||
return;
|
return;
|
||||||
@@ -1018,7 +1087,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIST:
|
case MENU_D_LIST:
|
||||||
gSubMenuSelection = gDTMFChosenContact + 1;
|
gSubMenuSelection = gDTMF_chosen_contact + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_D_LIVE_DEC:
|
case MENU_D_LIVE_DEC:
|
||||||
@@ -1037,12 +1106,12 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gTxVfo->AM_mode;
|
gSubMenuSelection = gTxVfo->AM_mode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
case MENU_AM_FIX:
|
case MENU_AM_FIX:
|
||||||
gSubMenuSelection = gSetting_AM_fix;
|
gSubMenuSelection = gSetting_AM_fix;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
gSubMenuSelection = gSetting_AM_fix_test1;
|
gSubMenuSelection = gSetting_AM_fix_test1;
|
||||||
@@ -1059,7 +1128,7 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
#if 0
|
#if 0
|
||||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[0], 1, false, 1);
|
||||||
#else
|
#else
|
||||||
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_CHANNEL], 1, false, 1);
|
gSubMenuSelection = RADIO_FindNextChannel(gEeprom.MrChannel[gEeprom.TX_VFO], 1, false, 1);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1091,9 +1160,42 @@ void MENU_ShowCurrentSetting(void)
|
|||||||
gSubMenuSelection = gSetting_TX_EN;
|
gSubMenuSelection = gSetting_TX_EN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
case MENU_F_CALI:
|
||||||
|
gSubMenuSelection = gEeprom.BK4819_XTAL_FREQ_LOW;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case MENU_BATCAL:
|
||||||
|
gSubMenuSelection = gBatteryCalibration[3];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_F1SHRT:
|
||||||
|
case MENU_F1LONG:
|
||||||
|
case MENU_F2SHRT:
|
||||||
|
case MENU_F2LONG:
|
||||||
|
case MENU_MLONG:
|
||||||
|
{
|
||||||
|
uint8_t * fun[]= {
|
||||||
|
&gEeprom.KEY_1_SHORT_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_1_LONG_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_2_SHORT_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_2_LONG_PRESS_ACTION,
|
||||||
|
&gEeprom.KEY_M_LONG_PRESS_ACTION};
|
||||||
|
uint8_t id = *fun[GetCurrentMenuId()-MENU_F1SHRT];
|
||||||
|
|
||||||
|
for(int i = 0; i < gSubMenu_SIDEFUNCTIONS_size; i++) {
|
||||||
|
if(gSubMenu_SIDEFUNCTIONS[i].id==id) {
|
||||||
|
gSubMenuSelection = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1109,12 +1211,12 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||||
{ // currently editing the channel name
|
{ // currently editing the channel name
|
||||||
|
|
||||||
if (edit_index < 10)
|
if (edit_index < 10)
|
||||||
{
|
{
|
||||||
if (Key >= KEY_0 && Key <= KEY_9)
|
if (Key <= KEY_9)
|
||||||
{
|
{
|
||||||
edit[edit_index] = '0' + Key - KEY_0;
|
edit[edit_index] = '0' + Key - KEY_0;
|
||||||
|
|
||||||
@@ -1143,7 +1245,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
|
||||||
Value = (gInputBox[0] * 10) + gInputBox[1];
|
Value = (gInputBox[0] * 10) + gInputBox[1];
|
||||||
|
|
||||||
if (Value > 0 && Value <= gMenuListCount)
|
if (Value > 0 && Value <= gMenuListCount)
|
||||||
{
|
{
|
||||||
gMenuCursor = Value - 1;
|
gMenuCursor = Value - 1;
|
||||||
@@ -1156,7 +1258,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
|
|
||||||
gInputBox[0] = gInputBox[1];
|
gInputBox[0] = gInputBox[1];
|
||||||
gInputBoxIndex = 1;
|
gInputBoxIndex = 1;
|
||||||
|
[[fallthrough]];
|
||||||
case 1:
|
case 1:
|
||||||
Value = gInputBox[0];
|
Value = gInputBox[0];
|
||||||
if (Value > 0 && Value <= gMenuListCount)
|
if (Value > 0 && Value <= gMenuListCount)
|
||||||
@@ -1174,7 +1276,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_OFFSET)
|
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||||
{
|
{
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
@@ -1189,15 +1291,18 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = (VOICE_ID_t)Key;
|
gAnotherVoiceID = (VOICE_ID_t)Key;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NUMBER_Get(gInputBox, &Frequency);
|
Frequency = StrToUL(INPUTBOX_GetAscii())*100;
|
||||||
gSubMenuSelection = FREQUENCY_FloorToStep(Frequency + 75, gTxVfo->StepFrequency, 0);
|
gSubMenuSelection = FREQUENCY_RoundToStep(Frequency, gTxVfo->StepFrequency);
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_CH || gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_1_CALL || gMenuCursor == MENU_MEM_NAME)
|
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||||
|
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||||
|
GetCurrentMenuId() == MENU_1_CALL ||
|
||||||
|
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||||
{ // enter 3-digit channel number
|
{ // enter 3-digit channel number
|
||||||
|
|
||||||
if (gInputBoxIndex < 3)
|
if (gInputBoxIndex < 3)
|
||||||
@@ -1226,7 +1331,7 @@ static void MENU_Key_0_to_9(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MENU_GetLimits(gMenuCursor, &Min, &Max))
|
if (MENU_GetLimits(GetCurrentMenuId(), &Min, &Max))
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL;
|
||||||
@@ -1271,7 +1376,7 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
if (gIsInSubMenu)
|
if (gIsInSubMenu)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0 || gMenuCursor != MENU_OFFSET)
|
if (gInputBoxIndex == 0 || GetCurrentMenuId() != MENU_OFFSET)
|
||||||
{
|
{
|
||||||
gAskForConfirmation = 0;
|
gAskForConfirmation = 0;
|
||||||
gIsInSubMenu = false;
|
gIsInSubMenu = false;
|
||||||
@@ -1285,6 +1390,8 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
else
|
else
|
||||||
gInputBox[--gInputBoxIndex] = 10;
|
gInputBox[--gInputBoxIndex] = 10;
|
||||||
|
|
||||||
|
// ***********************
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1294,11 +1401,10 @@ static void MENU_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT == 0)
|
if (gEeprom.BACKLIGHT_TIME == 0) // backlight set to always off
|
||||||
{
|
{
|
||||||
gBacklightCountdown = 0;
|
BACKLIGHT_TurnOff(); // turn the backlight OFF
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1326,29 +1432,29 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (gMenuCursor != MENU_SCR)
|
if (GetCurrentMenuId() != MENU_SCR)
|
||||||
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
gAnotherVoiceID = MenuList[gMenuCursor].voice_id;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (gMenuCursor == MENU_DEL_CH || gMenuCursor == MENU_MEM_NAME)
|
if (GetCurrentMenuId() == MENU_DEL_CH || GetCurrentMenuId() == MENU_MEM_NAME)
|
||||||
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
|
if (!RADIO_CheckValidChannel(gSubMenuSelection, false, 0))
|
||||||
return; // invalid channel
|
return; // invalid channel
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gAskForConfirmation = 0;
|
gAskForConfirmation = 0;
|
||||||
gIsInSubMenu = true;
|
gIsInSubMenu = true;
|
||||||
|
|
||||||
// if (gMenuCursor != MENU_D_LIST)
|
// if (GetCurrentMenuId() != MENU_D_LIST)
|
||||||
{
|
{
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
edit_index = -1;
|
edit_index = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_NAME)
|
if (GetCurrentMenuId() == MENU_MEM_NAME)
|
||||||
{
|
{
|
||||||
if (edit_index < 0)
|
if (edit_index < 0)
|
||||||
{ // enter channel name edit mode
|
{ // enter channel name edit mode
|
||||||
@@ -1395,10 +1501,10 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
if (gIsInSubMenu)
|
if (gIsInSubMenu)
|
||||||
{
|
{
|
||||||
if (gMenuCursor == MENU_RESET ||
|
if (GetCurrentMenuId() == MENU_RESET ||
|
||||||
gMenuCursor == MENU_MEM_CH ||
|
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||||
gMenuCursor == MENU_DEL_CH ||
|
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||||
gMenuCursor == MENU_MEM_NAME)
|
GetCurrentMenuId() == MENU_MEM_NAME)
|
||||||
{
|
{
|
||||||
switch (gAskForConfirmation)
|
switch (gAskForConfirmation)
|
||||||
{
|
{
|
||||||
@@ -1411,7 +1517,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
UI_DisplayMenu();
|
UI_DisplayMenu();
|
||||||
|
|
||||||
if (gMenuCursor == MENU_RESET)
|
if (GetCurrentMenuId() == MENU_RESET)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
AUDIO_SetVoiceID(0, VOICE_ID_CONFIRM);
|
||||||
@@ -1446,7 +1552,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
if (gMenuCursor == MENU_SCR)
|
if (GetCurrentMenuId() == MENU_SCR)
|
||||||
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
gAnotherVoiceID = (gSubMenuSelection == 0) ? VOICE_ID_SCRAMBLER_OFF : VOICE_ID_SCRAMBLER_ON;
|
||||||
else
|
else
|
||||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||||
@@ -1462,7 +1568,7 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||||
{ // currently editing the channel name
|
{ // currently editing the channel name
|
||||||
|
|
||||||
if (edit_index < 10)
|
if (edit_index < 10)
|
||||||
@@ -1484,12 +1590,12 @@ static void MENU_Key_STAR(const bool bKeyPressed, const bool bKeyHeld)
|
|||||||
RADIO_SelectVfos();
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
|
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) && gRxVfo->AM_mode == 0)
|
||||||
#else
|
#else
|
||||||
if (gRxVfo->AM_mode == 0)
|
if (gRxVfo->AM_mode == 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS)
|
if (GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS)
|
||||||
{ // scan CTCSS or DCS to find the tone/code of the incoming signal
|
{ // scan CTCSS or DCS to find the tone/code of the incoming signal
|
||||||
|
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
@@ -1524,7 +1630,7 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
bool bCheckScanList;
|
bool bCheckScanList;
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
if (GetCurrentMenuId() == MENU_MEM_NAME && gIsInSubMenu && edit_index >= 0)
|
||||||
{ // change the character
|
{ // change the character
|
||||||
if (bKeyPressed && edit_index < 10 && Direction != 0)
|
if (bKeyPressed && edit_index < 10 && Direction != 0)
|
||||||
{
|
{
|
||||||
@@ -1570,20 +1676,21 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
|
|
||||||
if (!gIsInSubMenu)
|
if (!gIsInSubMenu)
|
||||||
{
|
{
|
||||||
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
gMenuCursor = NUMBER_AddWithWraparound(gMenuCursor, -Direction, 0, gMenuListCount - 1);
|
||||||
gFlagRefreshSetting = true;
|
|
||||||
|
gFlagRefreshSetting = true;
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
|
|
||||||
if (gMenuCursor != MENU_ABR && gEeprom.BACKLIGHT == 0)
|
if (GetCurrentMenuId() != MENU_ABR && gEeprom.BACKLIGHT_TIME == 0) // backlight always off and not in the backlight menu
|
||||||
{
|
{
|
||||||
gBacklightCountdown = 0;
|
BACKLIGHT_TurnOff();
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_OFFSET)
|
if (GetCurrentMenuId() == MENU_OFFSET)
|
||||||
{
|
{
|
||||||
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
int32_t Offset = (Direction * gTxVfo->StepFrequency) + gSubMenuSelection;
|
||||||
if (Offset < 99999990)
|
if (Offset < 99999990)
|
||||||
@@ -1594,14 +1701,14 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
else
|
else
|
||||||
Offset = 0;
|
Offset = 0;
|
||||||
|
|
||||||
gSubMenuSelection = FREQUENCY_FloorToStep(Offset, gTxVfo->StepFrequency, 0);
|
gSubMenuSelection = FREQUENCY_RoundToStep(Offset, gTxVfo->StepFrequency);
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VFO = 0;
|
VFO = 0;
|
||||||
|
|
||||||
switch (gMenuCursor)
|
switch (GetCurrentMenuId())
|
||||||
{
|
{
|
||||||
case MENU_DEL_CH:
|
case MENU_DEL_CH:
|
||||||
case MENU_1_CALL:
|
case MENU_1_CALL:
|
||||||
@@ -1611,11 +1718,12 @@ static void MENU_Key_UP_DOWN(bool bKeyPressed, bool bKeyHeld, int8_t Direction)
|
|||||||
|
|
||||||
case MENU_SLIST2:
|
case MENU_SLIST2:
|
||||||
VFO = 1;
|
VFO = 1;
|
||||||
|
[[fallthrough]];
|
||||||
case MENU_SLIST1:
|
case MENU_SLIST1:
|
||||||
bCheckScanList = true;
|
bCheckScanList = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
MENU_ClampSelection(Direction);
|
MENU_ClampSelection(Direction);
|
||||||
gRequestDisplayScreen = DISPLAY_MENU;
|
gRequestDisplayScreen = DISPLAY_MENU;
|
||||||
return;
|
return;
|
||||||
@@ -1660,7 +1768,7 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
MENU_Key_STAR(bKeyPressed, bKeyHeld);
|
MENU_Key_STAR(bKeyPressed, bKeyHeld);
|
||||||
break;
|
break;
|
||||||
case KEY_F:
|
case KEY_F:
|
||||||
if (gMenuCursor == MENU_MEM_NAME && edit_index >= 0)
|
if (GetCurrentMenuId() == MENU_MEM_NAME && edit_index >= 0)
|
||||||
{ // currently editing the channel name
|
{ // currently editing the channel name
|
||||||
if (!bKeyHeld && bKeyPressed)
|
if (!bKeyHeld && bKeyPressed)
|
||||||
{
|
{
|
||||||
@@ -1690,6 +1798,19 @@ void MENU_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gScreenToDisplay == DISPLAY_MENU && gMenuCursor == MENU_VOL)
|
if (gScreenToDisplay == DISPLAY_MENU)
|
||||||
gVoltageMenuCountdown = menu_timeout_500ms;
|
{
|
||||||
|
if (GetCurrentMenuId() == MENU_VOL ||
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
GetCurrentMenuId() == MENU_F_CALI ||
|
||||||
|
#endif
|
||||||
|
GetCurrentMenuId() == MENU_BATCAL)
|
||||||
|
{
|
||||||
|
gMenuCountdown = menu_timeout_long_500ms;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gMenuCountdown = menu_timeout_500ms;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,11 @@
|
|||||||
|
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
int MENU_GetLimits(uint8_t Cursor, int32_t *pMin, int32_t *pMax);
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
void writeXtalFreqCal(const int32_t value, const bool update_eeprom);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int MENU_GetLimits(uint8_t menu_id, int32_t *pMin, int32_t *pMax);
|
||||||
void MENU_AcceptSetting(void);
|
void MENU_AcceptSetting(void);
|
||||||
void MENU_SelectNextCode(void);
|
void MENU_SelectNextCode(void);
|
||||||
void MENU_ShowCurrentSetting(void);
|
void MENU_ShowCurrentSetting(void);
|
||||||
|
|||||||
342
app/scanner.c
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "app/app.h"
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
#include "app/generic.h"
|
#include "app/generic.h"
|
||||||
#include "app/scanner.h"
|
#include "app/scanner.h"
|
||||||
@@ -37,12 +38,26 @@ uint32_t gScanFrequency;
|
|||||||
bool gScanPauseMode;
|
bool gScanPauseMode;
|
||||||
SCAN_CssState_t gScanCssState;
|
SCAN_CssState_t gScanCssState;
|
||||||
volatile bool gScheduleScanListen = true;
|
volatile bool gScheduleScanListen = true;
|
||||||
volatile uint16_t ScanPauseDelayIn_10ms;
|
volatile uint16_t gScanPauseDelayIn_10ms;
|
||||||
uint8_t gScanProgressIndicator;
|
uint8_t gScanProgressIndicator;
|
||||||
uint8_t gScanHitCount;
|
uint8_t gScanHitCount;
|
||||||
bool gScanUseCssResult;
|
bool gScanUseCssResult;
|
||||||
int8_t gScanState;
|
int8_t gScanStateDir;
|
||||||
bool bScanKeepFrequency;
|
bool gScanKeepResult;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SCAN_NEXT_CHAN_SCANLIST1 = 0,
|
||||||
|
SCAN_NEXT_CHAN_SCANLIST2,
|
||||||
|
SCAN_NEXT_CHAN_DUAL_WATCH,
|
||||||
|
SCAN_NEXT_CHAN_MR,
|
||||||
|
SCAN_NEXT_NUM
|
||||||
|
} scan_next_chan_t;
|
||||||
|
|
||||||
|
|
||||||
|
scan_next_chan_t currentScanList;
|
||||||
|
uint32_t initialFrqOrChan;
|
||||||
|
uint8_t initialCROSS_BAND_RX_TX;
|
||||||
|
uint32_t lastFoundFrqOrChan;
|
||||||
|
|
||||||
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
||||||
{
|
{
|
||||||
@@ -53,7 +68,9 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
uint16_t Channel;
|
uint16_t Channel;
|
||||||
|
|
||||||
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
|
||||||
|
|
||||||
INPUTBOX_Append(Key);
|
INPUTBOX_Append(Key);
|
||||||
|
|
||||||
gRequestDisplayScreen = DISPLAY_SCANNER;
|
gRequestDisplayScreen = DISPLAY_SCANNER;
|
||||||
|
|
||||||
if (gInputBoxIndex < 3)
|
if (gInputBoxIndex < 3)
|
||||||
@@ -65,8 +82,8 @@ static void SCANNER_Key_DIGITS(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld)
|
|||||||
}
|
}
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
|
||||||
|
|
||||||
|
Channel = ((gInputBox[0] * 100) + (gInputBox[1] * 10) + gInputBox[2]) - 1;
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -92,7 +109,8 @@ static void SCANNER_Key_EXIT(bool bKeyPressed, bool bKeyHeld)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
gRequestDisplayScreen = DISPLAY_MAIN;
|
gRequestDisplayScreen = DISPLAY_MAIN;
|
||||||
gEeprom.CROSS_BAND_RX_TX = gBackupCROSS_BAND_RX_TX;
|
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = gBackup_CROSS_BAND_RX_TX;
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
gFlagStopScan = true;
|
gFlagStopScan = true;
|
||||||
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
gVfoConfigureMode = VFO_CONFIGURE_RELOAD;
|
||||||
@@ -161,34 +179,19 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
case 0:
|
case 0:
|
||||||
if (!gScanSingleFrequency)
|
if (!gScanSingleFrequency)
|
||||||
{
|
{
|
||||||
int16_t Delta625;
|
uint32_t freq250 = FREQUENCY_RoundToStep(gScanFrequency, 250);
|
||||||
uint32_t Freq250 = FREQUENCY_FloorToStep(gScanFrequency, 250, 0);
|
uint32_t freq625 = FREQUENCY_RoundToStep(gScanFrequency, 625);
|
||||||
uint32_t Freq625 = FREQUENCY_FloorToStep(gScanFrequency, 625, 0);
|
|
||||||
int16_t Delta250 = (int16_t)gScanFrequency - (int16_t)Freq250;
|
|
||||||
|
|
||||||
if (125 < Delta250)
|
uint32_t diff250 = gScanFrequency > freq250 ? gScanFrequency - freq250 : freq250 - gScanFrequency;
|
||||||
{
|
uint32_t diff625 = gScanFrequency > freq625 ? gScanFrequency - freq625 : freq625 - gScanFrequency;
|
||||||
Delta250 = 250 - Delta250;
|
|
||||||
Freq250 += 250;
|
|
||||||
}
|
|
||||||
|
|
||||||
Delta625 = (int16_t)gScanFrequency - (int16_t)Freq625;
|
if(diff250 > diff625) {
|
||||||
|
|
||||||
if (312 < Delta625)
|
|
||||||
{
|
|
||||||
Delta625 = 625 - Delta625;
|
|
||||||
Freq625 += 625;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Delta625 < Delta250)
|
|
||||||
{
|
|
||||||
gStepSetting = STEP_6_25kHz;
|
gStepSetting = STEP_6_25kHz;
|
||||||
gScanFrequency = Freq625;
|
gScanFrequency = freq625;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
gStepSetting = STEP_2_5kHz;
|
gStepSetting = STEP_2_5kHz;
|
||||||
gScanFrequency = Freq250;
|
gScanFrequency = freq250;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,7 +227,7 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
case 2:
|
case 2:
|
||||||
if (!gScanSingleFrequency)
|
if (!gScanSingleFrequency)
|
||||||
{
|
{
|
||||||
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, FREQUENCY_GetBand(gScanFrequency), gScanFrequency);
|
RADIO_InitInfo(gTxVfo, gTxVfo->CHANNEL_SAVE, gScanFrequency);
|
||||||
|
|
||||||
if (gScanUseCssResult)
|
if (gScanUseCssResult)
|
||||||
{
|
{
|
||||||
@@ -249,16 +252,16 @@ static void SCANNER_Key_MENU(bool bKeyPressed, bool bKeyHeld)
|
|||||||
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
if (IS_MR_CHANNEL(gTxVfo->CHANNEL_SAVE))
|
||||||
{
|
{
|
||||||
Channel = gScanChannel;
|
Channel = gScanChannel;
|
||||||
gEeprom.MrChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.MrChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
Channel = gTxVfo->Band + FREQ_CHANNEL_FIRST;
|
||||||
gEeprom.FreqChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.FreqChannel[gEeprom.TX_VFO] = Channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
gTxVfo->CHANNEL_SAVE = Channel;
|
gTxVfo->CHANNEL_SAVE = Channel;
|
||||||
gEeprom.ScreenChannel[gEeprom.TX_CHANNEL] = Channel;
|
gEeprom.ScreenChannel[gEeprom.TX_VFO] = Channel;
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
gAnotherVoiceID = VOICE_ID_CONFIRM;
|
||||||
#endif
|
#endif
|
||||||
@@ -359,24 +362,24 @@ void SCANNER_Start(void)
|
|||||||
|
|
||||||
RADIO_SelectVfos();
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||||
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
gRxVfo->CHANNEL_SAVE = FREQ_CHANNEL_FIRST + BAND6_400MHz;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BackupStep = gRxVfo->STEP_SETTING;
|
BackupStep = gRxVfo->STEP_SETTING;
|
||||||
BackupFrequency = gRxVfo->StepFrequency;
|
BackupFrequency = gRxVfo->StepFrequency;
|
||||||
|
|
||||||
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->Band, gRxVfo->pRX->Frequency);
|
RADIO_InitInfo(gRxVfo, gRxVfo->CHANNEL_SAVE, gRxVfo->pRX->Frequency);
|
||||||
|
|
||||||
gRxVfo->STEP_SETTING = BackupStep;
|
gRxVfo->STEP_SETTING = BackupStep;
|
||||||
gRxVfo->StepFrequency = BackupFrequency;
|
gRxVfo->StepFrequency = BackupFrequency;
|
||||||
|
|
||||||
RADIO_SetupRegisters(true);
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gIsNoaaMode = false;
|
gIsNoaaMode = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gScanSingleFrequency)
|
if (gScanSingleFrequency)
|
||||||
{
|
{
|
||||||
@@ -411,47 +414,246 @@ void SCANNER_Start(void)
|
|||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
gCDCSSCodeType = 0;
|
gCDCSSCodeType = 0;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
gScannerEditState = 0;
|
gScannerEditState = 0;
|
||||||
gScanProgressIndicator = 0;
|
gScanProgressIndicator = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SCANNER_Found()
|
||||||
|
{
|
||||||
|
switch (gEeprom.SCAN_RESUME_MODE)
|
||||||
|
{
|
||||||
|
case SCAN_RESUME_TO:
|
||||||
|
if (!gScanPauseMode)
|
||||||
|
{
|
||||||
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_1_10ms;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
gScanPauseMode = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCAN_RESUME_CO:
|
||||||
|
case SCAN_RESUME_SE:
|
||||||
|
gScanPauseDelayIn_10ms = 0;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE)) { //memory scan
|
||||||
|
lastFoundFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||||
|
}
|
||||||
|
else { // frequency scan
|
||||||
|
lastFoundFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gScanKeepResult = true;
|
||||||
|
}
|
||||||
|
|
||||||
void SCANNER_Stop(void)
|
void SCANNER_Stop(void)
|
||||||
{
|
{
|
||||||
const uint8_t Previous = gRestoreMrChannel;
|
if(initialCROSS_BAND_RX_TX != CROSS_BAND_OFF) {
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = initialCROSS_BAND_RX_TX;
|
||||||
gScanState = SCAN_OFF;
|
initialCROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
|
|
||||||
if (!bScanKeepFrequency)
|
|
||||||
{
|
|
||||||
if (IS_MR_CHANNEL(gNextMrChannel))
|
|
||||||
{
|
|
||||||
gEeprom.MrChannel[gEeprom.RX_CHANNEL] = gRestoreMrChannel;
|
|
||||||
gEeprom.ScreenChannel[gEeprom.RX_CHANNEL] = Previous;
|
|
||||||
|
|
||||||
RADIO_ConfigureChannel(gEeprom.RX_CHANNEL, VFO_CONFIGURE_RELOAD);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gRxVfo->freq_config_RX.Frequency = gRestoreFrequency;
|
|
||||||
RADIO_ApplyOffset(gRxVfo);
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
|
||||||
}
|
|
||||||
RADIO_SetupRegisters(true);
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gScanStateDir = SCAN_OFF;
|
||||||
|
|
||||||
if (!IS_MR_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
const uint32_t chFr = gScanKeepResult ? lastFoundFrqOrChan : initialFrqOrChan;
|
||||||
{
|
const bool channelChanged = chFr != initialFrqOrChan;
|
||||||
|
if (IS_MR_CHANNEL(gNextMrChannel)) {
|
||||||
|
gEeprom.MrChannel[gEeprom.RX_VFO] = chFr;
|
||||||
|
gEeprom.ScreenChannel[gEeprom.RX_VFO] = chFr;
|
||||||
|
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||||
|
|
||||||
|
if(channelChanged) {
|
||||||
|
SETTINGS_SaveVfoIndices();
|
||||||
|
gUpdateStatus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gRxVfo->freq_config_RX.Frequency = chFr;
|
||||||
RADIO_ApplyOffset(gRxVfo);
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_CHANNEL, gRxVfo, 1);
|
if(channelChanged) {
|
||||||
return;
|
SETTINGS_SaveChannel(gRxVfo->CHANNEL_SAVE, gEeprom.RX_VFO, gRxVfo, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SETTINGS_SaveVfoIndices();
|
RADIO_SetupRegisters(true);
|
||||||
|
gUpdateDisplay = true;
|
||||||
gUpdateStatus = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void NextFreqChannel(void)
|
||||||
|
{
|
||||||
|
gRxVfo->freq_config_RX.Frequency = APP_SetFrequencyByStep(gRxVfo, gScanStateDir);
|
||||||
|
|
||||||
|
RADIO_ApplyOffset(gRxVfo);
|
||||||
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
|
gScanPauseDelayIn_10ms = 9; // 90ms
|
||||||
|
#else
|
||||||
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_6_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void NextMemChannel(void)
|
||||||
|
{
|
||||||
|
static unsigned int prev_mr_chan = 0;
|
||||||
|
const bool enabled = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCAN_LIST_ENABLED[gEeprom.SCAN_LIST_DEFAULT] : true;
|
||||||
|
const int chan1 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH1[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||||
|
const int chan2 = (gEeprom.SCAN_LIST_DEFAULT < 2) ? gEeprom.SCANLIST_PRIORITY_CH2[gEeprom.SCAN_LIST_DEFAULT] : -1;
|
||||||
|
const unsigned int prev_chan = gNextMrChannel;
|
||||||
|
unsigned int chan = 0;
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
{
|
||||||
|
switch (currentScanList)
|
||||||
|
{
|
||||||
|
case SCAN_NEXT_CHAN_SCANLIST1:
|
||||||
|
prev_mr_chan = gNextMrChannel;
|
||||||
|
|
||||||
|
if (chan1 >= 0)
|
||||||
|
{
|
||||||
|
if (RADIO_CheckValidChannel(chan1, false, 0))
|
||||||
|
{
|
||||||
|
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||||
|
gNextMrChannel = chan1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
|
case SCAN_NEXT_CHAN_SCANLIST2:
|
||||||
|
if (chan2 >= 0)
|
||||||
|
{
|
||||||
|
if (RADIO_CheckValidChannel(chan2, false, 0))
|
||||||
|
{
|
||||||
|
currentScanList = SCAN_NEXT_CHAN_SCANLIST2;
|
||||||
|
gNextMrChannel = chan2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[[fallthrough]];
|
||||||
|
|
||||||
|
// this bit doesn't yet work if the other VFO is a frequency
|
||||||
|
case SCAN_NEXT_CHAN_DUAL_WATCH:
|
||||||
|
// dual watch is enabled - include the other VFO in the scan
|
||||||
|
// if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
|
// {
|
||||||
|
// chan = (gEeprom.RX_VFO + 1) & 1u;
|
||||||
|
// chan = gEeprom.ScreenChannel[chan];
|
||||||
|
// if (IS_MR_CHANNEL(chan))
|
||||||
|
// {
|
||||||
|
// currentScanList = SCAN_NEXT_CHAN_DUAL_WATCH;
|
||||||
|
// gNextMrChannel = chan;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
default:
|
||||||
|
case SCAN_NEXT_CHAN_MR:
|
||||||
|
currentScanList = SCAN_NEXT_CHAN_MR;
|
||||||
|
gNextMrChannel = prev_mr_chan;
|
||||||
|
chan = 0xff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!enabled || chan == 0xff)
|
||||||
|
{
|
||||||
|
chan = RADIO_FindNextChannel(gNextMrChannel + gScanStateDir, gScanStateDir, (gEeprom.SCAN_LIST_DEFAULT < 2) ? true : false, gEeprom.SCAN_LIST_DEFAULT);
|
||||||
|
if (chan == 0xFF)
|
||||||
|
{ // no valid channel found
|
||||||
|
chan = MR_CHANNEL_FIRST;
|
||||||
|
}
|
||||||
|
|
||||||
|
gNextMrChannel = chan;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gNextMrChannel != prev_chan)
|
||||||
|
{
|
||||||
|
gEeprom.MrChannel[ gEeprom.RX_VFO] = gNextMrChannel;
|
||||||
|
gEeprom.ScreenChannel[gEeprom.RX_VFO] = gNextMrChannel;
|
||||||
|
|
||||||
|
RADIO_ConfigureChannel(gEeprom.RX_VFO, VFO_CONFIGURE_RELOAD);
|
||||||
|
RADIO_SetupRegisters(true);
|
||||||
|
|
||||||
|
gUpdateDisplay = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_FASTER_CHANNEL_SCAN
|
||||||
|
gScanPauseDelayIn_10ms = 9; // 90ms .. <= ~60ms it misses signals (squelch response and/or PLL lock time) ?
|
||||||
|
#else
|
||||||
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_3_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
if (++currentScanList >= SCAN_NEXT_NUM)
|
||||||
|
currentScanList = SCAN_NEXT_CHAN_SCANLIST1; // back round we go
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction)
|
||||||
|
{
|
||||||
|
if (storeBackupSettings) {
|
||||||
|
initialCROSS_BAND_RX_TX = gEeprom.CROSS_BAND_RX_TX;
|
||||||
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
|
gScanKeepResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RADIO_SelectVfos();
|
||||||
|
|
||||||
|
gNextMrChannel = gRxVfo->CHANNEL_SAVE;
|
||||||
|
currentScanList = SCAN_NEXT_CHAN_SCANLIST1;
|
||||||
|
gScanStateDir = scan_direction;
|
||||||
|
|
||||||
|
if (IS_MR_CHANNEL(gNextMrChannel))
|
||||||
|
{ // channel mode
|
||||||
|
if (storeBackupSettings) {
|
||||||
|
initialFrqOrChan = gRxVfo->CHANNEL_SAVE;
|
||||||
|
lastFoundFrqOrChan = initialFrqOrChan;
|
||||||
|
}
|
||||||
|
NextMemChannel();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // frequency mode
|
||||||
|
if (storeBackupSettings) {
|
||||||
|
initialFrqOrChan = gRxVfo->freq_config_RX.Frequency;
|
||||||
|
lastFoundFrqOrChan = initialFrqOrChan;
|
||||||
|
}
|
||||||
|
NextFreqChannel();
|
||||||
|
}
|
||||||
|
|
||||||
|
gScanPauseDelayIn_10ms = scan_pause_delay_in_2_10ms;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
gRxReceptionMode = RX_MODE_NONE;
|
||||||
|
gScanPauseMode = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCANNER_ContinueScanning()
|
||||||
|
{
|
||||||
|
if (IS_FREQ_CHANNEL(gNextMrChannel))
|
||||||
|
{
|
||||||
|
if (gCurrentFunction == FUNCTION_INCOMING)
|
||||||
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||||
|
else
|
||||||
|
NextFreqChannel(); // switch to next frequency
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gCurrentCodeType == CODE_TYPE_OFF && gCurrentFunction == FUNCTION_INCOMING)
|
||||||
|
APP_StartListening(gMonitor ? FUNCTION_MONITOR : FUNCTION_RECEIVE, true);
|
||||||
|
else
|
||||||
|
NextMemChannel(); // switch to next channel
|
||||||
|
}
|
||||||
|
|
||||||
|
gScanPauseMode = false;
|
||||||
|
gRxReceptionMode = RX_MODE_NONE;
|
||||||
|
gScheduleScanListen = false;
|
||||||
|
}
|
||||||
@@ -32,7 +32,9 @@ typedef enum SCAN_CssState_t SCAN_CssState_t;
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SCAN_OFF = 0,
|
SCAN_REV = -1,
|
||||||
|
SCAN_OFF = 0,
|
||||||
|
SCAN_FWD = +1
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DCS_CodeType_t gScanCssResultType;
|
extern DCS_CodeType_t gScanCssResultType;
|
||||||
@@ -46,16 +48,19 @@ extern uint32_t gScanFrequency;
|
|||||||
extern bool gScanPauseMode;
|
extern bool gScanPauseMode;
|
||||||
extern SCAN_CssState_t gScanCssState;
|
extern SCAN_CssState_t gScanCssState;
|
||||||
extern volatile bool gScheduleScanListen;
|
extern volatile bool gScheduleScanListen;
|
||||||
extern volatile uint16_t ScanPauseDelayIn_10ms;
|
extern volatile uint16_t gScanPauseDelayIn_10ms;
|
||||||
extern uint8_t gScanProgressIndicator;
|
extern uint8_t gScanProgressIndicator;
|
||||||
extern uint8_t gScanHitCount;
|
extern uint8_t gScanHitCount;
|
||||||
extern bool gScanUseCssResult;
|
extern bool gScanUseCssResult;
|
||||||
extern int8_t gScanState;
|
extern int8_t gScanStateDir;
|
||||||
extern bool bScanKeepFrequency;
|
extern bool gScanKeepResult;
|
||||||
|
|
||||||
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
void SCANNER_ProcessKeys(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld);
|
||||||
void SCANNER_Start(void);
|
void SCANNER_Start(void);
|
||||||
|
void SCANNER_Found();
|
||||||
void SCANNER_Stop(void);
|
void SCANNER_Stop(void);
|
||||||
|
void SCANNER_ScanChannels(const bool storeBackupSettings, const int8_t scan_direction);
|
||||||
|
void SCANNER_ContinueScanning();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../app/spectrum.h"
|
#include "app/spectrum.h"
|
||||||
|
#include "driver/backlight.h"
|
||||||
|
|
||||||
struct FrequencyBandInfo {
|
struct FrequencyBandInfo {
|
||||||
uint32_t lower;
|
uint32_t lower;
|
||||||
@@ -22,19 +23,8 @@ struct FrequencyBandInfo {
|
|||||||
uint32_t middle;
|
uint32_t middle;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct FrequencyBandInfo FrequencyBandTable[7] = {
|
#define F_MIN frequencyBandTable[0].lower
|
||||||
[BAND1_50MHz ] = {.lower = 1600000, .middle = 6500000, .upper = 7600000},
|
#define F_MAX frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper
|
||||||
[BAND2_108MHz] = {.lower = 10800000, .middle = 12200000, .upper = 13599990},
|
|
||||||
[BAND3_136MHz] = {.lower = 13600000, .middle = 15000000, .upper = 17399990},
|
|
||||||
[BAND4_174MHz] = {.lower = 17400000, .middle = 26000000, .upper = 34999990},
|
|
||||||
[BAND5_350MHz] = {.lower = 35000000, .middle = 37000000, .upper = 39999990},
|
|
||||||
[BAND6_400MHz] = {.lower = 40000000, .middle = 43500000, .upper = 46999990},
|
|
||||||
[BAND7_470MHz] = {.lower = 47000000, .middle = 55000000, .upper = 130000000},
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#define F_MIN FrequencyBandTable[0].lower
|
|
||||||
#define F_MAX FrequencyBandTable[ARRAY_SIZE(FrequencyBandTable) - 1].upper
|
|
||||||
|
|
||||||
const uint16_t RSSI_MAX_VALUE = 65535;
|
const uint16_t RSSI_MAX_VALUE = 65535;
|
||||||
|
|
||||||
@@ -62,26 +52,26 @@ const char *modulationTypeOptions[] = {" FM", " AM", "USB"};
|
|||||||
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
const uint8_t modulationTypeTuneSteps[] = {100, 50, 10};
|
||||||
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
const uint8_t modTypeReg47Values[] = {1, 7, 5};
|
||||||
|
|
||||||
SpectrumSettings settings = {STEPS_64,
|
SpectrumSettings settings = {stepsCount: STEPS_64,
|
||||||
S_STEP_25_0kHz,
|
scanStepIndex: S_STEP_25_0kHz,
|
||||||
80000,
|
frequencyChangeStep: 80000,
|
||||||
3200,
|
scanDelay: 3200,
|
||||||
150,
|
rssiTriggerLevel: 150,
|
||||||
true,
|
backlightState: true,
|
||||||
BK4819_FILTER_BW_WIDE,
|
bw: BK4819_FILTER_BW_WIDE,
|
||||||
BK4819_FILTER_BW_WIDE,
|
listenBw: BK4819_FILTER_BW_WIDE,
|
||||||
false,
|
modulationType: false,
|
||||||
-130,
|
dbMin: -130,
|
||||||
-50};
|
dbMax: -50};
|
||||||
|
|
||||||
uint32_t fMeasure = 0;
|
uint32_t fMeasure = 0;
|
||||||
uint32_t currentFreq, tempFreq;
|
uint32_t currentFreq, tempFreq;
|
||||||
uint16_t rssiHistory[128] = {};
|
uint16_t rssiHistory[128];
|
||||||
|
|
||||||
uint8_t freqInputIndex = 0;
|
uint8_t freqInputIndex = 0;
|
||||||
uint8_t freqInputDotIndex = 0;
|
uint8_t freqInputDotIndex = 0;
|
||||||
KEY_Code_t freqInputArr[10];
|
KEY_Code_t freqInputArr[10];
|
||||||
char freqInputString[11] = "----------\0"; // XXXX.XXXXX\0
|
char freqInputString[11];
|
||||||
|
|
||||||
uint8_t menuState = 0;
|
uint8_t menuState = 0;
|
||||||
uint16_t listenT = 0;
|
uint16_t listenT = 0;
|
||||||
@@ -323,7 +313,7 @@ static void ToggleAudio(bool on) {
|
|||||||
static void ToggleRX(bool on) {
|
static void ToggleRX(bool on) {
|
||||||
isListening = on;
|
isListening = on;
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, on);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, on);
|
||||||
|
|
||||||
ToggleAudio(on);
|
ToggleAudio(on);
|
||||||
ToggleAFDAC(on);
|
ToggleAFDAC(on);
|
||||||
@@ -504,9 +494,9 @@ static void ToggleListeningBW() {
|
|||||||
static void ToggleBacklight() {
|
static void ToggleBacklight() {
|
||||||
settings.backlightState = !settings.backlightState;
|
settings.backlightState = !settings.backlightState;
|
||||||
if (settings.backlightState) {
|
if (settings.backlightState) {
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
BACKLIGHT_TurnOn();
|
||||||
} else {
|
} else {
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
BACKLIGHT_TurnOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +551,7 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
|||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
if (i < freqInputIndex) {
|
if (i < freqInputIndex) {
|
||||||
digitKey = freqInputArr[i];
|
digitKey = freqInputArr[i];
|
||||||
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey : '.';
|
freqInputString[i] = digitKey <= KEY_9 ? '0' + digitKey-KEY_0 : '.';
|
||||||
} else {
|
} else {
|
||||||
freqInputString[i] = '-';
|
freqInputString[i] = '-';
|
||||||
}
|
}
|
||||||
@@ -569,14 +559,14 @@ static void UpdateFreqInput(KEY_Code_t key) {
|
|||||||
|
|
||||||
uint32_t base = 100000; // 1MHz in BK units
|
uint32_t base = 100000; // 1MHz in BK units
|
||||||
for (int i = dotIndex - 1; i >= 0; --i) {
|
for (int i = dotIndex - 1; i >= 0; --i) {
|
||||||
tempFreq += freqInputArr[i] * base;
|
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||||
base *= 10;
|
base *= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
base = 10000; // 0.1MHz in BK units
|
base = 10000; // 0.1MHz in BK units
|
||||||
if (dotIndex < freqInputIndex) {
|
if (dotIndex < freqInputIndex) {
|
||||||
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
|
for (int i = dotIndex + 1; i < freqInputIndex; ++i) {
|
||||||
tempFreq += freqInputArr[i] * base;
|
tempFreq += (freqInputArr[i]-KEY_0) * base;
|
||||||
base /= 10;
|
base /= 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -638,19 +628,12 @@ static void DrawStatus() {
|
|||||||
gBatteryVoltages[3]) /
|
gBatteryVoltages[3]) /
|
||||||
4;
|
4;
|
||||||
|
|
||||||
if (gBatteryCalibration[5] < Voltage) {
|
for(uint8_t i = 5; i > 0; i--) {
|
||||||
v = 5;
|
if(Voltage > gBatteryCalibration[i - 1]) {
|
||||||
} else if (gBatteryCalibration[4] < Voltage) {
|
v = i;
|
||||||
v = 5;
|
break;
|
||||||
} else if (gBatteryCalibration[3] < Voltage) {
|
|
||||||
v = 4;
|
|
||||||
} else if (gBatteryCalibration[2] < Voltage) {
|
|
||||||
v = 3;
|
|
||||||
} else if (gBatteryCalibration[1] < Voltage) {
|
|
||||||
v = 2;
|
|
||||||
} else if (gBatteryCalibration[0] < Voltage) {
|
|
||||||
v = 1;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gStatusLine[127] = 0b01111110;
|
gStatusLine[127] = 0b01111110;
|
||||||
for (int i = 126; i >= 116; i--) {
|
for (int i = 126; i >= 116; i--) {
|
||||||
@@ -686,7 +669,7 @@ static void DrawNums() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsCenterMode()) {
|
if (IsCenterMode()) {
|
||||||
sprintf(String, "%u.%05u \xB1%u.%02uk", currentFreq / 100000,
|
sprintf(String, "%u.%05u \x7F%u.%02uk", currentFreq / 100000,
|
||||||
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
currentFreq % 100000, settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 36, 49, false, true);
|
GUI_DisplaySmallest(String, 36, 49, false, true);
|
||||||
@@ -694,7 +677,7 @@ static void DrawNums() {
|
|||||||
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
sprintf(String, "%u.%05u", GetFStart() / 100000, GetFStart() % 100000);
|
||||||
GUI_DisplaySmallest(String, 0, 49, false, true);
|
GUI_DisplaySmallest(String, 0, 49, false, true);
|
||||||
|
|
||||||
sprintf(String, "\xB1%u.%02uk", settings.frequencyChangeStep / 100,
|
sprintf(String, "\x7F%u.%02uk", settings.frequencyChangeStep / 100,
|
||||||
settings.frequencyChangeStep % 100);
|
settings.frequencyChangeStep % 100);
|
||||||
GUI_DisplaySmallest(String, 48, 49, false, true);
|
GUI_DisplaySmallest(String, 48, 49, false, true);
|
||||||
|
|
||||||
@@ -905,8 +888,8 @@ void OnKeyDownStill(KEY_Code_t key) {
|
|||||||
break;
|
break;
|
||||||
case KEY_PTT:
|
case KEY_PTT:
|
||||||
// TODO: start transmit
|
// TODO: start transmit
|
||||||
/* BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
/* BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true); */
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true); */
|
||||||
break;
|
break;
|
||||||
case KEY_MENU:
|
case KEY_MENU:
|
||||||
if (menuState == ARRAY_SIZE(registerSpecs) - 1) {
|
if (menuState == ARRAY_SIZE(registerSpecs) - 1) {
|
||||||
@@ -1166,7 +1149,7 @@ static void Tick() {
|
|||||||
void APP_RunSpectrum() {
|
void APP_RunSpectrum() {
|
||||||
// TX here coz it always? set to active VFO
|
// TX here coz it always? set to active VFO
|
||||||
currentFreq = initialFreq =
|
currentFreq = initialFreq =
|
||||||
gEeprom.VfoInfo[gEeprom.TX_CHANNEL].pRX->Frequency;
|
gEeprom.VfoInfo[gEeprom.TX_VFO].pRX->Frequency;
|
||||||
|
|
||||||
BackupRegisters();
|
BackupRegisters();
|
||||||
|
|
||||||
|
|||||||
@@ -122,18 +122,17 @@ typedef enum ScanStep {
|
|||||||
} ScanStep;
|
} ScanStep;
|
||||||
|
|
||||||
typedef struct SpectrumSettings {
|
typedef struct SpectrumSettings {
|
||||||
|
uint32_t frequencyChangeStep;
|
||||||
StepsCount stepsCount;
|
StepsCount stepsCount;
|
||||||
ScanStep scanStepIndex;
|
ScanStep scanStepIndex;
|
||||||
uint32_t frequencyChangeStep;
|
|
||||||
uint16_t scanDelay;
|
uint16_t scanDelay;
|
||||||
uint16_t rssiTriggerLevel;
|
uint16_t rssiTriggerLevel;
|
||||||
|
|
||||||
bool backlightState;
|
|
||||||
BK4819_FilterBandwidth_t bw;
|
BK4819_FilterBandwidth_t bw;
|
||||||
BK4819_FilterBandwidth_t listenBw;
|
BK4819_FilterBandwidth_t listenBw;
|
||||||
ModulationType modulationType;
|
|
||||||
int dbMin;
|
int dbMin;
|
||||||
int dbMax;
|
int dbMax;
|
||||||
|
ModulationType modulationType;
|
||||||
|
bool backlightState;
|
||||||
} SpectrumSettings;
|
} SpectrumSettings;
|
||||||
|
|
||||||
typedef struct KeyboardState {
|
typedef struct KeyboardState {
|
||||||
@@ -161,8 +160,8 @@ typedef struct RegisterSpec {
|
|||||||
typedef struct PeakInfo {
|
typedef struct PeakInfo {
|
||||||
uint16_t t;
|
uint16_t t;
|
||||||
uint16_t rssi;
|
uint16_t rssi;
|
||||||
uint8_t i;
|
|
||||||
uint32_t f;
|
uint32_t f;
|
||||||
|
uint8_t i;
|
||||||
} PeakInfo;
|
} PeakInfo;
|
||||||
|
|
||||||
void APP_RunSpectrum(void);
|
void APP_RunSpectrum(void);
|
||||||
|
|||||||
100
app/uart.c
@@ -27,6 +27,7 @@
|
|||||||
#include "bsp/dp32g030/dma.h"
|
#include "bsp/dp32g030/dma.h"
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "driver/aes.h"
|
#include "driver/aes.h"
|
||||||
|
#include "driver/backlight.h"
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "driver/crc.h"
|
#include "driver/crc.h"
|
||||||
#include "driver/eeprom.h"
|
#include "driver/eeprom.h"
|
||||||
@@ -48,7 +49,7 @@ typedef struct {
|
|||||||
} Header_t;
|
} Header_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
uint16_t ID;
|
uint16_t ID;
|
||||||
} Footer_t;
|
} Footer_t;
|
||||||
|
|
||||||
@@ -60,10 +61,10 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
char Version[16];
|
char Version[16];
|
||||||
bool bHasCustomAesKey;
|
bool bHasCustomAesKey;
|
||||||
bool bIsInLockScreen;
|
bool bIsInLockScreen;
|
||||||
uint8_t Padding[2];
|
uint8_t Padding[2];
|
||||||
uint32_t Challenge[4];
|
uint32_t Challenge[4];
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_0514_t;
|
} REPLY_0514_t;
|
||||||
@@ -71,8 +72,8 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
uint8_t Padding;
|
uint8_t Padding;
|
||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
} CMD_051B_t;
|
} CMD_051B_t;
|
||||||
|
|
||||||
@@ -80,19 +81,19 @@ typedef struct {
|
|||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
uint8_t Padding;
|
uint8_t Padding;
|
||||||
uint8_t Data[128];
|
uint8_t Data[128];
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_051B_t;
|
} REPLY_051B_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
uint16_t Offset;
|
uint16_t Offset;
|
||||||
uint8_t Size;
|
uint8_t Size;
|
||||||
bool bAllowPassword;
|
bool bAllowPassword;
|
||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
uint8_t Data[0];
|
uint8_t Data[0];
|
||||||
} CMD_051D_t;
|
} CMD_051D_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -106,8 +107,8 @@ typedef struct {
|
|||||||
Header_t Header;
|
Header_t Header;
|
||||||
struct {
|
struct {
|
||||||
uint16_t RSSI;
|
uint16_t RSSI;
|
||||||
uint8_t ExNoiseIndicator;
|
uint8_t ExNoiseIndicator;
|
||||||
uint8_t GlitchIndicator;
|
uint8_t GlitchIndicator;
|
||||||
} Data;
|
} Data;
|
||||||
} REPLY_0527_t;
|
} REPLY_0527_t;
|
||||||
|
|
||||||
@@ -137,7 +138,10 @@ typedef struct {
|
|||||||
uint32_t Timestamp;
|
uint32_t Timestamp;
|
||||||
} CMD_052F_t;
|
} CMD_052F_t;
|
||||||
|
|
||||||
static const uint8_t Obfuscation[16] = { 0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80 };
|
static const uint8_t Obfuscation[16] =
|
||||||
|
{
|
||||||
|
0x16, 0x6C, 0x14, 0xE6, 0x2E, 0x91, 0x0D, 0x40, 0x21, 0x35, 0xD5, 0x40, 0x13, 0x03, 0xE9, 0x80
|
||||||
|
};
|
||||||
|
|
||||||
static union
|
static union
|
||||||
{
|
{
|
||||||
@@ -157,12 +161,11 @@ static void SendReply(void *pReply, uint16_t Size)
|
|||||||
{
|
{
|
||||||
Header_t Header;
|
Header_t Header;
|
||||||
Footer_t Footer;
|
Footer_t Footer;
|
||||||
uint8_t *pBytes;
|
|
||||||
uint16_t i;
|
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
{
|
{
|
||||||
pBytes = (uint8_t *)pReply;
|
uint8_t *pBytes = (uint8_t *)pReply;
|
||||||
|
unsigned int i;
|
||||||
for (i = 0; i < Size; i++)
|
for (i = 0; i < Size; i++)
|
||||||
pBytes[i] ^= Obfuscation[i % 16];
|
pBytes[i] ^= Obfuscation[i % 16];
|
||||||
}
|
}
|
||||||
@@ -171,6 +174,7 @@ static void SendReply(void *pReply, uint16_t Size)
|
|||||||
Header.Size = Size;
|
Header.Size = Size;
|
||||||
UART_Send(&Header, sizeof(Header));
|
UART_Send(&Header, sizeof(Header));
|
||||||
UART_Send(pReply, Size);
|
UART_Send(pReply, Size);
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
{
|
{
|
||||||
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
Footer.Padding[0] = Obfuscation[(Size + 0) % 16] ^ 0xFF;
|
||||||
@@ -205,14 +209,16 @@ static void SendVersion(void)
|
|||||||
|
|
||||||
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
static bool IsBadChallenge(const uint32_t *pKey, const uint32_t *pIn, const uint32_t *pResponse)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
unsigned int i;
|
||||||
uint32_t IV[4];
|
uint32_t IV[4];
|
||||||
|
|
||||||
IV[0] = 0;
|
IV[0] = 0;
|
||||||
IV[1] = 0;
|
IV[1] = 0;
|
||||||
IV[2] = 0;
|
IV[2] = 0;
|
||||||
IV[3] = 0;
|
IV[3] = 0;
|
||||||
|
|
||||||
AES_Encrypt(pKey, IV, pIn, IV, true);
|
AES_Encrypt(pKey, IV, pIn, IV, true);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
if (IV[i] != pResponse[i])
|
if (IV[i] != pResponse[i])
|
||||||
return true;
|
return true;
|
||||||
@@ -225,10 +231,16 @@ static void CMD_0514(const uint8_t *pBuffer)
|
|||||||
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
const CMD_0514_t *pCmd = (const CMD_0514_t *)pBuffer;
|
||||||
|
|
||||||
Timestamp = pCmd->Timestamp;
|
Timestamp = pCmd->Timestamp;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
|
// turn the LCD backlight off
|
||||||
|
BACKLIGHT_TurnOff();
|
||||||
|
|
||||||
SendVersion();
|
SendVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,14 +253,17 @@ static void CMD_051B(const uint8_t *pBuffer)
|
|||||||
if (pCmd->Timestamp != Timestamp)
|
if (pCmd->Timestamp != Timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&Reply, 0, sizeof(Reply));
|
memset(&Reply, 0, sizeof(Reply));
|
||||||
Reply.Header.ID = 0x051C;
|
Reply.Header.ID = 0x051C;
|
||||||
Reply.Header.Size = pCmd->Size + 4;
|
Reply.Header.Size = pCmd->Size + 4;
|
||||||
Reply.Data.Offset = pCmd->Offset;
|
Reply.Data.Offset = pCmd->Offset;
|
||||||
Reply.Data.Size = pCmd->Size;
|
Reply.Data.Size = pCmd->Size;
|
||||||
|
|
||||||
if (bHasCustomAesKey)
|
if (bHasCustomAesKey)
|
||||||
bLocked = gIsLocked;
|
bLocked = gIsLocked;
|
||||||
@@ -269,11 +284,14 @@ static void CMD_051D(const uint8_t *pBuffer)
|
|||||||
if (pCmd->Timestamp != Timestamp)
|
if (pCmd->Timestamp != Timestamp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
bReloadEeprom = false;
|
bReloadEeprom = false;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Reply.Header.ID = 0x051E;
|
Reply.Header.ID = 0x051E;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
Reply.Data.Offset = pCmd->Offset;
|
Reply.Data.Offset = pCmd->Offset;
|
||||||
@@ -282,7 +300,7 @@ static void CMD_051D(const uint8_t *pBuffer)
|
|||||||
|
|
||||||
if (!bIsLocked)
|
if (!bIsLocked)
|
||||||
{
|
{
|
||||||
uint16_t i;
|
unsigned int i;
|
||||||
for (i = 0; i < (pCmd->Size / 8); i++)
|
for (i = 0; i < (pCmd->Size / 8); i++)
|
||||||
{
|
{
|
||||||
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
const uint16_t Offset = pCmd->Offset + (i * 8U);
|
||||||
@@ -319,23 +337,25 @@ static void CMD_0529(void)
|
|||||||
{
|
{
|
||||||
REPLY_0529_t Reply;
|
REPLY_0529_t Reply;
|
||||||
|
|
||||||
Reply.Header.ID = 0x52A;
|
Reply.Header.ID = 0x52A;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
|
|
||||||
// Original doesn't actually send current!
|
// Original doesn't actually send current!
|
||||||
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
BOARD_ADC_GetBatteryInfo(&Reply.Data.Voltage, &Reply.Data.Current);
|
||||||
|
|
||||||
SendReply(&Reply, sizeof(Reply));
|
SendReply(&Reply, sizeof(Reply));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CMD_052D(const uint8_t *pBuffer)
|
static void CMD_052D(const uint8_t *pBuffer)
|
||||||
{
|
{
|
||||||
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
const CMD_052D_t *pCmd = (const CMD_052D_t *)pBuffer;
|
||||||
REPLY_052D_t Reply;
|
REPLY_052D_t Reply;
|
||||||
bool bIsLocked;
|
bool bIsLocked;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
gFmRadioCountdown_500ms = fm_radio_countdown_500ms;
|
||||||
#endif
|
#endif
|
||||||
Reply.Header.ID = 0x052E;
|
Reply.Header.ID = 0x052E;
|
||||||
Reply.Header.Size = sizeof(Reply.Data);
|
Reply.Header.Size = sizeof(Reply.Data);
|
||||||
|
|
||||||
bIsLocked = bHasCustomAesKey;
|
bIsLocked = bHasCustomAesKey;
|
||||||
@@ -373,7 +393,7 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
|
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gEeprom.RX_CHANNEL = 0;
|
gEeprom.RX_VFO = 0;
|
||||||
gEeprom.DTMF_SIDE_TONE = false;
|
gEeprom.DTMF_SIDE_TONE = false;
|
||||||
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
gEeprom.VfoInfo[0].FrequencyReverse = false;
|
||||||
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
gEeprom.VfoInfo[0].pRX = &gEeprom.VfoInfo[0].freq_config_RX;
|
||||||
@@ -389,24 +409,25 @@ static void CMD_052F(const uint8_t *pBuffer)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
FUNCTION_Select(FUNCTION_FOREGROUND);
|
FUNCTION_Select(FUNCTION_FOREGROUND);
|
||||||
|
|
||||||
|
gSerialConfigCountDown_500ms = 12; // 6 sec
|
||||||
|
|
||||||
Timestamp = pCmd->Timestamp;
|
Timestamp = pCmd->Timestamp;
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
// turn the LCD backlight off
|
||||||
|
BACKLIGHT_TurnOff();
|
||||||
|
|
||||||
SendVersion();
|
SendVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UART_IsCommandAvailable(void)
|
bool UART_IsCommandAvailable(void)
|
||||||
{
|
{
|
||||||
uint16_t DmaLength;
|
|
||||||
uint16_t CommandLength;
|
|
||||||
uint16_t Index;
|
uint16_t Index;
|
||||||
uint16_t TailIndex;
|
uint16_t TailIndex;
|
||||||
uint16_t Size;
|
uint16_t Size;
|
||||||
uint16_t CRC;
|
uint16_t CRC;
|
||||||
uint16_t i;
|
uint16_t CommandLength;
|
||||||
|
uint16_t DmaLength = DMA_CH0->ST & 0xFFFU;
|
||||||
|
|
||||||
DmaLength = DMA_CH0->ST & 0xFFFU;
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (gUART_WriteIndex == DmaLength)
|
if (gUART_WriteIndex == DmaLength)
|
||||||
@@ -435,7 +456,7 @@ bool UART_IsCommandAvailable(void)
|
|||||||
Index = DMA_INDEX(gUART_WriteIndex, 2);
|
Index = DMA_INDEX(gUART_WriteIndex, 2);
|
||||||
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
|
Size = (UART_DMA_Buffer[DMA_INDEX(Index, 1)] << 8) | UART_DMA_Buffer[Index];
|
||||||
|
|
||||||
if ((Size + 8) > sizeof(UART_DMA_Buffer))
|
if ((Size + 8u) > sizeof(UART_DMA_Buffer))
|
||||||
{
|
{
|
||||||
gUART_WriteIndex = DmaLength;
|
gUART_WriteIndex = DmaLength;
|
||||||
return false;
|
return false;
|
||||||
@@ -480,9 +501,12 @@ bool UART_IsCommandAvailable(void)
|
|||||||
bIsEncrypted = true;
|
bIsEncrypted = true;
|
||||||
|
|
||||||
if (bIsEncrypted)
|
if (bIsEncrypted)
|
||||||
for (i = 0; i < Size + 2; i++)
|
{
|
||||||
|
unsigned int i;
|
||||||
|
for (i = 0; i < (Size + 2u); i++)
|
||||||
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
UART_Command.Buffer[i] ^= Obfuscation[i % 16];
|
||||||
|
}
|
||||||
|
|
||||||
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
CRC = UART_Command.Buffer[Size] | (UART_Command.Buffer[Size + 1] << 8);
|
||||||
|
|
||||||
return (CRC_Calculate(UART_Command.Buffer, Size) != CRC) ? false : true;
|
return (CRC_Calculate(UART_Command.Buffer, Size) != CRC) ? false : true;
|
||||||
|
|||||||
51
audio.c
@@ -149,14 +149,14 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
SYSTEM_DelayMs(60);
|
SYSTEM_DelayMs(60);
|
||||||
BK4819_EnterTxMute();
|
BK4819_EnterTxMute();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
|
[[fallthrough]];
|
||||||
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
|
case BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL:
|
||||||
case BEEP_500HZ_60MS_DOUBLE_BEEP:
|
case BEEP_500HZ_60MS_DOUBLE_BEEP:
|
||||||
BK4819_ExitTxMute();
|
BK4819_ExitTxMute();
|
||||||
SYSTEM_DelayMs(60);
|
SYSTEM_DelayMs(60);
|
||||||
BK4819_EnterTxMute();
|
BK4819_EnterTxMute();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
|
[[fallthrough]];
|
||||||
case BEEP_1KHZ_60MS_OPTIONAL:
|
case BEEP_1KHZ_60MS_OPTIONAL:
|
||||||
BK4819_ExitTxMute();
|
BK4819_ExitTxMute();
|
||||||
Duration = 60;
|
Duration = 60;
|
||||||
@@ -187,7 +187,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
BK4819_TurnsOffTones_TurnsOnRX();
|
BK4819_TurnsOffTones_TurnsOnRX();
|
||||||
@@ -258,7 +260,9 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
VoiceID += VOICE_ID_ENG_BASE;
|
VoiceID += VOICE_ID_ENG_BASE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
BK4819_SetAF(BK4819_AF_MUTE);
|
BK4819_SetAF(BK4819_AF_MUTE);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
@@ -267,7 +271,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
AUDIO_PlayVoice(VoiceID);
|
AUDIO_PlayVoice(VoiceID);
|
||||||
|
|
||||||
@@ -278,13 +286,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
{
|
{
|
||||||
SYSTEM_DelayMs(Delay * 10);
|
SYSTEM_DelayMs(Delay * 10);
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
{
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
if (gRxVfo->AM_mode)
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
BK4819_SetAF(BK4819_AF_AM);
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
else
|
|
||||||
BK4819_SetAF(BK4819_AF_OPEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -296,7 +301,11 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
gVoxResumeCountdown = 80;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,14 +418,19 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
|
|
||||||
gCountdownToPlayNextVoice_10ms = Delay;
|
gCountdownToPlayNextVoice_10ms = Delay;
|
||||||
gFlagPlayQueuedVoice = false;
|
gFlagPlayQueuedVoice = false;
|
||||||
gVoxResumeCountdown = 2000;
|
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 2000;
|
||||||
|
#endif
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gCurrentFunction == FUNCTION_RECEIVE || gCurrentFunction == FUNCTION_MONITOR)
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_OPEN);
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING) // 1of11
|
||||||
|
BK4819_SetAF(gRxVfo->AM_mode ? BK4819_AF_AM : BK4819_AF_FM);
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
@@ -426,7 +440,10 @@ void AUDIO_PlayBeep(BEEP_Type_t Beep)
|
|||||||
if (!gEnableSpeaker)
|
if (!gEnableSpeaker)
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gVoxResumeCountdown = 80;
|
#ifdef ENABLE_VOX
|
||||||
|
gVoxResumeCountdown = 80;
|
||||||
|
#endif
|
||||||
|
|
||||||
gVoiceWriteIndex = 0;
|
gVoiceWriteIndex = 0;
|
||||||
gVoiceReadIndex = 0;
|
gVoiceReadIndex = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
162
bitmaps.c
@@ -4,7 +4,7 @@
|
|||||||
// all these images are on their right sides
|
// all these images are on their right sides
|
||||||
// turn your monitor 90-deg anti-clockwise to see the images
|
// turn your monitor 90-deg anti-clockwise to see the images
|
||||||
|
|
||||||
const uint8_t BITMAP_PowerSave[8] =
|
const uint8_t BITMAP_POWERSAVE[8] =
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// "S"
|
// "S"
|
||||||
@@ -29,6 +29,30 @@ const uint8_t BITMAP_PowerSave[8] =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t BITMAP_TX[8] =
|
||||||
|
{ // "TX"
|
||||||
|
0b00000000,
|
||||||
|
0b00000001,
|
||||||
|
0b00000001,
|
||||||
|
0b01111111,
|
||||||
|
0b00000001,
|
||||||
|
0b00000001,
|
||||||
|
0b00000000,
|
||||||
|
0b00000000
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t BITMAP_RX[8] =
|
||||||
|
{ // "RX"
|
||||||
|
0b00000000,
|
||||||
|
0b01111111,
|
||||||
|
0b00001001,
|
||||||
|
0b00011001,
|
||||||
|
0b01100110,
|
||||||
|
0b00000000,
|
||||||
|
0b00000000,
|
||||||
|
0b00000000
|
||||||
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_BatteryLevel[2] =
|
const uint8_t BITMAP_BatteryLevel[2] =
|
||||||
{
|
{
|
||||||
0b01011101,
|
0b01011101,
|
||||||
@@ -114,27 +138,29 @@ const uint8_t BITMAP_F_Key[6] =
|
|||||||
0b01000001
|
0b01000001
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_VOX[18] =
|
#ifdef ENABLE_VOX
|
||||||
{ // "VOX"
|
const uint8_t BITMAP_VOX[18] =
|
||||||
0b00000000,
|
{ // "VOX"
|
||||||
0b00011111,
|
0b00000000,
|
||||||
0b00100000,
|
0b00011111,
|
||||||
0b01000000,
|
0b00100000,
|
||||||
0b00100000,
|
0b01000000,
|
||||||
0b00011111,
|
0b00100000,
|
||||||
0b00000000,
|
0b00011111,
|
||||||
0b00111110,
|
0b00000000,
|
||||||
0b01000001,
|
0b00111110,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b00111110,
|
0b01000001,
|
||||||
0b00000000,
|
0b00111110,
|
||||||
0b01100011,
|
0b00000000,
|
||||||
0b00010100,
|
0b01100011,
|
||||||
0b00001000,
|
0b00010100,
|
||||||
0b00010100,
|
0b00001000,
|
||||||
0b01100011
|
0b00010100,
|
||||||
};
|
0b01100011
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
const uint8_t BITMAP_WX[12] =
|
const uint8_t BITMAP_WX[12] =
|
||||||
@@ -171,26 +197,27 @@ const uint8_t BITMAP_VOX[18] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t BITMAP_TDR1[12] =
|
const uint8_t BITMAP_TDR1[15] =
|
||||||
{ // "DW"
|
{ // "DWR"
|
||||||
0b00000000,
|
|
||||||
0b01111111,
|
0b01111111,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
0b01000001,
|
||||||
0b01000001,
|
|
||||||
0b00111110,
|
0b00111110,
|
||||||
0b00000000,
|
0b00000000,
|
||||||
0b01111111,
|
0b01111111,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b00011000,
|
0b00011000,
|
||||||
0b00100000,
|
0b00100000,
|
||||||
0b01111111
|
0b01111111,
|
||||||
|
0b00000000,
|
||||||
|
0b01111111,
|
||||||
|
0b00011001,
|
||||||
|
0b00101001,
|
||||||
|
0b01000110
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_TDR2[12] =
|
const uint8_t BITMAP_TDR2[9] =
|
||||||
{ // "><" .. DW on hold
|
{ // "><" .. DW on hold
|
||||||
0b00000000,
|
|
||||||
0b00000000,
|
|
||||||
0b00100010,
|
0b00100010,
|
||||||
0b00110110,
|
0b00110110,
|
||||||
0b00011100,
|
0b00011100,
|
||||||
@@ -200,7 +227,6 @@ const uint8_t BITMAP_TDR2[12] =
|
|||||||
0b00011100,
|
0b00011100,
|
||||||
0b00110110,
|
0b00110110,
|
||||||
0b00100010,
|
0b00100010,
|
||||||
0b00000000
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -218,27 +244,8 @@ const uint8_t BITMAP_TDR2[12] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
const uint8_t BITMAP_FM[12] =
|
|
||||||
{ // "FM"
|
|
||||||
0b00000000,
|
|
||||||
0b01111111,
|
|
||||||
0b00001001,
|
|
||||||
0b00001001,
|
|
||||||
0b00001001,
|
|
||||||
0b00000001,
|
|
||||||
|
|
||||||
0b00000000,
|
|
||||||
0b01111111,
|
|
||||||
0b00000010,
|
|
||||||
0b00001100,
|
|
||||||
0b00000010,
|
|
||||||
0b01111111
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
const uint8_t BITMAP_NOAA[12] =
|
const uint8_t BITMAP_NOAA[11] =
|
||||||
{ // "NS"
|
{ // "NS"
|
||||||
0b00000000,
|
0b00000000,
|
||||||
0b01111111,
|
0b01111111,
|
||||||
@@ -246,33 +253,14 @@ const uint8_t BITMAP_TDR2[12] =
|
|||||||
0b00001000,
|
0b00001000,
|
||||||
0b00010000,
|
0b00010000,
|
||||||
0b01111111,
|
0b01111111,
|
||||||
|
|
||||||
0b00000000,
|
0b00000000,
|
||||||
0b01000110,
|
0b01000110,
|
||||||
0b01001001,
|
0b01001001,
|
||||||
0b01001001,
|
0b01001001,
|
||||||
0b01001001,
|
|
||||||
0b00110001
|
0b00110001
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t BITMAP_SC[12] =
|
|
||||||
{ // "SC"
|
|
||||||
0b00000000,
|
|
||||||
0b01000110,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b01001001,
|
|
||||||
0b00110001,
|
|
||||||
|
|
||||||
0b00000000,
|
|
||||||
0b00111110,
|
|
||||||
0b01000001,
|
|
||||||
0b01000001,
|
|
||||||
0b01000001,
|
|
||||||
0b00100010
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t BITMAP_Antenna[5] =
|
const uint8_t BITMAP_Antenna[5] =
|
||||||
{
|
{
|
||||||
0b00000011,
|
0b00000011,
|
||||||
@@ -324,7 +312,7 @@ const uint8_t BITMAP_AntennaLevel6[3] =
|
|||||||
0b00000000
|
0b00000000
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t BITMAP_CurrentIndicator[8] =
|
const uint8_t BITMAP_MARKER[8] =
|
||||||
{
|
{
|
||||||
0b11111111,
|
0b11111111,
|
||||||
0b11111111,
|
0b11111111,
|
||||||
@@ -359,17 +347,7 @@ const uint8_t BITMAP_VFO_NotDefault[8] =
|
|||||||
0b00010100,
|
0b00010100,
|
||||||
0b00001000
|
0b00001000
|
||||||
};
|
};
|
||||||
/*
|
|
||||||
const uint8_t BITMAP_ScanList[6] =
|
|
||||||
{ // diamond symbol
|
|
||||||
0b00001000,
|
|
||||||
0b00011100,
|
|
||||||
0b00111110,
|
|
||||||
0b00111110,
|
|
||||||
0b00011100,
|
|
||||||
0b00001000
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
const uint8_t BITMAP_ScanList1[6] =
|
const uint8_t BITMAP_ScanList1[6] =
|
||||||
{ // 'I' symbol
|
{ // 'I' symbol
|
||||||
0b00000000,
|
0b00000000,
|
||||||
@@ -390,14 +368,12 @@ const uint8_t BITMAP_ScanList2[6] =
|
|||||||
0b01000010
|
0b01000010
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const uint8_t BITMAP_compand[6] =
|
||||||
const uint8_t BITMAP_compand[6] =
|
{
|
||||||
{
|
0b00000000,
|
||||||
0b00000000,
|
0b00111100,
|
||||||
0b00111100,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b01000010,
|
||||||
0b01000010,
|
0b00100100
|
||||||
0b00100100
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|||||||
33
bitmaps.h
@@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern const uint8_t BITMAP_PowerSave[8];
|
extern const uint8_t BITMAP_POWERSAVE[8];
|
||||||
|
extern const uint8_t BITMAP_TX[8];
|
||||||
|
extern const uint8_t BITMAP_RX[8];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_BatteryLevel[2];
|
extern const uint8_t BITMAP_BatteryLevel[2];
|
||||||
extern const uint8_t BITMAP_BatteryLevel1[17];
|
extern const uint8_t BITMAP_BatteryLevel1[17];
|
||||||
@@ -19,31 +21,23 @@ extern const uint8_t BITMAP_KeyLock[6];
|
|||||||
|
|
||||||
extern const uint8_t BITMAP_F_Key[6];
|
extern const uint8_t BITMAP_F_Key[6];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_VOX[18];
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint8_t BITMAP_VOX[18];
|
||||||
#if 0
|
|
||||||
extern const uint8_t BITMAP_WX[12];
|
|
||||||
#else
|
|
||||||
extern const uint8_t BITMAP_XB[12];
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint8_t BITMAP_TDR1[12];
|
extern const uint8_t BITMAP_XB[12];
|
||||||
extern const uint8_t BITMAP_TDR2[12];
|
|
||||||
|
extern const uint8_t BITMAP_TDR1[15];
|
||||||
|
extern const uint8_t BITMAP_TDR2[9];
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
extern const uint8_t BITMAP_VoicePrompt[9];
|
extern const uint8_t BITMAP_VoicePrompt[9];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
extern const uint8_t BITMAP_FM[12];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern const uint8_t BITMAP_NOAA[12];
|
extern const uint8_t BITMAP_NOAA[11];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint8_t BITMAP_SC[12];
|
|
||||||
|
|
||||||
extern const uint8_t BITMAP_Antenna[5];
|
extern const uint8_t BITMAP_Antenna[5];
|
||||||
extern const uint8_t BITMAP_AntennaLevel1[3];
|
extern const uint8_t BITMAP_AntennaLevel1[3];
|
||||||
extern const uint8_t BITMAP_AntennaLevel2[3];
|
extern const uint8_t BITMAP_AntennaLevel2[3];
|
||||||
@@ -52,18 +46,15 @@ extern const uint8_t BITMAP_AntennaLevel4[3];
|
|||||||
extern const uint8_t BITMAP_AntennaLevel5[3];
|
extern const uint8_t BITMAP_AntennaLevel5[3];
|
||||||
extern const uint8_t BITMAP_AntennaLevel6[3];
|
extern const uint8_t BITMAP_AntennaLevel6[3];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_CurrentIndicator[8];
|
extern const uint8_t BITMAP_MARKER[8];
|
||||||
|
|
||||||
extern const uint8_t BITMAP_VFO_Default[8];
|
extern const uint8_t BITMAP_VFO_Default[8];
|
||||||
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
extern const uint8_t BITMAP_VFO_NotDefault[8];
|
||||||
|
|
||||||
//extern const uint8_t BITMAP_ScanList[6];
|
|
||||||
extern const uint8_t BITMAP_ScanList1[6];
|
extern const uint8_t BITMAP_ScanList1[6];
|
||||||
extern const uint8_t BITMAP_ScanList2[6];
|
extern const uint8_t BITMAP_ScanList2[6];
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const uint8_t BITMAP_compand[6];
|
||||||
extern const uint8_t BITMAP_compand[6];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
76
board.c
@@ -23,6 +23,7 @@
|
|||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "bsp/dp32g030/portcon.h"
|
#include "bsp/dp32g030/portcon.h"
|
||||||
|
#include "bsp/dp32g030/pwmplus.h"
|
||||||
#include "bsp/dp32g030/saradc.h"
|
#include "bsp/dp32g030/saradc.h"
|
||||||
#include "bsp/dp32g030/syscon.h"
|
#include "bsp/dp32g030/syscon.h"
|
||||||
#include "driver/adc.h"
|
#include "driver/adc.h"
|
||||||
@@ -94,8 +95,6 @@ void BOARD_GPIO_Init(void)
|
|||||||
| GPIO_DIR_6_MASK // INPUT
|
| GPIO_DIR_6_MASK // INPUT
|
||||||
);
|
);
|
||||||
GPIOB->DIR |= 0
|
GPIOB->DIR |= 0
|
||||||
// Back light
|
|
||||||
| GPIO_DIR_6_BITS_OUTPUT
|
|
||||||
// ST7565
|
// ST7565
|
||||||
| GPIO_DIR_9_BITS_OUTPUT
|
| GPIO_DIR_9_BITS_OUTPUT
|
||||||
// ST7565 + SWD IO
|
// ST7565 + SWD IO
|
||||||
@@ -189,8 +188,8 @@ void BOARD_PORTCON_Init(void)
|
|||||||
| PORTCON_PORTB_SEL0_B7_MASK
|
| PORTCON_PORTB_SEL0_B7_MASK
|
||||||
);
|
);
|
||||||
PORTCON_PORTB_SEL0 |= 0
|
PORTCON_PORTB_SEL0 |= 0
|
||||||
// Back light
|
// Back light PWM
|
||||||
| PORTCON_PORTB_SEL0_B6_BITS_GPIOB6
|
| PORTCON_PORTB_SEL0_B6_BITS_PWMP0_CH0
|
||||||
// SPI0 SSN
|
// SPI0 SSN
|
||||||
| PORTCON_PORTB_SEL0_B7_BITS_SPI0_SSN
|
| PORTCON_PORTB_SEL0_B7_BITS_SPI0_SSN
|
||||||
;
|
;
|
||||||
@@ -471,6 +470,23 @@ void BOARD_PORTCON_Init(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void BacklightPWM_Init()
|
||||||
|
{
|
||||||
|
// 48MHz / 94 / 1024 ~ 500Hz
|
||||||
|
PWM_PLUS0_CLKSRC |= ((94) << 16);
|
||||||
|
PWM_PLUS0_PERIOD = 1023;
|
||||||
|
|
||||||
|
PWM_PLUS0_GEN =
|
||||||
|
PWMPLUS_GEN_CH0_OE_BITS_ENABLE |
|
||||||
|
PWMPLUS_GEN_CH0_OUTINV_BITS_ENABLE |
|
||||||
|
0;
|
||||||
|
|
||||||
|
PWM_PLUS0_CFG =
|
||||||
|
PWMPLUS_CFG_CNT_REP_BITS_ENABLE |
|
||||||
|
PWMPLUS_CFG_COUNTER_EN_BITS_ENABLE |
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
|
||||||
void BOARD_ADC_Init(void)
|
void BOARD_ADC_Init(void)
|
||||||
{
|
{
|
||||||
ADC_Config_t Config;
|
ADC_Config_t Config;
|
||||||
@@ -508,8 +524,9 @@ void BOARD_Init(void)
|
|||||||
{
|
{
|
||||||
BOARD_PORTCON_Init();
|
BOARD_PORTCON_Init();
|
||||||
BOARD_GPIO_Init();
|
BOARD_GPIO_Init();
|
||||||
|
BacklightPWM_Init();
|
||||||
BOARD_ADC_Init();
|
BOARD_ADC_Init();
|
||||||
ST7565_Init();
|
ST7565_Init(true);
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
BK1080_Init(0, false);
|
BK1080_Init(0, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -532,17 +549,21 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
gEeprom.NOAA_AUTO_SCAN = (Data[3] < 2) ? Data[3] : false;
|
||||||
#endif
|
#endif
|
||||||
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
gEeprom.KEY_LOCK = (Data[4] < 2) ? Data[4] : false;
|
||||||
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
#ifdef ENABLE_VOX
|
||||||
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
gEeprom.VOX_SWITCH = (Data[5] < 2) ? Data[5] : false;
|
||||||
|
gEeprom.VOX_LEVEL = (Data[6] < 10) ? Data[6] : 1;
|
||||||
|
#endif
|
||||||
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
gEeprom.MIC_SENSITIVITY = (Data[7] < 5) ? Data[7] : 4;
|
||||||
|
|
||||||
// 0E78..0E7F
|
// 0E78..0E7F
|
||||||
EEPROM_ReadBuffer(0x0E78, Data, 8);
|
EEPROM_ReadBuffer(0x0E78, Data, 8);
|
||||||
|
gEeprom.BACKLIGHT_MAX = (Data[0] & 0xF) <= 10 ? (Data[0] & 0xF) : 10;
|
||||||
|
gEeprom.BACKLIGHT_MIN = (Data[0] >> 4) < gEeprom.BACKLIGHT_MAX ? (Data[0] >> 4) : 0;
|
||||||
gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
|
gEeprom.CHANNEL_DISPLAY_MODE = (Data[1] < 4) ? Data[1] : MDF_FREQUENCY; // 4 instead of 3 - extra display mode
|
||||||
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = (Data[2] < 3) ? Data[2] : CROSS_BAND_OFF;
|
||||||
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
gEeprom.BATTERY_SAVE = (Data[3] < 5) ? Data[3] : 4;
|
||||||
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
gEeprom.DUAL_WATCH = (Data[4] < 3) ? Data[4] : DUAL_WATCH_CHAN_A;
|
||||||
gEeprom.BACKLIGHT = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
gEeprom.BACKLIGHT_TIME = (Data[5] < ARRAY_SIZE(gSubMenu_BACKLIGHT)) ? Data[5] : 3;
|
||||||
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
gEeprom.TAIL_NOTE_ELIMINATION = (Data[6] < 2) ? Data[6] : false;
|
||||||
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
gEeprom.VFO_OPEN = (Data[7] < 2) ? Data[7] : true;
|
||||||
|
|
||||||
@@ -588,7 +609,8 @@ void BOARD_EEPROM_Init(void)
|
|||||||
|
|
||||||
// 0E90..0E97
|
// 0E90..0E97
|
||||||
EEPROM_ReadBuffer(0x0E90, Data, 8);
|
EEPROM_ReadBuffer(0x0E90, Data, 8);
|
||||||
gEeprom.BEEP_CONTROL = (Data[0] < 2) ? Data[0] : true;
|
gEeprom.BEEP_CONTROL = Data[0] & 1;
|
||||||
|
gEeprom.KEY_M_LONG_PRESS_ACTION = ((Data[0] >> 1) < ACTION_OPT_LEN) ? (Data[0] >> 1) : ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR;
|
gEeprom.KEY_1_SHORT_PRESS_ACTION = (Data[1] < ACTION_OPT_LEN) ? Data[1] : ACTION_OPT_MONITOR;
|
||||||
gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT;
|
gEeprom.KEY_1_LONG_PRESS_ACTION = (Data[2] < ACTION_OPT_LEN) ? Data[2] : ACTION_OPT_FLASHLIGHT;
|
||||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN;
|
gEeprom.KEY_2_SHORT_PRESS_ACTION = (Data[3] < ACTION_OPT_LEN) ? Data[3] : ACTION_OPT_SCAN;
|
||||||
@@ -614,7 +636,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
|
gEeprom.ROGER = (Data[1] < 3) ? Data[1] : ROGER_MODE_OFF;
|
||||||
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0;
|
gEeprom.REPEATER_TAIL_TONE_ELIMINATION = (Data[2] < 11) ? Data[2] : 0;
|
||||||
gEeprom.TX_CHANNEL = (Data[3] < 2) ? Data[3] : 0;
|
gEeprom.TX_VFO = (Data[3] < 2) ? Data[3] : 0;
|
||||||
|
|
||||||
// 0ED0..0ED7
|
// 0ED0..0ED7
|
||||||
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
EEPROM_ReadBuffer(0x0ED0, Data, 8);
|
||||||
@@ -622,7 +644,7 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
gEeprom.DTMF_SEPARATE_CODE = DTMF_ValidateCodes((char *)(Data + 1), 1) ? Data[1] : '*';
|
||||||
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
gEeprom.DTMF_GROUP_CALL_CODE = DTMF_ValidateCodes((char *)(Data + 2), 1) ? Data[2] : '#';
|
||||||
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
gEeprom.DTMF_DECODE_RESPONSE = (Data[3] < 4) ? Data[3] : 0;
|
||||||
gEeprom.DTMF_AUTO_RESET_TIME = (Data[4] < 61) ? Data[4] : 5;
|
gEeprom.DTMF_auto_reset_time = (Data[4] < 61) ? Data[4] : (Data[4] >= 5) ? Data[4] : 10;
|
||||||
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
gEeprom.DTMF_PRELOAD_TIME = (Data[5] < 101) ? Data[5] * 10 : 300;
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME = (Data[6] < 101) ? Data[6] * 10 : 100;
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME = (Data[7] < 101) ? Data[7] * 10 : 100;
|
||||||
@@ -685,7 +707,8 @@ void BOARD_EEPROM_Init(void)
|
|||||||
|
|
||||||
// 0F18..0F1F
|
// 0F18..0F1F
|
||||||
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
EEPROM_ReadBuffer(0x0F18, Data, 8);
|
||||||
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
// gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 2) ? Data[0] : false;
|
||||||
|
gEeprom.SCAN_LIST_DEFAULT = (Data[0] < 3) ? Data[0] : false; // we now have 'all' channel scan option
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
const unsigned int j = 1 + (i * 3);
|
const unsigned int j = 1 + (i * 3);
|
||||||
@@ -705,13 +728,14 @@ void BOARD_EEPROM_Init(void)
|
|||||||
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
gSetting_ScrambleEnable = (Data[6] < 2) ? Data[6] : true;
|
||||||
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
gSetting_TX_EN = (Data[7] & (1u << 0)) ? true : false;
|
||||||
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
gSetting_live_DTMF_decoder = (Data[7] & (1u << 1)) ? true : false;
|
||||||
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3: 2;
|
gSetting_battery_text = (((Data[7] >> 2) & 3u) <= 2) ? (Data[7] >> 2) & 3 : 2;
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
gSetting_mic_bar = (Data[7] & (1u << 4)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
gSetting_AM_fix = (Data[7] & (1u << 5)) ? true : false;
|
||||||
#endif
|
#endif
|
||||||
|
gSetting_backlight_on_tx_rx = (Data[7] >> 6) & 3u;
|
||||||
|
|
||||||
if (!gEeprom.VFO_OPEN)
|
if (!gEeprom.VFO_OPEN)
|
||||||
{
|
{
|
||||||
@@ -735,18 +759,18 @@ void BOARD_EEPROM_Init(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BOARD_EEPROM_LoadMoreSettings(void)
|
void BOARD_EEPROM_LoadCalibration(void)
|
||||||
{
|
{
|
||||||
// uint8_t Mic;
|
// uint8_t Mic;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_1EC0_0, 8);
|
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[3], 8);
|
||||||
memmove(gEEPROM_1EC0_1, gEEPROM_1EC0_0, 8);
|
memcpy(gEEPROM_RSSI_CALIB[4], gEEPROM_RSSI_CALIB[3], 8);
|
||||||
memmove(gEEPROM_1EC0_2, gEEPROM_1EC0_0, 8);
|
memcpy(gEEPROM_RSSI_CALIB[5], gEEPROM_RSSI_CALIB[3], 8);
|
||||||
memmove(gEEPROM_1EC0_3, gEEPROM_1EC0_0, 8);
|
memcpy(gEEPROM_RSSI_CALIB[6], gEEPROM_RSSI_CALIB[3], 8);
|
||||||
|
|
||||||
// 8 * 16-bit values
|
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[0], 8);
|
||||||
EEPROM_ReadBuffer(0x1EC0, gEEPROM_RSSI_CALIB[0], 8);
|
memcpy(gEEPROM_RSSI_CALIB[1], gEEPROM_RSSI_CALIB[0], 8);
|
||||||
EEPROM_ReadBuffer(0x1EC8, gEEPROM_RSSI_CALIB[1], 8);
|
memcpy(gEEPROM_RSSI_CALIB[2], gEEPROM_RSSI_CALIB[0], 8);
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
|
EEPROM_ReadBuffer(0x1F40, gBatteryCalibration, 12);
|
||||||
if (gBatteryCalibration[0] >= 5000)
|
if (gBatteryCalibration[0] >= 5000)
|
||||||
@@ -756,9 +780,11 @@ void BOARD_EEPROM_LoadMoreSettings(void)
|
|||||||
}
|
}
|
||||||
gBatteryCalibration[5] = 2300;
|
gBatteryCalibration[5] = 2300;
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
#ifdef ENABLE_VOX
|
||||||
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
EEPROM_ReadBuffer(0x1F50 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX1_THRESHOLD, 2);
|
||||||
|
EEPROM_ReadBuffer(0x1F68 + (gEeprom.VOX_LEVEL * 2), &gEeprom.VOX0_THRESHOLD, 2);
|
||||||
|
#endif
|
||||||
|
|
||||||
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
//EEPROM_ReadBuffer(0x1F80 + gEeprom.MIC_SENSITIVITY, &Mic, 1);
|
||||||
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
//gEeprom.MIC_SENSITIVITY_TUNING = (Mic < 32) ? Mic : 15;
|
||||||
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
gEeprom.MIC_SENSITIVITY_TUNING = gMicGain_dB2[gEeprom.MIC_SENSITIVITY];
|
||||||
@@ -861,7 +887,7 @@ void BOARD_FactoryReset(bool bIsAll)
|
|||||||
|
|
||||||
if (bIsAll)
|
if (bIsAll)
|
||||||
{
|
{
|
||||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, BAND6_400MHz, 43350000);
|
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_FIRST + BAND6_400MHz, 43350000);
|
||||||
|
|
||||||
// set the first few memory channels
|
// set the first few memory channels
|
||||||
for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++)
|
for (i = 0; i < ARRAY_SIZE(gDefaultFrequencyTable); i++)
|
||||||
|
|||||||
2
board.h
@@ -27,7 +27,7 @@ void BOARD_ADC_Init(void);
|
|||||||
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
void BOARD_ADC_GetBatteryInfo(uint16_t *pVoltage, uint16_t *pCurrent);
|
||||||
void BOARD_Init(void);
|
void BOARD_Init(void);
|
||||||
void BOARD_EEPROM_Init(void);
|
void BOARD_EEPROM_Init(void);
|
||||||
void BOARD_EEPROM_LoadMoreSettings(void);
|
void BOARD_EEPROM_LoadCalibration(void);
|
||||||
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
uint32_t BOARD_fetchChannelFrequency(const int channel);
|
||||||
void BOARD_fetchChannelName(char *s, const int channel);
|
void BOARD_fetchChannelName(char *s, const int channel);
|
||||||
void BOARD_FactoryReset(bool bIsAll);
|
void BOARD_FactoryReset(bool bIsAll);
|
||||||
|
|||||||
146
bsp/dp32g030/pwmplus.h
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
#ifndef HARDWARE_DP32G030_PWMPLUS_H
|
||||||
|
#define HARDWARE_DP32G030_PWMPLUS_H
|
||||||
|
|
||||||
|
#define PWM_PLUS0_BASE_ADDR 0x400B4000U
|
||||||
|
|
||||||
|
//---------------
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG 0x00U
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG_COUNTER_EN_SHIFT 0U
|
||||||
|
#define PWMPLUS_CFG_COUNTER_EN_WIDTH 1U
|
||||||
|
#define PWMPLUS_CFG_COUNTER_EN_MASK (((1U << PWMPLUS_CFG_COUNTER_EN_WIDTH) - 1U) << PWMPLUS_CFG_COUNTER_EN_SHIFT)
|
||||||
|
#define PWMPLUS_CFG_COUNTER_EN_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_CFG_COUNTER_EN_BITS_ENABLE (PWMPLUS_CFG_COUNTER_EN_VALUE_ENABLE << PWMPLUS_CFG_COUNTER_EN_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG_CNT_TYPE_SHIFT 1U
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG_CNT_REP_SHIFT 2U
|
||||||
|
#define PWMPLUS_CFG_CNT_REP_WIDTH 1U
|
||||||
|
#define PWMPLUS_CFG_CNT_REP_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_CFG_CNT_REP_BITS_ENABLE (PWMPLUS_CFG_CNT_REP_VALUE_ENABLE << PWMPLUS_CFG_CNT_REP_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG_OUT_MODE_SHIFT 3U
|
||||||
|
#define PWMPLUS_CFG_OUT_MODE_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_CFG_OUT_MODE_BITS_ENABLE (PWMPLUS_CFG_OUT_MODE_VALUE_ENABLE << PWMPLUS_CFG_OUT_MODE_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_CFG_AUTO_RELOAD_SHIFT 8U
|
||||||
|
|
||||||
|
//---------------
|
||||||
|
|
||||||
|
#define PWMPLUS_GEN 0x04U
|
||||||
|
|
||||||
|
#define PWMPLUS_GEN_CH0_OE_SHIFT 24U
|
||||||
|
#define PWMPLUS_GEN_CH0_OE_WIDTH 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_OE_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_OE_BITS_ENABLE (PWMPLUS_GEN_CH0_OE_VALUE_ENABLE << PWMPLUS_GEN_CH0_OE_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_GEN_CH0_OUTINV_SHIFT 16U
|
||||||
|
#define PWMPLUS_GEN_CH0_OUTINV_WIDTH 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_OUTINV_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_OUTINV_BITS_ENABLE (PWMPLUS_GEN_CH0_OUTINV_VALUE_ENABLE << PWMPLUS_GEN_CH0_OUTINV_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_GEN_CH0_START_SHIFT 8U
|
||||||
|
#define PWMPLUS_GEN_CH0_START_WIDTH 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_START_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_START_BITS_ENABLE (PWMPLUS_GEN_CH0_START_VALUE_ENABLE << PWMPLUS_GEN_CH0_START_SHIFT)
|
||||||
|
|
||||||
|
#define PWMPLUS_GEN_CH0_IDLE_SHIFT 0U
|
||||||
|
#define PWMPLUS_GEN_CH0_IDLE_WIDTH 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_IDLE_VALUE_ENABLE 1U
|
||||||
|
#define PWMPLUS_GEN_CH0_IDLE_BITS_ENABLE (PWMPLUS_GEN_CH0_IDLE_VALUE_ENABLE << PWMPLUS_GEN_CH0_IDLE_SHIFT)
|
||||||
|
|
||||||
|
//---------------
|
||||||
|
|
||||||
|
#define PWMPLUS_CLKSRC 0x08U
|
||||||
|
#define PWMPLUS_BRAKE_CFG 0x0CU
|
||||||
|
#define PWMPLUS_MASK_LEV 0x10U
|
||||||
|
#define PWMPLUS_PERIOD 0x1CU
|
||||||
|
#define PWMPLUS_CH0_COMP 0x20U
|
||||||
|
#define PWMPLUS_CH1_COMP 0x24U
|
||||||
|
#define PWMPLUS_CH2_COMP 0x28U
|
||||||
|
#define PWMPLUS_CH0_DT 0x30U
|
||||||
|
#define PWMPLUS_CH1_DT 0x34U
|
||||||
|
#define PWMPLUS_CH2_DT 0x38U
|
||||||
|
#define PWMPLUS_TRIG_COMP 0x40U
|
||||||
|
#define PWMPLUS_TRIG_CFG 0x44U
|
||||||
|
#define PWMPLUS_IE 0x60U
|
||||||
|
#define PWMPLUS_IF 0x64U
|
||||||
|
#define PWMPLUS_SWLOAD 0x84U
|
||||||
|
#define PWMPLUS_MASK_EN 0x88
|
||||||
|
#define PWMPLUS_CNT_ST 0xE0
|
||||||
|
#define PWMPLUS_BRAKE_ST 0xE4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CFG)
|
||||||
|
#define PWM_PLUS0_CFG (*(volatile uint32_t *)PWM_PLUS0_CFG_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_GEN_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_GEN)
|
||||||
|
#define PWM_PLUS0_GEN (*(volatile uint32_t *)PWM_PLUS0_GEN_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CLKSRC_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CLKSRC)
|
||||||
|
#define PWM_PLUS0_CLKSRC (*(volatile uint32_t *)PWM_PLUS0_CLKSRC_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_BRAKE_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_BRAKE_CFG)
|
||||||
|
#define PWM_PLUS0_BRAKE_CFG (*(volatile uint32_t *)PWM_PLUS0_BRAKE_CFG_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_MASK_LEV_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_MASK_LEV)
|
||||||
|
#define PWM_PLUS0_MASK_LEV (*(volatile uint32_t *)PWM_PLUS0_MASK_LEV_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_PERIOD_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_PERIOD)
|
||||||
|
#define PWM_PLUS0_PERIOD (*(volatile uint32_t *)PWM_PLUS0_PERIOD_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH0_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH0_COMP)
|
||||||
|
#define PWM_PLUS0_CH0_COMP (*(volatile uint32_t *)PWM_PLUS0_CH0_COMP_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH1_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH1_COMP)
|
||||||
|
#define PWM_PLUS0_CH1_COMP (*(volatile uint32_t *)PWM_PLUS0_CH1_COMP_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH2_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH2_COMP)
|
||||||
|
#define PWM_PLUS0_CH2_COMP (*(volatile uint32_t *)PWM_PLUS0_CH2_COMP_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH0_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH0_DT)
|
||||||
|
#define PWM_PLUS0_CH0_DT (*(volatile uint32_t *)PWM_PLUS0_CH0_DT_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH1_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH1_DT)
|
||||||
|
#define PWM_PLUS0_CH1_DT (*(volatile uint32_t *)PWM_PLUS0_CH1_DT_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CH2_DT_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CH2_DT)
|
||||||
|
#define PWM_PLUS0_CH2_DT (*(volatile uint32_t *)PWM_PLUS0_CH2_DT_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_TRIG_COMP_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_TRIG_COMP)
|
||||||
|
#define PWM_PLUS0_TRIG_COMP (*(volatile uint32_t *)PWM_PLUS0_TRIG_COMP_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_TRIG_CFG_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_TRIG_CFG)
|
||||||
|
#define PWM_PLUS0_TRIG_CFG (*(volatile uint32_t *)PWM_PLUS0_TRIG_CFG_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_IE_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_IE)
|
||||||
|
#define PWM_PLUS0_IE (*(volatile uint32_t *)PWM_PLUS0_IE_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_IF_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_IF)
|
||||||
|
#define PWM_PLUS0_IF (*(volatile uint32_t *)PWM_PLUS0_IF_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_SWLOAD_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_SWLOAD)
|
||||||
|
#define PWM_PLUS0_SWLOAD (*(volatile uint32_t *)PWM_PLUS0_SWLOAD_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_MASK_EN_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_MASK_EN)
|
||||||
|
#define PWM_PLUS0_MASK_EN (*(volatile uint32_t *)PWM_PLUS0_MASK_EN_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_CNT_ST_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_CNT_ST)
|
||||||
|
#define PWM_PLUS0_CNT_ST (*(volatile uint32_t *)PWM_PLUS0_CNT_ST_ADDR)
|
||||||
|
|
||||||
|
#define PWM_PLUS0_BRAKE_ST_ADDR (PWM_PLUS0_BASE_ADDR + PWMPLUS_BRAKE_ST)
|
||||||
|
#define PWM_PLUS0_BRAKE_ST (*(volatile uint32_t *)PWM_PLUS0_BRAKE_ST_ADDR)
|
||||||
|
|
||||||
|
#endif
|
||||||
4
compile-with-docker.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
docker build -t uvk5 .
|
||||||
|
docker run -v %CD%\compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make clean && make && cp firmware* compiled-firmware/"
|
||||||
|
pause
|
||||||
3
compile-with-docker.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
docker build -t uvk5 .
|
||||||
|
docker run -v ${PWD}/compiled-firmware:/app/compiled-firmware uvk5 /bin/bash -c "cd /app && make && cp firmware* compiled-firmware/"
|
||||||
2
dcs.c
@@ -91,7 +91,7 @@ uint8_t DCS_GetCdcssCode(uint32_t Code)
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t DCS_GetCtcssCode(uint16_t Code)
|
uint8_t DCS_GetCtcssCode(int Code)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint8_t Result = 0xFF;
|
uint8_t Result = 0xFF;
|
||||||
|
|||||||
2
dcs.h
@@ -39,7 +39,7 @@ extern const uint16_t DCS_Options[104];
|
|||||||
|
|
||||||
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
|
uint32_t DCS_GetGolayCodeWord(DCS_CodeType_t CodeType, uint8_t Option);
|
||||||
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
uint8_t DCS_GetCdcssCode(uint32_t Code);
|
||||||
uint8_t DCS_GetCtcssCode(uint16_t Code);
|
uint8_t DCS_GetCtcssCode(int Code);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -134,9 +134,9 @@ void ADC_Configure(ADC_Config_t *pAdc)
|
|||||||
;
|
;
|
||||||
|
|
||||||
if (SARADC_IE == 0) {
|
if (SARADC_IE == 0) {
|
||||||
NVIC_DisableIRQ(DP32_SARADC_IRQn);
|
NVIC_DisableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||||
} else {
|
} else {
|
||||||
NVIC_EnableIRQ(DP32_SARADC_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SARADC_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
driver/adc.h
@@ -42,8 +42,10 @@ enum ADC_CH_MASK {
|
|||||||
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
typedef enum ADC_CH_MASK ADC_CH_MASK;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t CLK_SEL;
|
uint16_t EXTTRIG_SEL;
|
||||||
|
uint16_t IE_CHx_EOC;
|
||||||
ADC_CH_MASK CH_SEL;
|
ADC_CH_MASK CH_SEL;
|
||||||
|
uint8_t CLK_SEL;
|
||||||
uint8_t AVG;
|
uint8_t AVG;
|
||||||
uint8_t CONT;
|
uint8_t CONT;
|
||||||
uint8_t MEM_MODE;
|
uint8_t MEM_MODE;
|
||||||
@@ -51,13 +53,12 @@ typedef struct {
|
|||||||
uint8_t SMPL_SETUP;
|
uint8_t SMPL_SETUP;
|
||||||
uint8_t SMPL_WIN;
|
uint8_t SMPL_WIN;
|
||||||
uint8_t ADC_TRIG;
|
uint8_t ADC_TRIG;
|
||||||
uint16_t EXTTRIG_SEL;
|
|
||||||
bool CALIB_OFFSET_VALID;
|
|
||||||
bool CALIB_KD_VALID;
|
|
||||||
uint8_t DMA_EN;
|
uint8_t DMA_EN;
|
||||||
uint16_t IE_CHx_EOC;
|
|
||||||
uint8_t IE_FIFO_HFULL;
|
uint8_t IE_FIFO_HFULL;
|
||||||
uint8_t IE_FIFO_FULL;
|
uint8_t IE_FIFO_FULL;
|
||||||
|
bool CALIB_OFFSET_VALID;
|
||||||
|
bool CALIB_KD_VALID;
|
||||||
|
uint8_t _pad[1];
|
||||||
} ADC_Config_t;
|
} ADC_Config_t;
|
||||||
|
|
||||||
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
uint8_t ADC_GetChannelNumber(ADC_CH_MASK Mask);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ static void AES_Setup_ENC_CBC(bool IsDecrypt, const void *pKey, const void *pIv)
|
|||||||
const uint32_t *pK = (const uint32_t *)pKey;
|
const uint32_t *pK = (const uint32_t *)pKey;
|
||||||
const uint32_t *pI = (const uint32_t *)pIv;
|
const uint32_t *pI = (const uint32_t *)pIv;
|
||||||
|
|
||||||
|
(void)IsDecrypt; // unused
|
||||||
|
|
||||||
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
|
AES_CR = (AES_CR & ~AES_CR_EN_MASK) | AES_CR_EN_BITS_DISABLE;
|
||||||
AES_CR = AES_CR_CHMOD_BITS_CBC;
|
AES_CR = AES_CR_CHMOD_BITS_CBC;
|
||||||
AES_KEYR3 = pK[0];
|
AES_KEYR3 = pK[0];
|
||||||
|
|||||||
@@ -16,21 +16,26 @@
|
|||||||
|
|
||||||
#include "backlight.h"
|
#include "backlight.h"
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
|
#include "bsp/dp32g030/pwmplus.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
// this is decremented once every 500ms
|
// this is decremented once every 500ms
|
||||||
uint16_t gBacklightCountdown = 0;
|
uint16_t gBacklightCountdown = 0;
|
||||||
|
bool backlightOn;
|
||||||
|
|
||||||
void BACKLIGHT_TurnOn(void)
|
void BACKLIGHT_TurnOn(void)
|
||||||
{
|
{
|
||||||
if (gEeprom.BACKLIGHT == 0)
|
if (gEeprom.BACKLIGHT_TIME != 0) {
|
||||||
|
backlightOn = true;
|
||||||
|
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MAX);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BACKLIGHT_TurnOff();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// turn the backlight ON
|
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT);
|
|
||||||
|
|
||||||
switch (gEeprom.BACKLIGHT)
|
switch (gEeprom.BACKLIGHT_TIME)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 1: // 5 sec
|
case 1: // 5 sec
|
||||||
@@ -58,3 +63,21 @@ void BACKLIGHT_TurnOn(void)
|
|||||||
|
|
||||||
gBacklightCountdown *= 2;
|
gBacklightCountdown *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BACKLIGHT_TurnOff()
|
||||||
|
{
|
||||||
|
BACKLIGHT_SetBrightness(gEeprom.BACKLIGHT_MIN);
|
||||||
|
gBacklightCountdown = 0;
|
||||||
|
backlightOn = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BACKLIGHT_IsOn()
|
||||||
|
{
|
||||||
|
return backlightOn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BACKLIGHT_SetBrightness(uint8_t brigtness)
|
||||||
|
{
|
||||||
|
PWM_PLUS0_CH0_COMP = (1 << brigtness) - 1;
|
||||||
|
//PWM_PLUS0_SWLOAD = 1;
|
||||||
|
}
|
||||||
@@ -18,10 +18,15 @@
|
|||||||
#define DRIVER_BACKLIGHT_H
|
#define DRIVER_BACKLIGHT_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern uint16_t gBacklightCountdown;
|
extern uint16_t gBacklightCountdown;
|
||||||
|
extern uint8_t gBacklightBrightness;
|
||||||
|
|
||||||
void BACKLIGHT_TurnOn(void);
|
void BACKLIGHT_TurnOn();
|
||||||
|
void BACKLIGHT_TurnOff();
|
||||||
|
bool BACKLIGHT_IsOn();
|
||||||
|
void BACKLIGHT_SetBrightness(uint8_t brigtness);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -95,13 +95,12 @@ enum BK4819_REGISTER_t {
|
|||||||
typedef enum BK4819_REGISTER_t BK4819_REGISTER_t;
|
typedef enum BK4819_REGISTER_t BK4819_REGISTER_t;
|
||||||
|
|
||||||
enum BK4819_GPIO_PIN_t {
|
enum BK4819_GPIO_PIN_t {
|
||||||
BK4819_GPIO6_PIN2 = 0,
|
BK4819_GPIO0_PIN28_RX_ENABLE = 0,
|
||||||
BK4819_GPIO5_PIN1 = 1,
|
BK4819_GPIO1_PIN29_PA_ENABLE = 1,
|
||||||
BK4819_GPIO4_PIN32 = 2,
|
BK4819_GPIO3_PIN31_UHF_LNA = 3,
|
||||||
BK4819_GPIO3_PIN31 = 3,
|
BK4819_GPIO4_PIN32_VHF_LNA = 4,
|
||||||
BK4819_GPIO2_PIN30 = 4,
|
BK4819_GPIO5_PIN1_RED = 5,
|
||||||
BK4819_GPIO1_PIN29_RED = 5,
|
BK4819_GPIO6_PIN2_GREEN = 6,
|
||||||
BK4819_GPIO0_PIN28_GREEN = 6,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BK4819_GPIO_PIN_t BK4819_GPIO_PIN_t;
|
typedef enum BK4819_GPIO_PIN_t BK4819_GPIO_PIN_t;
|
||||||
|
|||||||
1201
driver/bk4819.c
@@ -24,22 +24,22 @@
|
|||||||
|
|
||||||
enum BK4819_AF_Type_t
|
enum BK4819_AF_Type_t
|
||||||
{
|
{
|
||||||
BK4819_AF_MUTE = 0u,
|
BK4819_AF_MUTE = 0u, //
|
||||||
BK4819_AF_OPEN = 1u,
|
BK4819_AF_FM = 1u, // FM
|
||||||
BK4819_AF_ALAM = 2u,
|
BK4819_AF_ALAM = 2u, //
|
||||||
BK4819_AF_BEEP = 3u,
|
BK4819_AF_BEEP = 3u, //
|
||||||
BK4819_AF_UNKNOWN1 = 4u,
|
BK4819_AF_BASEBAND1 = 4u, // SSB
|
||||||
BK4819_AF_UNKNOWN2 = 5u,
|
BK4819_AF_BASEBAND2 = 5u, // SSB
|
||||||
BK4819_AF_CTCO = 6u,
|
BK4819_AF_CTCO = 6u, // strange LF audio .. maybe the CTCSS LF line ?
|
||||||
BK4819_AF_AM = 7u,
|
BK4819_AF_AM = 7u, // AM
|
||||||
BK4819_AF_FSKO = 8u,
|
BK4819_AF_FSKO = 8u, // nothing
|
||||||
BK4819_AF_UNKNOWN3 = 9u,
|
BK4819_AF_UNKNOWN3 = 9u, // distorted
|
||||||
BK4819_AF_UNKNOWN4 = 10u,
|
BK4819_AF_UNKNOWN4 = 10u, // nothing at all
|
||||||
BK4819_AF_UNKNOWN5 = 11u,
|
BK4819_AF_UNKNOWN5 = 11u, // distorted
|
||||||
BK4819_AF_UNKNOWN6 = 12u,
|
BK4819_AF_UNKNOWN6 = 12u, // distorted
|
||||||
BK4819_AF_UNKNOWN7 = 13u,
|
BK4819_AF_UNKNOWN7 = 13u, // interesting
|
||||||
BK4819_AF_UNKNOWN8 = 14u,
|
BK4819_AF_UNKNOWN8 = 14u, // interesting
|
||||||
BK4819_AF_UNKNOWN9 = 15u
|
BK4819_AF_UNKNOWN9 = 15u // not a lot
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
typedef enum BK4819_AF_Type_t BK4819_AF_Type_t;
|
||||||
@@ -70,7 +70,8 @@ void BK4819_WriteRegister(BK4819_REGISTER_t Register, uint16_t Data);
|
|||||||
void BK4819_WriteU8(uint8_t Data);
|
void BK4819_WriteU8(uint8_t Data);
|
||||||
void BK4819_WriteU16(uint16_t Data);
|
void BK4819_WriteU16(uint16_t Data);
|
||||||
|
|
||||||
void BK4819_SetAGC(uint8_t Value);
|
void BK4819_EnableAGC();
|
||||||
|
void BK4819_DisableAGC();
|
||||||
|
|
||||||
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
void BK4819_ToggleGpioOut(BK4819_GPIO_PIN_t Pin, bool bSet);
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ void BK4819_DisableVox(void);
|
|||||||
void BK4819_DisableDTMF(void);
|
void BK4819_DisableDTMF(void);
|
||||||
void BK4819_EnableDTMF(void);
|
void BK4819_EnableDTMF(void);
|
||||||
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
void BK4819_PlayTone(uint16_t Frequency, bool bTuningGainSwitch);
|
||||||
|
void BK4819_PlaySingleTone(const unsigned int tone_Hz, const unsigned int delay, const unsigned int level, const bool play_speaker);
|
||||||
void BK4819_EnterTxMute(void);
|
void BK4819_EnterTxMute(void);
|
||||||
void BK4819_ExitTxMute(void);
|
void BK4819_ExitTxMute(void);
|
||||||
void BK4819_Sleep(void);
|
void BK4819_Sleep(void);
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "driver/eeprom.h"
|
#include "driver/eeprom.h"
|
||||||
#include "driver/i2c.h"
|
#include "driver/i2c.h"
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
@@ -38,16 +41,22 @@ void EEPROM_ReadBuffer(uint16_t Address, void *pBuffer, uint8_t Size)
|
|||||||
|
|
||||||
void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer)
|
void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer)
|
||||||
{
|
{
|
||||||
I2C_Start();
|
if (pBuffer == NULL || Address >= 0x2000)
|
||||||
|
return;
|
||||||
|
|
||||||
I2C_Write(0xA0);
|
|
||||||
|
|
||||||
I2C_Write((Address >> 8) & 0xFF);
|
uint8_t buffer[8];
|
||||||
I2C_Write((Address >> 0) & 0xFF);
|
EEPROM_ReadBuffer(Address, buffer, 8);
|
||||||
|
if (memcmp(pBuffer, buffer, 8) != 0)
|
||||||
|
{
|
||||||
|
I2C_Start();
|
||||||
|
I2C_Write(0xA0);
|
||||||
|
I2C_Write((Address >> 8) & 0xFF);
|
||||||
|
I2C_Write((Address >> 0) & 0xFF);
|
||||||
|
I2C_WriteBuffer(pBuffer, 8);
|
||||||
|
I2C_Stop();
|
||||||
|
}
|
||||||
|
|
||||||
I2C_WriteBuffer(pBuffer, 8);
|
// give the EEPROM time to burn the data in (apparently takes 5ms)
|
||||||
|
SYSTEM_DelayMs(8);
|
||||||
I2C_Stop();
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(10);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,10 +58,10 @@ enum GPIOC_PINS {
|
|||||||
GPIOC_PIN_PTT = 5
|
GPIOC_PIN_PTT = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_ClearBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||||
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
|
uint8_t GPIO_CheckBit(volatile uint32_t *pReg, uint8_t Bit);
|
||||||
void GPIO_FlipBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_FlipBit( volatile uint32_t *pReg, uint8_t Bit);
|
||||||
void GPIO_SetBit(volatile uint32_t *pReg, uint8_t Bit);
|
void GPIO_SetBit( volatile uint32_t *pReg, uint8_t Bit);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,182 +19,141 @@
|
|||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/keyboard.h"
|
#include "driver/keyboard.h"
|
||||||
#include "driver/systick.h"
|
#include "driver/systick.h"
|
||||||
|
#include "driver/i2c.h"
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
KEY_Code_t gKeyReading0 = KEY_INVALID;
|
||||||
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
KEY_Code_t gKeyReading1 = KEY_INVALID;
|
||||||
uint16_t gDebounceCounter;
|
uint16_t gDebounceCounter = 0;
|
||||||
bool gWasFKeyPressed;
|
bool gWasFKeyPressed = false;
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
|
||||||
|
// Using a 16 bit pre-calculated shift and invert is cheaper
|
||||||
|
// than using 8 bit and doing shift and invert in code.
|
||||||
|
uint16_t set_to_zero_mask;
|
||||||
|
|
||||||
|
// We are very fortunate.
|
||||||
|
// The key and pin defines fit together in a single u8, making this very efficient
|
||||||
|
struct {
|
||||||
|
KEY_Code_t key : 5;
|
||||||
|
uint8_t pin : 3; // Pin 6 is highest
|
||||||
|
} pins[4];
|
||||||
|
|
||||||
|
} keyboard[] = {
|
||||||
|
|
||||||
|
{ // Zero row
|
||||||
|
// Set to zero to handle special case of nothing pulled down
|
||||||
|
.set_to_zero_mask = 0xffff,
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_SIDE1, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_SIDE2, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
|
||||||
|
// Duplicate to fill the array with valid values
|
||||||
|
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_INVALID, .pin = GPIOA_PIN_KEYBOARD_1}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ // First row
|
||||||
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_4) & 0xffff,
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_MENU, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_1, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_4, .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_7, .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ // Second row
|
||||||
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_5) & 0xffff,
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_UP, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_2 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_5 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_8 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ // Third row
|
||||||
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_6) & 0xffff,
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_DOWN, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_3 , .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_6 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_9 , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ // Fourth row
|
||||||
|
.set_to_zero_mask = ~(1u << GPIOA_PIN_KEYBOARD_7) & 0xffff,
|
||||||
|
.pins = {
|
||||||
|
{ .key = KEY_EXIT, .pin = GPIOA_PIN_KEYBOARD_0},
|
||||||
|
{ .key = KEY_STAR, .pin = GPIOA_PIN_KEYBOARD_1},
|
||||||
|
{ .key = KEY_0 , .pin = GPIOA_PIN_KEYBOARD_2},
|
||||||
|
{ .key = KEY_F , .pin = GPIOA_PIN_KEYBOARD_3}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
KEY_Code_t KEYBOARD_Poll(void)
|
KEY_Code_t KEYBOARD_Poll(void)
|
||||||
{
|
{
|
||||||
KEY_Code_t Key = KEY_INVALID;
|
KEY_Code_t Key = KEY_INVALID;
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
// if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
// return KEY_PTT;
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
|
||||||
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
// *****************
|
// *****************
|
||||||
// Keys connected to gnd
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
for (unsigned int j = 0; j < ARRAY_SIZE(keyboard); j++)
|
||||||
{
|
{
|
||||||
Key = KEY_SIDE1;
|
uint16_t reg;
|
||||||
goto Bye;
|
unsigned int i;
|
||||||
|
unsigned int k;
|
||||||
|
|
||||||
|
// Set all high
|
||||||
|
GPIOA->DATA |= 1u << GPIOA_PIN_KEYBOARD_4 |
|
||||||
|
1u << GPIOA_PIN_KEYBOARD_5 |
|
||||||
|
1u << GPIOA_PIN_KEYBOARD_6 |
|
||||||
|
1u << GPIOA_PIN_KEYBOARD_7;
|
||||||
|
|
||||||
|
// Clear the pin we are selecting
|
||||||
|
GPIOA->DATA &= keyboard[j].set_to_zero_mask;
|
||||||
|
|
||||||
|
// Read all 4 GPIO pins at once .. with de-noise, max of 8 sample loops
|
||||||
|
for (i = 0, k = 0, reg = 0; i < 3 && k < 8; i++, k++)
|
||||||
|
{
|
||||||
|
uint16_t reg2;
|
||||||
|
|
||||||
|
SYSTICK_DelayUs(1);
|
||||||
|
|
||||||
|
reg2 = GPIOA->DATA;
|
||||||
|
if (reg != reg2)
|
||||||
|
{ // noise
|
||||||
|
reg = reg2;
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i < 3)
|
||||||
|
break; // noise is too bad
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < ARRAY_SIZE(keyboard[j].pins); i++)
|
||||||
|
{
|
||||||
|
const uint16_t mask = 1u << keyboard[j].pins[i].pin;
|
||||||
|
if (!(reg & mask))
|
||||||
|
{
|
||||||
|
Key = keyboard[j].pins[i].key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Key != KEY_INVALID)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
// Create I2C stop condition since we might have toggled I2C pins
|
||||||
{
|
// This leaves GPIOA_PIN_KEYBOARD_4 and GPIOA_PIN_KEYBOARD_5 high
|
||||||
Key = KEY_SIDE2;
|
I2C_Stop();
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Original doesn't do PTT
|
|
||||||
|
|
||||||
// *****************
|
|
||||||
// First row
|
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
|
||||||
{
|
|
||||||
Key = KEY_MENU;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
|
||||||
{
|
|
||||||
Key = KEY_1;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
|
||||||
{
|
|
||||||
Key = KEY_4;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
|
||||||
{
|
|
||||||
Key = KEY_7;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************
|
|
||||||
// Second row
|
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
|
||||||
{
|
|
||||||
Key = KEY_UP;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
|
||||||
{
|
|
||||||
Key = KEY_2;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
|
||||||
{
|
|
||||||
Key = KEY_5;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
|
||||||
{
|
|
||||||
Key = KEY_8;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************
|
|
||||||
// Third row
|
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
|
// Reset VOICE pins
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
||||||
SYSTICK_DelayUs(1);
|
GPIO_SetBit( &GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
|
||||||
{
|
|
||||||
Key = KEY_DOWN;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
|
||||||
{
|
|
||||||
Key = KEY_3;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
|
||||||
{
|
|
||||||
Key = KEY_6;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
|
||||||
{
|
|
||||||
Key = KEY_9;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************
|
|
||||||
// Fourth row
|
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
|
||||||
SYSTICK_DelayUs(1);
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_0))
|
|
||||||
{
|
|
||||||
Key = KEY_EXIT;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_1))
|
|
||||||
{
|
|
||||||
Key = KEY_STAR;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_2))
|
|
||||||
{
|
|
||||||
Key = KEY_0;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GPIO_CheckBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_3))
|
|
||||||
{
|
|
||||||
Key = KEY_F;
|
|
||||||
goto Bye;
|
|
||||||
}
|
|
||||||
|
|
||||||
// *****************
|
|
||||||
|
|
||||||
Bye:
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_4);
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_5);
|
|
||||||
GPIO_ClearBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_6);
|
|
||||||
GPIO_SetBit(&GPIOA->DATA, GPIOA_PIN_KEYBOARD_7);
|
|
||||||
|
|
||||||
return Key;
|
return Key;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,30 +21,29 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
enum KEY_Code_t {
|
enum KEY_Code_e {
|
||||||
KEY_0 = 0,
|
KEY_0 = 0, // 0
|
||||||
KEY_1 = 1,
|
KEY_1, // 1
|
||||||
KEY_2 = 2,
|
KEY_2, // 2
|
||||||
KEY_3 = 3,
|
KEY_3, // 3
|
||||||
KEY_4 = 4,
|
KEY_4, // 4
|
||||||
KEY_5 = 5,
|
KEY_5, // 5
|
||||||
KEY_6 = 6,
|
KEY_6, // 6
|
||||||
KEY_7 = 7,
|
KEY_7, // 7
|
||||||
KEY_8 = 8,
|
KEY_8, // 8
|
||||||
KEY_9 = 9,
|
KEY_9, // 9
|
||||||
KEY_MENU = 10,
|
KEY_MENU, // A
|
||||||
KEY_UP = 11,
|
KEY_UP, // B
|
||||||
KEY_DOWN = 12,
|
KEY_DOWN, // C
|
||||||
KEY_EXIT = 13,
|
KEY_EXIT, // D
|
||||||
KEY_STAR = 14,
|
KEY_STAR, // *
|
||||||
KEY_F = 15,
|
KEY_F, // #
|
||||||
KEY_PTT = 21,
|
KEY_PTT, //
|
||||||
KEY_SIDE2 = 22,
|
KEY_SIDE2, //
|
||||||
KEY_SIDE1 = 23,
|
KEY_SIDE1, //
|
||||||
KEY_INVALID = 255
|
KEY_INVALID //
|
||||||
};
|
};
|
||||||
|
typedef enum KEY_Code_e KEY_Code_t;
|
||||||
typedef enum KEY_Code_t KEY_Code_t;
|
|
||||||
|
|
||||||
extern KEY_Code_t gKeyReading0;
|
extern KEY_Code_t gKeyReading0;
|
||||||
extern KEY_Code_t gKeyReading1;
|
extern KEY_Code_t gKeyReading1;
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ void SPI_Configure(volatile SPI_Port_t *pPort, SPI_Config_t *pConfig)
|
|||||||
|
|
||||||
if (pPort->IE) {
|
if (pPort->IE) {
|
||||||
if (pPort == SPI0) {
|
if (pPort == SPI0) {
|
||||||
NVIC_EnableIRQ(DP32_SPI0_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SPI0_IRQn);
|
||||||
} else if (pPort == SPI1) {
|
} else if (pPort == SPI1) {
|
||||||
NVIC_EnableIRQ(DP32_SPI1_IRQn);
|
NVIC_EnableIRQ((IRQn_Type)DP32_SPI1_IRQn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,10 +82,10 @@ void ST7565_BlitFullScreen(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// whats the delay for I wonder ? .. it slows down scanning :(
|
// whats the delay for I wonder, it holds things up :(
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
#else
|
#else
|
||||||
SYSTEM_DelayMs(1);
|
// SYSTEM_DelayMs(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
@@ -119,7 +119,11 @@ void ST7565_FillScreen(uint8_t Value)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
// reset some of the displays settings to try and overcome the radios hardware problem - RF corrupting the display
|
||||||
|
ST7565_Init(false);
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
@@ -132,21 +136,27 @@ void ST7565_FillScreen(uint8_t Value)
|
|||||||
}
|
}
|
||||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||||
}
|
}
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7565_Init(void)
|
void ST7565_Init(const bool full)
|
||||||
{
|
{
|
||||||
SPI0_Init();
|
if (full)
|
||||||
|
{
|
||||||
ST7565_Configure_GPIO_B11();
|
SPI0_Init();
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, false);
|
ST7565_HardwareReset();
|
||||||
|
|
||||||
ST7565_WriteByte(0xE2); // internal reset
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
SYSTEM_DelayMs(120);
|
ST7565_WriteByte(0xE2); // internal reset
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(120);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SPI_ToggleMasterMode(&SPI0->CR, false);
|
||||||
|
|
||||||
ST7565_WriteByte(0xA2); // bias 9
|
ST7565_WriteByte(0xA2); // bias 9
|
||||||
ST7565_WriteByte(0xC0); // com normal
|
ST7565_WriteByte(0xC0); // com normal
|
||||||
ST7565_WriteByte(0xA1); // reverse ?
|
ST7565_WriteByte(0xA1); // reverse ?
|
||||||
@@ -157,33 +167,39 @@ void ST7565_Init(void)
|
|||||||
ST7565_WriteByte(0xA4); // all points normal
|
ST7565_WriteByte(0xA4); // all points normal
|
||||||
ST7565_WriteByte(0x24); //
|
ST7565_WriteByte(0x24); //
|
||||||
ST7565_WriteByte(0x81); // volume first ?
|
ST7565_WriteByte(0x81); // volume first ?
|
||||||
|
|
||||||
ST7565_WriteByte(0x1f); // contrast ?
|
ST7565_WriteByte(0x1f); // contrast ?
|
||||||
ST7565_WriteByte(0x2B); // power control ?
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(1);
|
|
||||||
|
|
||||||
ST7565_WriteByte(0x2E); // power control ?
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(1);
|
|
||||||
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
ST7565_WriteByte(0x2F); //
|
|
||||||
|
|
||||||
SYSTEM_DelayMs(40);
|
|
||||||
|
|
||||||
|
if (full)
|
||||||
|
{
|
||||||
|
ST7565_WriteByte(0x2B); // power control ?
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(1);
|
||||||
|
|
||||||
|
ST7565_WriteByte(0x2E); // power control ?
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(1);
|
||||||
|
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
ST7565_WriteByte(0x2F); //
|
||||||
|
|
||||||
|
SYSTEM_DelayMs(40);
|
||||||
|
}
|
||||||
|
|
||||||
ST7565_WriteByte(0x40); // start line ?
|
ST7565_WriteByte(0x40); // start line ?
|
||||||
ST7565_WriteByte(0xAF); // display on ?
|
ST7565_WriteByte(0xAF); // display on ?
|
||||||
|
|
||||||
SPI_WaitForUndocumentedTxFifoStatusBit();
|
SPI_WaitForUndocumentedTxFifoStatusBit();
|
||||||
|
|
||||||
SPI_ToggleMasterMode(&SPI0->CR, true);
|
SPI_ToggleMasterMode(&SPI0->CR, true);
|
||||||
|
|
||||||
ST7565_FillScreen(0x00);
|
if (full)
|
||||||
|
ST7565_FillScreen(0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ST7565_Configure_GPIO_B11(void)
|
void ST7565_HardwareReset(void)
|
||||||
{
|
{
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES);
|
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_ST7565_RES);
|
||||||
SYSTEM_DelayMs(1);
|
SYSTEM_DelayMs(1);
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ void ST7565_DrawLine(const unsigned int Column, const unsigned int Line, const u
|
|||||||
void ST7565_BlitFullScreen(void);
|
void ST7565_BlitFullScreen(void);
|
||||||
void ST7565_BlitStatusLine(void);
|
void ST7565_BlitStatusLine(void);
|
||||||
void ST7565_FillScreen(uint8_t Value);
|
void ST7565_FillScreen(uint8_t Value);
|
||||||
void ST7565_Init(void);
|
void ST7565_Init(const bool full);
|
||||||
void ST7565_Configure_GPIO_B11(void);
|
void ST7565_HardwareReset(void);
|
||||||
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
void ST7565_SelectColumnAndLine(uint8_t Column, uint8_t Line);
|
||||||
void ST7565_WriteByte(uint8_t Value);
|
void ST7565_WriteByte(uint8_t Value);
|
||||||
|
|
||||||
|
|||||||
@@ -29,26 +29,17 @@ void SYSTICK_Init(void)
|
|||||||
|
|
||||||
void SYSTICK_DelayUs(uint32_t Delay)
|
void SYSTICK_DelayUs(uint32_t Delay)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
const uint32_t ticks = Delay * gTickMultiplier;
|
||||||
uint32_t Start;
|
uint32_t i = 0;
|
||||||
uint32_t Previous;
|
uint32_t Start = SysTick->LOAD;
|
||||||
uint32_t Current;
|
uint32_t Previous = SysTick->VAL;
|
||||||
uint32_t Delta;
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
Start = SysTick->LOAD;
|
|
||||||
Previous = SysTick->VAL;
|
|
||||||
do {
|
do {
|
||||||
do {
|
uint32_t Current;
|
||||||
Current = SysTick->VAL;
|
uint32_t Delta;
|
||||||
} while (Current == Previous);
|
while ((Current = SysTick->VAL) == Previous) {}
|
||||||
if (Current < Previous) {
|
Delta = (Current < Previous) ? -Current : Start - Current;
|
||||||
Delta = -Current;
|
i += Delta + Previous;
|
||||||
} else {
|
|
||||||
Delta = Start - Current;
|
|
||||||
}
|
|
||||||
i += Delta + Previous;
|
|
||||||
Previous = Current;
|
Previous = Current;
|
||||||
} while (i < Delay * gTickMultiplier);
|
} while (i < ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ SECTIONS
|
|||||||
.text :
|
.text :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
*(.text.isr) /* .text sections of code */
|
KEEP(*(.text.isr)) /* .text sections of code */
|
||||||
*(.text) /* .text sections of code */
|
*(.text) /* .text sections of code */
|
||||||
*(.text*) /* .text* sections of code */
|
*(.text*) /* .text* sections of code */
|
||||||
*(.rodata) /* .rodata sections */
|
*(.rodata) /* .rodata sections */
|
||||||
|
|||||||
698
font.c
@@ -16,105 +16,204 @@
|
|||||||
|
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
//const uint8_t gFontBig[95][16] =
|
// removed last and middle column which was all 0x00
|
||||||
const uint8_t gFontBig[95][15] =
|
// also the space char is not needed
|
||||||
|
const uint8_t gFontBig[95 - 1][16 - 2] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
#if 0
|
||||||
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // ' '
|
||||||
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
{0x00, 0x00, 0x70, 0xF8, 0xF8, 0x70, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '!'
|
||||||
{0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, 0x00, 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
|
{0x00, 0x1E, 0x3E, 0x00, 0x00, 0x3E, 0x1E, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '"'
|
||||||
{0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, 0x00, 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
|
{0x40, 0xF0, 0xF0, 0x40, 0xF0, 0xF0, 0x40, /*0x00,*/ 0x04, 0x1F, 0x1F, 0x04, 0x1F, 0x1F, 0x04}, // , 0x00}, // '#'
|
||||||
{0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x00, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
|
{0x70, 0xF8, 0x88, 0x8F, 0x8F, 0x98, 0x30, /*0x00,*/ 0x06, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // , 0x00}, // '$'
|
||||||
{0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
|
{0x60, 0x60, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x18, 0x18}, // , 0x00}, // '%'
|
||||||
{0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
|
{0x00, 0xB0, 0xF8, 0xC8, 0x78, 0xB0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // '&'
|
||||||
{0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
|
{0x00, 0x20, 0x3E, 0x1E, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '''
|
||||||
{0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
|
{0x00, 0x00, 0xE0, 0xF0, 0x18, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x00}, // , 0x00}, // '('
|
||||||
{0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, 0x00, 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
|
{0x00, 0x00, 0x08, 0x18, 0xF0, 0xE0, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x00}, // , 0x00}, // ')'
|
||||||
{0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
|
{0x00, 0x40, 0xC0, 0x80, 0x80, 0xC0, 0x40, /*0x00,*/ 0x01, 0x05, 0x07, 0x03, 0x03, 0x07, 0x05}, // , 0x01}, // '*'
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
|
{0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, /*0x00,*/ 0x00, 0x01, 0x01, 0x07, 0x07, 0x01, 0x01}, // , 0x00}, // '+'
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x20, 0x3C, 0x1C, 0x00, 0x00}, // , 0x00}, // ','
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}, // , 0x00}, // '-'
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x00, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}, // , 0x00}, // '.'
|
||||||
{0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, 0x00, 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
|
{0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, /*0x00,*/ 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // , 0x00}, // '/'
|
||||||
{0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
|
{0xF0, 0xF8, 0x08, 0x88, 0x48, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x12, 0x11, 0x10, 0x1F, 0x0F}, // , 0x00}, // '0'
|
||||||
{0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, 0x00, 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
|
{0x00, 0x20, 0x30, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x10, 0x10}, // , 0x00}, // '1'
|
||||||
{0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
|
{0x10, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x18}, // , 0x00}, // '2'
|
||||||
{0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, 0x00, 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
|
{0x10, 0x18, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '3'
|
||||||
{0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, 0x00, 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
|
{0x80, 0xC0, 0x60, 0x30, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x01, 0x01, 0x01, 0x11, 0x1F, 0x1F, 0x11}, // , 0x00}, // '4'
|
||||||
{0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
|
{0xF8, 0xF8, 0x88, 0x88, 0x88, 0x88, 0x08, /*0x00,*/ 0x08, 0x18, 0x10, 0x10, 0x11, 0x1F, 0x0F}, // , 0x00}, // '5'
|
||||||
{0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
|
{0xE0, 0xF0, 0x98, 0x88, 0x88, 0x80, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '6'
|
||||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
|
{0x18, 0x18, 0x08, 0x08, 0x88, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x1E, 0x1F, 0x01, 0x00, 0x00}, // , 0x00}, // '7'
|
||||||
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, 0x00, 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
|
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // '8'
|
||||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
|
{0x70, 0xF8, 0x88, 0x88, 0x88, 0xF8, 0xF0, /*0x00,*/ 0x00, 0x10, 0x10, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // '9'
|
||||||
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
|
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // , 0x00}, // ':'
|
||||||
{0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
|
{0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1C, 0x0C, 0x00, 0x00}, // , 0x00}, // ';'
|
||||||
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
|
{0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, 0x10, /*0x00,*/ 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x10}, // , 0x00}, // '<'
|
||||||
{0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
|
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04}, // , 0x00}, // '='
|
||||||
{0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
|
{0x00, 0x10, 0x30, 0x60, 0xC0, 0x80, 0x00, /*0x00,*/ 0x00, 0x10, 0x18, 0x0C, 0x06, 0x03, 0x01}, // , 0x00}, // '>'
|
||||||
{0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, 0x00, 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
|
{0x30, 0x38, 0x08, 0x88, 0xC8, 0x78, 0x30, /*0x00,*/ 0x00, 0x00, 0x00, 0x1B, 0x1B, 0x00, 0x00}, // , 0x00}, // '?'
|
||||||
{0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, 0x00, 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
|
{0xE0, 0xF0, 0x10, 0x90, 0x90, 0xF0, 0xE0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x17, 0x17, 0x17, 0x03}, // , 0x00}, // '@'
|
||||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
|
{0xC0, 0xE0, 0x30, 0x18, 0x30, 0xE0, 0xC0, /*0x00,*/ 0x1F, 0x1F, 0x01, 0x01, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'A'
|
||||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
|
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'B'
|
||||||
{0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
|
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x10, 0x18, 0x0C}, // , 0x00}, // 'C'
|
||||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
|
{0x08, 0xF8, 0xF8, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'D'
|
||||||
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
|
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x11, 0x18, 0x1C}, // , 0x00}, // 'E'
|
||||||
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, 0x00, 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
|
{0x08, 0xF8, 0xF8, 0x88, 0xC8, 0x18, 0x38, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x01, 0x00, 0x00}, // , 0x00}, // 'F'
|
||||||
{0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
|
{0xE0, 0xF0, 0x18, 0x08, 0x08, 0x18, 0x30, /*0x00,*/ 0x07, 0x0F, 0x18, 0x11, 0x11, 0x0F, 0x1F}, // , 0x00}, // 'G'
|
||||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
|
{0xF8, 0xF8, 0x80, 0x80, 0x80, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'H'
|
||||||
{0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
|
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'I'
|
||||||
{0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, 0x00, 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
|
{0x00, 0x00, 0x00, 0x08, 0xF8, 0xF8, 0x08, /*0x00,*/ 0x0E, 0x1E, 0x10, 0x10, 0x1F, 0x0F, 0x00}, // , 0x00}, // 'J'
|
||||||
{0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
|
{0x08, 0xF8, 0xF8, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x01, 0x03, 0x1E, 0x1C}, // , 0x00}, // 'K'
|
||||||
{0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
|
{0x08, 0xF8, 0xF8, 0x08, 0x00, 0x00, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x10, 0x18, 0x1C}, // , 0x00}, // 'L'
|
||||||
{0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
|
{0xF8, 0xF8, 0x70, 0xE0, 0x70, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'M'
|
||||||
{0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, 0x00, 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
|
{0xF8, 0xF8, 0x70, 0xE0, 0xC0, 0xF8, 0xF8, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x00, 0x01, 0x1F, 0x1F}, // , 0x00}, // 'N'
|
||||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
|
{0xE0, 0xF0, 0x18, 0x08, 0x18, 0xF0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x18, 0x10, 0x18, 0x0F, 0x07}, // , 0x00}, // 'O'
|
||||||
{0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, 0x00, 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
|
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'P'
|
||||||
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, 0x00, 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
|
{0xF0, 0xF8, 0x08, 0x08, 0x08, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x1C, 0x78, 0x7F, 0x4F}, // , 0x00}, // 'Q'
|
||||||
{0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, 0x00, 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
|
{0x08, 0xF8, 0xF8, 0x88, 0x88, 0xF8, 0x70, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x01, 0x1F, 0x1E}, // , 0x00}, // 'R'
|
||||||
{0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
|
{0x30, 0x78, 0xC8, 0x88, 0x88, 0x38, 0x30, /*0x00,*/ 0x0C, 0x1C, 0x10, 0x10, 0x11, 0x1F, 0x0E}, // , 0x00}, // 'S'
|
||||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
|
{0x00, 0x38, 0x18, 0xF8, 0xF8, 0x18, 0x38, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'T'
|
||||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
|
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'U'
|
||||||
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0x00, 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
|
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x03, 0x07, 0x0C, 0x18, 0x0C, 0x07, 0x03}, // , 0x00}, // 'V'
|
||||||
{0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, 0x00, 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
|
{0xF8, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, /*0x00,*/ 0x07, 0x1F, 0x1C, 0x07, 0x1C, 0x1F, 0x07}, // , 0x00}, // 'W'
|
||||||
{0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
|
{0x18, 0x78, 0xE0, 0x80, 0xE0, 0x78, 0x18, /*0x00,*/ 0x18, 0x1E, 0x07, 0x01, 0x07, 0x1E, 0x18}, // , 0x00}, // 'X'
|
||||||
{0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, 0x00, 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
|
{0x00, 0x78, 0xF8, 0x80, 0x80, 0xF8, 0x78, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'Y'
|
||||||
{0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
|
{0x38, 0x18, 0x08, 0x88, 0xC8, 0x78, 0x38, /*0x00,*/ 0x1C, 0x1E, 0x13, 0x11, 0x10, 0x18, 0x1C}, // , 0x00}, // 'Z'
|
||||||
{0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
|
{0x00, 0x00, 0xF8, 0xF8, 0x08, 0x08, 0x00, /*0x00,*/ 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x00}, // , 0x00}, // '['
|
||||||
{0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
|
{0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E, 0x1C}, // , 0x00}, // '"\'
|
||||||
{0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
|
{0x00, 0x00, 0x08, 0x08, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x10, 0x1F, 0x1F, 0x00}, // , 0x00}, // ']'
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
|
{0x10, 0x18, 0x0E, 0x07, 0x0E, 0x18, 0x10, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '^'
|
||||||
{0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40}, // , 0x40}, // '_'
|
||||||
{0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
|
{0x00, 0x00, 0x07, 0x0F, 0x08, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // , 0x00}, // '`'
|
||||||
{0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
|
{0x00, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x0E, 0x1F, 0x11, 0x11, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'a'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
|
{0x08, 0xF8, 0xF8, 0x40, 0xC0, 0x80, 0x00, /*0x00,*/ 0x10, 0x1F, 0x0F, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'b'
|
||||||
{0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
|
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x18, 0x08}, // , 0x00}, // 'c'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
|
{0x00, 0x80, 0xC0, 0x48, 0xF8, 0xF8, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'd'
|
||||||
{0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
|
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x11, 0x11, 0x11, 0x19, 0x09}, // , 0x00}, // 'e'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, 0x00, 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
|
{0x80, 0xF0, 0xF8, 0x88, 0x18, 0x30, 0x00, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x00}, // , 0x00}, // 'f'
|
||||||
{0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, 0x00, 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
|
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x4F, 0xDF, 0x90, 0x90, 0xFF, 0x7F, 0x00}, // , 0x00}, // 'g'
|
||||||
{0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
|
{0x08, 0xF8, 0xF8, 0x80, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'h'
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
|
{0x00, 0x00, 0x40, 0xD8, 0xD8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'i'
|
||||||
{0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, 0x00, 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
|
{0x00, 0x00, 0x00, 0x00, 0x40, 0xD8, 0xD8, /*0x00,*/ 0x00, 0x60, 0xE0, 0x80, 0x80, 0xFF, 0x7F}, // , 0x00}, // 'j'
|
||||||
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
|
{0x08, 0xF8, 0xF8, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x03, 0x07, 0x1C, 0x18}, // , 0x00}, // 'k'
|
||||||
{0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, 0x00, 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
|
{0x00, 0x00, 0x08, 0xF8, 0xF8, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00}, // , 0x00}, // 'l'
|
||||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
|
{0xC0, 0xC0, 0xC0, 0x80, 0xC0, 0xC0, 0x80, /*0x00,*/ 0x1F, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'm'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
|
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x00, 0x1F, 0x1F, 0x00, 0x00, 0x1F, 0x1F}, // , 0x00}, // 'n'
|
||||||
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
|
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'o'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, 0x00, 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
|
{0x40, 0xC0, 0x80, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x80, 0xFF, 0xFF, 0x90, 0x10, 0x1F, 0x0F}, // , 0x00}, // 'p'
|
||||||
{0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, 0x00, 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
|
{0x80, 0xC0, 0x40, 0x40, 0x80, 0xC0, 0x40, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x90, 0xFF, 0xFF, 0x80}, // , 0x00}, // 'q'
|
||||||
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, 0x00, 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
|
{0x40, 0xC0, 0x80, 0xC0, 0x40, 0xC0, 0x80, /*0x00,*/ 0x10, 0x1F, 0x1F, 0x10, 0x00, 0x00, 0x01}, // , 0x00}, // 'r'
|
||||||
{0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
|
{0x80, 0xC0, 0x40, 0x40, 0x40, 0xC0, 0x80, /*0x00,*/ 0x08, 0x19, 0x13, 0x12, 0x16, 0x1C, 0x08}, // , 0x00}, // 's'
|
||||||
{0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
|
{0x40, 0x40, 0xF0, 0xF8, 0x40, 0x40, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x18, 0x08}, // , 0x00}, // 't'
|
||||||
{0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
|
{0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, 0x00, /*0x00,*/ 0x0F, 0x1F, 0x10, 0x10, 0x0F, 0x1F, 0x10}, // , 0x00}, // 'u'
|
||||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
|
{0x00, 0xC0, 0xC0, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x00, 0x07, 0x0F, 0x18, 0x18, 0x0F, 0x07}, // , 0x00}, // 'v'
|
||||||
{0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, 0x00, 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
|
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x0F, 0x1F, 0x18, 0x0E, 0x18, 0x1F, 0x0F}, // , 0x00}, // 'w'
|
||||||
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
|
{0x40, 0xC0, 0x80, 0x00, 0x80, 0xC0, 0x40, /*0x00,*/ 0x10, 0x18, 0x0F, 0x07, 0x0F, 0x18, 0x10}, // , 0x00}, // 'x'
|
||||||
{0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, 0x00, 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
|
{0xC0, 0xC0, 0x00, 0x00, 0x00, 0xC0, 0xC0, /*0x00,*/ 0x8F, 0x9F, 0x90, 0x90, 0xD0, 0x7F, 0x3F}, // , 0x00}, // 'y'
|
||||||
{0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 0x00}, // '{'
|
{0xC0, 0xC0, 0x40, 0x40, 0xC0, 0xC0, 0x40, /*0x00,*/ 0x18, 0x1C, 0x16, 0x13, 0x11, 0x18, 0x18}, // , 0x00}, // 'z'
|
||||||
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
|
{0x00, 0x80, 0x80, 0xF0, 0x78, 0x08, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x10, 0x10}, // , 0x00}, // '{'
|
||||||
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, 0x00, 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
|
{0x00, 0x00, 0x00, 0x78, 0x78, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x00, 0x00}, // , 0x00}, // '|'
|
||||||
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
{0x00, 0x08, 0x08, 0x78, 0xF0, 0x80, 0x80, /*0x00,*/ 0x00, 0x10, 0x10, 0x1F, 0x0F, 0x00, 0x00}, // , 0x00}, // '}'
|
||||||
};
|
{0x10, 0x18, 0x08, 0x18, 0x10, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // , 0x00} // '->'
|
||||||
|
#else
|
||||||
|
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||||
|
{0x00, 0x00, 0x00, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '!'
|
||||||
|
{0x00, 0x0F, 0x1F, 0x00, 0x00, 0x1F, 0x0F, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '"'
|
||||||
|
{0x20, 0xF8, 0xF8, 0x20, 0xF8, 0xF8, 0x20, /*0x00,*/ 0x02, 0x0F, 0x0F, 0x02, 0x0F, 0x0F, 0x02}, // '#'
|
||||||
|
{0x70, 0xF8, 0x88, 0x8E, 0x8E, 0x98, 0x10, /*0x00,*/ 0x04, 0x0C, 0x08, 0x38, 0x38, 0x0F, 0x07}, // '$'
|
||||||
|
{0x30, 0x30, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x0C, 0x0C}, // '%'
|
||||||
|
{0x80, 0xD8, 0x7C, 0xE4, 0xBC, 0xD8, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x07, 0x0F, 0x08}, // '&'
|
||||||
|
{0x00, 0x10, 0x1F, 0x0F, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '''
|
||||||
|
{0x00, 0x00, 0xF0, 0xF8, 0x0C, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x03, 0x07, 0x0C, 0x08, 0x00}, // '('
|
||||||
|
{0x00, 0x00, 0x04, 0x0C, 0xF8, 0xF0, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0C, 0x07, 0x03, 0x00}, // ')'
|
||||||
|
{0x00, 0x80, 0xA0, 0xE0, 0xC0, 0xE0, 0xA0, /*0x80,*/ 0x00, 0x00, 0x02, 0x03, 0x01, 0x03, 0x02}, // '*'
|
||||||
|
{0x00, 0x80, 0x80, 0xE0, 0xE0, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00}, // '+'
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x10, 0x1E, 0x0E, 0x00, 0x00}, // ','
|
||||||
|
{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '-'
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // '.'
|
||||||
|
{0x00, 0x00, 0x00, 0x80, 0xC0, 0x60, 0x30, /*0x00,*/ 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00}, // '/'
|
||||||
|
{0xF8, 0xFC, 0x84, 0xC4, 0x64, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x09, 0x08, 0x08, 0x0F, 0x07}, // '0'
|
||||||
|
{0x00, 0x10, 0x18, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x08, 0x08}, // '1'
|
||||||
|
{0x18, 0x1C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // '2'
|
||||||
|
{0x18, 0x1C, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '3'
|
||||||
|
{0x80, 0xC0, 0x60, 0x30, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x0F}, // '4'
|
||||||
|
{0x7C, 0x7C, 0x44, 0x44, 0x44, 0xC4, 0x84, /*0x00,*/ 0x04, 0x0C, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '5'
|
||||||
|
{0xF0, 0xF8, 0x4C, 0x44, 0x44, 0xC4, 0x80, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '6'
|
||||||
|
{0x04, 0x04, 0x04, 0x84, 0xE4, 0x7C, 0x1C, /*0x00,*/ 0x00, 0x00, 0x0E, 0x0F, 0x01, 0x00, 0x00}, // '7'
|
||||||
|
{0xB8, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // '8'
|
||||||
|
{0x78, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x00, 0x08, 0x08, 0x08, 0x0C, 0x07, 0x03}, // '9'
|
||||||
|
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x06, 0x06, 0x00, 0x00}, // ':'
|
||||||
|
{0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0E, 0x06, 0x00, 0x00}, // ';'
|
||||||
|
{0x00, 0x80, 0xC0, 0x60, 0x30, 0x18, 0x08, /*0x00,*/ 0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x08}, // '<'
|
||||||
|
{0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /*0x00,*/ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}, // '='
|
||||||
|
{0x00, 0x08, 0x18, 0x30, 0x60, 0xC0, 0x80, /*0x00,*/ 0x00, 0x08, 0x0C, 0x06, 0x03, 0x01, 0x00}, // '>'
|
||||||
|
{0x38, 0x3C, 0x04, 0x84, 0xC4, 0x7C, 0x38, /*0x00,*/ 0x00, 0x00, 0x00, 0x0D, 0x0D, 0x00, 0x00}, // '?'
|
||||||
|
{0xF0, 0xF8, 0x08, 0xC8, 0xC8, 0xF8, 0xF0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0B, 0x0B, 0x0B, 0x01}, // '@'
|
||||||
|
{0xF8, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0xF8, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'A'
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0xFC, 0xB8, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'B'
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0x1C, 0x18, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0E, 0x06}, // 'C'
|
||||||
|
{0xFC, 0xFC, 0x04, 0x04, 0x0C, 0xF8, 0xF0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x0C, 0x07, 0x03}, // 'D'
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'E'
|
||||||
|
{0xFC, 0xFC, 0x44, 0x44, 0x44, 0x04, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'F'
|
||||||
|
{0xF8, 0xFC, 0x04, 0x84, 0x84, 0x9C, 0x98, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'G'
|
||||||
|
{0xFC, 0xFC, 0x40, 0x40, 0x40, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'H'
|
||||||
|
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'I'
|
||||||
|
{0x00, 0x00, 0x00, 0x04, 0xFC, 0xFC, 0x04, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x0F, 0x07, 0x00}, // 'J'
|
||||||
|
{0xFC, 0xFC, 0xE0, 0x30, 0x18, 0x0C, 0x04, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'K'
|
||||||
|
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08}, // 'L'
|
||||||
|
{0xFC, 0xFC, 0x18, 0x70, 0x18, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'M'
|
||||||
|
{0xFC, 0xFC, 0x60, 0xC0, 0x80, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x01, 0x0F, 0x0F}, // 'N'
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'O'
|
||||||
|
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'P'
|
||||||
|
{0xF8, 0xFC, 0x04, 0x04, 0x04, 0xFC, 0xF8, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0C, 0x0C, 0x1F, 0x17}, // 'Q'
|
||||||
|
{0xFC, 0xFC, 0x84, 0x84, 0x84, 0xFC, 0x78, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'R'
|
||||||
|
{0x38, 0x7C, 0x44, 0x44, 0x44, 0xCC, 0x88, /*0x00,*/ 0x06, 0x0E, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'S'
|
||||||
|
{0x00, 0x04, 0x04, 0xFC, 0xFC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'T'
|
||||||
|
{0xFC, 0xFC, 0x00, 0x00, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'U'
|
||||||
|
{0x7C, 0xFC, 0x80, 0x00, 0x80, 0xFC, 0x7C, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'V'
|
||||||
|
{0xFC, 0xFC, 0x00, 0x80, 0x00, 0xFC, 0xFC, /*0x00,*/ 0x0F, 0x0F, 0x06, 0x03, 0x06, 0x0F, 0x0F}, // 'W'
|
||||||
|
{0x0C, 0x3C, 0xF0, 0xC0, 0xF0, 0x3C, 0x0C, /*0x00,*/ 0x0C, 0x0F, 0x03, 0x00, 0x03, 0x0F, 0x0C}, // 'X'
|
||||||
|
{0x00, 0x3C, 0x7C, 0xC0, 0xC0, 0x7C, 0x3C, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // 'Y'
|
||||||
|
{0x04, 0x04, 0x84, 0xC4, 0x64, 0x3C, 0x1C, /*0x00,*/ 0x0E, 0x0F, 0x09, 0x08, 0x08, 0x08, 0x08}, // 'Z'
|
||||||
|
{0x00, 0x00, 0xFC, 0xFC, 0x04, 0x04, 0x00, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x08, 0x08, 0x00}, // '['
|
||||||
|
{0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0E}, // '"\'
|
||||||
|
{0x00, 0x00, 0x04, 0x04, 0xFC, 0xFC, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x08, 0x0F, 0x0F, 0x00}, // ']'
|
||||||
|
{0x08, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x08, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '^'
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20}, // '_'
|
||||||
|
{0x00, 0x00, 0x03, 0x07, 0x04, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // '`'
|
||||||
|
{0x00, 0xA0, 0xA0, 0xA0, 0xA0, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'a'
|
||||||
|
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'b'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x60, 0x40, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0C, 0x04}, // 'c'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xFC, 0xFC, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'd'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x09, 0x09, 0x09, 0x09, 0x01}, // 'e'
|
||||||
|
{0x20, 0x20, 0xF8, 0xFC, 0x24, 0x24, 0x04, /*0x00,*/ 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x00}, // 'f'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'g'
|
||||||
|
{0xFC, 0xFC, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'h'
|
||||||
|
{0x00, 0x00, 0x20, 0xEC, 0xEC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'i'
|
||||||
|
{0x00, 0x00, 0x00, 0x00, 0x20, 0xEC, 0xEC, /*0x00,*/ 0x00, 0x30, 0x70, 0x40, 0x40, 0x7F, 0x3F}, // 'j'
|
||||||
|
{0xFC, 0xFC, 0x00, 0x80, 0xC0, 0x60, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x01, 0x03, 0x06, 0x0C, 0x08}, // 'k'
|
||||||
|
{0x00, 0x00, 0x04, 0xFC, 0xFC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x08, 0x0F, 0x0F, 0x08, 0x00}, // 'l'
|
||||||
|
{0xE0, 0xE0, 0x20, 0xE0, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x0F}, // 'm'
|
||||||
|
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F}, // 'n'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'o'
|
||||||
|
{0xE0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xC0, /*0x00,*/ 0x7F, 0x7F, 0x08, 0x08, 0x08, 0x0F, 0x07}, // 'p'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x7F, 0x7F}, // 'q'
|
||||||
|
{0xE0, 0xE0, 0x60, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 'r'
|
||||||
|
{0xC0, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, /*0x00,*/ 0x08, 0x09, 0x09, 0x09, 0x09, 0x0F, 0x06}, // 's'
|
||||||
|
{0x20, 0x20, 0xFC, 0xFC, 0x20, 0x20, 0x00, /*0x00,*/ 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08, 0x08}, // 't'
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x08, 0x08, 0x0F, 0x0F}, // 'u'
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x00, 0x03, 0x0F, 0x0C, 0x0F, 0x03, 0x00}, // 'v'
|
||||||
|
{0xE0, 0xE0, 0x00, 0x80, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x0F, 0x08, 0x0F, 0x08, 0x0F, 0x07}, // 'w'
|
||||||
|
{0x60, 0xE0, 0x80, 0x00, 0x80, 0xE0, 0x60, /*0x00,*/ 0x0C, 0x0E, 0x03, 0x01, 0x03, 0x0E, 0x0C}, // 'x'
|
||||||
|
{0xE0, 0xE0, 0x00, 0x00, 0x00, 0xE0, 0xE0, /*0x00,*/ 0x07, 0x4F, 0x48, 0x48, 0x48, 0x7F, 0x3F}, // 'y'
|
||||||
|
{0x20, 0x20, 0x20, 0xA0, 0xE0, 0x60, 0x20, /*0x00,*/ 0x0C, 0x0E, 0x0B, 0x09, 0x08, 0x08, 0x08}, // 'z'
|
||||||
|
{0x00, 0x00, 0x40, 0xF8, 0xBC, 0x04, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x07, 0x0F, 0x08, 0x08}, // '{'
|
||||||
|
{0x00, 0x00, 0x00, 0xBC, 0xBC, 0x00, 0x00, /*0x00,*/ 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00}, // '|'
|
||||||
|
{0x00, 0x04, 0x04, 0xBC, 0xF8, 0x40, 0x00, /*0x00,*/ 0x00, 0x08, 0x08, 0x0F, 0x07, 0x00, 0x00}, // '}'
|
||||||
|
{0x08, 0x0C, 0x04, 0x0C, 0x08, 0x0C, 0x04, /*0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // '->'
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// original font
|
// original font
|
||||||
@@ -132,21 +231,40 @@ const uint8_t gFontBig[95][15] =
|
|||||||
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
{0x00, 0xF0, 0xF8, 0xB8, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1C, 0xB8, 0xF0, 0xE0, 0x00, 0x11, 0x33, 0x77, 0x67, 0x66, 0x66, 0x66, 0x76, 0x33, 0x3F, 0x1F, 0x07},
|
||||||
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
{0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
|
// 6 Empty columns removed
|
||||||
|
#elif 0
|
||||||
// VCR font
|
// VCR font
|
||||||
const uint8_t gFontBigDigits[11][26] =
|
const uint8_t gFontBigDigits[11][26 - 6] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0xF8, 0xFC, 0x06, 0x86, 0xC6, 0xE6, 0xF6, 0x76, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x77, 0x67, 0x63, 0x61, 0x60, 0x70, 0x3F, 0x1F, 0x00},
|
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0x06, 0x86, 0xC6, 0xE6, 0xF6, 0x76, 0xFC, 0xF8, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x77, 0x67, 0x63, 0x61, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00, 0x00},
|
{/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x60, 0x60, 0x00, 0x00, /*0x00*/},
|
||||||
{0x00, 0x00, 0x18, 0x1C, 0x86, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x7E, 0x7F, 0x63, 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, 0x00},
|
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x86, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x7E, 0x7F, 0x63, 0x61, 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, /*0x00*/},
|
||||||
{0x00, 0x00, 0x18, 0x1C, 0x06, 0x06, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x18, 0x38, 0x70, 0x60, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 0x00},
|
{/*0x00, 0x00,*/ 0x18, 0x1C, 0x06, 0x06, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
||||||
{0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x7F, 0x7F, 0x06, 0x06, 0x00},
|
{/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0xFE, 0xFE, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x7F, 0x7F, 0x06, 0x06, /*0x00*/},
|
||||||
{0x00, 0x00, 0x7E, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0xC6, 0x86, 0x00, 0x00, 0x00, 0x18, 0x38, 0x70, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, 0x00},
|
{/*0x00, 0x00,*/ 0x7E, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x66, 0xE6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x70, 0x60, 0x60, 0x60, 0x60, 0x70, 0x3F, 0x1F, /*0x00*/},
|
||||||
{0x00, 0x00, 0xF8, 0xFC, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x1C, 0x18, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x71, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 0x00},
|
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0x86, 0x86, 0x86, 0x86, 0x86, 0x86, 0x1C, 0x18, /*0x00,*/ /*0x00, 0x00,*/ 0x1F, 0x3F, 0x71, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
||||||
{0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0xC6, 0xE6, 0x7E, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, 0x00},
|
{/*0x00, 0x00,*/ 0x06, 0x06, 0x06, 0x06, 0x06, 0x86, 0xC6, 0xE6, 0x7E, 0x3E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x01, 0x00, 0x00, 0x00, /*0x00*/},
|
||||||
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, 0x00},
|
{/*0x00, 0x00,*/ 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0xC6, 0xFC, 0x78, /*0x00,*/ /*0x00, 0x00,*/ 0x1E, 0x3F, 0x73, 0x61, 0x61, 0x61, 0x61, 0x73, 0x3F, 0x1E, /*0x00*/},
|
||||||
{0x00, 0x00, 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, 0x00, 0x00, 0x00, 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, 0x00},
|
{/*0x00, 0x00,*/ 0x78, 0xFC, 0xC6, 0x86, 0x86, 0x86, 0x86, 0x86, 0xFC, 0xF8, /*0x00,*/ /*0x00, 0x00,*/ 0x18, 0x38, 0x71, 0x61, 0x61, 0x61, 0x61, 0x71, 0x3F, 0x1F, /*0x00*/},
|
||||||
{0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}
|
{/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/}
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
// Terminus font
|
||||||
|
|
||||||
|
const uint8_t gFontBigDigits[11][26 - 6] =
|
||||||
|
{
|
||||||
|
{/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x86, 0xC6, 0xE6, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x67, 0x63, 0x61, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x00, 0x00, 0x18, 0x1C, 0xFE, 0xFE, 0xFE, 0x00, 0x00, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x60, 0x60, 0x7F, 0x7F, 0x7F, 0x60, 0x60, 0x00, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x1C, 0x1E, 0x1E, 0x06, 0x06, 0x06, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x60, 0x70, 0x78, 0x7C, 0x6E, 0x67, 0x63, 0x61, 0x60, 0x60, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x0C, 0x0E, 0x0E, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3E, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x80, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0xFE, 0xFE, 0xFE, /*0x00,*/ /*0x00, 0x00,*/ 0x0F, 0x0F, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x7F, 0x7F, 0x7F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0xFE, 0xFE, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x86, /*0x00,*/ /*0x00, 0x00,*/ 0x30, 0x70, 0x70, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0xF8, 0xFC, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x80, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x60, 0x60, 0x60, 0x60, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x86, 0xE6, 0xFE, 0x7E, 0x1E, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0x7F, 0x03, 0x00, 0x00, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x7C, 0xFE, 0xFE, 0x86, 0x86, 0x86, 0x86, 0xFE, 0xFE, 0x7C, /*0x00,*/ /*0x00, 0x00,*/ 0x3F, 0x7F, 0x7F, 0x61, 0x61, 0x61, 0x61, 0x7F, 0x7F, 0x3F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0xFC, 0xFE, 0xFE, 0x06, 0x06, 0x06, 0x06, 0xFE, 0xFE, 0xFC, /*0x00,*/ /*0x00, 0x00,*/ 0x01, 0x63, 0x63, 0x63, 0x63, 0x63, 0x63, 0x7F, 0x3F, 0x1F, /*0x00*/},
|
||||||
|
{/*0x00, 0x00,*/ 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, /*0x00,*/ /*0x00, 0x00,*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, /*0x00*/}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
@@ -165,177 +283,9 @@ const uint8_t gFontSmallDigits[11][7] =
|
|||||||
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00} // '-'
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
const uint8_t gFontSmall[95-1][6] =
|
||||||
#ifdef ENABLE_SPECTRUM
|
|
||||||
|
|
||||||
const uint8_t gFont3x5[160][3] = {
|
|
||||||
{0x00, 0x00, 0x00}, // 32 - space
|
|
||||||
{0x00, 0x17, 0x00}, // 33 - exclam
|
|
||||||
{0x03, 0x00, 0x03}, // 34 - quotedbl
|
|
||||||
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
|
|
||||||
{0x0a, 0x1f, 0x05}, // 36 - dollar
|
|
||||||
{0x09, 0x04, 0x12}, // 37 - percent
|
|
||||||
{0x0f, 0x17, 0x1c}, // 38 - ampersand
|
|
||||||
{0x00, 0x03, 0x00}, // 39 - quotesingle
|
|
||||||
{0x00, 0x0e, 0x11}, // 40 - parenleft
|
|
||||||
{0x11, 0x0e, 0x00}, // 41 - parenright
|
|
||||||
{0x05, 0x02, 0x05}, // 42 - asterisk
|
|
||||||
{0x04, 0x0e, 0x04}, // 43 - plus
|
|
||||||
{0x10, 0x08, 0x00}, // 44 - comma
|
|
||||||
{0x04, 0x04, 0x04}, // 45 - hyphen
|
|
||||||
{0x00, 0x10, 0x00}, // 46 - period
|
|
||||||
{0x18, 0x04, 0x03}, // 47 - slash
|
|
||||||
{0x1e, 0x11, 0x0f}, // 48 - zero
|
|
||||||
{0x02, 0x1f, 0x00}, // 49 - one
|
|
||||||
{0x19, 0x15, 0x12}, // 50 - two
|
|
||||||
{0x11, 0x15, 0x0a}, // 51 - three
|
|
||||||
{0x07, 0x04, 0x1f}, // 52 - four
|
|
||||||
{0x17, 0x15, 0x09}, // 53 - five
|
|
||||||
{0x1e, 0x15, 0x1d}, // 54 - six
|
|
||||||
{0x19, 0x05, 0x03}, // 55 - seven
|
|
||||||
{0x1f, 0x15, 0x1f}, // 56 - eight
|
|
||||||
{0x17, 0x15, 0x0f}, // 57 - nine
|
|
||||||
{0x00, 0x0a, 0x00}, // 58 - colon
|
|
||||||
{0x10, 0x0a, 0x00}, // 59 - semicolon
|
|
||||||
{0x04, 0x0a, 0x11}, // 60 - less
|
|
||||||
{0x0a, 0x0a, 0x0a}, // 61 - equal
|
|
||||||
{0x11, 0x0a, 0x04}, // 62 - greater
|
|
||||||
{0x01, 0x15, 0x03}, // 63 - question
|
|
||||||
{0x0e, 0x15, 0x16}, // 64 - at
|
|
||||||
{0x1e, 0x05, 0x1e}, // 65 - A
|
|
||||||
{0x1f, 0x15, 0x0a}, // 66 - B
|
|
||||||
{0x0e, 0x11, 0x11}, // 67 - C
|
|
||||||
{0x1f, 0x11, 0x0e}, // 68 - D
|
|
||||||
{0x1f, 0x15, 0x15}, // 69 - E
|
|
||||||
{0x1f, 0x05, 0x05}, // 70 - F
|
|
||||||
{0x0e, 0x15, 0x1d}, // 71 - G
|
|
||||||
{0x1f, 0x04, 0x1f}, // 72 - H
|
|
||||||
{0x11, 0x1f, 0x11}, // 73 - I
|
|
||||||
{0x08, 0x10, 0x0f}, // 74 - J
|
|
||||||
{0x1f, 0x04, 0x1b}, // 75 - K
|
|
||||||
{0x1f, 0x10, 0x10}, // 76 - L
|
|
||||||
{0x1f, 0x06, 0x1f}, // 77 - M
|
|
||||||
{0x1f, 0x0e, 0x1f}, // 78 - N
|
|
||||||
{0x0e, 0x11, 0x0e}, // 79 - O
|
|
||||||
{0x1f, 0x05, 0x02}, // 80 - P
|
|
||||||
{0x0e, 0x19, 0x1e}, // 81 - Q
|
|
||||||
{0x1f, 0x0d, 0x16}, // 82 - R
|
|
||||||
{0x12, 0x15, 0x09}, // 83 - S
|
|
||||||
{0x01, 0x1f, 0x01}, // 84 - T
|
|
||||||
{0x0f, 0x10, 0x1f}, // 85 - U
|
|
||||||
{0x07, 0x18, 0x07}, // 86 - V
|
|
||||||
{0x1f, 0x0c, 0x1f}, // 87 - W
|
|
||||||
{0x1b, 0x04, 0x1b}, // 88 - X
|
|
||||||
{0x03, 0x1c, 0x03}, // 89 - Y
|
|
||||||
{0x19, 0x15, 0x13}, // 90 - Z
|
|
||||||
{0x1f, 0x11, 0x11}, // 91 - bracketleft
|
|
||||||
{0x02, 0x04, 0x08}, // 92 - backslash
|
|
||||||
{0x11, 0x11, 0x1f}, // 93 - bracketright
|
|
||||||
{0x02, 0x01, 0x02}, // 94 - asciicircum
|
|
||||||
{0x10, 0x10, 0x10}, // 95 - underscore
|
|
||||||
{0x01, 0x02, 0x00}, // 96 - grave
|
|
||||||
{0x1a, 0x16, 0x1c}, // 97 - a
|
|
||||||
{0x1f, 0x12, 0x0c}, // 98 - b
|
|
||||||
{0x0c, 0x12, 0x12}, // 99 - c
|
|
||||||
{0x0c, 0x12, 0x1f}, // 100 - d
|
|
||||||
{0x0c, 0x1a, 0x16}, // 101 - e
|
|
||||||
{0x04, 0x1e, 0x05}, // 102 - f
|
|
||||||
{0x0c, 0x2a, 0x1e}, // 103 - g
|
|
||||||
{0x1f, 0x02, 0x1c}, // 104 - h
|
|
||||||
{0x00, 0x1d, 0x00}, // 105 - i
|
|
||||||
{0x10, 0x20, 0x1d}, // 106 - j
|
|
||||||
{0x1f, 0x0c, 0x12}, // 107 - k
|
|
||||||
{0x11, 0x1f, 0x10}, // 108 - l
|
|
||||||
{0x1e, 0x0e, 0x1e}, // 109 - m
|
|
||||||
{0x1e, 0x02, 0x1c}, // 110 - n
|
|
||||||
{0x0c, 0x12, 0x0c}, // 111 - o
|
|
||||||
{0x3e, 0x12, 0x0c}, // 112 - p
|
|
||||||
{0x0c, 0x12, 0x3e}, // 113 - q
|
|
||||||
{0x1c, 0x02, 0x02}, // 114 - r
|
|
||||||
{0x14, 0x1e, 0x0a}, // 115 - s
|
|
||||||
{0x02, 0x1f, 0x12}, // 116 - t
|
|
||||||
{0x0e, 0x10, 0x1e}, // 117 - u
|
|
||||||
{0x0e, 0x18, 0x0e}, // 118 - v
|
|
||||||
{0x1e, 0x1c, 0x1e}, // 119 - w
|
|
||||||
{0x12, 0x0c, 0x12}, // 120 - x
|
|
||||||
{0x06, 0x28, 0x1e}, // 121 - y
|
|
||||||
{0x1a, 0x1e, 0x16}, // 122 - z
|
|
||||||
{0x04, 0x1b, 0x11}, // 123 - braceleft
|
|
||||||
{0x00, 0x1b, 0x00}, // 124 - bar
|
|
||||||
{0x11, 0x1b, 0x04}, // 125 - braceright
|
|
||||||
{0x02, 0x03, 0x01}, // 126 - asciitilde
|
|
||||||
{0x00, 0x00, 0x00}, // 127 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 128 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 129 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 130 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 131 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 132 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 133 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 134 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 135 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 136 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 137 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 138 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 139 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 140 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 141 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 142 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 143 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 144 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 145 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 146 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 147 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 148 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 149 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 150 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 151 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 152 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 153 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 154 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 155 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 156 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 157 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 158 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 159 - empty
|
|
||||||
{0x00, 0x00, 0x00}, // 160 - empty
|
|
||||||
{0x00, 0x1d, 0x00}, // 161 - exclamdown
|
|
||||||
{0x0e, 0x1b, 0x0a}, // 162 - cent
|
|
||||||
{0x14, 0x1f, 0x15}, // 163 - sterling
|
|
||||||
{0x15, 0x0e, 0x15}, // 164 - currency
|
|
||||||
{0x0b, 0x1c, 0x0b}, // 165 - yen
|
|
||||||
{0x00, 0x1b, 0x00}, // 166 - brokenbar
|
|
||||||
{0x14, 0x1b, 0x05}, // 167 - section
|
|
||||||
{0x01, 0x00, 0x01}, // 168 - dieresis
|
|
||||||
{0x02, 0x05, 0x05}, // 169 - copyright
|
|
||||||
{0x16, 0x15, 0x17}, // 170 - ordfeminine
|
|
||||||
{0x02, 0x05, 0x00}, // 171 - guillemotleft
|
|
||||||
{0x02, 0x02, 0x06}, // 172 - logicalnot
|
|
||||||
{0x04, 0x04, 0x00}, // 173 - softhyphen
|
|
||||||
{0x07, 0x03, 0x04}, // 174 - registered
|
|
||||||
{0x01, 0x01, 0x01}, // 175 - macron
|
|
||||||
{0x02, 0x05, 0x02}, // 176 - degree
|
|
||||||
{0x12, 0x17, 0x12}, // 177 - plusminus
|
|
||||||
{0x01, 0x07, 0x04}, // 178 - twosuperior
|
|
||||||
{0x05, 0x07, 0x07}, // 179 - threesuperior
|
|
||||||
{0x00, 0x02, 0x01}, // 180 - acute
|
|
||||||
{0x1f, 0x08, 0x07}, // 181 - mu
|
|
||||||
{0x02, 0x1d, 0x1f}, // 182 - paragraph
|
|
||||||
{0x0e, 0x0e, 0x0e}, // 183 - periodcentered
|
|
||||||
{0x10, 0x14, 0x08}, // 184 - cedilla
|
|
||||||
{0x00, 0x07, 0x00}, // 185 - onesuperior
|
|
||||||
{0x12, 0x15, 0x12}, // 186 - ordmasculine
|
|
||||||
{0x00, 0x05, 0x02}, // 187 - guillemotright
|
|
||||||
{0x03, 0x08, 0x18}, // 188 - onequarter
|
|
||||||
{0x0b, 0x18, 0x10}, // 189 - onehalf
|
|
||||||
{0x03, 0x0b, 0x18}, // 190 - threequarters
|
|
||||||
{0x18, 0x15, 0x10}, // 191 - questiondown
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const uint8_t gFontSmall[95][6] =
|
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // ' '
|
||||||
{0x00, 0x00, 0x5E, 0x00, 0x00, 0x00}, // '!'
|
{0x00, 0x00, 0x5E, 0x00, 0x00, 0x00}, // '!'
|
||||||
{0x00, 0x06, 0x00, 0x06, 0x00, 0x00}, // '"'
|
{0x00, 0x06, 0x00, 0x06, 0x00, 0x00}, // '"'
|
||||||
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00}, // '#'
|
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00}, // '#'
|
||||||
@@ -433,9 +383,9 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
const uint8_t gFontSmallBold[95][6] =
|
const uint8_t gFontSmallBold[95 - 1][6] =
|
||||||
{
|
{
|
||||||
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
// {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||||
{0x00, 0x00, 0x5E, 0x5E, 0x00, 0x00},
|
{0x00, 0x00, 0x5E, 0x5E, 0x00, 0x00},
|
||||||
{0x06, 0x06, 0x00, 0x06, 0x06, 0x00},
|
{0x06, 0x06, 0x00, 0x06, 0x06, 0x00},
|
||||||
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00},
|
{0x14, 0x3E, 0x14, 0x3E, 0x14, 0x00},
|
||||||
@@ -502,10 +452,10 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
|
{0x00, 0x03, 0x07, 0x06, 0x00, 0x00},
|
||||||
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
|
{0x20, 0x76, 0x56, 0x56, 0x7E, 0x3C},
|
||||||
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
|
{0x7F, 0x7F, 0x6C, 0x6C, 0x7C, 0x38},
|
||||||
{0x3C, 0x7E, 0x66, 0x66, 0x66, 0x24},
|
{0x38, 0x7C, 0x6C, 0x6C, 0x6C, 0x00},
|
||||||
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
|
{0x38, 0x7C, 0x6C, 0x6C, 0x7F, 0x7F},
|
||||||
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
|
{0x3C, 0x7E, 0x56, 0x56, 0x5E, 0x0C},
|
||||||
{0x7C, 0x7E, 0x36, 0x36, 0x06, 0x00},
|
{0x7E, 0x7F, 0x1B, 0x1B, 0x02, 0x00},
|
||||||
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
|
{0x0C, 0x5E, 0x56, 0x56, 0x7E, 0x3C},
|
||||||
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
|
{0x7F, 0x7F, 0x0C, 0x0C, 0x7C, 0x78},
|
||||||
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
|
{0x00, 0x00, 0x7A, 0x7A, 0x00, 0x00},
|
||||||
@@ -516,7 +466,7 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
|
{0x7C, 0x7C, 0x0C, 0x0C, 0x7C, 0x78},
|
||||||
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
|
{0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C},
|
||||||
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
|
{0x7E, 0x7E, 0x36, 0x36, 0x3E, 0x1C},
|
||||||
{0x1C, 0x3E, 0x36, 0x3E, 0x7E, 0x40},
|
{0x1C, 0x3E, 0x36, 0x7E, 0x7E, 0x60},
|
||||||
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
|
{0x7C, 0x7C, 0x0C, 0x0C, 0x18, 0x00},
|
||||||
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
|
{0x4C, 0x5E, 0x56, 0x56, 0x76, 0x20},
|
||||||
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
|
{0x3F, 0x7F, 0x6C, 0x6C, 0x60, 0x00},
|
||||||
@@ -524,11 +474,181 @@ const uint8_t gFontSmall[95][6] =
|
|||||||
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
|
{0x0C, 0x3C, 0x70, 0x70, 0x3C, 0x0C},
|
||||||
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
|
{0x3C, 0x7C, 0x30, 0x30, 0x7C, 0x3C},
|
||||||
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
|
{0x44, 0x6C, 0x38, 0x38, 0x6C, 0x44},
|
||||||
{0x06, 0x6E, 0x6C, 0x6C, 0x7E, 0x3E},
|
{0x06, 0x6E, 0x68, 0x68, 0x7E, 0x3E},
|
||||||
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
|
{0x66, 0x76, 0x7E, 0x6E, 0x66, 0x00},
|
||||||
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
|
{0x08, 0x3E, 0x77, 0x41, 0x00, 0x00},
|
||||||
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
|
{0x00, 0x00, 0x7F, 0x00, 0x00, 0x00},
|
||||||
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
|
{0x00, 0x41, 0x77, 0x3E, 0x08, 0x00},
|
||||||
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00},
|
{0x0C, 0x06, 0x0C, 0x18, 0x0C, 0x00}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_SPECTRUM
|
||||||
|
const uint8_t gFont3x5[][3] =
|
||||||
|
{
|
||||||
|
{0x00, 0x00, 0x00}, // 32 - space
|
||||||
|
{0x00, 0x17, 0x00}, // 33 - exclam
|
||||||
|
{0x03, 0x00, 0x03}, // 34 - quotedbl
|
||||||
|
{0x1f, 0x0a, 0x1f}, // 35 - numbersign
|
||||||
|
{0x0a, 0x1f, 0x05}, // 36 - dollar
|
||||||
|
{0x09, 0x04, 0x12}, // 37 - percent
|
||||||
|
{0x0f, 0x17, 0x1c}, // 38 - ampersand
|
||||||
|
{0x00, 0x03, 0x00}, // 39 - quotesingle
|
||||||
|
{0x00, 0x0e, 0x11}, // 40 - parenleft
|
||||||
|
{0x11, 0x0e, 0x00}, // 41 - parenright
|
||||||
|
{0x05, 0x02, 0x05}, // 42 - asterisk
|
||||||
|
{0x04, 0x0e, 0x04}, // 43 - plus
|
||||||
|
{0x10, 0x08, 0x00}, // 44 - comma
|
||||||
|
{0x04, 0x04, 0x04}, // 45 - hyphen
|
||||||
|
{0x00, 0x10, 0x00}, // 46 - period
|
||||||
|
{0x18, 0x04, 0x03}, // 47 - slash
|
||||||
|
{0x1e, 0x11, 0x0f}, // 48 - zero
|
||||||
|
{0x02, 0x1f, 0x00}, // 49 - one
|
||||||
|
{0x19, 0x15, 0x12}, // 50 - two
|
||||||
|
{0x11, 0x15, 0x0a}, // 51 - three
|
||||||
|
{0x07, 0x04, 0x1f}, // 52 - four
|
||||||
|
{0x17, 0x15, 0x09}, // 53 - five
|
||||||
|
{0x1e, 0x15, 0x1d}, // 54 - six
|
||||||
|
{0x19, 0x05, 0x03}, // 55 - seven
|
||||||
|
{0x1f, 0x15, 0x1f}, // 56 - eight
|
||||||
|
{0x17, 0x15, 0x0f}, // 57 - nine
|
||||||
|
{0x00, 0x0a, 0x00}, // 58 - colon
|
||||||
|
{0x10, 0x0a, 0x00}, // 59 - semicolon
|
||||||
|
{0x04, 0x0a, 0x11}, // 60 - less
|
||||||
|
{0x0a, 0x0a, 0x0a}, // 61 - equal
|
||||||
|
{0x11, 0x0a, 0x04}, // 62 - greater
|
||||||
|
{0x01, 0x15, 0x03}, // 63 - question
|
||||||
|
{0x0e, 0x15, 0x16}, // 64 - at
|
||||||
|
{0x1e, 0x05, 0x1e}, // 65 - A
|
||||||
|
{0x1f, 0x15, 0x0a}, // 66 - B
|
||||||
|
{0x0e, 0x11, 0x11}, // 67 - C
|
||||||
|
{0x1f, 0x11, 0x0e}, // 68 - D
|
||||||
|
{0x1f, 0x15, 0x15}, // 69 - E
|
||||||
|
{0x1f, 0x05, 0x05}, // 70 - F
|
||||||
|
{0x0e, 0x15, 0x1d}, // 71 - G
|
||||||
|
{0x1f, 0x04, 0x1f}, // 72 - H
|
||||||
|
{0x11, 0x1f, 0x11}, // 73 - I
|
||||||
|
{0x08, 0x10, 0x0f}, // 74 - J
|
||||||
|
{0x1f, 0x04, 0x1b}, // 75 - K
|
||||||
|
{0x1f, 0x10, 0x10}, // 76 - L
|
||||||
|
{0x1f, 0x06, 0x1f}, // 77 - M
|
||||||
|
{0x1f, 0x0e, 0x1f}, // 78 - N
|
||||||
|
{0x0e, 0x11, 0x0e}, // 79 - O
|
||||||
|
{0x1f, 0x05, 0x02}, // 80 - P
|
||||||
|
{0x0e, 0x19, 0x1e}, // 81 - Q
|
||||||
|
{0x1f, 0x0d, 0x16}, // 82 - R
|
||||||
|
{0x12, 0x15, 0x09}, // 83 - S
|
||||||
|
{0x01, 0x1f, 0x01}, // 84 - T
|
||||||
|
{0x0f, 0x10, 0x1f}, // 85 - U
|
||||||
|
{0x07, 0x18, 0x07}, // 86 - V
|
||||||
|
{0x1f, 0x0c, 0x1f}, // 87 - W
|
||||||
|
{0x1b, 0x04, 0x1b}, // 88 - X
|
||||||
|
{0x03, 0x1c, 0x03}, // 89 - Y
|
||||||
|
{0x19, 0x15, 0x13}, // 90 - Z
|
||||||
|
{0x1f, 0x11, 0x11}, // 91 - bracketleft
|
||||||
|
{0x02, 0x04, 0x08}, // 92 - backslash
|
||||||
|
{0x11, 0x11, 0x1f}, // 93 - bracketright
|
||||||
|
{0x02, 0x01, 0x02}, // 94 - asciicircum
|
||||||
|
{0x10, 0x10, 0x10}, // 95 - underscore
|
||||||
|
{0x01, 0x02, 0x00}, // 96 - grave
|
||||||
|
{0x1a, 0x16, 0x1c}, // 97 - a
|
||||||
|
{0x1f, 0x12, 0x0c}, // 98 - b
|
||||||
|
{0x0c, 0x12, 0x12}, // 99 - c
|
||||||
|
{0x0c, 0x12, 0x1f}, // 100 - d
|
||||||
|
{0x0c, 0x1a, 0x16}, // 101 - e
|
||||||
|
{0x04, 0x1e, 0x05}, // 102 - f
|
||||||
|
{0x0c, 0x2a, 0x1e}, // 103 - g
|
||||||
|
{0x1f, 0x02, 0x1c}, // 104 - h
|
||||||
|
{0x00, 0x1d, 0x00}, // 105 - i
|
||||||
|
{0x10, 0x20, 0x1d}, // 106 - j
|
||||||
|
{0x1f, 0x0c, 0x12}, // 107 - k
|
||||||
|
{0x11, 0x1f, 0x10}, // 108 - l
|
||||||
|
{0x1e, 0x0e, 0x1e}, // 109 - m
|
||||||
|
{0x1e, 0x02, 0x1c}, // 110 - n
|
||||||
|
{0x0c, 0x12, 0x0c}, // 111 - o
|
||||||
|
{0x3e, 0x12, 0x0c}, // 112 - p
|
||||||
|
{0x0c, 0x12, 0x3e}, // 113 - q
|
||||||
|
{0x1c, 0x02, 0x02}, // 114 - r
|
||||||
|
{0x14, 0x1e, 0x0a}, // 115 - s
|
||||||
|
{0x02, 0x1f, 0x12}, // 116 - t
|
||||||
|
{0x0e, 0x10, 0x1e}, // 117 - u
|
||||||
|
{0x0e, 0x18, 0x0e}, // 118 - v
|
||||||
|
{0x1e, 0x1c, 0x1e}, // 119 - w
|
||||||
|
{0x12, 0x0c, 0x12}, // 120 - x
|
||||||
|
{0x06, 0x28, 0x1e}, // 121 - y
|
||||||
|
{0x1a, 0x1e, 0x16}, // 122 - z
|
||||||
|
{0x04, 0x1b, 0x11}, // 123 - braceleft
|
||||||
|
{0x00, 0x1b, 0x00}, // 124 - bar
|
||||||
|
{0x11, 0x1b, 0x04}, // 125 - braceright
|
||||||
|
{0x02, 0x03, 0x01}, // 126 - asciitilde
|
||||||
|
|
||||||
|
{0x12, 0x17, 0x12}, // 127 - plusminus
|
||||||
|
|
||||||
|
|
||||||
|
// {0x00, 0x00, 0x00}, // 127 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 128 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 129 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 130 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 131 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 132 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 133 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 134 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 135 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 136 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 137 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 138 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 139 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 140 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 141 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 142 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 143 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 144 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 145 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 146 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 147 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 148 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 149 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 150 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 151 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 152 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 153 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 154 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 155 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 156 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 157 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 158 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 159 - empty
|
||||||
|
// {0x00, 0x00, 0x00}, // 160 - empty
|
||||||
|
// {0x00, 0x1d, 0x00}, // 161 - exclamdown
|
||||||
|
// {0x0e, 0x1b, 0x0a}, // 162 - cent
|
||||||
|
// {0x14, 0x1f, 0x15}, // 163 - sterling
|
||||||
|
// {0x15, 0x0e, 0x15}, // 164 - currency
|
||||||
|
// {0x0b, 0x1c, 0x0b}, // 165 - yen
|
||||||
|
// {0x00, 0x1b, 0x00}, // 166 - brokenbar
|
||||||
|
// {0x14, 0x1b, 0x05}, // 167 - section
|
||||||
|
// {0x01, 0x00, 0x01}, // 168 - dieresis
|
||||||
|
// {0x02, 0x05, 0x05}, // 169 - copyright
|
||||||
|
// {0x16, 0x15, 0x17}, // 170 - ordfeminine
|
||||||
|
// {0x02, 0x05, 0x00}, // 171 - guillemotleft
|
||||||
|
// {0x02, 0x02, 0x06}, // 172 - logicalnot
|
||||||
|
// {0x04, 0x04, 0x00}, // 173 - softhyphen
|
||||||
|
// {0x07, 0x03, 0x04}, // 174 - registered
|
||||||
|
// {0x01, 0x01, 0x01}, // 175 - macron
|
||||||
|
// {0x02, 0x05, 0x02}, // 176 - degree
|
||||||
|
// {0x12, 0x17, 0x12}, // 177 - plusminus
|
||||||
|
// {0x01, 0x07, 0x04}, // 178 - twosuperior
|
||||||
|
// {0x05, 0x07, 0x07}, // 179 - threesuperior
|
||||||
|
// {0x00, 0x02, 0x01}, // 180 - acute
|
||||||
|
// {0x1f, 0x08, 0x07}, // 181 - mu
|
||||||
|
// {0x02, 0x1d, 0x1f}, // 182 - paragraph
|
||||||
|
// {0x0e, 0x0e, 0x0e}, // 183 - periodcentered
|
||||||
|
// {0x10, 0x14, 0x08}, // 184 - cedilla
|
||||||
|
// {0x00, 0x07, 0x00}, // 185 - onesuperior
|
||||||
|
// {0x12, 0x15, 0x12}, // 186 - ordmasculine
|
||||||
|
// {0x00, 0x05, 0x02}, // 187 - guillemotright
|
||||||
|
// {0x03, 0x08, 0x18}, // 188 - onequarter
|
||||||
|
// {0x0b, 0x18, 0x10}, // 189 - onehalf
|
||||||
|
// {0x03, 0x0b, 0x18}, // 190 - threequarters
|
||||||
|
// {0x18, 0x15, 0x10}, // 191 - questiondown
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|||||||
13
font.h
@@ -19,14 +19,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
//extern const uint8_t gFontBig[95][16];
|
|
||||||
extern const uint8_t gFontBig[95][15];
|
extern const uint8_t gFontBig[95 - 1][16 - 2];
|
||||||
extern const uint8_t gFontBigDigits[11][26];
|
extern const uint8_t gFontBigDigits[11][26 - 6];
|
||||||
//extern const uint8_t gFontSmallDigits[11][7];
|
extern const uint8_t gFont3x5[96][3];
|
||||||
extern const uint8_t gFont3x5[160][3];
|
extern const uint8_t gFontSmall[95 - 1][6];
|
||||||
extern const uint8_t gFontSmall[95][6];
|
|
||||||
#ifdef ENABLE_SMALL_BOLD
|
#ifdef ENABLE_SMALL_BOLD
|
||||||
extern const uint8_t gFontSmallBold[95][6];
|
extern const uint8_t gFontSmallBold[95 - 1][6];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
167
frequencies.c
@@ -19,52 +19,29 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
|
// the BK4819 has 2 bands it covers, 18MHz ~ 630MHz and 760MHz ~ 1300MHz
|
||||||
|
const freq_band_table_t BX4819_band1 = { 1800000, 63000000};
|
||||||
|
const freq_band_table_t BX4819_band2 = {84000000, 130000000};
|
||||||
|
|
||||||
const uint32_t bx_start1_Hz = 1800000; // 18MHz
|
const freq_band_table_t frequencyBandTable[7] =
|
||||||
const uint32_t bx_stop1_Hz = 63000000; // 630MHz
|
|
||||||
|
|
||||||
//const uint32_t bx_start2_Hz = 76000000; // 760MHz // my one radio the BK chip managed to lock down to this frequency
|
|
||||||
const uint32_t bx_start2_Hz = 84000000; // 840MHz // but best to go with datasheet specification really
|
|
||||||
const uint32_t bx_stop2_Hz = 130000000; // 1300MHz
|
|
||||||
|
|
||||||
const uint32_t LowerLimitFrequencyBandTable[7] =
|
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_WIDE_RX
|
#ifndef ENABLE_WIDE_RX
|
||||||
5000000,
|
// QS original
|
||||||
|
{.lower = 5000000, .upper = 7600000},
|
||||||
|
{.lower = 10800000, .upper = 13700000},
|
||||||
|
{.lower = 13700000, .upper = 17400000},
|
||||||
|
{.lower = 17400000, .upper = 35000000},
|
||||||
|
{.lower = 35000000, .upper = 40000000},
|
||||||
|
{.lower = 40000000, .upper = 47000000},
|
||||||
|
{.lower = 47000000, .upper = 60000000}
|
||||||
#else
|
#else
|
||||||
1800000,
|
// extended range
|
||||||
#endif
|
{.lower = BX4819_band1.lower, .upper = 10800000},
|
||||||
10800000,
|
{.lower = 10800000, .upper = 13700000},
|
||||||
13600000,
|
{.lower = 13700000, .upper = 17400000},
|
||||||
17400000,
|
{.lower = 17400000, .upper = 35000000},
|
||||||
35000000,
|
{.lower = 35000000, .upper = 40000000},
|
||||||
40000000,
|
{.lower = 40000000, .upper = 47000000},
|
||||||
47000000
|
{.lower = 47000000, .upper = BX4819_band2.upper}
|
||||||
};
|
|
||||||
|
|
||||||
const uint32_t MiddleFrequencyBandTable[7] =
|
|
||||||
{
|
|
||||||
6500000,
|
|
||||||
12200000,
|
|
||||||
15000000,
|
|
||||||
26000000,
|
|
||||||
37000000,
|
|
||||||
43500000,
|
|
||||||
55000000
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint32_t UpperLimitFrequencyBandTable[7] =
|
|
||||||
{
|
|
||||||
7600000,
|
|
||||||
13599990,
|
|
||||||
17399990,
|
|
||||||
34999990,
|
|
||||||
39999990,
|
|
||||||
46999990,
|
|
||||||
#ifndef ENABLE_WIDE_RX
|
|
||||||
60000000
|
|
||||||
#else
|
|
||||||
130000000
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,37 +61,24 @@ const uint32_t UpperLimitFrequencyBandTable[7] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#ifndef ENABLE_12_5KHZ_STEP
|
||||||
const uint16_t StepFrequencyTable[7] =
|
// QS steps (*10 Hz)
|
||||||
{
|
const uint16_t StepFrequencyTable[7] = {250, 500, 625, 1000, 1250, 2500, 833};
|
||||||
250,
|
|
||||||
500,
|
|
||||||
625,
|
|
||||||
1000,
|
|
||||||
1250,
|
|
||||||
2500,
|
|
||||||
833
|
|
||||||
};
|
|
||||||
#else
|
#else
|
||||||
const uint16_t StepFrequencyTable[7] =
|
// includes 1.25kHz step
|
||||||
{
|
const uint16_t StepFrequencyTable[7] = {125, 250, 625, 1000, 1250, 2500, 833};
|
||||||
125,
|
|
||||||
250,
|
|
||||||
625,
|
|
||||||
1000,
|
|
||||||
1250,
|
|
||||||
2500,
|
|
||||||
833
|
|
||||||
};
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency)
|
||||||
{
|
{
|
||||||
int band;
|
int band;
|
||||||
for (band = BAND7_470MHz; band >= BAND1_50MHz; band--)
|
for (band = ARRAY_SIZE(frequencyBandTable) - 1; band >= 0; band--)
|
||||||
if (Frequency >= LowerLimitFrequencyBandTable[band])
|
if (Frequency >= frequencyBandTable[band].lower)
|
||||||
return band;
|
// if (Frequency < frequencyBandTable[band].upper)
|
||||||
|
return (FREQUENCY_Band_t)band;
|
||||||
|
|
||||||
return BAND1_50MHz;
|
return BAND1_50MHz;
|
||||||
|
// return BAND_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency)
|
||||||
@@ -136,61 +100,47 @@ uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t T
|
|||||||
return TxpMid;
|
return TxpMid;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower)
|
static int32_t rnd(int32_t freq, uint16_t step)
|
||||||
{
|
{
|
||||||
uint32_t Index;
|
return (freq + (step + 1) / 2) / step * step;
|
||||||
|
}
|
||||||
|
|
||||||
if (Step == 833)
|
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step)
|
||||||
{
|
{
|
||||||
const uint32_t Delta = Upper - Lower;
|
if(step == 833) {
|
||||||
uint32_t Base = (Delta / 2500) * 2500;
|
uint32_t base = freq/2500*2500;
|
||||||
const uint32_t Index = ((Delta - Base) % 2500) / 833;
|
int f = rnd(freq - base, step);
|
||||||
|
int x = f / step;
|
||||||
if (Index == 2)
|
return base + f + (x == 3);
|
||||||
Base++;
|
|
||||||
|
|
||||||
return Lower + Base + (Index * 833);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Index = (Upper - Lower) / Step;
|
return rnd(freq, step);
|
||||||
|
|
||||||
return Lower + (Step * Index);
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
int TX_FREQUENCY_Check(VFO_Info_t *pInfo)
|
|
||||||
{ // return '0' if TX frequency is allowed
|
|
||||||
// otherwise return '-1'
|
|
||||||
|
|
||||||
const uint32_t Frequency = pInfo->pTX->Frequency;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
int TX_freq_check(const uint32_t Frequency)
|
||||||
if (pInfo->CHANNEL_SAVE > FREQ_CHANNEL_LAST)
|
|
||||||
return -1;
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|
||||||
{ // return '0' if TX frequency is allowed
|
{ // return '0' if TX frequency is allowed
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
return -1;
|
return -1; // not allowed outside this range
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
|
||||||
return -1;
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
|
return -1; // BX chip does not work in this range
|
||||||
|
|
||||||
switch (gSetting_F_LOCK)
|
switch (gSetting_F_LOCK)
|
||||||
{
|
{
|
||||||
case F_LOCK_OFF:
|
case F_LOCK_OFF:
|
||||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < frequencyBandTable[BAND3_137MHz].upper)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 17400000 && Frequency < 35000000)
|
if (Frequency >= frequencyBandTable[BAND4_174MHz].lower && Frequency < frequencyBandTable[BAND4_174MHz].upper)
|
||||||
if (gSetting_200TX)
|
if (gSetting_200TX)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 35000000 && Frequency < 40000000)
|
if (Frequency >= frequencyBandTable[BAND5_350MHz].lower && Frequency < frequencyBandTable[BAND5_350MHz].upper)
|
||||||
if (gSetting_350TX && gSetting_350EN)
|
if (gSetting_350TX && gSetting_350EN)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 40000000 && Frequency < 47000000)
|
if (Frequency >= frequencyBandTable[BAND6_400MHz].lower && Frequency < frequencyBandTable[BAND6_400MHz].upper)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 47000000 && Frequency <= 60000000)
|
if (Frequency >= frequencyBandTable[BAND7_470MHz].lower && Frequency <= 60000000)
|
||||||
if (gSetting_500TX)
|
if (gSetting_500TX)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
@@ -205,6 +155,8 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|||||||
case F_LOCK_CE:
|
case F_LOCK_CE:
|
||||||
if (Frequency >= 14400000 && Frequency < 14600000)
|
if (Frequency >= 14400000 && Frequency < 14600000)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (Frequency >= 43000000 && Frequency < 44000000)
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_LOCK_GB:
|
case F_LOCK_GB:
|
||||||
@@ -215,14 +167,14 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case F_LOCK_430:
|
case F_LOCK_430:
|
||||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 40000000 && Frequency < 43000000)
|
if (Frequency >= 40000000 && Frequency < 43000000)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_LOCK_438:
|
case F_LOCK_438:
|
||||||
if (Frequency >= 13600000 && Frequency < 17400000)
|
if (Frequency >= frequencyBandTable[BAND3_137MHz].lower && Frequency < 17400000)
|
||||||
return 0;
|
return 0;
|
||||||
if (Frequency >= 40000000 && Frequency < 43800000)
|
if (Frequency >= 40000000 && Frequency < 43800000)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -233,13 +185,14 @@ int TX_FREQUENCY_Check(const uint32_t Frequency)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RX_FREQUENCY_Check(const uint32_t Frequency)
|
int RX_freq_check(const uint32_t Frequency)
|
||||||
{ // return '0' if RX frequency is allowed
|
{ // return '0' if RX frequency is allowed
|
||||||
// otherwise return '-1'
|
// otherwise return '-1'
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0] || Frequency > UpperLimitFrequencyBandTable[6])
|
if (Frequency < frequencyBandTable[0].lower || Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
return -1;
|
return -1;
|
||||||
if (Frequency >= bx_stop1_Hz && Frequency < bx_start2_Hz)
|
|
||||||
|
if (Frequency >= BX4819_band1.upper && Frequency < BX4819_band2.lower)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0; // OK frequency
|
return 0; // OK frequency
|
||||||
|
|||||||
@@ -19,45 +19,66 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "radio.h"
|
#define ENABLE_12_5KHZ_STEP
|
||||||
|
|
||||||
extern const uint32_t bx_start1_Hz;
|
typedef struct {
|
||||||
extern const uint32_t bx_stop1_Hz;
|
const uint32_t lower;
|
||||||
|
const uint32_t upper;
|
||||||
|
} freq_band_table_t;
|
||||||
|
|
||||||
extern const uint32_t bx_start2_Hz;
|
extern const freq_band_table_t BX4819_band1;
|
||||||
extern const uint32_t bx_stop2_Hz;
|
extern const freq_band_table_t BX4819_band2;
|
||||||
|
|
||||||
enum FREQUENCY_Band_t
|
extern const freq_band_table_t frequencyBandTable[7];
|
||||||
{
|
|
||||||
BAND1_NONE = -1,
|
enum FREQUENCY_Band_t {
|
||||||
|
BAND_NONE = -1,
|
||||||
BAND1_50MHz = 0,
|
BAND1_50MHz = 0,
|
||||||
BAND2_108MHz,
|
BAND2_108MHz,
|
||||||
BAND3_136MHz,
|
BAND3_137MHz,
|
||||||
BAND4_174MHz,
|
BAND4_174MHz,
|
||||||
BAND5_350MHz,
|
BAND5_350MHz,
|
||||||
BAND6_400MHz,
|
BAND6_400MHz,
|
||||||
BAND7_470MHz
|
BAND7_470MHz
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
typedef enum FREQUENCY_Band_t FREQUENCY_Band_t;
|
||||||
|
|
||||||
extern const uint32_t LowerLimitFrequencyBandTable[7];
|
#ifndef ENABLE_12_5KHZ_STEP
|
||||||
extern const uint32_t MiddleFrequencyBandTable[7];
|
// QS steps
|
||||||
extern const uint32_t UpperLimitFrequencyBandTable[7];
|
enum STEP_Setting_t {
|
||||||
|
STEP_2_5kHz = 0,
|
||||||
|
STEP_5_0kHz,
|
||||||
|
STEP_6_25kHz,
|
||||||
|
STEP_10_0kHz,
|
||||||
|
STEP_12_5kHz,
|
||||||
|
STEP_25_0kHz,
|
||||||
|
STEP_8_33kHz
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
// includes 1.25kHz step
|
||||||
|
enum STEP_Setting_t {
|
||||||
|
STEP_1_25kHz = 0,
|
||||||
|
STEP_2_5kHz,
|
||||||
|
STEP_6_25kHz,
|
||||||
|
STEP_10_0kHz,
|
||||||
|
STEP_12_5kHz,
|
||||||
|
STEP_25_0kHz,
|
||||||
|
STEP_8_33kHz
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
typedef enum STEP_Setting_t STEP_Setting_t;
|
||||||
|
|
||||||
|
extern const uint16_t StepFrequencyTable[7];
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern const uint32_t NoaaFrequencyTable[10];
|
extern const uint32_t NoaaFrequencyTable[10];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const uint16_t StepFrequencyTable[7];
|
|
||||||
|
|
||||||
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
|
FREQUENCY_Band_t FREQUENCY_GetBand(uint32_t Frequency);
|
||||||
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency);
|
uint8_t FREQUENCY_CalculateOutputPower(uint8_t TxpLow, uint8_t TxpMid, uint8_t TxpHigh, int32_t LowerLimit, int32_t Middle, int32_t UpperLimit, int32_t Frequency);
|
||||||
uint32_t FREQUENCY_FloorToStep(uint32_t Upper, uint32_t Step, uint32_t Lower);
|
uint32_t FREQUENCY_RoundToStep(uint32_t freq, uint16_t step);
|
||||||
|
|
||||||
//int TX_FREQUENCY_Check(VFO_Info_t *pInfo);
|
int TX_freq_check(const uint32_t Frequency);
|
||||||
int TX_FREQUENCY_Check(const uint32_t Frequency);
|
int RX_freq_check(const uint32_t Frequency);
|
||||||
int RX_FREQUENCY_Check(const uint32_t Frequency);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
82
functions.c
@@ -22,12 +22,14 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "bsp/dp32g030/gpio.h"
|
#include "bsp/dp32g030/gpio.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
|
#include "driver/backlight.h"
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
#include "driver/bk1080.h"
|
#include "driver/bk1080.h"
|
||||||
#endif
|
#endif
|
||||||
#include "driver/bk4819.h"
|
#include "driver/bk4819.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "driver/system.h"
|
#include "driver/system.h"
|
||||||
|
#include "frequencies.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "helper/battery.h"
|
#include "helper/battery.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
@@ -41,7 +43,7 @@ FUNCTION_Type_t gCurrentFunction;
|
|||||||
void FUNCTION_Init(void)
|
void FUNCTION_Init(void)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
gCurrentCodeType = gSelectedCodeType;
|
gCurrentCodeType = gSelectedCodeType;
|
||||||
@@ -54,12 +56,15 @@ void FUNCTION_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
DTMF_clear_RX();
|
DTMF_clear_RX();
|
||||||
|
|
||||||
g_CxCSS_TAIL_Found = false;
|
g_CxCSS_TAIL_Found = false;
|
||||||
g_CDCSS_Lost = false;
|
g_CDCSS_Lost = false;
|
||||||
g_CTCSS_Lost = false;
|
g_CTCSS_Lost = false;
|
||||||
|
|
||||||
g_VOX_Lost = false;
|
#ifdef ENABLE_VOX
|
||||||
|
g_VOX_Lost = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
g_SquelchLost = false;
|
g_SquelchLost = false;
|
||||||
|
|
||||||
gFlagTailNoteEliminationComplete = false;
|
gFlagTailNoteEliminationComplete = false;
|
||||||
@@ -73,6 +78,8 @@ void FUNCTION_Init(void)
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
gNOAACountdown_10ms = 0;
|
gNOAACountdown_10ms = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FUNCTION_Select(FUNCTION_Type_t Function)
|
void FUNCTION_Select(FUNCTION_Type_t Function)
|
||||||
@@ -109,37 +116,44 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
gFM_RestoreCountdown_10ms = fm_restore_countdown_10ms;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT || gDTMF_CallState == DTMF_CALL_STATE_RECEIVED)
|
if (gDTMF_CallState == DTMF_CALL_STATE_CALL_OUT ||
|
||||||
gDTMF_AUTO_RESET_TIME = 1 + (gEeprom.DTMF_AUTO_RESET_TIME * 2);
|
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED ||
|
||||||
|
gDTMF_CallState == DTMF_CALL_STATE_RECEIVED_STAY)
|
||||||
|
{
|
||||||
|
gDTMF_auto_reset_time_500ms = gEeprom.DTMF_auto_reset_time * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FUNCTION_MONITOR:
|
case FUNCTION_MONITOR:
|
||||||
gMonitor = true;
|
gMonitor = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_INCOMING:
|
case FUNCTION_INCOMING:
|
||||||
case FUNCTION_RECEIVE:
|
case FUNCTION_RECEIVE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_POWER_SAVE:
|
case FUNCTION_POWER_SAVE:
|
||||||
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
|
gPowerSave_10ms = gEeprom.BATTERY_SAVE * 10;
|
||||||
gPowerSaveCountdownExpired = false;
|
gPowerSaveCountdownExpired = false;
|
||||||
|
|
||||||
gRxIdleMode = true;
|
gRxIdleMode = true;
|
||||||
|
|
||||||
gMonitor = false;
|
gMonitor = false;
|
||||||
|
|
||||||
BK4819_DisableVox();
|
BK4819_DisableVox();
|
||||||
BK4819_Sleep();
|
BK4819_Sleep();
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
if (gScreenToDisplay != DISPLAY_MENU) // 1of11 .. don't close the menu
|
||||||
|
GUI_SelectNextDisplay(DISPLAY_MAIN);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case FUNCTION_TRANSMIT:
|
case FUNCTION_TRANSMIT:
|
||||||
|
|
||||||
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
// if DTMF is enabled when TX'ing, it changes the TX audio filtering !! .. 1of11
|
||||||
@@ -152,7 +166,7 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
gDTMF_RX_live_timeout = 0;
|
gDTMF_RX_live_timeout = 0;
|
||||||
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
memset(gDTMF_RX_live, 0, sizeof(gDTMF_RX_live));
|
||||||
|
|
||||||
#if defined(ENABLE_FMRADIO)
|
#if defined(ENABLE_FMRADIO)
|
||||||
if (gFmRadioMode)
|
if (gFmRadioMode)
|
||||||
BK1080_Init(0, false);
|
BK1080_Init(0, false);
|
||||||
@@ -182,33 +196,51 @@ void FUNCTION_Select(FUNCTION_Type_t Function)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
|
||||||
GUI_DisplayScreen();
|
GUI_DisplayScreen();
|
||||||
|
|
||||||
RADIO_SetTxParameters();
|
RADIO_SetTxParameters();
|
||||||
|
|
||||||
// turn the RED LED on
|
// turn the RED LED on
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, true);
|
||||||
|
|
||||||
DTMF_Reply();
|
DTMF_Reply();
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
|
BK4819_PlaySingleTone(2525, 250, 0, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState != ALARM_STATE_OFF)
|
if (gAlarmState != ALARM_STATE_OFF)
|
||||||
{
|
{
|
||||||
BK4819_TransmitTone(true, (gAlarmState == ALARM_STATE_TX1750) ? 1750 : 500);
|
#ifdef ENABLE_TX1750
|
||||||
|
if (gAlarmState == ALARM_STATE_TX1750)
|
||||||
|
BK4819_TransmitTone(true, 1750);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_ALARM
|
||||||
|
if (gAlarmState == ALARM_STATE_TXALARM)
|
||||||
|
BK4819_TransmitTone(true, 500);
|
||||||
|
#endif
|
||||||
SYSTEM_DelayMs(2);
|
SYSTEM_DelayMs(2);
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
gAlarmToneCounter = 0;
|
#ifdef ENABLE_ALARM
|
||||||
gEnableSpeaker = true;
|
gAlarmToneCounter = 0;
|
||||||
|
#endif
|
||||||
|
gEnableSpeaker = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
if (gCurrentVfo->SCRAMBLING_TYPE > 0 && gSetting_ScrambleEnable)
|
||||||
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
BK4819_EnableScramble(gCurrentVfo->SCRAMBLING_TYPE - 1);
|
||||||
else
|
else
|
||||||
BK4819_DisableScramble();
|
BK4819_DisableScramble();
|
||||||
|
|
||||||
|
if (gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TX ||
|
||||||
|
gSetting_backlight_on_tx_rx == BACKLIGHT_ON_TR_TXRX)
|
||||||
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FUNCTION_BAND_SCOPE:
|
case FUNCTION_BAND_SCOPE:
|
||||||
|
|||||||
@@ -66,63 +66,36 @@ Volts Percent Volts Percent Volts Percent Volts Percent
|
|||||||
7.96478 75 7.72911 48 7.51285 21
|
7.96478 75 7.72911 48 7.51285 21
|
||||||
7.95983 74 7.72097 47 7.49832 20
|
7.95983 74 7.72097 47 7.49832 20
|
||||||
*/
|
*/
|
||||||
uint8_t BATTERY_VoltsToPercent(uint16_t voltage_10mV)
|
unsigned int BATTERY_VoltsToPercent(const unsigned int voltage_10mV)
|
||||||
{
|
{
|
||||||
if(voltage_10mV>814)
|
if (voltage_10mV > 814)
|
||||||
return 100;
|
return 100;
|
||||||
else if(voltage_10mV>756)
|
if (voltage_10mV > 756)
|
||||||
return 132*voltage_10mV/100-974;
|
return ((132ul * voltage_10mV) / 100) - 974u;
|
||||||
else if(voltage_10mV>729)
|
if (voltage_10mV > 729)
|
||||||
return 63*voltage_10mV/100-452;
|
return ((63ul * voltage_10mV) / 100) - 452u;
|
||||||
else if(voltage_10mV>600)
|
if (voltage_10mV > 600)
|
||||||
return 52*voltage_10mV/1000-31;
|
return ((52ul * voltage_10mV) / 1000) - 31u;
|
||||||
else
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel)
|
void BATTERY_GetReadings(const bool bDisplayBatteryLevel)
|
||||||
{
|
{
|
||||||
const uint8_t PreviousBatteryLevel = gBatteryDisplayLevel;
|
const uint8_t PreviousBatteryLevel = gBatteryDisplayLevel;
|
||||||
const uint16_t Voltage = (gBatteryVoltages[0] + gBatteryVoltages[1] + gBatteryVoltages[2] + gBatteryVoltages[3]) / 4;
|
const uint16_t Voltage = (gBatteryVoltages[0] + gBatteryVoltages[1] + gBatteryVoltages[2] + gBatteryVoltages[3]) / 4;
|
||||||
|
|
||||||
gBatteryDisplayLevel = 0;
|
gBatteryDisplayLevel = 0;
|
||||||
|
|
||||||
if (Voltage >= gBatteryCalibration[5])
|
for(uint8_t i = 6; i > 0; i--){
|
||||||
gBatteryDisplayLevel = 11;
|
if (Voltage > gBatteryCalibration[i-1]) {
|
||||||
else
|
gBatteryDisplayLevel = i;
|
||||||
if (Voltage >= ((gBatteryCalibration[4] + gBatteryCalibration[5]) / 2))
|
break;
|
||||||
gBatteryDisplayLevel = 10;
|
}
|
||||||
else
|
}
|
||||||
if (Voltage >= gBatteryCalibration[4])
|
|
||||||
gBatteryDisplayLevel = 9;
|
|
||||||
else
|
|
||||||
if (Voltage >= ((gBatteryCalibration[3] + gBatteryCalibration[4]) / 2))
|
|
||||||
gBatteryDisplayLevel = 8;
|
|
||||||
else
|
|
||||||
if (Voltage >= gBatteryCalibration[3])
|
|
||||||
gBatteryDisplayLevel = 7;
|
|
||||||
else
|
|
||||||
if (Voltage >= ((gBatteryCalibration[2] + gBatteryCalibration[3]) / 2))
|
|
||||||
gBatteryDisplayLevel = 6;
|
|
||||||
else
|
|
||||||
if (Voltage >= gBatteryCalibration[2])
|
|
||||||
gBatteryDisplayLevel = 5;
|
|
||||||
else
|
|
||||||
if (Voltage >= ((gBatteryCalibration[1] + gBatteryCalibration[2]) / 2))
|
|
||||||
gBatteryDisplayLevel = 4;
|
|
||||||
else
|
|
||||||
if (Voltage >= gBatteryCalibration[1])
|
|
||||||
gBatteryDisplayLevel = 3;
|
|
||||||
else
|
|
||||||
if (Voltage >= ((gBatteryCalibration[0] + gBatteryCalibration[1]) / 2))
|
|
||||||
gBatteryDisplayLevel = 2;
|
|
||||||
else
|
|
||||||
if (Voltage >= gBatteryCalibration[0])
|
|
||||||
gBatteryDisplayLevel = 1;
|
|
||||||
|
|
||||||
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
gBatteryVoltageAverage = (Voltage * 760) / gBatteryCalibration[3];
|
||||||
|
|
||||||
if ((gScreenToDisplay == DISPLAY_MENU) && gMenuCursor == MENU_VOL)
|
if ((gScreenToDisplay == DISPLAY_MENU) && GetCurrentMenuId() == MENU_VOL)
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
|
|
||||||
if (gBatteryCurrent < 501)
|
if (gBatteryCurrent < 501)
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ extern uint16_t gBatteryCheckCounter;
|
|||||||
|
|
||||||
extern volatile uint16_t gPowerSave_10ms;
|
extern volatile uint16_t gPowerSave_10ms;
|
||||||
|
|
||||||
uint8_t BATTERY_VoltsToPercent(uint16_t voltage_10mV);
|
unsigned int BATTERY_VoltsToPercent(const unsigned int voltage_10mV);
|
||||||
void BATTERY_GetReadings(bool bDisplayBatteryLevel);
|
void BATTERY_GetReadings(const bool bDisplayBatteryLevel);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -39,15 +39,16 @@ BOOT_Mode_t BOOT_GetMode(void)
|
|||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
if (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT))
|
||||||
return BOOT_MODE_NORMAL;
|
return BOOT_MODE_NORMAL; // PTT not pressed
|
||||||
Keys[i] = KEYBOARD_Poll();
|
Keys[i] = KEYBOARD_Poll();
|
||||||
SYSTEM_DelayMs(20);
|
SYSTEM_DelayMs(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Keys[0] == Keys[1])
|
if (Keys[0] == Keys[1])
|
||||||
{
|
{
|
||||||
gKeyReading0 = Keys[0];
|
gKeyReading0 = Keys[0];
|
||||||
gKeyReading1 = Keys[0];
|
gKeyReading1 = Keys[0];
|
||||||
|
|
||||||
gDebounceCounter = 2;
|
gDebounceCounter = 2;
|
||||||
|
|
||||||
if (Keys[0] == KEY_SIDE1)
|
if (Keys[0] == KEY_SIDE1)
|
||||||
@@ -66,16 +67,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
{
|
{
|
||||||
if (Mode == BOOT_MODE_F_LOCK)
|
if (Mode == BOOT_MODE_F_LOCK)
|
||||||
{
|
{
|
||||||
// enable all the menu items
|
|
||||||
gMenuListCount = 0;
|
|
||||||
// while (MenuList[gMenuListCount].name != NULL)
|
|
||||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
|
||||||
gMenuListCount++;
|
|
||||||
|
|
||||||
gMenuCursor = MENU_350TX;
|
|
||||||
gSubMenuSelection = gSetting_350TX;
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_MENU);
|
GUI_SelectNextDisplay(DISPLAY_MENU);
|
||||||
gF_LOCK = true;
|
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
else
|
else
|
||||||
@@ -83,18 +75,21 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
{
|
{
|
||||||
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
gEeprom.DUAL_WATCH = DUAL_WATCH_OFF;
|
||||||
gEeprom.BATTERY_SAVE = 0;
|
gEeprom.BATTERY_SAVE = 0;
|
||||||
gEeprom.VOX_SWITCH = false;
|
#ifdef ENABLE_VOX
|
||||||
|
gEeprom.VOX_SWITCH = false;
|
||||||
|
#endif
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
gEeprom.AUTO_KEYPAD_LOCK = false;
|
gEeprom.AUTO_KEYPAD_LOCK = false;
|
||||||
gEeprom.KEY_1_SHORT_PRESS_ACTION = 0;
|
gEeprom.KEY_1_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_1_LONG_PRESS_ACTION = 0;
|
gEeprom.KEY_1_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_2_SHORT_PRESS_ACTION = 0;
|
gEeprom.KEY_2_SHORT_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
gEeprom.KEY_2_LONG_PRESS_ACTION = 0;
|
gEeprom.KEY_2_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
gEeprom.KEY_M_LONG_PRESS_ACTION = ACTION_OPT_NONE;
|
||||||
|
|
||||||
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 5, 41002500);
|
RADIO_InitInfo(gRxVfo, FREQ_CHANNEL_LAST - 1, 41002500);
|
||||||
|
|
||||||
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_NARROW;
|
gRxVfo->CHANNEL_BANDWIDTH = BANDWIDTH_WIDE;
|
||||||
gRxVfo->OUTPUT_POWER = 0;
|
gRxVfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
RADIO_ConfigureSquelchAndOutputPower(gRxVfo);
|
||||||
|
|
||||||
@@ -105,6 +100,7 @@ void BOOT_ProcessMode(BOOT_Mode_t Mode)
|
|||||||
BK4819_ResetFSK();
|
BK4819_ResetFSK();
|
||||||
|
|
||||||
gAircopyState = AIRCOPY_READY;
|
gAircopyState = AIRCOPY_READY;
|
||||||
|
|
||||||
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
GUI_SelectNextDisplay(DISPLAY_AIRCOPY);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.2 MiB |
14
init.c
@@ -30,21 +30,17 @@ void DATA_Init(void);
|
|||||||
void BSS_Init(void)
|
void BSS_Init(void)
|
||||||
{
|
{
|
||||||
uint32_t *pBss;
|
uint32_t *pBss;
|
||||||
|
for (pBss = __bss_start__; pBss < __bss_end__; pBss++)
|
||||||
for (pBss = __bss_start__; pBss < __bss_end__; pBss++) {
|
|
||||||
*pBss = 0;
|
*pBss = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATA_Init(void)
|
void DATA_Init(void)
|
||||||
{
|
{
|
||||||
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
volatile uint32_t *pDataRam = (volatile uint32_t *)sram_data_start;
|
||||||
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
volatile uint32_t *pDataFlash = (volatile uint32_t *)flash_data_start;
|
||||||
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
uint32_t Size = (uint32_t)sram_data_end - (uint32_t)sram_data_start;
|
||||||
uint32_t i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < Size / 4; i++) {
|
for (i = 0; i < (Size / 4); i++)
|
||||||
*pDataRam++ = *pDataFlash++;
|
*pDataRam++ = *pDataFlash++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
88
main.c
@@ -50,6 +50,7 @@ void _putchar(char c)
|
|||||||
void Main(void)
|
void Main(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
BOOT_Mode_t BootMode;
|
||||||
|
|
||||||
// Enable clock gating of blocks we need
|
// Enable clock gating of blocks we need
|
||||||
SYSCON_DEV_CLK_GATE = 0
|
SYSCON_DEV_CLK_GATE = 0
|
||||||
@@ -60,14 +61,15 @@ void Main(void)
|
|||||||
| SYSCON_DEV_CLK_GATE_SPI0_BITS_ENABLE
|
| SYSCON_DEV_CLK_GATE_SPI0_BITS_ENABLE
|
||||||
| SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE
|
| SYSCON_DEV_CLK_GATE_SARADC_BITS_ENABLE
|
||||||
| SYSCON_DEV_CLK_GATE_CRC_BITS_ENABLE
|
| SYSCON_DEV_CLK_GATE_CRC_BITS_ENABLE
|
||||||
| SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE;
|
| SYSCON_DEV_CLK_GATE_AES_BITS_ENABLE
|
||||||
|
| SYSCON_DEV_CLK_GATE_PWM_PLUS0_BITS_ENABLE;
|
||||||
|
|
||||||
SYSTICK_Init();
|
SYSTICK_Init();
|
||||||
BOARD_Init();
|
BOARD_Init();
|
||||||
UART_Init();
|
UART_Init();
|
||||||
|
|
||||||
boot_counter_10ms = 250; // 2.5 sec
|
boot_counter_10ms = 250; // 2.5 sec
|
||||||
|
|
||||||
UART_Send(UART_Version, strlen(UART_Version));
|
UART_Send(UART_Version, strlen(UART_Version));
|
||||||
|
|
||||||
// Not implementing authentic device checks
|
// Not implementing authentic device checks
|
||||||
@@ -83,7 +85,7 @@ void Main(void)
|
|||||||
|
|
||||||
BOARD_EEPROM_Init();
|
BOARD_EEPROM_Init();
|
||||||
|
|
||||||
BOARD_EEPROM_LoadMoreSettings();
|
BOARD_EEPROM_LoadCalibration();
|
||||||
|
|
||||||
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(0, VFO_CONFIGURE_RELOAD);
|
||||||
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
RADIO_ConfigureChannel(1, VFO_CONFIGURE_RELOAD);
|
||||||
@@ -101,28 +103,55 @@ void Main(void)
|
|||||||
AM_fix_init();
|
AM_fix_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// count the number of menu list items
|
BootMode = BOOT_GetMode();
|
||||||
gMenuListCount = 0;
|
|
||||||
while (MenuList[gMenuListCount].name[0] != '\0')
|
|
||||||
gMenuListCount++;
|
|
||||||
gMenuListCount -= 8; // disable the last 'n' items
|
|
||||||
|
|
||||||
if (!gChargingWithTypeC && !gBatteryDisplayLevel)
|
if (BootMode == BOOT_MODE_F_LOCK)
|
||||||
|
{
|
||||||
|
gF_LOCK = true; // flag to say include the hidden menu items
|
||||||
|
}
|
||||||
|
|
||||||
|
// count the number of menu items
|
||||||
|
gMenuListCount = 0;
|
||||||
|
while (MenuList[gMenuListCount].name[0] != '\0') {
|
||||||
|
if(!gF_LOCK && MenuList[gMenuListCount].menu_id == FIRST_HIDDEN_MENU_ITEM)
|
||||||
|
break;
|
||||||
|
|
||||||
|
gMenuListCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wait for user to release all butts before moving on
|
||||||
|
if (!GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) ||
|
||||||
|
KEYBOARD_Poll() != KEY_INVALID ||
|
||||||
|
BootMode != BOOT_MODE_NORMAL)
|
||||||
|
{ // keys are pressed
|
||||||
|
UI_DisplayReleaseKeys();
|
||||||
|
BACKLIGHT_TurnOn();
|
||||||
|
i = 0;
|
||||||
|
while (i < 50) // 500ms
|
||||||
|
{
|
||||||
|
i = (GPIO_CheckBit(&GPIOC->DATA, GPIOC_PIN_PTT) && KEYBOARD_Poll() == KEY_INVALID) ? i + 1 : 0;
|
||||||
|
SYSTEM_DelayMs(10);
|
||||||
|
}
|
||||||
|
gKeyReading0 = KEY_INVALID;
|
||||||
|
gKeyReading1 = KEY_INVALID;
|
||||||
|
gDebounceCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gChargingWithTypeC && gBatteryDisplayLevel == 0)
|
||||||
{
|
{
|
||||||
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
FUNCTION_Select(FUNCTION_POWER_SAVE);
|
||||||
|
|
||||||
if (gEeprom.BACKLIGHT < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1))
|
if (gEeprom.BACKLIGHT_TIME < (ARRAY_SIZE(gSubMenu_BACKLIGHT) - 1)) // backlight is not set to be always on
|
||||||
GPIO_ClearBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight OFF
|
BACKLIGHT_TurnOff(); // turn the backlight OFF
|
||||||
else
|
else
|
||||||
GPIO_SetBit(&GPIOB->DATA, GPIOB_PIN_BACKLIGHT); // turn the backlight ON
|
BACKLIGHT_TurnOn(); // turn the backlight ON
|
||||||
|
|
||||||
gReducedService = true;
|
gReducedService = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BOOT_Mode_t BootMode;
|
|
||||||
|
|
||||||
UI_DisplayWelcome();
|
UI_DisplayWelcome();
|
||||||
|
|
||||||
BACKLIGHT_TurnOn();
|
BACKLIGHT_TurnOn();
|
||||||
|
|
||||||
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
|
if (gEeprom.POWER_ON_DISPLAY_MODE != POWER_ON_DISPLAY_MODE_NONE)
|
||||||
@@ -131,24 +160,24 @@ void Main(void)
|
|||||||
{
|
{
|
||||||
if (KEYBOARD_Poll() != KEY_INVALID)
|
if (KEYBOARD_Poll() != KEY_INVALID)
|
||||||
{ // halt boot beeps
|
{ // halt boot beeps
|
||||||
boot_counter_10ms = 0;
|
boot_counter_10ms = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_BOOT_BEEPS
|
#ifdef ENABLE_BOOT_BEEPS
|
||||||
if ((boot_counter_10ms % 25) == 0)
|
if ((boot_counter_10ms % 25) == 0)
|
||||||
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_880HZ_40MS_OPTIONAL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BootMode = BOOT_GetMode();
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
|
|
||||||
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
if (gEeprom.POWER_ON_PASSWORD < 1000000)
|
||||||
{
|
{
|
||||||
bIsInLockScreen = true;
|
bIsInLockScreen = true;
|
||||||
UI_DisplayLock();
|
UI_DisplayLock();
|
||||||
bIsInLockScreen = false;
|
bIsInLockScreen = false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOT_ProcessMode(BootMode);
|
BOOT_ProcessMode(BootMode);
|
||||||
|
|
||||||
@@ -156,29 +185,30 @@ void Main(void)
|
|||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
{
|
{
|
||||||
uint8_t Channel;
|
uint8_t Channel;
|
||||||
|
|
||||||
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
AUDIO_SetVoiceID(0, VOICE_ID_WELCOME);
|
||||||
|
|
||||||
Channel = gEeprom.ScreenChannel[gEeprom.TX_CHANNEL];
|
Channel = gEeprom.ScreenChannel[gEeprom.TX_VFO];
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
AUDIO_SetVoiceID(1, VOICE_ID_CHANNEL_MODE);
|
||||||
AUDIO_SetDigitVoice(2, Channel + 1);
|
AUDIO_SetDigitVoice(2, Channel + 1);
|
||||||
}
|
}
|
||||||
else
|
else if (IS_FREQ_CHANNEL(Channel))
|
||||||
if (IS_FREQ_CHANNEL(Channel))
|
|
||||||
AUDIO_SetVoiceID(1, VOICE_ID_FREQUENCY_MODE);
|
AUDIO_SetVoiceID(1, VOICE_ID_FREQUENCY_MODE);
|
||||||
|
|
||||||
AUDIO_PlaySingleVoice(0);
|
AUDIO_PlaySingleVoice(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
RADIO_ConfigureNOAA();
|
RADIO_ConfigureNOAA();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ******************
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
|||||||
105
misc.c
@@ -17,14 +17,17 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
const uint8_t fm_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
|
||||||
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
const uint8_t fm_radio_countdown_500ms = 2000 / 500; // 2 seconds
|
||||||
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
const uint16_t fm_play_countdown_scan_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
const uint16_t fm_play_countdown_noscan_10ms = 1200 / 10; // 1.2 seconds
|
||||||
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t fm_restore_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
|
|
||||||
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
const uint8_t vfo_state_resume_countdown_500ms = 2500 / 500; // 2.5 seconds
|
||||||
|
|
||||||
|
const uint8_t menu_timeout_500ms = 20000 / 500; // 20 seconds
|
||||||
|
const uint16_t menu_timeout_long_500ms = 120000 / 500; // 2 minutes
|
||||||
|
|
||||||
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
const uint8_t DTMF_RX_live_timeout_500ms = 6000 / 500; // 6 seconds live decoder on screen
|
||||||
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
const uint8_t DTMF_RX_timeout_500ms = 10000 / 500; // 10 seconds till we wipe the DTMF receiver
|
||||||
@@ -44,20 +47,27 @@ const uint16_t dual_watch_count_after_rx_10ms = 1000 / 10; // 1 sec afte
|
|||||||
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
const uint16_t dual_watch_count_after_1_10ms = 5000 / 10; // 5 sec
|
||||||
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
const uint16_t dual_watch_count_after_2_10ms = 3600 / 10; // 3.6 sec
|
||||||
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
const uint16_t dual_watch_count_noaa_10ms = 70 / 10; // 70ms
|
||||||
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t dual_watch_count_after_vox_10ms = 200 / 10; // 200ms
|
||||||
|
#endif
|
||||||
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
const uint16_t dual_watch_count_toggle_10ms = 100 / 10; // 100ms between VFO toggles
|
||||||
|
|
||||||
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
const uint16_t scan_pause_delay_in_1_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
const uint16_t scan_pause_delay_in_2_10ms = 500 / 10; // 500ms
|
||||||
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
const uint16_t scan_pause_delay_in_3_10ms = 200 / 10; // 200ms
|
||||||
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
const uint16_t scan_pause_delay_in_4_10ms = 300 / 10; // 300ms
|
||||||
|
const uint16_t scan_pause_delay_in_5_10ms = 1000 / 10; // 1 sec
|
||||||
|
const uint16_t scan_pause_delay_in_6_10ms = 100 / 10; // 100ms
|
||||||
|
const uint16_t scan_pause_delay_in_7_10ms = 3600 / 10; // 3.6 seconds
|
||||||
|
|
||||||
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
const uint16_t battery_save_count_10ms = 10000 / 10; // 10 seconds
|
||||||
|
|
||||||
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
const uint16_t power_save1_10ms = 100 / 10; // 100ms
|
||||||
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
const uint16_t power_save2_10ms = 200 / 10; // 200ms
|
||||||
|
|
||||||
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
#ifdef ENABLE_VOX
|
||||||
|
const uint16_t vox_stop_count_down_10ms = 1000 / 10; // 1 second
|
||||||
|
#endif
|
||||||
|
|
||||||
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
const uint16_t NOAA_countdown_10ms = 5000 / 10; // 5 seconds
|
||||||
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
const uint16_t NOAA_countdown_2_10ms = 500 / 10; // 500ms
|
||||||
@@ -76,6 +86,8 @@ bool gSetting_TX_EN;
|
|||||||
uint8_t gSetting_F_LOCK;
|
uint8_t gSetting_F_LOCK;
|
||||||
bool gSetting_ScrambleEnable;
|
bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
|
uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
bool gSetting_AM_fix;
|
bool gSetting_AM_fix;
|
||||||
#endif
|
#endif
|
||||||
@@ -95,12 +107,7 @@ bool bHasCustomAesKey;
|
|||||||
uint32_t gChallenge[4];
|
uint32_t gChallenge[4];
|
||||||
uint8_t gTryCount;
|
uint8_t gTryCount;
|
||||||
|
|
||||||
uint8_t gEEPROM_1EC0_0[8];
|
uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||||
uint8_t gEEPROM_1EC0_1[8];
|
|
||||||
uint8_t gEEPROM_1EC0_2[8];
|
|
||||||
uint8_t gEEPROM_1EC0_3[8];
|
|
||||||
|
|
||||||
uint16_t gEEPROM_RSSI_CALIB[2][4];
|
|
||||||
|
|
||||||
uint16_t gEEPROM_1F8A;
|
uint16_t gEEPROM_1F8A;
|
||||||
uint16_t gEEPROM_1F8C;
|
uint16_t gEEPROM_1F8C;
|
||||||
@@ -115,9 +122,10 @@ volatile bool gSchedulePowerSave;
|
|||||||
volatile bool gScheduleDualWatch = true;
|
volatile bool gScheduleDualWatch = true;
|
||||||
|
|
||||||
volatile uint16_t gDualWatchCountdown_10ms;
|
volatile uint16_t gDualWatchCountdown_10ms;
|
||||||
volatile bool gDualWatchCountdownExpired = true;
|
|
||||||
bool gDualWatchActive = false;
|
bool gDualWatchActive = false;
|
||||||
|
|
||||||
|
volatile uint8_t gSerialConfigCountDown_500ms;
|
||||||
|
|
||||||
volatile bool gNextTimeslice_500ms;
|
volatile bool gNextTimeslice_500ms;
|
||||||
|
|
||||||
volatile uint16_t gTxTimerCountdown_500ms;
|
volatile uint16_t gTxTimerCountdown_500ms;
|
||||||
@@ -125,6 +133,8 @@ volatile bool gTxTimeoutReached;
|
|||||||
|
|
||||||
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
volatile uint16_t gTailNoteEliminationCountdown_10ms;
|
||||||
|
|
||||||
|
volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
volatile uint16_t gNOAA_Countdown_10ms;
|
volatile uint16_t gNOAA_Countdown_10ms;
|
||||||
#endif
|
#endif
|
||||||
@@ -146,10 +156,10 @@ uint8_t gReducedService;
|
|||||||
uint8_t gBatteryVoltageIndex;
|
uint8_t gBatteryVoltageIndex;
|
||||||
CssScanMode_t gCssScanMode;
|
CssScanMode_t gCssScanMode;
|
||||||
bool gUpdateRSSI;
|
bool gUpdateRSSI;
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
AlarmState_t gAlarmState;
|
AlarmState_t gAlarmState;
|
||||||
#endif
|
#endif
|
||||||
uint8_t gVoltageMenuCountdown;
|
uint16_t gMenuCountdown;
|
||||||
bool gPttWasReleased;
|
bool gPttWasReleased;
|
||||||
bool gPttWasPressed;
|
bool gPttWasPressed;
|
||||||
uint8_t gKeypadLocked;
|
uint8_t gKeypadLocked;
|
||||||
@@ -163,8 +173,10 @@ bool gRequestSaveSettings;
|
|||||||
bool gRequestSaveFM;
|
bool gRequestSaveFM;
|
||||||
#endif
|
#endif
|
||||||
bool gFlagPrepareTX;
|
bool gFlagPrepareTX;
|
||||||
|
|
||||||
bool gFlagAcceptSetting;
|
bool gFlagAcceptSetting;
|
||||||
bool gFlagRefreshSetting;
|
bool gFlagRefreshSetting;
|
||||||
|
|
||||||
bool gFlagSaveVfo;
|
bool gFlagSaveVfo;
|
||||||
bool gFlagSaveSettings;
|
bool gFlagSaveSettings;
|
||||||
bool gFlagSaveChannel;
|
bool gFlagSaveChannel;
|
||||||
@@ -175,22 +187,21 @@ bool g_CDCSS_Lost;
|
|||||||
uint8_t gCDCSSCodeType;
|
uint8_t gCDCSSCodeType;
|
||||||
bool g_CTCSS_Lost;
|
bool g_CTCSS_Lost;
|
||||||
bool g_CxCSS_TAIL_Found;
|
bool g_CxCSS_TAIL_Found;
|
||||||
bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
bool g_VOX_Lost;
|
||||||
|
bool gVOX_NoiseDetected;
|
||||||
|
uint16_t gVoxResumeCountdown;
|
||||||
|
uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
bool g_SquelchLost;
|
bool g_SquelchLost;
|
||||||
uint8_t gFlashLightState;
|
uint8_t gFlashLightState;
|
||||||
bool gVOX_NoiseDetected;
|
|
||||||
uint16_t gVoxResumeCountdown;
|
|
||||||
uint16_t gVoxPauseCountdown;
|
|
||||||
volatile uint16_t gFlashLightBlinkCounter;
|
volatile uint16_t gFlashLightBlinkCounter;
|
||||||
bool gFlagEndTransmission;
|
bool gFlagEndTransmission;
|
||||||
uint16_t gLowBatteryCountdown;
|
uint16_t gLowBatteryCountdown;
|
||||||
uint8_t gNextMrChannel;
|
uint8_t gNextMrChannel;
|
||||||
ReceptionMode_t gRxReceptionMode;
|
ReceptionMode_t gRxReceptionMode;
|
||||||
uint8_t gRestoreMrChannel;
|
|
||||||
uint8_t gCurrentScanList;
|
bool gRxVfoIsActive;
|
||||||
uint8_t gPreviousMrChannel;
|
|
||||||
uint32_t gRestoreFrequency;
|
|
||||||
uint8_t gRxVfoIsActive;
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
uint8_t gAlarmToneCounter;
|
uint8_t gAlarmToneCounter;
|
||||||
uint16_t gAlarmRunningCounter;
|
uint16_t gAlarmRunningCounter;
|
||||||
@@ -199,13 +210,12 @@ bool gKeyBeingHeld;
|
|||||||
bool gPttIsPressed;
|
bool gPttIsPressed;
|
||||||
uint8_t gPttDebounceCounter;
|
uint8_t gPttDebounceCounter;
|
||||||
uint8_t gMenuListCount;
|
uint8_t gMenuListCount;
|
||||||
uint8_t gBackupCROSS_BAND_RX_TX;
|
uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||||
uint8_t gScanDelay_10ms;
|
uint8_t gScanDelay_10ms;
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
uint8_t gAircopySendCountdown;
|
uint8_t gAircopySendCountdown;
|
||||||
#endif
|
#endif
|
||||||
uint8_t gFSKWriteIndex;
|
uint8_t gFSKWriteIndex;
|
||||||
uint8_t gNeverUsed;
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
bool gIsNoaaMode;
|
bool gIsNoaaMode;
|
||||||
@@ -213,13 +223,17 @@ uint8_t gNeverUsed;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool gUpdateDisplay;
|
bool gUpdateDisplay;
|
||||||
bool gF_LOCK;
|
|
||||||
|
bool gF_LOCK = false;
|
||||||
|
|
||||||
uint8_t gShowChPrefix;
|
uint8_t gShowChPrefix;
|
||||||
|
|
||||||
volatile bool gNextTimeslice;
|
volatile bool gNextTimeslice;
|
||||||
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
volatile bool gNextTimeslice40ms;
|
volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
volatile uint16_t gNOAACountdown_10ms = 0;
|
volatile uint16_t gNOAACountdown_10ms = 0;
|
||||||
@@ -236,34 +250,7 @@ int16_t gCurrentRSSI[2] = {0, 0}; // now one per VFO
|
|||||||
|
|
||||||
uint8_t gIsLocked = 0xFF;
|
uint8_t gIsLocked = 0xFF;
|
||||||
|
|
||||||
// --------
|
|
||||||
|
|
||||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
uint32_t Multiplier = 10000000;
|
|
||||||
uint32_t Value = 0;
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
if (pDigits[i] > 9)
|
|
||||||
break;
|
|
||||||
Value += pDigits[i] * Multiplier;
|
|
||||||
Multiplier /= 10U;
|
|
||||||
}
|
|
||||||
*pInteger = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0; i < 8; i++)
|
|
||||||
{
|
|
||||||
const uint32_t Result = Value / 10U;
|
|
||||||
pDigits[7 - i] = Value - (Result * 10U);
|
|
||||||
Value = Result;
|
|
||||||
}
|
|
||||||
pDigits[8] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit)
|
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit)
|
||||||
{
|
{
|
||||||
@@ -277,3 +264,15 @@ int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit,
|
|||||||
|
|
||||||
return Base;
|
return Base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long StrToUL(const char * str)
|
||||||
|
{
|
||||||
|
unsigned long ul = 0;
|
||||||
|
for(uint8_t i = 0; i < strlen(str); i++){
|
||||||
|
char c = str[i];
|
||||||
|
if(c < '0' || c > '9')
|
||||||
|
break;
|
||||||
|
ul = ul * 10 + (uint8_t)(c-'0');
|
||||||
|
}
|
||||||
|
return ul;
|
||||||
|
}
|
||||||
106
misc.h
@@ -24,31 +24,34 @@
|
|||||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_MR_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= MR_CHANNEL_LAST)
|
#ifndef MAX
|
||||||
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
#define MAX(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a > _b ? _a : _b; })
|
||||||
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
|
||||||
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
|
||||||
#define IS_NOT_NOAA_CHANNEL(x) ((x) >= MR_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(a, b) ({ __typeof__ (a) _a = (a); __typeof__ (b) _b = (b); _a < _b ? _a : _b; })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IS_MR_CHANNEL(x) ((x) <= MR_CHANNEL_LAST)
|
||||||
|
#define IS_FREQ_CHANNEL(x) ((x) >= FREQ_CHANNEL_FIRST && (x) <= FREQ_CHANNEL_LAST)
|
||||||
|
#define IS_VALID_CHANNEL(x) ((x) < LAST_CHANNEL)
|
||||||
|
#define IS_NOAA_CHANNEL(x) ((x) >= NOAA_CHANNEL_FIRST && (x) <= NOAA_CHANNEL_LAST)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CHANNEL_FIRST = 0,
|
MR_CHANNEL_FIRST = 0,
|
||||||
MR_CHANNEL_LAST = 199u,
|
MR_CHANNEL_LAST = 199u,
|
||||||
FREQ_CHANNEL_FIRST = 200u,
|
FREQ_CHANNEL_FIRST = 200u,
|
||||||
FREQ_CHANNEL_LAST = 206u,
|
FREQ_CHANNEL_LAST = 206u,
|
||||||
#ifdef ENABLE_NOAA
|
NOAA_CHANNEL_FIRST = 207u,
|
||||||
NOAA_CHANNEL_FIRST = 207u,
|
NOAA_CHANNEL_LAST = 216u,
|
||||||
NOAA_CHANNEL_LAST = 216u,
|
|
||||||
#endif
|
|
||||||
LAST_CHANNEL
|
LAST_CHANNEL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FLASHLIGHT_OFF = 0,
|
FLASHLIGHT_OFF = 0,
|
||||||
FLASHLIGHT_ON,
|
FLASHLIGHT_ON,
|
||||||
FLASHLIGHT_BLINK
|
FLASHLIGHT_BLINK,
|
||||||
|
FLASHLIGHT_SOS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -63,7 +66,6 @@ enum AlarmState_t {
|
|||||||
ALARM_STATE_ALARM,
|
ALARM_STATE_ALARM,
|
||||||
ALARM_STATE_TX1750
|
ALARM_STATE_TX1750
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum AlarmState_t AlarmState_t;
|
typedef enum AlarmState_t AlarmState_t;
|
||||||
|
|
||||||
enum ReceptionMode_t {
|
enum ReceptionMode_t {
|
||||||
@@ -71,7 +73,6 @@ enum ReceptionMode_t {
|
|||||||
RX_MODE_DETECTED, // signal detected
|
RX_MODE_DETECTED, // signal detected
|
||||||
RX_MODE_LISTENING //
|
RX_MODE_LISTENING //
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ReceptionMode_t ReceptionMode_t;
|
typedef enum ReceptionMode_t ReceptionMode_t;
|
||||||
|
|
||||||
enum CssScanMode_t
|
enum CssScanMode_t
|
||||||
@@ -80,16 +81,24 @@ enum CssScanMode_t
|
|||||||
CSS_SCAN_MODE_SCANNING,
|
CSS_SCAN_MODE_SCANNING,
|
||||||
CSS_SCAN_MODE_FOUND,
|
CSS_SCAN_MODE_FOUND,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum CssScanMode_t CssScanMode_t;
|
typedef enum CssScanMode_t CssScanMode_t;
|
||||||
|
|
||||||
extern const uint8_t fm_resume_countdown_500ms;
|
enum BacklightOnRxTx_t {
|
||||||
|
BACKLIGHT_ON_TR_OFF,
|
||||||
|
BACKLIGHT_ON_TR_TX,
|
||||||
|
BACKLIGHT_ON_TR_RX,
|
||||||
|
BACKLIGHT_ON_TR_TXRX
|
||||||
|
};
|
||||||
|
|
||||||
extern const uint8_t fm_radio_countdown_500ms;
|
extern const uint8_t fm_radio_countdown_500ms;
|
||||||
extern const uint16_t fm_play_countdown_scan_10ms;
|
extern const uint16_t fm_play_countdown_scan_10ms;
|
||||||
extern const uint16_t fm_play_countdown_noscan_10ms;
|
extern const uint16_t fm_play_countdown_noscan_10ms;
|
||||||
extern const uint16_t fm_restore_countdown_10ms;
|
extern const uint16_t fm_restore_countdown_10ms;
|
||||||
|
|
||||||
|
extern const uint8_t vfo_state_resume_countdown_500ms;
|
||||||
|
|
||||||
extern const uint8_t menu_timeout_500ms;
|
extern const uint8_t menu_timeout_500ms;
|
||||||
|
extern const uint16_t menu_timeout_long_500ms;
|
||||||
|
|
||||||
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
extern const uint8_t DTMF_RX_live_timeout_500ms;
|
||||||
extern const uint8_t DTMF_RX_timeout_500ms;
|
extern const uint8_t DTMF_RX_timeout_500ms;
|
||||||
@@ -109,7 +118,9 @@ extern const uint16_t battery_save_count_10ms;
|
|||||||
extern const uint16_t power_save1_10ms;
|
extern const uint16_t power_save1_10ms;
|
||||||
extern const uint16_t power_save2_10ms;
|
extern const uint16_t power_save2_10ms;
|
||||||
|
|
||||||
extern const uint16_t vox_stop_count_down_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t vox_stop_count_down_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t NOAA_countdown_10ms;
|
extern const uint16_t NOAA_countdown_10ms;
|
||||||
extern const uint16_t NOAA_countdown_2_10ms;
|
extern const uint16_t NOAA_countdown_2_10ms;
|
||||||
@@ -121,12 +132,20 @@ extern const uint16_t dual_watch_count_after_1_10ms;
|
|||||||
extern const uint16_t dual_watch_count_after_2_10ms;
|
extern const uint16_t dual_watch_count_after_2_10ms;
|
||||||
extern const uint16_t dual_watch_count_toggle_10ms;
|
extern const uint16_t dual_watch_count_toggle_10ms;
|
||||||
extern const uint16_t dual_watch_count_noaa_10ms;
|
extern const uint16_t dual_watch_count_noaa_10ms;
|
||||||
extern const uint16_t dual_watch_count_after_vox_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern const uint16_t dual_watch_count_after_vox_10ms;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern const uint16_t scan_pause_delay_in_1_10ms;
|
extern const uint16_t scan_pause_delay_in_1_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_2_10ms;
|
extern const uint16_t scan_pause_delay_in_2_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_3_10ms;
|
extern const uint16_t scan_pause_delay_in_3_10ms;
|
||||||
extern const uint16_t scan_pause_delay_in_4_10ms;
|
extern const uint16_t scan_pause_delay_in_4_10ms;
|
||||||
|
extern const uint16_t scan_pause_delay_in_5_10ms;
|
||||||
|
extern const uint16_t scan_pause_delay_in_6_10ms;
|
||||||
|
extern const uint16_t scan_pause_delay_in_7_10ms;
|
||||||
|
|
||||||
|
//extern const uint16_t gMax_bat_v;
|
||||||
|
//extern const uint16_t gMin_bat_v;
|
||||||
|
|
||||||
extern const uint8_t gMicGain_dB2[5];
|
extern const uint8_t gMicGain_dB2[5];
|
||||||
|
|
||||||
@@ -139,6 +158,8 @@ extern bool gSetting_TX_EN;
|
|||||||
extern uint8_t gSetting_F_LOCK;
|
extern uint8_t gSetting_F_LOCK;
|
||||||
extern bool gSetting_ScrambleEnable;
|
extern bool gSetting_ScrambleEnable;
|
||||||
|
|
||||||
|
extern uint8_t gSetting_backlight_on_tx_rx;
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
extern bool gSetting_AM_fix;
|
extern bool gSetting_AM_fix;
|
||||||
#endif
|
#endif
|
||||||
@@ -159,12 +180,7 @@ extern bool bHasCustomAesKey;
|
|||||||
extern uint32_t gChallenge[4];
|
extern uint32_t gChallenge[4];
|
||||||
extern uint8_t gTryCount;
|
extern uint8_t gTryCount;
|
||||||
|
|
||||||
extern uint8_t gEEPROM_1EC0_0[8];
|
extern uint16_t gEEPROM_RSSI_CALIB[7][4];
|
||||||
extern uint8_t gEEPROM_1EC0_1[8];
|
|
||||||
extern uint8_t gEEPROM_1EC0_2[8];
|
|
||||||
extern uint8_t gEEPROM_1EC0_3[8];
|
|
||||||
|
|
||||||
extern uint16_t gEEPROM_RSSI_CALIB[2][4];
|
|
||||||
|
|
||||||
extern uint16_t gEEPROM_1F8A;
|
extern uint16_t gEEPROM_1F8A;
|
||||||
extern uint16_t gEEPROM_1F8C;
|
extern uint16_t gEEPROM_1F8C;
|
||||||
@@ -179,9 +195,10 @@ extern volatile bool gSchedulePowerSave;
|
|||||||
extern volatile bool gScheduleDualWatch;
|
extern volatile bool gScheduleDualWatch;
|
||||||
|
|
||||||
extern volatile uint16_t gDualWatchCountdown_10ms;
|
extern volatile uint16_t gDualWatchCountdown_10ms;
|
||||||
extern volatile bool gDualWatchCountdownExpired;
|
|
||||||
extern bool gDualWatchActive;
|
extern bool gDualWatchActive;
|
||||||
|
|
||||||
|
extern volatile uint8_t gSerialConfigCountDown_500ms;
|
||||||
|
|
||||||
extern volatile bool gNextTimeslice_500ms;
|
extern volatile bool gNextTimeslice_500ms;
|
||||||
|
|
||||||
extern volatile uint16_t gTxTimerCountdown_500ms;
|
extern volatile uint16_t gTxTimerCountdown_500ms;
|
||||||
@@ -213,7 +230,7 @@ extern uint8_t gBatteryVoltageIndex;
|
|||||||
extern CssScanMode_t gCssScanMode;
|
extern CssScanMode_t gCssScanMode;
|
||||||
extern bool gUpdateRSSI;
|
extern bool gUpdateRSSI;
|
||||||
extern AlarmState_t gAlarmState;
|
extern AlarmState_t gAlarmState;
|
||||||
extern uint8_t gVoltageMenuCountdown;
|
extern uint16_t gMenuCountdown;
|
||||||
extern bool gPttWasReleased;
|
extern bool gPttWasReleased;
|
||||||
extern bool gPttWasPressed;
|
extern bool gPttWasPressed;
|
||||||
extern bool gFlagReconfigureVfos;
|
extern bool gFlagReconfigureVfos;
|
||||||
@@ -227,8 +244,10 @@ extern bool gRequestSaveSettings;
|
|||||||
#endif
|
#endif
|
||||||
extern uint8_t gKeypadLocked;
|
extern uint8_t gKeypadLocked;
|
||||||
extern bool gFlagPrepareTX;
|
extern bool gFlagPrepareTX;
|
||||||
extern bool gFlagAcceptSetting;
|
|
||||||
extern bool gFlagRefreshSetting;
|
extern bool gFlagAcceptSetting; // accept menu setting
|
||||||
|
extern bool gFlagRefreshSetting; // refresh menu display
|
||||||
|
|
||||||
extern bool gFlagSaveVfo;
|
extern bool gFlagSaveVfo;
|
||||||
extern bool gFlagSaveSettings;
|
extern bool gFlagSaveSettings;
|
||||||
extern bool gFlagSaveChannel;
|
extern bool gFlagSaveChannel;
|
||||||
@@ -239,55 +258,57 @@ extern bool g_CDCSS_Lost;
|
|||||||
extern uint8_t gCDCSSCodeType;
|
extern uint8_t gCDCSSCodeType;
|
||||||
extern bool g_CTCSS_Lost;
|
extern bool g_CTCSS_Lost;
|
||||||
extern bool g_CxCSS_TAIL_Found;
|
extern bool g_CxCSS_TAIL_Found;
|
||||||
extern bool g_VOX_Lost;
|
#ifdef ENABLE_VOX
|
||||||
|
extern bool g_VOX_Lost;
|
||||||
|
extern bool gVOX_NoiseDetected;
|
||||||
|
extern uint16_t gVoxResumeCountdown;
|
||||||
|
extern uint16_t gVoxPauseCountdown;
|
||||||
|
#endif
|
||||||
extern bool g_SquelchLost;
|
extern bool g_SquelchLost;
|
||||||
extern uint8_t gFlashLightState;
|
extern uint8_t gFlashLightState;
|
||||||
extern bool gVOX_NoiseDetected;
|
|
||||||
extern uint16_t gVoxResumeCountdown;
|
|
||||||
extern uint16_t gVoxPauseCountdown;
|
|
||||||
extern volatile uint16_t gFlashLightBlinkCounter;
|
extern volatile uint16_t gFlashLightBlinkCounter;
|
||||||
extern bool gFlagEndTransmission;
|
extern bool gFlagEndTransmission;
|
||||||
extern uint16_t gLowBatteryCountdown;
|
extern uint16_t gLowBatteryCountdown;
|
||||||
extern uint8_t gNextMrChannel;
|
extern uint8_t gNextMrChannel;
|
||||||
extern ReceptionMode_t gRxReceptionMode;
|
extern ReceptionMode_t gRxReceptionMode;
|
||||||
extern uint8_t gRestoreMrChannel;
|
|
||||||
extern uint8_t gCurrentScanList;
|
//TRUE when dual watch is momentarly suspended and RX_VFO is locked to either last TX or RX
|
||||||
extern uint8_t gPreviousMrChannel;
|
extern bool gRxVfoIsActive;
|
||||||
extern uint32_t gRestoreFrequency;
|
|
||||||
extern uint8_t gRxVfoIsActive;
|
|
||||||
extern uint8_t gAlarmToneCounter;
|
extern uint8_t gAlarmToneCounter;
|
||||||
extern uint16_t gAlarmRunningCounter;
|
extern uint16_t gAlarmRunningCounter;
|
||||||
extern bool gKeyBeingHeld;
|
extern bool gKeyBeingHeld;
|
||||||
extern bool gPttIsPressed;
|
extern bool gPttIsPressed;
|
||||||
extern uint8_t gPttDebounceCounter;
|
extern uint8_t gPttDebounceCounter;
|
||||||
extern uint8_t gMenuListCount;
|
extern uint8_t gMenuListCount;
|
||||||
extern uint8_t gBackupCROSS_BAND_RX_TX;
|
extern uint8_t gBackup_CROSS_BAND_RX_TX;
|
||||||
extern uint8_t gScanDelay_10ms;
|
extern uint8_t gScanDelay_10ms;
|
||||||
#ifdef ENABLE_AIRCOPY
|
#ifdef ENABLE_AIRCOPY
|
||||||
extern uint8_t gAircopySendCountdown;
|
extern uint8_t gAircopySendCountdown;
|
||||||
#endif
|
#endif
|
||||||
extern uint8_t gFSKWriteIndex;
|
extern uint8_t gFSKWriteIndex;
|
||||||
extern uint8_t gNeverUsed;
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern bool gIsNoaaMode;
|
extern bool gIsNoaaMode;
|
||||||
extern uint8_t gNoaaChannel;
|
extern uint8_t gNoaaChannel;
|
||||||
#endif
|
#endif
|
||||||
extern volatile bool gNextTimeslice;
|
extern volatile bool gNextTimeslice;
|
||||||
extern bool gUpdateDisplay;
|
extern bool gUpdateDisplay;
|
||||||
|
extern bool gF_LOCK;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern uint8_t gFM_ChannelPosition;
|
extern uint8_t gFM_ChannelPosition;
|
||||||
#endif
|
#endif
|
||||||
extern bool gF_LOCK;
|
|
||||||
extern uint8_t gShowChPrefix;
|
extern uint8_t gShowChPrefix;
|
||||||
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCDCSSCountdown_10ms;
|
||||||
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
extern volatile uint8_t gFoundCTCSSCountdown_10ms;
|
||||||
extern volatile uint16_t gVoxStopCountdown_10ms;
|
#ifdef ENABLE_VOX
|
||||||
|
extern volatile uint16_t gVoxStopCountdown_10ms;
|
||||||
|
#endif
|
||||||
extern volatile bool gNextTimeslice40ms;
|
extern volatile bool gNextTimeslice40ms;
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
extern volatile uint16_t gNOAACountdown_10ms;
|
extern volatile uint16_t gNOAACountdown_10ms;
|
||||||
extern volatile bool gScheduleNOAA;
|
extern volatile bool gScheduleNOAA;
|
||||||
#endif
|
#endif
|
||||||
extern volatile bool gFlagTailNoteEliminationComplete;
|
extern volatile bool gFlagTailNoteEliminationComplete;
|
||||||
|
extern volatile uint8_t gVFOStateResumeCountdown_500ms;
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_FMRADIO
|
||||||
extern volatile bool gScheduleFM;
|
extern volatile bool gScheduleFM;
|
||||||
#endif
|
#endif
|
||||||
@@ -295,9 +316,8 @@ extern int16_t gCurrentRSSI[2]; // now one per VFO
|
|||||||
extern uint8_t gIsLocked;
|
extern uint8_t gIsLocked;
|
||||||
extern volatile uint8_t boot_counter_10ms;
|
extern volatile uint8_t boot_counter_10ms;
|
||||||
|
|
||||||
void NUMBER_Get(char *pDigits, uint32_t *pInteger);
|
|
||||||
void NUMBER_ToDigits(uint32_t Value, char *pDigits);
|
|
||||||
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
int32_t NUMBER_AddWithWraparound(int32_t Base, int32_t Add, int32_t LowerLimit, int32_t UpperLimit);
|
||||||
|
unsigned long StrToUL(const char * str);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
397
radio.c
@@ -97,12 +97,12 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i <= MR_CHANNEL_LAST; i++)
|
for (i = 0; IS_MR_CHANNEL(i); i++)
|
||||||
{
|
{
|
||||||
if (Channel == 0xFF)
|
if (Channel == 0xFF)
|
||||||
Channel = MR_CHANNEL_LAST;
|
Channel = MR_CHANNEL_LAST;
|
||||||
else
|
else
|
||||||
if (Channel > MR_CHANNEL_LAST)
|
if (!IS_MR_CHANNEL(Channel))
|
||||||
Channel = MR_CHANNEL_FIRST;
|
Channel = MR_CHANNEL_FIRST;
|
||||||
|
|
||||||
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO))
|
if (RADIO_CheckValidChannel(Channel, bCheckScanList, VFO))
|
||||||
@@ -114,26 +114,23 @@ uint8_t RADIO_FindNextChannel(uint8_t Channel, int8_t Direction, bool bCheckScan
|
|||||||
return 0xFF;
|
return 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t Band, uint32_t Frequency)
|
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency)
|
||||||
{
|
{
|
||||||
memset(pInfo, 0, sizeof(*pInfo));
|
memset(pInfo, 0, sizeof(*pInfo));
|
||||||
|
|
||||||
pInfo->Band = Band;
|
pInfo->Band = FREQUENCY_GetBand(Frequency);
|
||||||
pInfo->SCANLIST1_PARTICIPATION = true;
|
pInfo->SCANLIST1_PARTICIPATION = true;
|
||||||
pInfo->SCANLIST2_PARTICIPATION = true;
|
pInfo->SCANLIST2_PARTICIPATION = true;
|
||||||
pInfo->STEP_SETTING = STEP_12_5kHz;
|
pInfo->STEP_SETTING = STEP_12_5kHz;
|
||||||
pInfo->StepFrequency = 2500;
|
pInfo->StepFrequency = StepFrequencyTable[pInfo->STEP_SETTING];
|
||||||
pInfo->CHANNEL_SAVE = ChannelSave;
|
pInfo->CHANNEL_SAVE = ChannelSave;
|
||||||
pInfo->FrequencyReverse = false;
|
pInfo->FrequencyReverse = false;
|
||||||
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
pInfo->OUTPUT_POWER = OUTPUT_POWER_LOW;
|
||||||
pInfo->freq_config_RX.Frequency = Frequency;
|
pInfo->freq_config_RX.Frequency = Frequency;
|
||||||
pInfo->freq_config_TX.Frequency = Frequency;
|
pInfo->freq_config_TX.Frequency = Frequency;
|
||||||
pInfo->pRX = &pInfo->freq_config_RX;
|
pInfo->pRX = &pInfo->freq_config_RX;
|
||||||
pInfo->pTX = &pInfo->freq_config_TX;
|
pInfo->pTX = &pInfo->freq_config_TX;
|
||||||
pInfo->TX_OFFSET_FREQUENCY = 1000000;
|
pInfo->Compander = 0; // off
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
pInfo->Compander = 0; // off
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
if (ChannelSave == (FREQ_CHANNEL_FIRST + BAND2_108MHz))
|
||||||
pInfo->AM_mode = 1;
|
pInfo->AM_mode = 1;
|
||||||
@@ -164,20 +161,20 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
if (IS_VALID_CHANNEL(Channel))
|
if (IS_VALID_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (Channel >= NOAA_CHANNEL_FIRST)
|
if (Channel >= NOAA_CHANNEL_FIRST)
|
||||||
{
|
{
|
||||||
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], 2, NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
RADIO_InitInfo(pRadio, gEeprom.ScreenChannel[VFO], NoaaFrequencyTable[Channel - NOAA_CHANNEL_FIRST]);
|
||||||
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
||||||
return;
|
|
||||||
|
|
||||||
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
|
||||||
|
|
||||||
gUpdateStatus = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#endif
|
gEeprom.CROSS_BAND_RX_TX = CROSS_BAND_OFF;
|
||||||
|
|
||||||
|
gUpdateStatus = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{
|
||||||
@@ -211,7 +208,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
Index = Channel - FREQ_CHANNEL_FIRST;
|
Index = Channel - FREQ_CHANNEL_FIRST;
|
||||||
|
|
||||||
RADIO_InitInfo(pRadio, Channel, Index, LowerLimitFrequencyBandTable[Index]);
|
RADIO_InitInfo(pRadio, Channel, frequencyBandTable[Index].lower);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +216,6 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
if (Band > BAND7_470MHz)
|
if (Band > BAND7_470MHz)
|
||||||
{
|
{
|
||||||
Band = BAND6_400MHz;
|
Band = BAND6_400MHz;
|
||||||
// Band = FREQUENCY_GetBand(gEeprom.ScreenChannel[VFO]); // 1of11 bug fix, or have I broke it ?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
@@ -336,16 +332,16 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
if (Data[5] == 0xFF)
|
if (Data[5] == 0xFF)
|
||||||
{
|
{
|
||||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
|
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = false;
|
||||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = 0;
|
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = PTT_ID_OFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = !!((Data[5] >> 0) & 1u);
|
gEeprom.VfoInfo[VFO].DTMF_DECODING_ENABLE = ((Data[5] >> 0) & 1u) ? true : false;
|
||||||
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 3u);
|
gEeprom.VfoInfo[VFO].DTMF_PTT_ID_TX_MODE = ((Data[5] >> 1) & 7u);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************
|
// ***************
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
@@ -365,27 +361,24 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
|
|
||||||
Frequency = pRadio->freq_config_RX.Frequency;
|
Frequency = pRadio->freq_config_RX.Frequency;
|
||||||
|
|
||||||
#if 1
|
|
||||||
// fix previously set incorrect band
|
// fix previously set incorrect band
|
||||||
Band = FREQUENCY_GetBand(Frequency);
|
Band = FREQUENCY_GetBand(Frequency);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[Band])
|
if (Frequency < frequencyBandTable[Band].lower)
|
||||||
Frequency = LowerLimitFrequencyBandTable[Band];
|
Frequency = frequencyBandTable[Band].lower;
|
||||||
else
|
else
|
||||||
if (Frequency > UpperLimitFrequencyBandTable[Band])
|
if (Frequency > frequencyBandTable[Band].upper)
|
||||||
Frequency = UpperLimitFrequencyBandTable[Band];
|
Frequency = frequencyBandTable[Band].upper;
|
||||||
else
|
else
|
||||||
if (Channel >= FREQ_CHANNEL_FIRST)
|
if (Channel >= FREQ_CHANNEL_FIRST)
|
||||||
Frequency = FREQUENCY_FloorToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency, LowerLimitFrequencyBandTable[Band]);
|
Frequency = FREQUENCY_RoundToStep(Frequency, gEeprom.VfoInfo[VFO].StepFrequency);
|
||||||
|
|
||||||
pRadio->freq_config_RX.Frequency = Frequency;
|
pRadio->freq_config_RX.Frequency = Frequency;
|
||||||
|
|
||||||
if (Frequency >= 10800000 && Frequency < 13600000)
|
if (Frequency >= frequencyBandTable[BAND2_108MHz].upper && Frequency < frequencyBandTable[BAND2_108MHz].upper)
|
||||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY_DIRECTION = TX_OFFSET_FREQUENCY_DIRECTION_OFF;
|
||||||
else
|
else if (!IS_MR_CHANNEL(Channel))
|
||||||
if (!IS_MR_CHANNEL(Channel))
|
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_RoundToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency);
|
||||||
gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY = FREQUENCY_FloorToStep(gEeprom.VfoInfo[VFO].TX_OFFSET_FREQUENCY, gEeprom.VfoInfo[VFO].StepFrequency, 0);
|
|
||||||
|
|
||||||
RADIO_ApplyOffset(pRadio);
|
RADIO_ApplyOffset(pRadio);
|
||||||
|
|
||||||
@@ -422,9 +415,7 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
gEeprom.VfoInfo[VFO].freq_config_TX.CodeType = CODE_TYPE_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
||||||
gEeprom.VfoInfo[VFO].Compander = (Attributes & MR_CH_COMPAND) >> 4;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
RADIO_ConfigureSquelchAndOutputPower(pRadio);
|
||||||
}
|
}
|
||||||
@@ -432,22 +423,27 @@ void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure
|
|||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
||||||
{
|
{
|
||||||
uint8_t Txp[3];
|
uint8_t Txp[3];
|
||||||
FREQUENCY_Band_t Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
FREQUENCY_Band_t Band;
|
||||||
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
|
||||||
|
// *******************************
|
||||||
|
// squelch
|
||||||
|
|
||||||
|
Band = FREQUENCY_GetBand(pInfo->pRX->Frequency);
|
||||||
|
uint16_t Base = (Band < BAND4_174MHz) ? 0x1E60 : 0x1E00;
|
||||||
|
|
||||||
if (gEeprom.SQUELCH_LEVEL == 0)
|
if (gEeprom.SQUELCH_LEVEL == 0)
|
||||||
{ // squelch == 0 (off)
|
{ // squelch == 0 (off)
|
||||||
pInfo->SquelchOpenRSSIThresh = 0;
|
pInfo->SquelchOpenRSSIThresh = 0; // 0 ~ 255
|
||||||
pInfo->SquelchOpenNoiseThresh = 127;
|
pInfo->SquelchOpenNoiseThresh = 127; // 127 ~ 0
|
||||||
pInfo->SquelchCloseGlitchThresh = 255;
|
pInfo->SquelchCloseGlitchThresh = 255; // 255 ~ 0
|
||||||
|
|
||||||
pInfo->SquelchCloseRSSIThresh = 0;
|
pInfo->SquelchCloseRSSIThresh = 0; // 0 ~ 255
|
||||||
pInfo->SquelchCloseNoiseThresh = 127;
|
pInfo->SquelchCloseNoiseThresh = 127; // 127 ~ 0
|
||||||
pInfo->SquelchOpenGlitchThresh = 255;
|
pInfo->SquelchOpenGlitchThresh = 255; // 255 ~ 0
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // squelch >= 1
|
{ // squelch >= 1
|
||||||
Base += gEeprom.SQUELCH_LEVEL; // my squelch-1
|
Base += gEeprom.SQUELCH_LEVEL; // my eeprom squelch-1
|
||||||
// VHF UHF
|
// VHF UHF
|
||||||
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
EEPROM_ReadBuffer(Base + 0x00, &pInfo->SquelchOpenRSSIThresh, 1); // 50 10
|
||||||
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
EEPROM_ReadBuffer(Base + 0x10, &pInfo->SquelchCloseRSSIThresh, 1); // 40 5
|
||||||
@@ -458,26 +454,61 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
EEPROM_ReadBuffer(Base + 0x40, &pInfo->SquelchCloseGlitchThresh, 1); // 90 90
|
||||||
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
EEPROM_ReadBuffer(Base + 0x50, &pInfo->SquelchOpenGlitchThresh, 1); // 100 100
|
||||||
|
|
||||||
#if ENABLE_SQUELCH_LOWER
|
uint16_t rssi_open = pInfo->SquelchOpenRSSIThresh;
|
||||||
// make squelch more sensitive
|
uint16_t rssi_close = pInfo->SquelchCloseRSSIThresh;
|
||||||
|
uint16_t noise_open = pInfo->SquelchOpenNoiseThresh;
|
||||||
|
uint16_t noise_close = pInfo->SquelchCloseNoiseThresh;
|
||||||
|
uint16_t glitch_open = pInfo->SquelchOpenGlitchThresh;
|
||||||
|
uint16_t glitch_close = pInfo->SquelchCloseGlitchThresh;
|
||||||
|
|
||||||
pInfo->SquelchOpenRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 8) / 9;
|
#if ENABLE_SQUELCH_MORE_SENSITIVE
|
||||||
pInfo->SquelchCloseRSSIThresh = ((uint16_t)pInfo->SquelchOpenRSSIThresh * 7) / 8;
|
// make squelch a little more sensitive
|
||||||
|
//
|
||||||
|
// getting the best setting here is still experimental, bare with me
|
||||||
|
//
|
||||||
|
// note that 'noise' and 'glitch' values are inverted compared to 'rssi' values
|
||||||
|
|
||||||
pInfo->SquelchOpenNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 8) / 7;
|
#if 0
|
||||||
pInfo->SquelchCloseNoiseThresh = ((uint16_t)pInfo->SquelchOpenNoiseThresh * 9) / 8;
|
rssi_open = (rssi_open * 8) / 9;
|
||||||
|
noise_open = (noise_open * 9) / 8;
|
||||||
|
glitch_open = (glitch_open * 9) / 8;
|
||||||
|
#else
|
||||||
|
// even more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||||
|
rssi_open = (rssi_open * 1) / 2;
|
||||||
|
noise_open = (noise_open * 2) / 1;
|
||||||
|
glitch_open = (glitch_open * 2) / 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
pInfo->SquelchOpenGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 8) / 7;
|
#else
|
||||||
pInfo->SquelchCloseGlitchThresh = ((uint16_t)pInfo->SquelchOpenGlitchThresh * 9) / 8;
|
// more sensitive .. use when RX bandwidths are fixed (no weak signal auto adjust)
|
||||||
|
rssi_open = (rssi_open * 3) / 4;
|
||||||
|
noise_open = (noise_open * 4) / 3;
|
||||||
|
glitch_open = (glitch_open * 4) / 3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (pInfo->SquelchOpenNoiseThresh > 127)
|
rssi_close = (rssi_open * 9) / 10;
|
||||||
pInfo->SquelchOpenNoiseThresh = 127;
|
noise_close = (noise_open * 10) / 9;
|
||||||
|
glitch_close = (glitch_open * 10) / 9;
|
||||||
|
|
||||||
if (pInfo->SquelchCloseNoiseThresh > 127)
|
// ensure the 'close' threshold is lower than the 'open' threshold
|
||||||
pInfo->SquelchCloseNoiseThresh = 127;
|
if (rssi_close == rssi_open && rssi_close >= 2)
|
||||||
|
rssi_close -= 2;
|
||||||
|
if (noise_close == noise_open && noise_close <= 125)
|
||||||
|
noise_close += 2;
|
||||||
|
if (glitch_close == glitch_open && glitch_close <= 253)
|
||||||
|
glitch_close += 2;
|
||||||
|
|
||||||
|
pInfo->SquelchOpenRSSIThresh = (rssi_open > 255) ? 255 : rssi_open;
|
||||||
|
pInfo->SquelchCloseRSSIThresh = (rssi_close > 255) ? 255 : rssi_close;
|
||||||
|
pInfo->SquelchOpenNoiseThresh = (noise_open > 127) ? 127 : noise_open;
|
||||||
|
pInfo->SquelchCloseNoiseThresh = (noise_close > 127) ? 127 : noise_close;
|
||||||
|
pInfo->SquelchOpenGlitchThresh = (glitch_open > 255) ? 255 : glitch_open;
|
||||||
|
pInfo->SquelchCloseGlitchThresh = (glitch_close > 255) ? 255 : glitch_close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *******************************
|
||||||
|
// output power
|
||||||
|
|
||||||
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
Band = FREQUENCY_GetBand(pInfo->pTX->Frequency);
|
||||||
|
|
||||||
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
EEPROM_ReadBuffer(0x1ED0 + (Band * 16) + (pInfo->OUTPUT_POWER * 3), Txp, 3);
|
||||||
@@ -486,10 +517,12 @@ void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo)
|
|||||||
Txp[0],
|
Txp[0],
|
||||||
Txp[1],
|
Txp[1],
|
||||||
Txp[2],
|
Txp[2],
|
||||||
LowerLimitFrequencyBandTable[Band],
|
frequencyBandTable[Band].lower,
|
||||||
MiddleFrequencyBandTable[Band],
|
(frequencyBandTable[Band].lower + frequencyBandTable[Band].upper) / 2,
|
||||||
UpperLimitFrequencyBandTable[Band],
|
frequencyBandTable[Band].upper,
|
||||||
pInfo->pTX->Frequency);
|
pInfo->pTX->Frequency);
|
||||||
|
|
||||||
|
// *******************************
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
||||||
@@ -508,57 +541,38 @@ void RADIO_ApplyOffset(VFO_Info_t *pInfo)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
if (Frequency < frequencyBandTable[0].lower)
|
||||||
// limit to 50MHz to 600MHz
|
Frequency = frequencyBandTable[0].lower;
|
||||||
if (Frequency < 5000000)
|
else
|
||||||
Frequency = 5000000;
|
if (Frequency > frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper)
|
||||||
else
|
Frequency = frequencyBandTable[ARRAY_SIZE(frequencyBandTable) - 1].upper;
|
||||||
if (Frequency > 60000000)
|
|
||||||
Frequency = 60000000;
|
|
||||||
#else
|
|
||||||
if (Frequency < LowerLimitFrequencyBandTable[0])
|
|
||||||
Frequency = LowerLimitFrequencyBandTable[0];
|
|
||||||
else
|
|
||||||
if (Frequency > UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1])
|
|
||||||
Frequency = UpperLimitFrequencyBandTable[ARRAY_SIZE(UpperLimitFrequencyBandTable) - 1];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pInfo->freq_config_TX.Frequency = Frequency;
|
pInfo->freq_config_TX.Frequency = Frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RADIO_SelectCurrentVfo(void)
|
static void RADIO_SelectCurrentVfo(void)
|
||||||
{
|
{
|
||||||
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gRxVfo : &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
// if crossband is active and DW not the gCurrentVfo is gTxVfo (gTxVfo/TX_VFO is only ever changed by the user)
|
||||||
|
// otherwise it is set to gRxVfo which is set to gTxVfo in RADIO_SelectVfos
|
||||||
|
// so in the end gCurrentVfo is equal to gTxVfo unless dual watch changes it on incomming transmition (again, this can only happen when XB off)
|
||||||
|
// note: it is called only in certain situations so could be not up-to-date
|
||||||
|
gCurrentVfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gRxVfo : gTxVfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_SelectVfos(void)
|
void RADIO_SelectVfos(void)
|
||||||
{
|
{
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_B)
|
// if crossband without DW is used then RX_VFO is the opposite to the TX_VFO
|
||||||
gEeprom.TX_CHANNEL = 1;
|
gEeprom.RX_VFO = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF || gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) ? gEeprom.TX_VFO : !gEeprom.TX_VFO;
|
||||||
else
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_CHAN_A)
|
|
||||||
gEeprom.TX_CHANNEL = 0;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_B)
|
|
||||||
gEeprom.TX_CHANNEL = 1;
|
|
||||||
else
|
|
||||||
if (gEeprom.DUAL_WATCH == DUAL_WATCH_CHAN_A)
|
|
||||||
gEeprom.TX_CHANNEL = 0;
|
|
||||||
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF)
|
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_VFO];
|
||||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_VFO];
|
||||||
else
|
|
||||||
gEeprom.RX_CHANNEL = (gEeprom.TX_CHANNEL == 0) ? 1 : 0;
|
|
||||||
|
|
||||||
gTxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.RX_CHANNEL];
|
|
||||||
|
|
||||||
RADIO_SelectCurrentVfo();
|
RADIO_SelectCurrentVfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
||||||
{
|
{
|
||||||
BK4819_FilterBandwidth_t Bandwidth;
|
BK4819_FilterBandwidth_t Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
||||||
uint16_t InterruptMask;
|
uint16_t InterruptMask;
|
||||||
uint32_t Frequency;
|
uint32_t Frequency;
|
||||||
|
|
||||||
@@ -566,29 +580,29 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_GREEN, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2_GREEN, false);
|
||||||
|
|
||||||
Bandwidth = gRxVfo->CHANNEL_BANDWIDTH;
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||||
|
[[fallthrough]];
|
||||||
case BK4819_FILTER_BW_WIDE:
|
case BK4819_FILTER_BW_WIDE:
|
||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gRxVfo->AM_mode && gSetting_AM_fix);
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_RED, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1_RED, false);
|
||||||
|
|
||||||
BK4819_SetupPowerAmplifier(0, 0);
|
BK4819_SetupPowerAmplifier(0, 0);
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, false);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
@@ -605,7 +619,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f));
|
BK4819_WriteRegister(BK4819_REG_7D, 0xE940 | (gEeprom.MIC_SENSITIVITY_TUNING & 0x1f));
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
|
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE) || !gIsNoaaMode)
|
||||||
Frequency = gRxVfo->pRX->Frequency;
|
Frequency = gRxVfo->pRX->Frequency;
|
||||||
else
|
else
|
||||||
Frequency = NoaaFrequencyTable[gNoaaChannel];
|
Frequency = NoaaFrequencyTable[gNoaaChannel];
|
||||||
@@ -621,7 +635,8 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
BK4819_PickRXFilterPathBasedOnFrequency(Frequency);
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, true);
|
// what does this in do ?
|
||||||
|
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, true);
|
||||||
|
|
||||||
// AF RX Gain and DAC
|
// AF RX Gain and DAC
|
||||||
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
|
BK4819_WriteRegister(BK4819_REG_48, 0xB3A8); // 1011 00 111010 1000
|
||||||
@@ -629,11 +644,11 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
|
InterruptMask = BK4819_REG_3F_SQUELCH_FOUND | BK4819_REG_3F_SQUELCH_LOST;
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
if (!IS_NOAA_CHANNEL(gRxVfo->CHANNEL_SAVE))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gRxVfo->AM_mode == 0)
|
if (gRxVfo->AM_mode == 0)
|
||||||
{
|
{ // FM
|
||||||
uint8_t CodeType = gSelectedCodeType;
|
uint8_t CodeType = gSelectedCodeType;
|
||||||
uint8_t Code = gSelectedCode;
|
uint8_t Code = gSelectedCode;
|
||||||
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
if (gCssScanMode == CSS_SCAN_MODE_OFF)
|
||||||
@@ -705,30 +720,30 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_VOX
|
||||||
#ifdef ENABLE_FMRADIO
|
#ifdef ENABLE_NOAA
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#else
|
||||||
|
if (gEeprom.VOX_SWITCH && !IS_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if (gEeprom.VOX_SWITCH && IS_NOT_NOAA_CHANNEL(gCurrentVfo->CHANNEL_SAVE) && gCurrentVfo->AM_mode == 0)
|
#ifdef ENABLE_FMRADIO
|
||||||
#endif
|
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
||||||
#else
|
#else
|
||||||
#ifdef ENABLE_FMRADIO
|
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
||||||
if (gEeprom.VOX_SWITCH && !gFmRadioMode && gCurrentVfo->AM_mode == 0)
|
#endif
|
||||||
#else
|
|
||||||
if (gEeprom.VOX_SWITCH && gCurrentVfo->AM_mode == 0)
|
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
||||||
|
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
BK4819_EnableVox(gEeprom.VOX1_THRESHOLD, gEeprom.VOX0_THRESHOLD);
|
|
||||||
InterruptMask |= BK4819_REG_3F_VOX_FOUND | BK4819_REG_3F_VOX_LOST;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
BK4819_DisableVox();
|
BK4819_DisableVox();
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// RX expander
|
||||||
// RX expander
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && gRxVfo->Compander >= 2) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
if (!gRxVfo->DTMF_DECODING_ENABLE && !gSetting_KILLED)
|
||||||
@@ -743,6 +758,7 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
#else
|
#else
|
||||||
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
{
|
{
|
||||||
|
BK4819_DisableDTMF();
|
||||||
BK4819_EnableDTMF();
|
BK4819_EnableDTMF();
|
||||||
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
InterruptMask |= BK4819_REG_3F_DTMF_5TONE_FOUND;
|
||||||
}
|
}
|
||||||
@@ -772,9 +788,9 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
{
|
{
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
{
|
{
|
||||||
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[0]))
|
||||||
{
|
{
|
||||||
if (IS_NOT_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
if (!IS_NOAA_CHANNEL(gEeprom.ScreenChannel[1]))
|
||||||
{
|
{
|
||||||
gIsNoaaMode = false;
|
gIsNoaaMode = false;
|
||||||
return;
|
return;
|
||||||
@@ -808,24 +824,24 @@ void RADIO_SetupRegisters(bool bSwitchToFunction0)
|
|||||||
|
|
||||||
void RADIO_SetTxParameters(void)
|
void RADIO_SetTxParameters(void)
|
||||||
{
|
{
|
||||||
BK4819_FilterBandwidth_t Bandwidth;
|
BK4819_FilterBandwidth_t Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO6_PIN2, false);
|
BK4819_ToggleGpioOut(BK4819_GPIO0_PIN28_RX_ENABLE, false);
|
||||||
|
|
||||||
Bandwidth = gCurrentVfo->CHANNEL_BANDWIDTH;
|
|
||||||
switch (Bandwidth)
|
switch (Bandwidth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
Bandwidth = BK4819_FILTER_BW_WIDE;
|
Bandwidth = BK4819_FILTER_BW_WIDE;
|
||||||
|
[[fallthrough]];
|
||||||
case BK4819_FILTER_BW_WIDE:
|
case BK4819_FILTER_BW_WIDE:
|
||||||
case BK4819_FILTER_BW_NARROW:
|
case BK4819_FILTER_BW_NARROW:
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
// BK4819_SetFilterBandwidth(Bandwidth, gCurrentVfo->AM_mode && gSetting_AM_fix);
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, true);
|
||||||
#else
|
#else
|
||||||
BK4819_SetFilterBandwidth(Bandwidth, false);
|
BK4819_SetFilterBandwidth(Bandwidth, false);
|
||||||
#endif
|
#endif
|
||||||
@@ -834,10 +850,8 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
BK4819_SetFrequency(gCurrentVfo->pTX->Frequency);
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
// TX compressor
|
||||||
// TX compressor
|
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
||||||
BK4819_SetCompander((gRxVfo->AM_mode == 0 && (gRxVfo->Compander == 1 || gRxVfo->Compander >= 3)) ? gRxVfo->Compander : 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BK4819_PrepareTransmit();
|
BK4819_PrepareTransmit();
|
||||||
|
|
||||||
@@ -845,7 +859,7 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
BK4819_PickRXFilterPathBasedOnFrequency(gCurrentVfo->pTX->Frequency);
|
BK4819_PickRXFilterPathBasedOnFrequency(gCurrentVfo->pTX->Frequency);
|
||||||
|
|
||||||
BK4819_ToggleGpioOut(BK4819_GPIO5_PIN1, true);
|
BK4819_ToggleGpioOut(BK4819_GPIO1_PIN29_PA_ENABLE, true);
|
||||||
|
|
||||||
SYSTEM_DelayMs(5);
|
SYSTEM_DelayMs(5);
|
||||||
|
|
||||||
@@ -866,9 +880,7 @@ void RADIO_SetTxParameters(void)
|
|||||||
|
|
||||||
case CODE_TYPE_DIGITAL:
|
case CODE_TYPE_DIGITAL:
|
||||||
case CODE_TYPE_REVERSE_DIGITAL:
|
case CODE_TYPE_REVERSE_DIGITAL:
|
||||||
BK4819_SetCDCSSCodeWord(
|
BK4819_SetCDCSSCodeWord(DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code));
|
||||||
DCS_GetGolayCodeWord(gCurrentVfo->pTX->CodeType, gCurrentVfo->pTX->Code)
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -879,10 +891,7 @@ void RADIO_SetVfoState(VfoState_t State)
|
|||||||
{
|
{
|
||||||
VfoState[0] = VFO_STATE_NORMAL;
|
VfoState[0] = VFO_STATE_NORMAL;
|
||||||
VfoState[1] = VFO_STATE_NORMAL;
|
VfoState[1] = VFO_STATE_NORMAL;
|
||||||
|
gVFOStateResumeCountdown_500ms = 0;
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
gFM_ResumeCountdown_500ms = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -892,14 +901,12 @@ void RADIO_SetVfoState(VfoState_t State)
|
|||||||
VfoState[1] = VFO_STATE_TX_DISABLE;
|
VfoState[1] = VFO_STATE_TX_DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{ // 1of11
|
||||||
const uint8_t Channel = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_CHANNEL : gEeprom.TX_CHANNEL;
|
const unsigned int vfo = (gEeprom.CROSS_BAND_RX_TX == CROSS_BAND_OFF) ? gEeprom.RX_VFO : gEeprom.TX_VFO;
|
||||||
VfoState[Channel] = State;
|
VfoState[vfo] = State;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
gVFOStateResumeCountdown_500ms = vfo_state_resume_countdown_500ms;
|
||||||
gFM_ResumeCountdown_500ms = fm_resume_countdown_500ms;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
gUpdateDisplay = true;
|
||||||
@@ -916,10 +923,10 @@ void RADIO_PrepareTX(void)
|
|||||||
gScheduleDualWatch = false;
|
gScheduleDualWatch = false;
|
||||||
|
|
||||||
if (!gRxVfoIsActive)
|
if (!gRxVfoIsActive)
|
||||||
{
|
{ // use the current RX vfo
|
||||||
gEeprom.RX_CHANNEL = gEeprom.TX_CHANNEL;
|
gEeprom.RX_VFO = gEeprom.TX_VFO;
|
||||||
gRxVfo = &gEeprom.VfoInfo[gEeprom.TX_CHANNEL];
|
gRxVfo = gTxVfo;
|
||||||
gRxVfoIsActive = true;
|
gRxVfoIsActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let the user see that DW is not active
|
// let the user see that DW is not active
|
||||||
@@ -929,10 +936,16 @@ void RADIO_PrepareTX(void)
|
|||||||
|
|
||||||
RADIO_SelectCurrentVfo();
|
RADIO_SelectCurrentVfo();
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) && defined(ENABLE_TX1750)
|
||||||
if (gAlarmState == ALARM_STATE_OFF ||
|
if (gAlarmState == ALARM_STATE_OFF ||
|
||||||
gAlarmState == ALARM_STATE_TX1750 ||
|
gAlarmState == ALARM_STATE_TX1750 ||
|
||||||
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
||||||
|
#elif defined(ENABLE_ALARM)
|
||||||
|
if (gAlarmState == ALARM_STATE_OFF ||
|
||||||
|
(gAlarmState == ALARM_STATE_ALARM && gEeprom.ALARM_MODE == ALARM_MODE_TONE))
|
||||||
|
#elif defined(ENABLE_TX1750)
|
||||||
|
if (gAlarmState == ALARM_STATE_OFF ||
|
||||||
|
gAlarmState == ALARM_STATE_TX1750)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef ENABLE_TX_WHEN_AM
|
#ifndef ENABLE_TX_WHEN_AM
|
||||||
@@ -942,13 +955,12 @@ void RADIO_PrepareTX(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!gSetting_TX_EN)
|
if (!gSetting_TX_EN || gSerialConfigCountDown_500ms > 0)
|
||||||
{ // TX is disabled
|
{ // TX is disabled or config upload/download in progress
|
||||||
State = VFO_STATE_TX_DISABLE;
|
State = VFO_STATE_TX_DISABLE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
//if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0 || gCurrentVfo->CHANNEL_SAVE <= FREQ_CHANNEL_LAST)
|
if (TX_freq_check(gCurrentVfo->pTX->Frequency) == 0)
|
||||||
if (TX_FREQUENCY_Check(gCurrentVfo->pTX->Frequency) == 0)
|
|
||||||
{ // TX frequency is allowed
|
{ // TX frequency is allowed
|
||||||
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
if (gCurrentVfo->BUSY_CHANNEL_LOCK && gCurrentFunction == FUNCTION_RECEIVE)
|
||||||
State = VFO_STATE_BUSY; // busy RX'ing a station
|
State = VFO_STATE_BUSY; // busy RX'ing a station
|
||||||
@@ -956,8 +968,7 @@ void RADIO_PrepareTX(void)
|
|||||||
if (gBatteryDisplayLevel == 0)
|
if (gBatteryDisplayLevel == 0)
|
||||||
State = VFO_STATE_BAT_LOW; // charge your battery !
|
State = VFO_STATE_BAT_LOW; // charge your battery !
|
||||||
else
|
else
|
||||||
//if (gBatteryDisplayLevel >= 6)
|
if (gBatteryDisplayLevel >= 6)
|
||||||
if (gBatteryDisplayLevel >= 11) // I've increased the battery level bar resolution
|
|
||||||
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
State = VFO_STATE_VOLTAGE_HIGH; // over voltage .. this is being a pain
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -967,16 +978,19 @@ void RADIO_PrepareTX(void)
|
|||||||
if (State != VFO_STATE_NORMAL)
|
if (State != VFO_STATE_NORMAL)
|
||||||
{ // TX not allowed
|
{ // TX not allowed
|
||||||
RADIO_SetVfoState(State);
|
RADIO_SetVfoState(State);
|
||||||
#ifdef ENABLE_ALARM
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
gAlarmState = ALARM_STATE_OFF;
|
gAlarmState = ALARM_STATE_OFF;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
gDTMF_ReplyState = DTMF_REPLY_NONE;
|
||||||
|
|
||||||
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TX is allowed
|
// TX is allowed
|
||||||
|
|
||||||
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
if (gDTMF_ReplyState == DTMF_REPLY_ANI)
|
||||||
{
|
{
|
||||||
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
if (gDTMF_CallMode == DTMF_CALL_MODE_DTMF)
|
||||||
@@ -995,15 +1009,18 @@ void RADIO_PrepareTX(void)
|
|||||||
FUNCTION_Select(FUNCTION_TRANSMIT);
|
FUNCTION_Select(FUNCTION_TRANSMIT);
|
||||||
|
|
||||||
gTxTimerCountdown_500ms = 0; // no timeout
|
gTxTimerCountdown_500ms = 0; // no timeout
|
||||||
#ifdef ENABLE_ALARM
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
if (gAlarmState == ALARM_STATE_OFF)
|
if (gAlarmState == ALARM_STATE_OFF)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (gEeprom.TX_TIMEOUT_TIMER == 1)
|
if (gEeprom.TX_TIMEOUT_TIMER == 0)
|
||||||
gTxTimerCountdown_500ms = 60; // 30 sec
|
gTxTimerCountdown_500ms = 60; // 30 sec
|
||||||
else
|
else
|
||||||
if (gEeprom.TX_TIMEOUT_TIMER >= 2)
|
if (gEeprom.TX_TIMEOUT_TIMER < (ARRAY_SIZE(gSubMenu_TOT) - 1))
|
||||||
gTxTimerCountdown_500ms = (gEeprom.TX_TIMEOUT_TIMER - 1) * 120; // minutes
|
gTxTimerCountdown_500ms = 120 * gEeprom.TX_TIMEOUT_TIMER; // minutes
|
||||||
|
else
|
||||||
|
gTxTimerCountdown_500ms = 120 * 15; // 15 minutes
|
||||||
}
|
}
|
||||||
gTxTimeoutReached = false;
|
gTxTimeoutReached = false;
|
||||||
|
|
||||||
@@ -1051,8 +1068,13 @@ void RADIO_SendEndOfTransmission(void)
|
|||||||
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
if (gEeprom.ROGER == ROGER_MODE_MDC)
|
||||||
BK4819_PlayRogerMDC();
|
BK4819_PlayRogerMDC();
|
||||||
|
|
||||||
if (gDTMF_CallState == DTMF_CALL_STATE_NONE && (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_EOT || gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
if (gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_APOLLO)
|
||||||
{
|
BK4819_PlaySingleTone(2475, 250, 28, gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
|
if (gDTMF_CallState == DTMF_CALL_STATE_NONE &&
|
||||||
|
(gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_TX_DOWN ||
|
||||||
|
gCurrentVfo->DTMF_PTT_ID_TX_MODE == PTT_ID_BOTH))
|
||||||
|
{ // end-of-tx
|
||||||
if (gEeprom.DTMF_SIDE_TONE)
|
if (gEeprom.DTMF_SIDE_TONE)
|
||||||
{
|
{
|
||||||
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_SetBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
@@ -1063,15 +1085,14 @@ void RADIO_SendEndOfTransmission(void)
|
|||||||
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
BK4819_EnterDTMF_TX(gEeprom.DTMF_SIDE_TONE);
|
||||||
|
|
||||||
BK4819_PlayDTMFString(
|
BK4819_PlayDTMFString(
|
||||||
gEeprom.DTMF_DOWN_CODE,
|
gEeprom.DTMF_DOWN_CODE,
|
||||||
0,
|
0,
|
||||||
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
gEeprom.DTMF_FIRST_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
gEeprom.DTMF_HASH_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_CODE_PERSIST_TIME,
|
gEeprom.DTMF_CODE_PERSIST_TIME,
|
||||||
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
gEeprom.DTMF_CODE_INTERVAL_TIME);
|
||||||
|
|
||||||
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
GPIO_ClearBit(&GPIOC->DATA, GPIOC_PIN_AUDIO_PATH);
|
||||||
|
|
||||||
gEnableSpeaker = false;
|
gEnableSpeaker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
63
radio.h
@@ -21,12 +21,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
|
#include "frequencies.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MR_CH_BAND_MASK = 0x0F << 0,
|
MR_CH_BAND_MASK = 0x0F << 0,
|
||||||
#ifdef ENABLE_COMPANDER
|
MR_CH_COMPAND = 3u << 4, // new
|
||||||
MR_CH_COMPAND = 3u << 4, // new
|
|
||||||
#endif
|
|
||||||
MR_CH_SCANLIST2 = 1u << 6,
|
MR_CH_SCANLIST2 = 1u << 6,
|
||||||
MR_CH_SCANLIST1 = 1u << 7
|
MR_CH_SCANLIST1 = 1u << 7
|
||||||
};
|
};
|
||||||
@@ -42,40 +41,14 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum PTT_ID_t {
|
enum PTT_ID_t {
|
||||||
PTT_ID_OFF = 0,
|
PTT_ID_OFF = 0, // OFF
|
||||||
PTT_ID_BOT,
|
PTT_ID_TX_UP, // BEGIN OF TX
|
||||||
PTT_ID_EOT,
|
PTT_ID_TX_DOWN, // END OF TX
|
||||||
PTT_ID_BOTH
|
PTT_ID_BOTH, // BOTH
|
||||||
|
PTT_ID_APOLLO // Apolo quindar tones
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum PTT_ID_t PTT_ID_t;
|
typedef enum PTT_ID_t PTT_ID_t;
|
||||||
|
|
||||||
#if 0
|
|
||||||
enum STEP_Setting_t
|
|
||||||
{
|
|
||||||
STEP_2_5kHz,
|
|
||||||
STEP_5_0kHz,
|
|
||||||
STEP_6_25kHz,
|
|
||||||
STEP_10_0kHz,
|
|
||||||
STEP_12_5kHz,
|
|
||||||
STEP_25_0kHz,
|
|
||||||
STEP_8_33kHz
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
enum STEP_Setting_t
|
|
||||||
{
|
|
||||||
STEP_1_25kHz,
|
|
||||||
STEP_2_5kHz,
|
|
||||||
STEP_6_25kHz,
|
|
||||||
STEP_10_0kHz,
|
|
||||||
STEP_12_5kHz,
|
|
||||||
STEP_25_0kHz,
|
|
||||||
STEP_8_33kHz
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum STEP_Setting_t STEP_Setting_t;
|
|
||||||
|
|
||||||
enum VfoState_t
|
enum VfoState_t
|
||||||
{
|
{
|
||||||
VFO_STATE_NORMAL = 0,
|
VFO_STATE_NORMAL = 0,
|
||||||
@@ -86,7 +59,6 @@ enum VfoState_t
|
|||||||
VFO_STATE_ALARM,
|
VFO_STATE_ALARM,
|
||||||
VFO_STATE_VOLTAGE_HIGH
|
VFO_STATE_VOLTAGE_HIGH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum VfoState_t VfoState_t;
|
typedef enum VfoState_t VfoState_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -101,7 +73,14 @@ typedef struct VFO_Info_t
|
|||||||
{
|
{
|
||||||
FREQ_Config_t freq_config_RX;
|
FREQ_Config_t freq_config_RX;
|
||||||
FREQ_Config_t freq_config_TX;
|
FREQ_Config_t freq_config_TX;
|
||||||
|
|
||||||
|
// this is for a purpose of the FrequencyReverse function
|
||||||
|
// it points to freq_config_RX normally and to freq_config_TX if reverse function is active
|
||||||
|
//
|
||||||
FREQ_Config_t *pRX;
|
FREQ_Config_t *pRX;
|
||||||
|
|
||||||
|
// this is for a purpose of the FrequencyReverse function
|
||||||
|
// it points to freq_config_TX normally and to freq_config_RX if reverse function is active
|
||||||
FREQ_Config_t *pTX;
|
FREQ_Config_t *pTX;
|
||||||
|
|
||||||
uint32_t TX_OFFSET_FREQUENCY;
|
uint32_t TX_OFFSET_FREQUENCY;
|
||||||
@@ -138,15 +117,21 @@ typedef struct VFO_Info_t
|
|||||||
|
|
||||||
uint8_t AM_mode;
|
uint8_t AM_mode;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
uint8_t Compander;
|
||||||
uint8_t Compander;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char Name[16];
|
char Name[16];
|
||||||
} VFO_Info_t;
|
} VFO_Info_t;
|
||||||
|
|
||||||
|
// Settings of the main VFO that is selected by the user
|
||||||
|
// The pointer follows gEeprom.RX_VFO index
|
||||||
extern VFO_Info_t *gTxVfo;
|
extern VFO_Info_t *gTxVfo;
|
||||||
|
|
||||||
|
// Settings of the actual VFO that is now used for RX,
|
||||||
|
// It is being alternated by dual watch, and flipped by crossband
|
||||||
|
// The pointer follows gEeprom.RX_VFO
|
||||||
extern VFO_Info_t *gRxVfo;
|
extern VFO_Info_t *gRxVfo;
|
||||||
|
|
||||||
|
// Equal to gTxVfo unless dual watch changes it on incomming transmition (this can only happen when XB off and DW on)
|
||||||
extern VFO_Info_t *gCurrentVfo;
|
extern VFO_Info_t *gCurrentVfo;
|
||||||
|
|
||||||
extern DCS_CodeType_t gSelectedCodeType;
|
extern DCS_CodeType_t gSelectedCodeType;
|
||||||
@@ -159,7 +144,7 @@ extern VfoState_t VfoState[2];
|
|||||||
|
|
||||||
bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum);
|
bool RADIO_CheckValidChannel(uint16_t ChNum, bool bCheckScanList, uint8_t RadioNum);
|
||||||
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
uint8_t RADIO_FindNextChannel(uint8_t ChNum, int8_t Direction, bool bCheckScanList, uint8_t RadioNum);
|
||||||
void RADIO_InitInfo(VFO_Info_t *pInfo, uint8_t ChannelSave, uint8_t ChIndex, uint32_t Frequency);
|
void RADIO_InitInfo(VFO_Info_t *pInfo, const uint8_t ChannelSave, const uint32_t Frequency);
|
||||||
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
void RADIO_ConfigureChannel(const unsigned int VFO, const unsigned int configure);
|
||||||
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
void RADIO_ConfigureSquelchAndOutputPower(VFO_Info_t *pInfo);
|
||||||
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
void RADIO_ApplyOffset(VFO_Info_t *pInfo);
|
||||||
|
|||||||
13
scheduler.c
@@ -57,6 +57,7 @@ void SystickHandler(void)
|
|||||||
gNextTimeslice_500ms = true;
|
gNextTimeslice_500ms = true;
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
DECREMENT_AND_TRIGGER(gTxTimerCountdown_500ms, gTxTimeoutReached);
|
||||||
|
DECREMENT(gSerialConfigCountDown_500ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gGlobalSysTickCounter & 3) == 0)
|
if ((gGlobalSysTickCounter & 3) == 0)
|
||||||
@@ -76,20 +77,20 @@ void SystickHandler(void)
|
|||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE)
|
||||||
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
DECREMENT_AND_TRIGGER(gPowerSave_10ms, gPowerSaveCountdownExpired);
|
||||||
|
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH != DUAL_WATCH_OFF)
|
||||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
DECREMENT_AND_TRIGGER(gDualWatchCountdown_10ms, gScheduleDualWatch);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (gScanState == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
if (gScanStateDir == SCAN_OFF && gCssScanMode == CSS_SCAN_MODE_OFF && gEeprom.DUAL_WATCH == DUAL_WATCH_OFF)
|
||||||
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gIsNoaaMode && gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
if (gCurrentFunction != FUNCTION_RECEIVE)
|
if (gCurrentFunction != FUNCTION_RECEIVE)
|
||||||
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
DECREMENT_AND_TRIGGER(gNOAA_Countdown_10ms, gScheduleNOAA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (gScanState != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
if (gScanStateDir != SCAN_OFF || gCssScanMode == CSS_SCAN_MODE_SCANNING)
|
||||||
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
if (gCurrentFunction != FUNCTION_MONITOR && gCurrentFunction != FUNCTION_TRANSMIT)
|
||||||
DECREMENT_AND_TRIGGER(ScanPauseDelayIn_10ms, gScheduleScanListen);
|
DECREMENT_AND_TRIGGER(gScanPauseDelayIn_10ms, gScheduleScanListen);
|
||||||
|
|
||||||
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
|
DECREMENT_AND_TRIGGER(gTailNoteEliminationCountdown_10ms, gFlagTailNoteEliminationComplete);
|
||||||
|
|
||||||
@@ -103,7 +104,9 @@ void SystickHandler(void)
|
|||||||
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
DECREMENT_AND_TRIGGER(gFmPlayCountdown_10ms, gScheduleFM);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECREMENT(gVoxStopCountdown_10ms);
|
#ifdef ENABLE_VOX
|
||||||
|
DECREMENT(gVoxStopCountdown_10ms);
|
||||||
|
#endif
|
||||||
|
|
||||||
DECREMENT(boot_counter_10ms);
|
DECREMENT(boot_counter_10ms);
|
||||||
}
|
}
|
||||||
|
|||||||
79
settings.c
@@ -86,22 +86,28 @@ void SETTINGS_SaveSettings(void)
|
|||||||
State[3] = false;
|
State[3] = false;
|
||||||
#endif
|
#endif
|
||||||
State[4] = gEeprom.KEY_LOCK;
|
State[4] = gEeprom.KEY_LOCK;
|
||||||
State[5] = gEeprom.VOX_SWITCH;
|
#ifdef ENABLE_VOX
|
||||||
State[6] = gEeprom.VOX_LEVEL;
|
State[5] = gEeprom.VOX_SWITCH;
|
||||||
|
State[6] = gEeprom.VOX_LEVEL;
|
||||||
|
#else
|
||||||
|
State[5] = false;
|
||||||
|
State[6] = 0;
|
||||||
|
#endif
|
||||||
State[7] = gEeprom.MIC_SENSITIVITY;
|
State[7] = gEeprom.MIC_SENSITIVITY;
|
||||||
EEPROM_WriteBuffer(0x0E70, State);
|
EEPROM_WriteBuffer(0x0E70, State);
|
||||||
|
|
||||||
State[0] = 0xFF;
|
State[0] = (gEeprom.BACKLIGHT_MIN << 4) + gEeprom.BACKLIGHT_MAX;
|
||||||
State[1] = gEeprom.CHANNEL_DISPLAY_MODE;
|
State[1] = gEeprom.CHANNEL_DISPLAY_MODE;
|
||||||
State[2] = gEeprom.CROSS_BAND_RX_TX;
|
State[2] = gEeprom.CROSS_BAND_RX_TX;
|
||||||
State[3] = gEeprom.BATTERY_SAVE;
|
State[3] = gEeprom.BATTERY_SAVE;
|
||||||
State[4] = gEeprom.DUAL_WATCH;
|
State[4] = gEeprom.DUAL_WATCH;
|
||||||
State[5] = gEeprom.BACKLIGHT;
|
State[5] = gEeprom.BACKLIGHT_TIME;
|
||||||
State[6] = gEeprom.TAIL_NOTE_ELIMINATION;
|
State[6] = gEeprom.TAIL_NOTE_ELIMINATION;
|
||||||
State[7] = gEeprom.VFO_OPEN;
|
State[7] = gEeprom.VFO_OPEN;
|
||||||
EEPROM_WriteBuffer(0x0E78, State);
|
EEPROM_WriteBuffer(0x0E78, State);
|
||||||
|
|
||||||
State[0] = gEeprom.BEEP_CONTROL;
|
State[0] = gEeprom.BEEP_CONTROL;
|
||||||
|
State[0] |= gEeprom.KEY_M_LONG_PRESS_ACTION << 1;
|
||||||
State[1] = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
State[1] = gEeprom.KEY_1_SHORT_PRESS_ACTION;
|
||||||
State[2] = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
State[2] = gEeprom.KEY_1_LONG_PRESS_ACTION;
|
||||||
State[3] = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
State[3] = gEeprom.KEY_2_SHORT_PRESS_ACTION;
|
||||||
@@ -112,30 +118,32 @@ void SETTINGS_SaveSettings(void)
|
|||||||
EEPROM_WriteBuffer(0x0E90, State);
|
EEPROM_WriteBuffer(0x0E90, State);
|
||||||
|
|
||||||
memset(Password, 0xFF, sizeof(Password));
|
memset(Password, 0xFF, sizeof(Password));
|
||||||
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
EEPROM_WriteBuffer(0x0E98, State);
|
Password[0] = gEeprom.POWER_ON_PASSWORD;
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
memset(State, 0xFF, sizeof(State));
|
|
||||||
State[0] = gEeprom.VOICE_PROMPT;
|
|
||||||
EEPROM_WriteBuffer(0x0EA0, State);
|
|
||||||
#endif
|
#endif
|
||||||
|
EEPROM_WriteBuffer(0x0E98, Password);
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
memset(State, 0xFF, sizeof(State));
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
State[0] = gEeprom.VOICE_PROMPT;
|
||||||
|
EEPROM_WriteBuffer(0x0EA0, State);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
State[0] = gEeprom.ALARM_MODE;
|
State[0] = gEeprom.ALARM_MODE;
|
||||||
#else
|
#else
|
||||||
State[0] = false;
|
State[0] = false;
|
||||||
#endif
|
#endif
|
||||||
State[1] = gEeprom.ROGER;
|
State[1] = gEeprom.ROGER;
|
||||||
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
State[2] = gEeprom.REPEATER_TAIL_TONE_ELIMINATION;
|
||||||
State[3] = gEeprom.TX_CHANNEL;
|
State[3] = gEeprom.TX_VFO;
|
||||||
EEPROM_WriteBuffer(0x0EA8, State);
|
EEPROM_WriteBuffer(0x0EA8, State);
|
||||||
|
|
||||||
State[0] = gEeprom.DTMF_SIDE_TONE;
|
State[0] = gEeprom.DTMF_SIDE_TONE;
|
||||||
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
State[1] = gEeprom.DTMF_SEPARATE_CODE;
|
||||||
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
State[2] = gEeprom.DTMF_GROUP_CALL_CODE;
|
||||||
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
State[3] = gEeprom.DTMF_DECODE_RESPONSE;
|
||||||
State[4] = gEeprom.DTMF_AUTO_RESET_TIME;
|
State[4] = gEeprom.DTMF_auto_reset_time;
|
||||||
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
State[5] = gEeprom.DTMF_PRELOAD_TIME / 10U;
|
||||||
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
State[6] = gEeprom.DTMF_FIRST_CODE_PERSIST_TIME / 10U;
|
||||||
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
State[7] = gEeprom.DTMF_HASH_CODE_PERSIST_TIME / 10U;
|
||||||
@@ -174,17 +182,15 @@ void SETTINGS_SaveSettings(void)
|
|||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
if (!gSetting_AM_fix) State[7] &= ~(1u << 5);
|
||||||
#endif
|
#endif
|
||||||
|
State[7] = (State[7] & ~(3u << 6)) | ((gSetting_backlight_on_tx_rx & 3u) << 6);
|
||||||
|
|
||||||
EEPROM_WriteBuffer(0x0F40, State);
|
EEPROM_WriteBuffer(0x0F40, State);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SETTINGS_LoadChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
if (!IS_NOAA_CHANNEL(Channel))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const uint16_t OffsetMR = Channel * 16;
|
const uint16_t OffsetMR = Channel * 16;
|
||||||
@@ -214,7 +220,7 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
| (pVFO->OUTPUT_POWER << 2)
|
| (pVFO->OUTPUT_POWER << 2)
|
||||||
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
| (pVFO->CHANNEL_BANDWIDTH << 1)
|
||||||
| (pVFO->FrequencyReverse << 0);
|
| (pVFO->FrequencyReverse << 0);
|
||||||
State[5] = (pVFO->DTMF_PTT_ID_TX_MODE << 1) | (pVFO->DTMF_DECODING_ENABLE << 0);
|
State[5] = ((pVFO->DTMF_PTT_ID_TX_MODE & 7u) << 1) | ((pVFO->DTMF_DECODING_ENABLE & 1u) << 0);
|
||||||
State[6] = pVFO->STEP_SETTING;
|
State[6] = pVFO->STEP_SETTING;
|
||||||
State[7] = pVFO->SCRAMBLING_TYPE;
|
State[7] = pVFO->SCRAMBLING_TYPE;
|
||||||
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
EEPROM_WriteBuffer(OffsetVFO + 8, State);
|
||||||
@@ -222,8 +228,9 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
SETTINGS_UpdateChannel(Channel, pVFO, true);
|
SETTINGS_UpdateChannel(Channel, pVFO, true);
|
||||||
|
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{ // it's a memory channel
|
||||||
#ifndef KEEP_MEM_NAME
|
|
||||||
|
#ifndef ENABLE_KEEP_MEM_NAME
|
||||||
// clear/reset the channel name
|
// clear/reset the channel name
|
||||||
//memset(&State, 0xFF, sizeof(State));
|
//memset(&State, 0xFF, sizeof(State));
|
||||||
memset(&State, 0x00, sizeof(State)); // follow the QS way
|
memset(&State, 0x00, sizeof(State)); // follow the QS way
|
||||||
@@ -245,28 +252,33 @@ void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration)
|
||||||
|
{
|
||||||
|
uint16_t buf[4];
|
||||||
|
EEPROM_WriteBuffer(0x1F40, batteryCalibration);
|
||||||
|
EEPROM_ReadBuffer( 0x1F48, buf, sizeof(buf));
|
||||||
|
buf[0] = batteryCalibration[4];
|
||||||
|
buf[1] = batteryCalibration[5];
|
||||||
|
EEPROM_WriteBuffer(0x1F48, buf);
|
||||||
|
}
|
||||||
|
|
||||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
if (IS_NOT_NOAA_CHANNEL(Channel))
|
if (!IS_NOAA_CHANNEL(Channel))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
uint8_t State[8];
|
uint8_t State[8];
|
||||||
uint8_t Attributes = 0xFF; // default attributes
|
uint8_t Attributes = 0xFF; // default attributes
|
||||||
#ifdef ENABLE_COMPANDER
|
|
||||||
Attributes &= ~MR_CH_COMPAND; // default to '0' = compander disabled
|
|
||||||
#endif
|
|
||||||
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
uint16_t Offset = 0x0D60 + (Channel & ~7u);
|
||||||
|
|
||||||
|
Attributes &= (uint8_t)(~MR_CH_COMPAND); // default to '0' = compander disabled
|
||||||
|
|
||||||
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
EEPROM_ReadBuffer(Offset, State, sizeof(State));
|
||||||
|
|
||||||
if (keep)
|
if (keep)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_COMPANDER
|
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Compander << 4) | (pVFO->Band << 0);
|
|
||||||
#else
|
|
||||||
Attributes = (pVFO->SCANLIST1_PARTICIPATION << 7) | (pVFO->SCANLIST2_PARTICIPATION << 6) | (pVFO->Band << 0);
|
|
||||||
#endif
|
|
||||||
if (State[Channel & 7u] == Attributes)
|
if (State[Channel & 7u] == Attributes)
|
||||||
return; // no change in the attributes
|
return; // no change in the attributes
|
||||||
}
|
}
|
||||||
@@ -277,9 +289,10 @@ void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep)
|
|||||||
|
|
||||||
gMR_ChannelAttributes[Channel] = Attributes;
|
gMR_ChannelAttributes[Channel] = Attributes;
|
||||||
|
|
||||||
// #ifndef KEEP_MEM_NAME
|
// #ifndef ENABLE_KEEP_MEM_NAME
|
||||||
if (IS_MR_CHANNEL(Channel))
|
if (IS_MR_CHANNEL(Channel))
|
||||||
{
|
{ // it's a memory channel
|
||||||
|
|
||||||
const uint16_t OffsetMR = Channel * 16;
|
const uint16_t OffsetMR = Channel * 16;
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{ // clear/reset the channel name
|
{ // clear/reset the channel name
|
||||||
|
|||||||
60
settings.h
@@ -20,6 +20,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "frequencies.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
|
|
||||||
enum POWER_OnDisplayMode_t {
|
enum POWER_OnDisplayMode_t {
|
||||||
@@ -28,7 +29,6 @@ enum POWER_OnDisplayMode_t {
|
|||||||
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
POWER_ON_DISPLAY_MODE_VOLTAGE,
|
||||||
POWER_ON_DISPLAY_MODE_NONE
|
POWER_ON_DISPLAY_MODE_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
typedef enum POWER_OnDisplayMode_t POWER_OnDisplayMode_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -80,6 +80,9 @@ enum {
|
|||||||
ACTION_OPT_ALARM,
|
ACTION_OPT_ALARM,
|
||||||
ACTION_OPT_FM,
|
ACTION_OPT_FM,
|
||||||
ACTION_OPT_1750,
|
ACTION_OPT_1750,
|
||||||
|
ACTION_OPT_KEYLOCK,
|
||||||
|
ACTION_OPT_A_B,
|
||||||
|
ACTION_OPT_VFO_MR,
|
||||||
ACTION_OPT_LEN
|
ACTION_OPT_LEN
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -90,7 +93,6 @@ enum {
|
|||||||
VOICE_PROMPT_CHINESE,
|
VOICE_PROMPT_CHINESE,
|
||||||
VOICE_PROMPT_ENGLISH
|
VOICE_PROMPT_ENGLISH
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
typedef enum VOICE_Prompt_t VOICE_Prompt_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -98,7 +100,6 @@ enum ALARM_Mode_t {
|
|||||||
ALARM_MODE_SITE = 0,
|
ALARM_MODE_SITE = 0,
|
||||||
ALARM_MODE_TONE
|
ALARM_MODE_TONE
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
typedef enum ALARM_Mode_t ALARM_Mode_t;
|
||||||
|
|
||||||
enum ROGER_Mode_t {
|
enum ROGER_Mode_t {
|
||||||
@@ -106,7 +107,6 @@ enum ROGER_Mode_t {
|
|||||||
ROGER_MODE_ROGER,
|
ROGER_MODE_ROGER,
|
||||||
ROGER_MODE_MDC
|
ROGER_MODE_MDC
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
typedef enum ROGER_Mode_t ROGER_Mode_t;
|
||||||
|
|
||||||
enum CHANNEL_DisplayMode_t {
|
enum CHANNEL_DisplayMode_t {
|
||||||
@@ -115,7 +115,6 @@ enum CHANNEL_DisplayMode_t {
|
|||||||
MDF_NAME,
|
MDF_NAME,
|
||||||
MDF_NAME_FREQ
|
MDF_NAME_FREQ
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
typedef enum CHANNEL_DisplayMode_t CHANNEL_DisplayMode_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -125,13 +124,27 @@ typedef struct {
|
|||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
uint8_t NoaaChannel[2];
|
uint8_t NoaaChannel[2];
|
||||||
#endif
|
#endif
|
||||||
uint8_t RX_CHANNEL;
|
|
||||||
uint8_t TX_CHANNEL;
|
// The actual VFO index (0-upper/1-lower) that is now used for RX,
|
||||||
|
// It is being alternated by dual watch, and flipped by crossband
|
||||||
|
uint8_t RX_VFO;
|
||||||
|
|
||||||
|
// The main VFO index (0-upper/1-lower) selected by the user
|
||||||
|
//
|
||||||
|
uint8_t TX_VFO;
|
||||||
|
|
||||||
uint8_t field7_0xa;
|
uint8_t field7_0xa;
|
||||||
uint8_t field8_0xb;
|
uint8_t field8_0xb;
|
||||||
|
|
||||||
uint32_t POWER_ON_PASSWORD;
|
#ifdef ENABLE_FMRADIO
|
||||||
|
uint16_t FM_SelectedFrequency;
|
||||||
|
uint8_t FM_SelectedChannel;
|
||||||
|
bool FM_IsMrMode;
|
||||||
|
uint16_t FM_FrequencyPlaying;
|
||||||
|
uint16_t FM_LowerLimit;
|
||||||
|
uint16_t FM_UpperLimit;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t SQUELCH_LEVEL;
|
uint8_t SQUELCH_LEVEL;
|
||||||
uint8_t TX_TIMEOUT_TIMER;
|
uint8_t TX_TIMEOUT_TIMER;
|
||||||
bool KEY_LOCK;
|
bool KEY_LOCK;
|
||||||
@@ -147,7 +160,7 @@ typedef struct {
|
|||||||
uint8_t DUAL_WATCH;
|
uint8_t DUAL_WATCH;
|
||||||
uint8_t CROSS_BAND_RX_TX;
|
uint8_t CROSS_BAND_RX_TX;
|
||||||
uint8_t BATTERY_SAVE;
|
uint8_t BATTERY_SAVE;
|
||||||
uint8_t BACKLIGHT;
|
uint8_t BACKLIGHT_TIME;
|
||||||
uint8_t SCAN_RESUME_MODE;
|
uint8_t SCAN_RESUME_MODE;
|
||||||
uint8_t SCAN_LIST_DEFAULT;
|
uint8_t SCAN_LIST_DEFAULT;
|
||||||
bool SCAN_LIST_ENABLED[2];
|
bool SCAN_LIST_ENABLED[2];
|
||||||
@@ -156,27 +169,12 @@ typedef struct {
|
|||||||
|
|
||||||
uint8_t field29_0x26;
|
uint8_t field29_0x26;
|
||||||
uint8_t field30_0x27;
|
uint8_t field30_0x27;
|
||||||
|
|
||||||
uint16_t VOX1_THRESHOLD;
|
|
||||||
uint16_t VOX0_THRESHOLD;
|
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_SelectedFrequency;
|
|
||||||
uint8_t FM_SelectedChannel;
|
|
||||||
bool FM_IsMrMode;
|
|
||||||
uint16_t FM_FrequencyPlaying;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t field37_0x32;
|
uint8_t field37_0x32;
|
||||||
uint8_t field38_0x33;
|
uint8_t field38_0x33;
|
||||||
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
uint16_t FM_LowerLimit;
|
|
||||||
uint16_t FM_UpperLimit;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool AUTO_KEYPAD_LOCK;
|
bool AUTO_KEYPAD_LOCK;
|
||||||
#ifdef ENABLE_ALARM
|
#if defined(ENABLE_ALARM) || defined(ENABLE_TX1750)
|
||||||
ALARM_Mode_t ALARM_MODE;
|
ALARM_Mode_t ALARM_MODE;
|
||||||
#endif
|
#endif
|
||||||
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
POWER_OnDisplayMode_t POWER_ON_DISPLAY_MODE;
|
||||||
@@ -205,7 +203,7 @@ typedef struct {
|
|||||||
char DTMF_SEPARATE_CODE;
|
char DTMF_SEPARATE_CODE;
|
||||||
char DTMF_GROUP_CALL_CODE;
|
char DTMF_GROUP_CALL_CODE;
|
||||||
uint8_t DTMF_DECODE_RESPONSE;
|
uint8_t DTMF_DECODE_RESPONSE;
|
||||||
uint8_t DTMF_AUTO_RESET_TIME;
|
uint8_t DTMF_auto_reset_time;
|
||||||
uint16_t DTMF_PRELOAD_TIME;
|
uint16_t DTMF_PRELOAD_TIME;
|
||||||
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
uint16_t DTMF_FIRST_CODE_PERSIST_TIME;
|
||||||
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
uint16_t DTMF_HASH_CODE_PERSIST_TIME;
|
||||||
@@ -220,11 +218,18 @@ typedef struct {
|
|||||||
uint8_t VOLUME_GAIN;
|
uint8_t VOLUME_GAIN;
|
||||||
uint8_t DAC_GAIN;
|
uint8_t DAC_GAIN;
|
||||||
|
|
||||||
|
VFO_Info_t VfoInfo[2];
|
||||||
|
uint32_t POWER_ON_PASSWORD;
|
||||||
|
uint16_t VOX1_THRESHOLD;
|
||||||
|
uint16_t VOX0_THRESHOLD;
|
||||||
|
|
||||||
uint8_t field77_0x95;
|
uint8_t field77_0x95;
|
||||||
uint8_t field78_0x96;
|
uint8_t field78_0x96;
|
||||||
uint8_t field79_0x97;
|
uint8_t field79_0x97;
|
||||||
|
|
||||||
VFO_Info_t VfoInfo[2];
|
uint8_t KEY_M_LONG_PRESS_ACTION;
|
||||||
|
uint8_t BACKLIGHT_MIN;
|
||||||
|
uint8_t BACKLIGHT_MAX;
|
||||||
} EEPROM_Config_t;
|
} EEPROM_Config_t;
|
||||||
|
|
||||||
extern EEPROM_Config_t gEeprom;
|
extern EEPROM_Config_t gEeprom;
|
||||||
@@ -235,6 +240,7 @@ extern EEPROM_Config_t gEeprom;
|
|||||||
void SETTINGS_SaveVfoIndices(void);
|
void SETTINGS_SaveVfoIndices(void);
|
||||||
void SETTINGS_SaveSettings(void);
|
void SETTINGS_SaveSettings(void);
|
||||||
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
|
void SETTINGS_SaveChannel(uint8_t Channel, uint8_t VFO, const VFO_Info_t *pVFO, uint8_t Mode);
|
||||||
|
void SETTINGS_SaveBatteryCalibration(const uint16_t * batteryCalibration);
|
||||||
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep);
|
void SETTINGS_UpdateChannel(uint8_t Channel, const VFO_Info_t *pVFO, bool keep);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
17
ui/aircopy.c
@@ -44,12 +44,19 @@ void UI_DisplayAircopy(void)
|
|||||||
|
|
||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
{
|
{
|
||||||
NUMBER_ToDigits(gRxVfo->freq_config_RX.Frequency, String);
|
uint32_t frequency = gRxVfo->freq_config_RX.Frequency;
|
||||||
UI_DisplayFrequency(String, 16, 2, 0, 0);
|
sprintf(String, "%3u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_DisplaySmallDigits(2, String + 6, 97, 3, true);
|
// show the remaining 2 small frequency digits
|
||||||
|
UI_PrintStringSmall(String + 7, 97, 0, 3);
|
||||||
|
String[7] = 0;
|
||||||
|
// show the main large frequency digits
|
||||||
|
UI_DisplayFrequency(String, 16, 2, false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const char * ascii = INPUTBOX_GetAscii();
|
||||||
|
sprintf(String, "%.3s.%.3s",ascii, ascii + 3);
|
||||||
|
UI_DisplayFrequency(String, 16, 2, false);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
UI_DisplayFrequency(gInputBox, 16, 2, 1, 0);
|
|
||||||
|
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
if (gAirCopyIsSendMode == 0)
|
if (gAirCopyIsSendMode == 0)
|
||||||
|
|||||||
83
ui/battery.c
@@ -22,66 +22,35 @@
|
|||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
#include "ui/battery.h"
|
#include "ui/battery.h"
|
||||||
|
|
||||||
void UI_DisplayBattery(const uint8_t level, const uint8_t blink)
|
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink)
|
||||||
{
|
{
|
||||||
// if (gCurrentFunction != FUNCTION_TRANSMIT)
|
if (level < 2 && blink == 1) {
|
||||||
|
memset(bitmap, 0, sizeof(BITMAP_BatteryLevel1));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
||||||
|
if (level > 1)
|
||||||
#if 1
|
|
||||||
|
|
||||||
if (level >= 2)
|
|
||||||
{
|
{
|
||||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
unsigned int i;
|
||||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
uint8_t bars = level - 1;
|
||||||
uint8_t *pb = bitmap + sizeof(BITMAP_BatteryLevel1);
|
if (bars > 4)
|
||||||
if (level >= 2)
|
bars = 4;
|
||||||
memmove(pb - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
for (i = 0; i < bars; i++)
|
||||||
if (level >= 5)
|
{
|
||||||
memmove(pb - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
||||||
if (level >= 7)
|
memcpy(bitmap + sizeof(BITMAP_BatteryLevel1) - 4 - (i * 3), BITMAP_BatteryLevel, 2);
|
||||||
memmove(pb - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
#else
|
||||||
if (level >= 9)
|
memcpy(bitmap + 3 + (i * 3) + 0, BITMAP_BatteryLevel, 2);
|
||||||
memmove(pb - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
#endif
|
||||||
#else
|
}
|
||||||
if (level >= 2)
|
|
||||||
memmove(bitmap + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (level >= 5)
|
|
||||||
memmove(bitmap + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (level >= 7)
|
|
||||||
memmove(bitmap + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (level >= 9)
|
|
||||||
memmove(bitmap + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (blink == 1)
|
|
||||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
else
|
|
||||||
memset(bitmap, 0, sizeof(bitmap));
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (level > 0)
|
|
||||||
{
|
|
||||||
const uint8_t lev = (level <= 11) ? level : 11;
|
|
||||||
|
|
||||||
memmove(bitmap, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
|
|
||||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
|
||||||
for (uint8_t i = 0; i < lev; i++)
|
|
||||||
bitmap[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
|
||||||
#else
|
|
||||||
for (uint8_t i = 0; i < lev; i++)
|
|
||||||
bitmap[sizeof(bitmap) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
memset(bitmap, 0, sizeof(bitmap));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// col lne, siz, bm
|
|
||||||
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI_DisplayBattery(uint8_t level, uint8_t blink)
|
||||||
|
{
|
||||||
|
uint8_t bitmap[sizeof(BITMAP_BatteryLevel1)];
|
||||||
|
UI_DrawBattery(bitmap, level, blink);
|
||||||
|
ST7565_DrawLine(LCD_WIDTH - sizeof(bitmap), 0, sizeof(bitmap), bitmap);
|
||||||
|
}
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
#define UI_BATTERY_H
|
#define UI_BATTERY_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
void UI_DrawBattery(uint8_t* bitmap, uint8_t level, uint8_t blink);
|
||||||
void UI_DisplayBattery(const uint8_t Level, const uint8_t blink);
|
void UI_DisplayBattery(uint8_t Level, uint8_t blink);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
11
ui/fmradio.c
@@ -90,11 +90,14 @@ void UI_DisplayFM(void)
|
|||||||
{
|
{
|
||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
{
|
{
|
||||||
NUMBER_ToDigits(gEeprom.FM_FrequencyPlaying * 10000, String);
|
sprintf(String, "%3d.%d", gEeprom.FM_FrequencyPlaying / 10, gEeprom.FM_FrequencyPlaying % 10);
|
||||||
UI_DisplayFrequency(String, 23, 4, false, true);
|
UI_DisplayFrequency(String, 32, 4, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const char * ascii = INPUTBOX_GetAscii();
|
||||||
|
sprintf(String, "%.3s.%.1s",ascii, ascii + 3);
|
||||||
|
UI_DisplayFrequency(String, 32, 4, false);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
UI_DisplayFrequency(gInputBox, 23, 4, true, false);
|
|
||||||
|
|
||||||
ST7565_BlitFullScreen();
|
ST7565_BlitFullScreen();
|
||||||
return;
|
return;
|
||||||
|
|||||||
140
ui/helper.c
@@ -72,12 +72,12 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
|
|||||||
|
|
||||||
for (i = 0; i < Length; i++)
|
for (i = 0; i < Length; i++)
|
||||||
{
|
{
|
||||||
if (pString[i] >= ' ' && pString[i] < 127)
|
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
||||||
|
if (pString[i] > ' ' && pString[i] < 127)
|
||||||
{
|
{
|
||||||
const unsigned int index = pString[i] - ' ';
|
const unsigned int index = pString[i] - ' ' - 1;
|
||||||
const unsigned int ofs = (unsigned int)Start + (i * Width);
|
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
|
||||||
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 8);
|
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
|
||||||
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][8], 7);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,9 +95,9 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||||
for (i = 0; i < Length; i++)
|
for (i = 0; i < Length; i++)
|
||||||
{
|
{
|
||||||
if (pString[i] >= 32)
|
if (pString[i] > ' ')
|
||||||
{
|
{
|
||||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||||
if (index < ARRAY_SIZE(gFontSmall))
|
if (index < ARRAY_SIZE(gFontSmall))
|
||||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||||
}
|
}
|
||||||
@@ -118,9 +118,9 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
uint8_t *pFb = gFrameBuffer[Line] + Start;
|
||||||
for (i = 0; i < Length; i++)
|
for (i = 0; i < Length; i++)
|
||||||
{
|
{
|
||||||
if (pString[i] >= 32)
|
if (pString[i] > ' ')
|
||||||
{
|
{
|
||||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||||
if (index < ARRAY_SIZE(gFontSmallBold))
|
if (index < ARRAY_SIZE(gFontSmallBold))
|
||||||
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
|
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
|
||||||
}
|
}
|
||||||
@@ -135,126 +135,46 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
|
|||||||
const unsigned int char_spacing = char_width + 1;
|
const unsigned int char_spacing = char_width + 1;
|
||||||
for (i = 0; i < strlen(pString); i++)
|
for (i = 0; i < strlen(pString); i++)
|
||||||
{
|
{
|
||||||
if (pString[i] >= 32)
|
if (pString[i] > ' ')
|
||||||
{
|
{
|
||||||
const unsigned int index = (unsigned int)pString[i] - 32;
|
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
|
||||||
if (index < ARRAY_SIZE(gFontSmall))
|
if (index < ARRAY_SIZE(gFontSmall))
|
||||||
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag)
|
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center)
|
||||||
{
|
{
|
||||||
const unsigned int char_width = 13;
|
const unsigned int char_width = 13;
|
||||||
uint8_t *pFb0 = gFrameBuffer[Y] + X;
|
uint8_t *pFb0 = gFrameBuffer[Y] + X;
|
||||||
uint8_t *pFb1 = pFb0 + 128;
|
uint8_t *pFb1 = pFb0 + 128;
|
||||||
bool bCanDisplay = false;
|
bool bCanDisplay = false;
|
||||||
unsigned int i = 0;
|
|
||||||
|
uint8_t len = strlen(string);
|
||||||
// MHz
|
for(int i = 0; i < len; i++) {
|
||||||
while (i < 3)
|
char c = string[i];
|
||||||
{
|
if(c=='-') c = '9' + 1;
|
||||||
const unsigned int Digit = pDigits[i++];
|
if (bCanDisplay || c != ' ')
|
||||||
if (bDisplayLeadingZero || bCanDisplay || Digit > 0)
|
|
||||||
{
|
{
|
||||||
bCanDisplay = true;
|
bCanDisplay = true;
|
||||||
memmove(pFb0, gFontBigDigits[Digit], char_width);
|
if(c>='0' && c<='9' + 1) {
|
||||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
memcpy(pFb0 + 2, gFontBigDigits[c-'0'], char_width - 3);
|
||||||
|
memcpy(pFb1 + 2, gFontBigDigits[c-'0'] + char_width - 3, char_width - 3);
|
||||||
|
}
|
||||||
|
else if(c=='.') {
|
||||||
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
|
*pFb1 = 0x60; pFb0++; pFb1++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else if (center) {
|
||||||
if (bFlag)
|
|
||||||
{
|
|
||||||
pFb0 -= 6;
|
pFb0 -= 6;
|
||||||
pFb1 -= 6;
|
pFb1 -= 6;
|
||||||
}
|
}
|
||||||
pFb0 += char_width;
|
pFb0 += char_width;
|
||||||
pFb1 += char_width;
|
pFb1 += char_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// decimal point
|
|
||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
|
||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
|
||||||
*pFb1 = 0x60; pFb0++; pFb1++;
|
|
||||||
|
|
||||||
// kHz
|
|
||||||
while (i < 6)
|
|
||||||
{
|
|
||||||
const unsigned int Digit = pDigits[i++];
|
|
||||||
memmove(pFb0, gFontBigDigits[Digit], char_width);
|
|
||||||
memmove(pFb1, gFontBigDigits[Digit] + char_width, char_width);
|
|
||||||
pFb0 += char_width;
|
|
||||||
pFb1 += char_width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero)
|
|
||||||
{
|
|
||||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
|
||||||
const unsigned int spacing = 1 + char_width;
|
|
||||||
uint8_t *pFb = gFrameBuffer[Y] + X;
|
|
||||||
bool bCanDisplay = false;
|
|
||||||
unsigned int i = 0;
|
|
||||||
|
|
||||||
// MHz
|
|
||||||
while (i < 3)
|
|
||||||
{
|
|
||||||
const unsigned int c = pDigits[i++];
|
|
||||||
if (bDisplayLeadingZero || bCanDisplay || c > 0)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
memmove(pFb + 1, gFontSmallDigits[c], char_width);
|
|
||||||
#else
|
|
||||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
|
||||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
|
||||||
#endif
|
|
||||||
pFb += spacing;
|
|
||||||
bCanDisplay = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// decimal point
|
|
||||||
pFb++;
|
|
||||||
pFb++;
|
|
||||||
*pFb++ = 0x60;
|
|
||||||
*pFb++ = 0x60;
|
|
||||||
pFb++;
|
|
||||||
|
|
||||||
// kHz
|
|
||||||
while (i < 8)
|
|
||||||
{
|
|
||||||
const unsigned int c = pDigits[i++];
|
|
||||||
#if 0
|
|
||||||
memmove(pFb + 1, gFontSmallDigits[c], char_width);
|
|
||||||
#else
|
|
||||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
|
||||||
memmove(pFb + 1, gFontSmall[index], char_width);
|
|
||||||
#endif
|
|
||||||
pFb += spacing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros)
|
|
||||||
{
|
|
||||||
const unsigned int char_width = ARRAY_SIZE(gFontSmall[0]);
|
|
||||||
const unsigned int spacing = 1 + char_width;
|
|
||||||
bool display = display_leading_zeros;
|
|
||||||
unsigned int xx;
|
|
||||||
unsigned int i;
|
|
||||||
for (i = 0, xx = x; i < size; i++)
|
|
||||||
{
|
|
||||||
const unsigned int c = (unsigned int)str[i];
|
|
||||||
if (c > 0)
|
|
||||||
display = true; // non '0'
|
|
||||||
if (display && c < 11)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
memmove(gFrameBuffer[y] + xx, gFontSmallDigits[c], char_width);
|
|
||||||
#else
|
|
||||||
const unsigned int index = (c < 10) ? '0' - 32 + c : '-' - 32;
|
|
||||||
memmove(gFrameBuffer[y] + xx + 1, gFontSmall[index], char_width);
|
|
||||||
#endif
|
|
||||||
xx += spacing;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
|
|||||||
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
void UI_PrintStringSmallBold(const char *pString, uint8_t Start, uint8_t End, uint8_t Line);
|
||||||
#endif
|
#endif
|
||||||
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer);
|
||||||
void UI_DisplayFrequency(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero, bool bFlag);
|
void UI_DisplayFrequency(const char *string, uint8_t X, uint8_t Y, bool center);
|
||||||
void UI_DisplayFrequencySmall(const char *pDigits, uint8_t X, uint8_t Y, bool bDisplayLeadingZero);
|
|
||||||
void UI_DisplaySmallDigits(const uint8_t size, const char *str, const uint8_t x, const uint8_t y, const bool display_leading_zeros);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,10 @@
|
|||||||
#include "ui/inputbox.h"
|
#include "ui/inputbox.h"
|
||||||
|
|
||||||
char gInputBox[8];
|
char gInputBox[8];
|
||||||
|
char inputBoxAscii[9];
|
||||||
uint8_t gInputBoxIndex;
|
uint8_t gInputBoxIndex;
|
||||||
|
|
||||||
void INPUTBOX_Append(char Digit)
|
void INPUTBOX_Append(const KEY_Code_t Digit)
|
||||||
{
|
{
|
||||||
if (gInputBoxIndex >= sizeof(gInputBox))
|
if (gInputBoxIndex >= sizeof(gInputBox))
|
||||||
return;
|
return;
|
||||||
@@ -29,6 +30,15 @@ void INPUTBOX_Append(char Digit)
|
|||||||
if (gInputBoxIndex == 0)
|
if (gInputBoxIndex == 0)
|
||||||
memset(gInputBox, 10, sizeof(gInputBox));
|
memset(gInputBox, 10, sizeof(gInputBox));
|
||||||
|
|
||||||
gInputBox[gInputBoxIndex++] = Digit;
|
if (Digit != KEY_INVALID)
|
||||||
|
gInputBox[gInputBoxIndex++] = (char)(Digit - KEY_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* INPUTBOX_GetAscii()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < 8; i++) {
|
||||||
|
char c = gInputBox[i];
|
||||||
|
inputBoxAscii[i] = (c==10)? '-' : '0' + c;
|
||||||
|
}
|
||||||
|
return inputBoxAscii;
|
||||||
|
}
|
||||||
@@ -19,10 +19,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "driver/keyboard.h"
|
||||||
|
|
||||||
extern char gInputBox[8];
|
extern char gInputBox[8];
|
||||||
extern uint8_t gInputBoxIndex;
|
extern uint8_t gInputBoxIndex;
|
||||||
|
|
||||||
void INPUTBOX_Append(char Digit);
|
void INPUTBOX_Append(const KEY_Code_t Digit);
|
||||||
|
const char* INPUTBOX_GetAscii();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "ARMCM0.h"
|
#include "ARMCM0.h"
|
||||||
@@ -100,10 +102,9 @@ void UI_DisplayLock(void)
|
|||||||
uint32_t Password;
|
uint32_t Password;
|
||||||
|
|
||||||
gInputBoxIndex = 0;
|
gInputBoxIndex = 0;
|
||||||
|
Password = StrToUL(INPUTBOX_GetAscii());
|
||||||
|
|
||||||
NUMBER_Get(gInputBox, &Password);
|
if ((gEeprom.POWER_ON_PASSWORD) == Password)
|
||||||
|
|
||||||
if ((gEeprom.POWER_ON_PASSWORD * 100) == Password)
|
|
||||||
{
|
{
|
||||||
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
AUDIO_PlayBeep(BEEP_1KHZ_60MS_OPTIONAL);
|
||||||
return;
|
return;
|
||||||
@@ -156,3 +157,5 @@ void UI_DisplayLock(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -17,7 +17,9 @@
|
|||||||
#ifndef UI_LOCK_H
|
#ifndef UI_LOCK_H
|
||||||
#define UI_LOCK_H
|
#define UI_LOCK_H
|
||||||
|
|
||||||
void UI_DisplayLock(void);
|
#ifdef ENABLE_PWRON_PASSWORD
|
||||||
|
void UI_DisplayLock(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
13
ui/main.h
@@ -17,6 +17,19 @@
|
|||||||
#ifndef UI_MAIN_H
|
#ifndef UI_MAIN_H
|
||||||
#define UI_MAIN_H
|
#define UI_MAIN_H
|
||||||
|
|
||||||
|
enum center_line_t {
|
||||||
|
CENTER_LINE_NONE = 0,
|
||||||
|
CENTER_LINE_IN_USE,
|
||||||
|
CENTER_LINE_AUDIO_BAR,
|
||||||
|
CENTER_LINE_RSSI,
|
||||||
|
CENTER_LINE_AM_FIX_DATA,
|
||||||
|
CENTER_LINE_DTMF_DEC,
|
||||||
|
CENTER_LINE_CHARGE_DATA
|
||||||
|
};
|
||||||
|
typedef enum center_line_t center_line_t;
|
||||||
|
|
||||||
|
extern center_line_t center_line;
|
||||||
|
|
||||||
void UI_DisplayAudioBar(void);
|
void UI_DisplayAudioBar(void);
|
||||||
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
void UI_UpdateRSSI(const int16_t rssi, const int vfo);
|
||||||
void UI_DisplayMain(void);
|
void UI_DisplayMain(void);
|
||||||
|
|||||||
637
ui/menu.c
@@ -18,6 +18,7 @@
|
|||||||
#include <stdlib.h> // abs()
|
#include <stdlib.h> // abs()
|
||||||
|
|
||||||
#include "app/dtmf.h"
|
#include "app/dtmf.h"
|
||||||
|
#include "app/menu.h"
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "dcs.h"
|
#include "dcs.h"
|
||||||
@@ -35,102 +36,111 @@
|
|||||||
#include "ui/menu.h"
|
#include "ui/menu.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
|
|
||||||
// NOTE. this menu list is half way through a change, what might seem
|
|
||||||
// pointless at this time is for there for a reason.
|
|
||||||
//
|
|
||||||
const t_menu_item MenuList[] =
|
const t_menu_item MenuList[] =
|
||||||
{
|
{
|
||||||
// text, voice ID, menu ID
|
// text, voice ID, menu ID
|
||||||
|
{"Step", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
||||||
|
{"TxPwr", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
||||||
|
{"RxDCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
||||||
|
{"RxCTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
||||||
|
{"TxDCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
||||||
|
{"TxCTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
||||||
|
{"TxODir", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
||||||
|
{"TxOffs", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
||||||
|
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
||||||
|
{"Scramb", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
||||||
|
{"BusyCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
||||||
|
{"Compnd", VOICE_ID_INVALID, MENU_COMPAND },
|
||||||
|
{"Demodu", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
||||||
|
{"ScAdd1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
||||||
|
{"ScAdd2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
||||||
|
{"ChSave", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
||||||
|
{"ChDele", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
||||||
|
{"ChName", VOICE_ID_INVALID, MENU_MEM_NAME },
|
||||||
|
|
||||||
{"SQL", VOICE_ID_SQUELCH, MENU_SQL },
|
{"SList", VOICE_ID_INVALID, MENU_S_LIST },
|
||||||
{"STEP", VOICE_ID_FREQUENCY_STEP, MENU_STEP },
|
{"SList1", VOICE_ID_INVALID, MENU_SLIST1 },
|
||||||
{"T-PWR", VOICE_ID_POWER, MENU_TXP }, // was "TXP"
|
{"SList2", VOICE_ID_INVALID, MENU_SLIST2 },
|
||||||
{"R-DCS", VOICE_ID_DCS, MENU_R_DCS }, // was "R_DCS"
|
{"ScnRev", VOICE_ID_INVALID, MENU_SC_REV },
|
||||||
{"R-CTCS", VOICE_ID_CTCSS, MENU_R_CTCS }, // was "R_CTCS"
|
#ifdef ENABLE_NOAA
|
||||||
{"T-DCS", VOICE_ID_DCS, MENU_T_DCS }, // was "T_DCS"
|
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
||||||
{"T-CTCS", VOICE_ID_CTCSS, MENU_T_CTCS }, // was "T_CTCS"
|
|
||||||
{"T-DIR", VOICE_ID_TX_OFFSET_FREQUENCY_DIRECTION, MENU_SFT_D }, // was "SFT_D"
|
|
||||||
{"T-OFFS", VOICE_ID_TX_OFFSET_FREQUENCY, MENU_OFFSET }, // was "OFFSET"
|
|
||||||
{"T-VFO", VOICE_ID_INVALID, MENU_XB }, // was "WX"
|
|
||||||
{"T-TOUT", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
|
||||||
{"W/N", VOICE_ID_CHANNEL_BANDWIDTH, MENU_W_N },
|
|
||||||
{"SCRAM", VOICE_ID_SCRAMBLER_ON, MENU_SCR }, // was "SCR"
|
|
||||||
{"BUSYCL", VOICE_ID_BUSY_LOCKOUT, MENU_BCL }, // was "BCL"
|
|
||||||
{"CH-SAV", VOICE_ID_MEMORY_CHANNEL, MENU_MEM_CH }, // was "MEM-CH"
|
|
||||||
{"CH-DEL", VOICE_ID_DELETE_CHANNEL, MENU_DEL_CH }, // was "DEL-CH"
|
|
||||||
{"CH-NAM", VOICE_ID_INVALID, MENU_MEM_NAME },
|
|
||||||
{"CH-DIS", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
|
||||||
{"BATSAV", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
|
||||||
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
|
||||||
{"BACKLT", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
|
||||||
{"DUALRX", VOICE_ID_DUAL_STANDBY, MENU_TDR }, // was "TDR"
|
|
||||||
{"BEEP", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
|
||||||
#ifdef ENABLE_VOICE
|
|
||||||
{"VOICE", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
|
||||||
#endif
|
#endif
|
||||||
{"SC-REV", VOICE_ID_INVALID, MENU_SC_REV },
|
|
||||||
{"KEYLOC", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
{"F1Shrt", VOICE_ID_INVALID, MENU_F1SHRT },
|
||||||
{"S-ADD1", VOICE_ID_INVALID, MENU_S_ADD1 },
|
{"F1Long", VOICE_ID_INVALID, MENU_F1LONG },
|
||||||
{"S-ADD2", VOICE_ID_INVALID, MENU_S_ADD2 },
|
{"F2Shrt", VOICE_ID_INVALID, MENU_F2SHRT },
|
||||||
{"STE", VOICE_ID_INVALID, MENU_STE },
|
{"F2Long", VOICE_ID_INVALID, MENU_F2LONG },
|
||||||
{"RP-STE", VOICE_ID_INVALID, MENU_RP_STE },
|
{"M Long", VOICE_ID_INVALID, MENU_MLONG },
|
||||||
{"MIC", VOICE_ID_INVALID, MENU_MIC },
|
|
||||||
|
{"KeyLck", VOICE_ID_INVALID, MENU_AUTOLK }, // was "AUTOLk"
|
||||||
|
{"TxTOut", VOICE_ID_TRANSMIT_OVER_TIME, MENU_TOT }, // was "TOT"
|
||||||
|
{"BatSav", VOICE_ID_SAVE_MODE, MENU_SAVE }, // was "SAVE"
|
||||||
|
{"Mic", VOICE_ID_INVALID, MENU_MIC },
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
{"MICBAR", VOICE_ID_INVALID, MENU_MIC_BAR },
|
{"MicBar", VOICE_ID_INVALID, MENU_MIC_BAR },
|
||||||
|
#endif
|
||||||
|
{"ChDisp", VOICE_ID_INVALID, MENU_MDF }, // was "MDF"
|
||||||
|
{"POnMsg", VOICE_ID_INVALID, MENU_PONMSG },
|
||||||
|
{"BatTxt", VOICE_ID_INVALID, MENU_BAT_TXT },
|
||||||
|
{"BackLt", VOICE_ID_INVALID, MENU_ABR }, // was "ABR"
|
||||||
|
{"BLMin", VOICE_ID_INVALID, MENU_ABR_MIN },
|
||||||
|
{"BLMax", VOICE_ID_INVALID, MENU_ABR_MAX },
|
||||||
|
{"BltTRX", VOICE_ID_INVALID, MENU_ABR_ON_TX_RX },
|
||||||
|
{"Beep", VOICE_ID_BEEP_PROMPT, MENU_BEEP },
|
||||||
|
#ifdef ENABLE_VOICE
|
||||||
|
{"Voice", VOICE_ID_VOICE_PROMPT, MENU_VOICE },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
{"Roger", VOICE_ID_INVALID, MENU_ROGER },
|
||||||
{"COMPND", VOICE_ID_INVALID, MENU_COMPAND },
|
{"STE", VOICE_ID_INVALID, MENU_STE },
|
||||||
#endif
|
{"RP STE", VOICE_ID_INVALID, MENU_RP_STE },
|
||||||
{"1-CALL", VOICE_ID_INVALID, MENU_1_CALL },
|
{"1 Call", VOICE_ID_INVALID, MENU_1_CALL },
|
||||||
{"SLIST", VOICE_ID_INVALID, MENU_S_LIST },
|
|
||||||
{"SLIST1", VOICE_ID_INVALID, MENU_SLIST1 },
|
|
||||||
{"SLIST2", VOICE_ID_INVALID, MENU_SLIST2 },
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
{"AL-MOD", VOICE_ID_INVALID, MENU_AL_MOD },
|
{"AlarmT", VOICE_ID_INVALID, MENU_AL_MOD },
|
||||||
#endif
|
#endif
|
||||||
{"ANI-ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
{"ANI ID", VOICE_ID_ANI_CODE, MENU_ANI_ID },
|
||||||
{"UPCODE", VOICE_ID_INVALID, MENU_UPCODE },
|
{"UPCode", VOICE_ID_INVALID, MENU_UPCODE },
|
||||||
{"DWCODE", VOICE_ID_INVALID, MENU_DWCODE },
|
{"DWCode", VOICE_ID_INVALID, MENU_DWCODE },
|
||||||
{"D-ST", VOICE_ID_INVALID, MENU_D_ST },
|
{"PTT ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
||||||
{"D-RSP", VOICE_ID_INVALID, MENU_D_RSP },
|
{"D ST", VOICE_ID_INVALID, MENU_D_ST },
|
||||||
{"D-HOLD", VOICE_ID_INVALID, MENU_D_HOLD },
|
{"D Resp", VOICE_ID_INVALID, MENU_D_RSP },
|
||||||
{"D-PRE", VOICE_ID_INVALID, MENU_D_PRE },
|
{"D Hold", VOICE_ID_INVALID, MENU_D_HOLD },
|
||||||
{"PTT-ID", VOICE_ID_INVALID, MENU_PTT_ID },
|
{"D Prel", VOICE_ID_INVALID, MENU_D_PRE },
|
||||||
{"D-DCD", VOICE_ID_INVALID, MENU_D_DCD },
|
{"D Decd", VOICE_ID_INVALID, MENU_D_DCD },
|
||||||
{"D-LIST", VOICE_ID_INVALID, MENU_D_LIST },
|
{"D List", VOICE_ID_INVALID, MENU_D_LIST },
|
||||||
{"D-LIVE", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
{"D Live", VOICE_ID_INVALID, MENU_D_LIVE_DEC }, // live DTMF decoder
|
||||||
{"PONMSG", VOICE_ID_INVALID, MENU_PONMSG },
|
|
||||||
{"ROGER", VOICE_ID_INVALID, MENU_ROGER },
|
|
||||||
{"BATVOL", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
|
||||||
{"BATTXT", VOICE_ID_INVALID, MENU_BAT_TXT },
|
|
||||||
{"MODE", VOICE_ID_INVALID, MENU_AM }, // was "AM"
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
{"AM-FIX", VOICE_ID_INVALID, MENU_AM_FIX },
|
{"AM Fix", VOICE_ID_INVALID, MENU_AM_FIX },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
{"AM-FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1},
|
{"AM FT1", VOICE_ID_INVALID, MENU_AM_FIX_TEST1 },
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_VOX
|
||||||
{"NOAA-S", VOICE_ID_INVALID, MENU_NOAA_S },
|
{"VOX", VOICE_ID_VOX, MENU_VOX },
|
||||||
#endif
|
#endif
|
||||||
{"RESET", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
{"BatVol", VOICE_ID_INVALID, MENU_VOL }, // was "VOL"
|
||||||
|
{"RxMode", VOICE_ID_DUAL_STANDBY, MENU_TDR },
|
||||||
|
{"Sql", VOICE_ID_SQUELCH, MENU_SQL },
|
||||||
|
|
||||||
// hidden menu items from here on
|
// hidden menu items from here on
|
||||||
// enabled if pressing both the PTT and upper side button at power-on
|
// enabled if pressing both the PTT and upper side button at power-on
|
||||||
|
{"F Lock", VOICE_ID_INVALID, MENU_F_LOCK },
|
||||||
|
{"Tx 200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
||||||
|
{"Tx 350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
||||||
|
{"Tx 500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
||||||
|
{"350 En", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
||||||
|
{"ScraEn", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
||||||
|
{"TxEnab", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
||||||
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
{"FrCali", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
||||||
|
#endif
|
||||||
|
{"BatCal", VOICE_ID_INVALID, MENU_BATCAL }, // battery voltage calibration
|
||||||
|
{"Reset", VOICE_ID_INITIALISATION, MENU_RESET }, // might be better to move this to the hidden menu items ?
|
||||||
|
|
||||||
{"F-LOCK", VOICE_ID_INVALID, MENU_F_LOCK },
|
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
||||||
{"TX-200", VOICE_ID_INVALID, MENU_200TX }, // was "200TX"
|
|
||||||
{"TX-350", VOICE_ID_INVALID, MENU_350TX }, // was "350TX"
|
|
||||||
{"TX-500", VOICE_ID_INVALID, MENU_500TX }, // was "500TX"
|
|
||||||
{"350-EN", VOICE_ID_INVALID, MENU_350EN }, // was "350EN"
|
|
||||||
{"SCR-EN", VOICE_ID_INVALID, MENU_SCREN }, // was "SCREN"
|
|
||||||
|
|
||||||
{"TX-EN", VOICE_ID_INVALID, MENU_TX_EN }, // enable TX
|
|
||||||
{"F-CALI", VOICE_ID_INVALID, MENU_F_CALI }, // reference xtal calibration
|
|
||||||
|
|
||||||
{"", VOICE_ID_INVALID, 0xff } // end of list - DO NOT delete or move this this
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const uint8_t FIRST_HIDDEN_MENU_ITEM = MENU_F_LOCK;
|
||||||
|
|
||||||
const char gSubMenu_TXP[3][5] =
|
const char gSubMenu_TXP[3][5] =
|
||||||
{
|
{
|
||||||
"LOW",
|
"LOW",
|
||||||
@@ -168,7 +178,6 @@ const char gSubMenu_SAVE[5][4] =
|
|||||||
|
|
||||||
const char gSubMenu_TOT[11][7] =
|
const char gSubMenu_TOT[11][7] =
|
||||||
{
|
{
|
||||||
"OFF",
|
|
||||||
"30 sec",
|
"30 sec",
|
||||||
"1 min",
|
"1 min",
|
||||||
"2 min",
|
"2 min",
|
||||||
@@ -178,21 +187,16 @@ const char gSubMenu_TOT[11][7] =
|
|||||||
"6 min",
|
"6 min",
|
||||||
"7 min",
|
"7 min",
|
||||||
"8 min",
|
"8 min",
|
||||||
"9 min"
|
"9 min",
|
||||||
|
"15 min"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_CHAN[3][7] =
|
const char* gSubMenu_RXMode[4] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"MAIN\nONLY", // TX and RX on main only
|
||||||
"CHAN A",
|
"DUAL RX\nRESPOND", // Watch both and respond
|
||||||
"CHAN B"
|
"CROSS\nBAND", // TX on main, RX on secondary
|
||||||
};
|
"MAIN TX\nDUAL RX" // always TX on main, but RX on both
|
||||||
|
|
||||||
const char gSubMenu_XB[3][7] =
|
|
||||||
{
|
|
||||||
"SAME",
|
|
||||||
"CHAN A",
|
|
||||||
"CHAN B"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
@@ -204,19 +208,19 @@ const char gSubMenu_XB[3][7] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char gSubMenu_SC_REV[3][3] =
|
const char gSubMenu_SC_REV[3][8] =
|
||||||
{
|
{
|
||||||
"TO",
|
"TIMEOUT",
|
||||||
"CO",
|
"CARRIER",
|
||||||
"SE"
|
"STOP"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_MDF[4][8] =
|
const char* gSubMenu_MDF[4] =
|
||||||
{
|
{
|
||||||
"FREQ",
|
"FREQ",
|
||||||
"CHAN",
|
"CHANNEL\nNUMBER",
|
||||||
"NAME",
|
"NAME",
|
||||||
"NAM+FRE"
|
"NAME\n+\nFREQ"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -227,35 +231,36 @@ const char gSubMenu_MDF[4][8] =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char gSubMenu_D_RSP[4][6] =
|
const char gSubMenu_D_RSP[4][11] =
|
||||||
{
|
{
|
||||||
"NULL",
|
"DO\nNOTHING",
|
||||||
"RING",
|
"RING",
|
||||||
"REPLY",
|
"REPLY",
|
||||||
"BOTH"
|
"BOTH"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PTT_ID[4][5] =
|
const char* gSubMenu_PTT_ID[5] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"BOT",
|
"KEY\nUP",
|
||||||
"EOT",
|
"KEY\nDOWN",
|
||||||
"BOTH"
|
"KEY\nUP+DOWN",
|
||||||
|
"APOLLO\nQUINDAR"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_PONMSG[4][5] =
|
const char gSubMenu_PONMSG[4][8] =
|
||||||
{
|
{
|
||||||
"FULL",
|
"FULL",
|
||||||
"MSG",
|
"MESSAGE",
|
||||||
"VOL",
|
"VOLTAGE",
|
||||||
"NONE"
|
"NONE"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_ROGER[3][6] =
|
const char* gSubMenu_ROGER[3] =
|
||||||
{
|
{
|
||||||
"OFF",
|
"OFF",
|
||||||
"ROGER",
|
"ROGER",
|
||||||
"MDC"
|
"MDC\n1200"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char gSubMenu_RESET[2][4] =
|
const char gSubMenu_RESET[2][4] =
|
||||||
@@ -286,15 +291,13 @@ const char gSubMenu_BACKLIGHT[8][7] =
|
|||||||
"ON"
|
"ON"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
const char gSubMenu_RX_TX[4][6] =
|
||||||
const char gSubMenu_Compand[4][6] =
|
{
|
||||||
{
|
"OFF",
|
||||||
"OFF",
|
"TX",
|
||||||
"TX",
|
"RX",
|
||||||
"RX",
|
"TX/RX"
|
||||||
"TX/RX"
|
};
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
const char gSubMenu_AM_fix_test1[4][8] =
|
const char gSubMenu_AM_fix_test1[4][8] =
|
||||||
@@ -328,8 +331,41 @@ const char gSubMenu_SCRAMBLER[11][7] =
|
|||||||
"3500Hz"
|
"3500Hz"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const t_sidefunction SIDEFUNCTIONS[] =
|
||||||
|
{
|
||||||
|
{"NONE", ACTION_OPT_NONE},
|
||||||
|
{"FLASH\nLIGHT", ACTION_OPT_FLASHLIGHT},
|
||||||
|
{"POWER", ACTION_OPT_POWER},
|
||||||
|
{"MONITOR", ACTION_OPT_MONITOR},
|
||||||
|
{"SCAN", ACTION_OPT_SCAN},
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
|
{"VOX", ACTION_OPT_VOX},
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_ALARM
|
||||||
|
{"ALARM", ACTION_OPT_ALARM},
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FMRADIO
|
||||||
|
{"FM RADIO", ACTION_OPT_FM},
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_TX1750
|
||||||
|
{"1750HZ", ACTION_OPT_1750},
|
||||||
|
#endif
|
||||||
|
{"LOCK\nKEYPAD", ACTION_OPT_KEYLOCK},
|
||||||
|
{"SWITCH\nVFO", ACTION_OPT_A_B},
|
||||||
|
{"VFO/MR", ACTION_OPT_VFO_MR},
|
||||||
|
};
|
||||||
|
const t_sidefunction* gSubMenu_SIDEFUNCTIONS = SIDEFUNCTIONS;
|
||||||
|
const uint8_t gSubMenu_SIDEFUNCTIONS_size = ARRAY_SIZE(SIDEFUNCTIONS);
|
||||||
|
|
||||||
bool gIsInSubMenu;
|
bool gIsInSubMenu;
|
||||||
uint8_t gMenuCursor;
|
uint8_t gMenuCursor;
|
||||||
|
int GetCurrentMenuId() {
|
||||||
|
if(gMenuCursor < ARRAY_SIZE(MenuList))
|
||||||
|
return MenuList[gMenuCursor].menu_id;
|
||||||
|
else
|
||||||
|
return MenuList[ARRAY_SIZE(MenuList)-1].menu_id;
|
||||||
|
}
|
||||||
int8_t gMenuScrollDirection;
|
int8_t gMenuScrollDirection;
|
||||||
int32_t gSubMenuSelection;
|
int32_t gSubMenuSelection;
|
||||||
|
|
||||||
@@ -344,40 +380,96 @@ void UI_DisplayMenu(void)
|
|||||||
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
const unsigned int menu_item_x1 = (8 * menu_list_width) + 2;
|
||||||
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
const unsigned int menu_item_x2 = LCD_WIDTH - 1;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char String[16];
|
char String[64]; // bigger cuz we can now do multi-line in one string (use '\n' char)
|
||||||
char Contact[16];
|
char Contact[16];
|
||||||
|
|
||||||
|
// clear the screen buffer
|
||||||
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
#if 0
|
||||||
if (gMenuCursor > 0 || i > 0)
|
// original menu layout
|
||||||
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
|
||||||
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
|
||||||
|
|
||||||
// invert the menu list text pixels
|
for (i = 0; i < 3; i++)
|
||||||
for (i = 0; i < (8 * menu_list_width); i++)
|
if (gMenuCursor > 0 || i > 0)
|
||||||
{
|
if ((gMenuListCount - 1) != gMenuCursor || i != 2)
|
||||||
gFrameBuffer[2][i] ^= 0xFF;
|
UI_PrintString(MenuList[gMenuCursor + i - 1].name, 0, 0, i * 2, 8);
|
||||||
gFrameBuffer[3][i] ^= 0xFF;
|
|
||||||
|
// invert the current menu list item pixels
|
||||||
|
for (i = 0; i < (8 * menu_list_width); i++)
|
||||||
|
{
|
||||||
|
gFrameBuffer[2][i] ^= 0xFF;
|
||||||
|
gFrameBuffer[3][i] ^= 0xFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw vertical separating dotted line
|
||||||
|
for (i = 0; i < 7; i++)
|
||||||
|
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
||||||
|
|
||||||
|
// draw the little sub-menu triangle marker
|
||||||
|
if (gIsInSubMenu)
|
||||||
|
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
||||||
|
|
||||||
|
// draw the menu index number/count
|
||||||
|
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||||
|
UI_PrintStringSmall(String, 2, 0, 6);
|
||||||
|
|
||||||
|
#else
|
||||||
|
{ // new menu layout .. experimental & unfinished
|
||||||
|
|
||||||
|
const int menu_index = gMenuCursor; // current selected menu item
|
||||||
|
i = 1;
|
||||||
|
|
||||||
|
if (!gIsInSubMenu)
|
||||||
|
{
|
||||||
|
while (i < 2)
|
||||||
|
{ // leading menu items - small text
|
||||||
|
const int k = menu_index + i - 2;
|
||||||
|
if (k < 0)
|
||||||
|
UI_PrintStringSmall(MenuList[gMenuListCount + k].name, 0, 0, i); // wrap-a-round
|
||||||
|
else
|
||||||
|
if (k >= 0 && k < (int)gMenuListCount)
|
||||||
|
UI_PrintStringSmall(MenuList[k].name, 0, 0, i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// current menu item - keep big n fat
|
||||||
|
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||||
|
UI_PrintString(MenuList[menu_index].name, 0, 0, 2, 8);
|
||||||
|
i++;
|
||||||
|
|
||||||
|
while (i < 4)
|
||||||
|
{ // trailing menu item - small text
|
||||||
|
const int k = menu_index + i - 2;
|
||||||
|
if (k >= 0 && k < (int)gMenuListCount)
|
||||||
|
UI_PrintStringSmall(MenuList[k].name, 0, 0, 1 + i);
|
||||||
|
else
|
||||||
|
if (k >= (int)gMenuListCount)
|
||||||
|
UI_PrintStringSmall(MenuList[gMenuListCount - k].name, 0, 0, 1 + i); // wrap-a-round
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the menu index number/count
|
||||||
|
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
||||||
|
UI_PrintStringSmall(String, 2, 0, 6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (menu_index >= 0 && menu_index < (int)gMenuListCount)
|
||||||
|
{ // current menu item
|
||||||
|
strcpy(String, MenuList[menu_index].name);
|
||||||
|
// strcat(String, ":");
|
||||||
|
UI_PrintString(String, 0, 0, 0, 8);
|
||||||
|
// UI_PrintStringSmall(String, 0, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// draw vertical separating dotted line
|
// **************
|
||||||
for (i = 0; i < 7; i++)
|
|
||||||
gFrameBuffer[i][(8 * menu_list_width) + 1] = 0xAA;
|
|
||||||
|
|
||||||
// draw the menu index number/count
|
|
||||||
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
|
|
||||||
UI_PrintStringSmall(String, 8, 0, 6);
|
|
||||||
|
|
||||||
// draw the little marker
|
|
||||||
if (gIsInSubMenu)
|
|
||||||
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
|
|
||||||
|
|
||||||
memset(String, 0, sizeof(String));
|
memset(String, 0, sizeof(String));
|
||||||
|
|
||||||
bool already_printed = false;
|
bool already_printed = false;
|
||||||
|
|
||||||
switch (gMenuCursor)
|
switch (GetCurrentMenuId())
|
||||||
{
|
{
|
||||||
case MENU_SQL:
|
case MENU_SQL:
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
sprintf(String, "%d", gSubMenuSelection);
|
||||||
@@ -397,7 +489,7 @@ void UI_DisplayMenu(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
case MENU_STEP:
|
case MENU_STEP:
|
||||||
sprintf(String, "%d.%02uKHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
sprintf(String, "%d.%02ukHz", StepFrequencyTable[gSubMenuSelection] / 100, abs(StepFrequencyTable[gSubMenuSelection]) % 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TXP:
|
case MENU_TXP:
|
||||||
@@ -417,11 +509,41 @@ void UI_DisplayMenu(void)
|
|||||||
|
|
||||||
case MENU_R_CTCS:
|
case MENU_R_CTCS:
|
||||||
case MENU_T_CTCS:
|
case MENU_T_CTCS:
|
||||||
if (gSubMenuSelection == 0)
|
{
|
||||||
strcpy(String, "OFF");
|
#if 1
|
||||||
else
|
unsigned int Code;
|
||||||
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
FREQ_Config_t *pConfig = (GetCurrentMenuId() == MENU_R_CTCS) ? &gTxVfo->freq_config_RX : &gTxVfo->freq_config_TX;
|
||||||
|
if (gSubMenuSelection == 0)
|
||||||
|
{
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
|
||||||
|
if (pConfig->CodeType != CODE_TYPE_CONTINUOUS_TONE)
|
||||||
|
break;
|
||||||
|
Code = 0;
|
||||||
|
pConfig->CodeType = CODE_TYPE_OFF;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_ExitSubAu();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||||
|
|
||||||
|
pConfig->CodeType = CODE_TYPE_CONTINUOUS_TONE;
|
||||||
|
Code = gSubMenuSelection - 1;
|
||||||
|
pConfig->Code = Code;
|
||||||
|
|
||||||
|
BK4819_SetCTCSSFrequency(CTCSS_Options[Code]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (gSubMenuSelection == 0)
|
||||||
|
strcpy(String, "OFF");
|
||||||
|
else
|
||||||
|
sprintf(String, "%u.%uHz", CTCSS_Options[gSubMenuSelection - 1] / 10, CTCSS_Options[gSubMenuSelection - 1] % 10);
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case MENU_SFT_D:
|
case MENU_SFT_D:
|
||||||
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SFT_D[gSubMenuSelection]);
|
||||||
@@ -430,21 +552,13 @@ void UI_DisplayMenu(void)
|
|||||||
case MENU_OFFSET:
|
case MENU_OFFSET:
|
||||||
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
if (!gIsInSubMenu || gInputBoxIndex == 0)
|
||||||
{
|
{
|
||||||
sprintf(String, "%d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
sprintf(String, "%3d.%05u", gSubMenuSelection / 100000, abs(gSubMenuSelection) % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < 3; i++)
|
const char * ascii = INPUTBOX_GetAscii();
|
||||||
String[i ] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
sprintf(String, "%.3s.%.3s ",ascii, ascii + 3);
|
||||||
String[3] = '.';
|
|
||||||
for (i = 3; i < 6; i++)
|
|
||||||
String[i + 1] = (gInputBox[i] == 10) ? '-' : gInputBox[i] + '0';
|
|
||||||
String[ 7] = '-';
|
|
||||||
String[ 8] = '-';
|
|
||||||
String[ 9] = 0;
|
|
||||||
String[10] = 0;
|
|
||||||
String[11] = 0;
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,19 +573,37 @@ void UI_DisplayMenu(void)
|
|||||||
|
|
||||||
case MENU_SCR:
|
case MENU_SCR:
|
||||||
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
strcpy(String, gSubMenu_SCRAMBLER[gSubMenuSelection]);
|
||||||
|
#if 1
|
||||||
|
if (gSubMenuSelection > 0 && gSetting_ScrambleEnable)
|
||||||
|
BK4819_EnableScramble(gSubMenuSelection - 1);
|
||||||
|
else
|
||||||
|
BK4819_DisableScramble();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOX:
|
#ifdef ENABLE_VOX
|
||||||
if (gSubMenuSelection == 0)
|
case MENU_VOX:
|
||||||
strcpy(String, "OFF");
|
if (gSubMenuSelection == 0)
|
||||||
else
|
strcpy(String, "OFF");
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
else
|
||||||
break;
|
sprintf(String, "%d", gSubMenuSelection);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case MENU_ABR:
|
case MENU_ABR:
|
||||||
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
strcpy(String, gSubMenu_BACKLIGHT[gSubMenuSelection]);
|
||||||
|
BACKLIGHT_SetBrightness(-1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MENU_ABR_MIN:
|
||||||
|
case MENU_ABR_MAX:
|
||||||
|
sprintf(String, "%d", gSubMenuSelection);
|
||||||
|
if(gIsInSubMenu)
|
||||||
|
BACKLIGHT_SetBrightness(gSubMenuSelection);
|
||||||
|
else
|
||||||
|
BACKLIGHT_SetBrightness(-1);
|
||||||
|
break;
|
||||||
|
|
||||||
case MENU_AM:
|
case MENU_AM:
|
||||||
strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM");
|
strcpy(String, (gSubMenuSelection == 0) ? "FM" : "AM");
|
||||||
break;
|
break;
|
||||||
@@ -479,6 +611,7 @@ void UI_DisplayMenu(void)
|
|||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
case MENU_AM_FIX_TEST1:
|
case MENU_AM_FIX_TEST1:
|
||||||
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
strcpy(String, gSubMenu_AM_fix_test1[gSubMenuSelection]);
|
||||||
|
// gSetting_AM_fix = gSubMenuSelection;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -486,11 +619,10 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
strcpy(String, (gSubMenuSelection == 0) ? "OFF" : "AUTO");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_COMPANDER
|
case MENU_COMPAND:
|
||||||
case MENU_COMPAND:
|
case MENU_ABR_ON_TX_RX:
|
||||||
strcpy(String, gSubMenu_Compand[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RX_TX[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
case MENU_AM_FIX:
|
case MENU_AM_FIX:
|
||||||
@@ -529,7 +661,6 @@ void UI_DisplayMenu(void)
|
|||||||
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
const uint32_t frequency = BOARD_fetchChannelFrequency(gSubMenuSelection);
|
||||||
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
sprintf(String, "%u.%05u", frequency / 100000, frequency % 100000);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
already_printed = true;
|
already_printed = true;
|
||||||
@@ -559,7 +690,6 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
UI_PrintString(edit, menu_item_x1, 0, 2, 8);
|
||||||
if (edit_index < 10)
|
if (edit_index < 10)
|
||||||
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
UI_PrintString( "^", menu_item_x1 + (8 * edit_index), 0, 4, 8); // show the cursor
|
||||||
// UI_PrintStringSmall("^", menu_item_x1 + (8 * edit_index), 0, 4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gAskForConfirmation)
|
if (!gAskForConfirmation)
|
||||||
@@ -569,7 +699,6 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
else
|
else
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
// UI_PrintStringSmall(String, menu_item_x1, menu_item_x2, 5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,11 +711,7 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TDR:
|
case MENU_TDR:
|
||||||
strcpy(String, gSubMenu_CHAN[gSubMenuSelection]);
|
strcpy(String, gSubMenu_RXMode[gSubMenuSelection]);
|
||||||
break;
|
|
||||||
|
|
||||||
case MENU_XB:
|
|
||||||
strcpy(String, gSubMenu_XB[gSubMenuSelection]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_TOT:
|
case MENU_TOT:
|
||||||
@@ -615,7 +740,10 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_S_LIST:
|
case MENU_S_LIST:
|
||||||
sprintf(String, "LIST%u", gSubMenuSelection);
|
if (gSubMenuSelection < 2)
|
||||||
|
sprintf(String, "LIST%u", 1 + gSubMenuSelection);
|
||||||
|
else
|
||||||
|
strcpy(String, "ALL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
@@ -673,29 +801,9 @@ void UI_DisplayMenu(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_VOL:
|
case MENU_VOL:
|
||||||
|
sprintf(String, "%u.%02uV\n%u%%",
|
||||||
// 1st text line
|
gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100,
|
||||||
sprintf(String, "%u.%02uV", gBatteryVoltageAverage / 100, gBatteryVoltageAverage % 100);
|
BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
|
||||||
|
|
||||||
{ // 2nd text line .. percentage
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 1, 8);
|
|
||||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
|
||||||
sprintf(String, "%u%%", percent);
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 3, 8);
|
|
||||||
#if 0
|
|
||||||
sprintf(String, "Curr %u", gBatteryCurrent); // needs scaling into mA
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if(gF_LOCK){
|
|
||||||
gBatteryCalibration[3] = gSubMenuSelection;
|
|
||||||
sprintf(String, "%u", gSubMenuSelection);
|
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
already_printed = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_RESET:
|
case MENU_RESET:
|
||||||
@@ -706,32 +814,95 @@ void UI_DisplayMenu(void)
|
|||||||
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
strcpy(String, gSubMenu_F_LOCK[gSubMenuSelection]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MENU_F_CALI:
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
{
|
case MENU_F_CALI:
|
||||||
const uint32_t value = 22656 + gSubMenuSelection;
|
{
|
||||||
//gEeprom.BK4819_XTAL_FREQ_LOW = gSubMenuSelection; // already set when the user was adjusting the value
|
const uint32_t value = 22656 + gSubMenuSelection;
|
||||||
BK4819_WriteRegister(BK4819_REG_3B, value);
|
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
||||||
|
|
||||||
sprintf(String, "%d", gSubMenuSelection);
|
writeXtalFreqCal(gSubMenuSelection, false);
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 0, 8);
|
|
||||||
|
|
||||||
const uint32_t xtal_Hz = (0x4f0000u + value) * 5;
|
sprintf(String, "%d\n%u.%06u\nMHz",
|
||||||
sprintf(String, "%u.%06u", xtal_Hz / 1000000, xtal_Hz % 1000000);
|
gSubMenuSelection,
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
xtal_Hz / 1000000, xtal_Hz % 1000000);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
UI_PrintString("MHz", menu_item_x1, menu_item_x2, 4, 8);
|
case MENU_BATCAL:
|
||||||
|
{
|
||||||
already_printed = true;
|
const uint16_t vol = (uint32_t)gBatteryVoltageAverage * gBatteryCalibration[3] / gSubMenuSelection;
|
||||||
}
|
sprintf(String, "%u.%02uV\n%u", vol / 100, vol % 100, gSubMenuSelection);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case MENU_F1SHRT:
|
||||||
|
case MENU_F1LONG:
|
||||||
|
case MENU_F2SHRT:
|
||||||
|
case MENU_F2LONG:
|
||||||
|
case MENU_MLONG:
|
||||||
|
strcpy(String, gSubMenu_SIDEFUNCTIONS[gSubMenuSelection].name);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!already_printed)
|
if (!already_printed)
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 2, 8);
|
{ // we now do multi-line text in a single string
|
||||||
|
|
||||||
if (gMenuCursor == MENU_SLIST1 || gMenuCursor == MENU_SLIST2)
|
unsigned int y;
|
||||||
|
unsigned int lines = 1;
|
||||||
|
unsigned int len = strlen(String);
|
||||||
|
bool small = false;
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
// count number of lines
|
||||||
|
for (i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
if (String[i] == '\n' && i < (len - 1))
|
||||||
|
{ // found new line char
|
||||||
|
lines++;
|
||||||
|
String[i] = 0; // null terminate the line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lines > 3)
|
||||||
|
{ // use small text
|
||||||
|
small = true;
|
||||||
|
if (lines > 7)
|
||||||
|
lines = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// center vertically'ish
|
||||||
|
if (small)
|
||||||
|
y = 3 - ((lines + 0) / 2); // untested
|
||||||
|
else
|
||||||
|
y = 2 - ((lines + 0) / 2);
|
||||||
|
|
||||||
|
// draw the text lines
|
||||||
|
for (i = 0; i < len && lines > 0; lines--)
|
||||||
|
{
|
||||||
|
if (small)
|
||||||
|
UI_PrintStringSmall(String + i, menu_item_x1, menu_item_x2, y);
|
||||||
|
else
|
||||||
|
UI_PrintString(String + i, menu_item_x1, menu_item_x2, y, 8);
|
||||||
|
|
||||||
|
// look for start of next line
|
||||||
|
while (i < len && String[i] >= 32)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
// hop over the null term char(s)
|
||||||
|
while (i < len && String[i] < 32)
|
||||||
|
i++;
|
||||||
|
|
||||||
|
y += small ? 1 : 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetCurrentMenuId() == MENU_SLIST1 || GetCurrentMenuId() == MENU_SLIST2)
|
||||||
{
|
{
|
||||||
i = (gMenuCursor == MENU_SLIST1) ? 0 : 1;
|
i = (GetCurrentMenuId() == MENU_SLIST1) ? 0 : 1;
|
||||||
|
|
||||||
// if (gSubMenuSelection == 0xFF)
|
// if (gSubMenuSelection == 0xFF)
|
||||||
if (gSubMenuSelection < 0)
|
if (gSubMenuSelection < 0)
|
||||||
@@ -776,9 +947,9 @@ void UI_DisplayMenu(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_MEM_CH ||
|
if (GetCurrentMenuId() == MENU_MEM_CH ||
|
||||||
gMenuCursor == MENU_DEL_CH ||
|
GetCurrentMenuId() == MENU_DEL_CH ||
|
||||||
gMenuCursor == MENU_1_CALL)
|
GetCurrentMenuId() == MENU_1_CALL)
|
||||||
{ // display the channel name
|
{ // display the channel name
|
||||||
char s[11];
|
char s[11];
|
||||||
BOARD_fetchChannelName(s, gSubMenuSelection);
|
BOARD_fetchChannelName(s, gSubMenuSelection);
|
||||||
@@ -787,18 +958,18 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
UI_PrintString(s, menu_item_x1, menu_item_x2, 2, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gMenuCursor == MENU_R_CTCS || gMenuCursor == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
if ((GetCurrentMenuId() == MENU_R_CTCS || GetCurrentMenuId() == MENU_R_DCS) && gCssScanMode != CSS_SCAN_MODE_OFF)
|
||||||
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString("SCAN", menu_item_x1, menu_item_x2, 4, 8);
|
||||||
|
|
||||||
if (gMenuCursor == MENU_UPCODE)
|
if (GetCurrentMenuId() == MENU_UPCODE)
|
||||||
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
if (strlen(gEeprom.DTMF_UP_CODE) > 8)
|
||||||
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(gEeprom.DTMF_UP_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
|
|
||||||
if (gMenuCursor == MENU_DWCODE)
|
if (GetCurrentMenuId() == MENU_DWCODE)
|
||||||
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
if (strlen(gEeprom.DTMF_DOWN_CODE) > 8)
|
||||||
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(gEeprom.DTMF_DOWN_CODE + 8, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
|
|
||||||
if (gMenuCursor == MENU_D_LIST && gIsDtmfContactValid)
|
if (GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
|
||||||
{
|
{
|
||||||
Contact[11] = 0;
|
Contact[11] = 0;
|
||||||
memmove(&gDTMF_ID, Contact + 8, 4);
|
memmove(&gDTMF_ID, Contact + 8, 4);
|
||||||
@@ -806,22 +977,20 @@ void UI_DisplayMenu(void)
|
|||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMenuCursor == MENU_R_CTCS ||
|
if (GetCurrentMenuId() == MENU_R_CTCS ||
|
||||||
gMenuCursor == MENU_T_CTCS ||
|
GetCurrentMenuId() == MENU_T_CTCS ||
|
||||||
gMenuCursor == MENU_R_DCS ||
|
GetCurrentMenuId() == MENU_R_DCS ||
|
||||||
gMenuCursor == MENU_T_DCS ||
|
GetCurrentMenuId() == MENU_T_DCS ||
|
||||||
gMenuCursor == MENU_D_LIST)
|
GetCurrentMenuId() == MENU_D_LIST)
|
||||||
{
|
{
|
||||||
unsigned int Offset;
|
sprintf(String, "%2d", gSubMenuSelection);
|
||||||
NUMBER_ToDigits(gSubMenuSelection, String);
|
UI_PrintStringSmall(String, 105, 0, 0);
|
||||||
Offset = (gMenuCursor == MENU_D_LIST) ? 2 : 3;
|
|
||||||
UI_DisplaySmallDigits(Offset, String + (8 - Offset), 105, 0, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gMenuCursor == MENU_RESET ||
|
if ((GetCurrentMenuId() == MENU_RESET ||
|
||||||
gMenuCursor == MENU_MEM_CH ||
|
GetCurrentMenuId() == MENU_MEM_CH ||
|
||||||
gMenuCursor == MENU_MEM_NAME ||
|
GetCurrentMenuId() == MENU_MEM_NAME ||
|
||||||
gMenuCursor == MENU_DEL_CH) && gAskForConfirmation)
|
GetCurrentMenuId() == MENU_DEL_CH) && gAskForConfirmation)
|
||||||
{ // display confirmation
|
{ // display confirmation
|
||||||
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
strcpy(String, (gAskForConfirmation == 1) ? "SURE?" : "WAIT!");
|
||||||
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
UI_PrintString(String, menu_item_x1, menu_item_x2, 5, 8);
|
||||||
|
|||||||
87
ui/menu.h
@@ -39,7 +39,6 @@ enum
|
|||||||
MENU_T_CTCS,
|
MENU_T_CTCS,
|
||||||
MENU_SFT_D,
|
MENU_SFT_D,
|
||||||
MENU_OFFSET,
|
MENU_OFFSET,
|
||||||
MENU_XB,
|
|
||||||
MENU_TOT,
|
MENU_TOT,
|
||||||
MENU_W_N,
|
MENU_W_N,
|
||||||
MENU_SCR,
|
MENU_SCR,
|
||||||
@@ -49,13 +48,18 @@ enum
|
|||||||
MENU_MEM_NAME,
|
MENU_MEM_NAME,
|
||||||
MENU_MDF,
|
MENU_MDF,
|
||||||
MENU_SAVE,
|
MENU_SAVE,
|
||||||
|
#ifdef ENABLE_VOX
|
||||||
MENU_VOX,
|
MENU_VOX,
|
||||||
|
#endif
|
||||||
MENU_ABR,
|
MENU_ABR,
|
||||||
|
MENU_ABR_ON_TX_RX,
|
||||||
|
MENU_ABR_MIN,
|
||||||
|
MENU_ABR_MAX,
|
||||||
MENU_TDR,
|
MENU_TDR,
|
||||||
MENU_BEEP,
|
MENU_BEEP,
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
MENU_VOICE,
|
MENU_VOICE,
|
||||||
#endif
|
#endif
|
||||||
MENU_SC_REV,
|
MENU_SC_REV,
|
||||||
MENU_AUTOLK,
|
MENU_AUTOLK,
|
||||||
MENU_S_ADD1,
|
MENU_S_ADD1,
|
||||||
@@ -63,27 +67,25 @@ enum
|
|||||||
MENU_STE,
|
MENU_STE,
|
||||||
MENU_RP_STE,
|
MENU_RP_STE,
|
||||||
MENU_MIC,
|
MENU_MIC,
|
||||||
#ifdef ENABLE_AUDIO_BAR
|
#ifdef ENABLE_AUDIO_BAR
|
||||||
MENU_MIC_BAR,
|
MENU_MIC_BAR,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COMPANDER
|
MENU_COMPAND,
|
||||||
MENU_COMPAND,
|
|
||||||
#endif
|
|
||||||
MENU_1_CALL,
|
MENU_1_CALL,
|
||||||
MENU_S_LIST,
|
MENU_S_LIST,
|
||||||
MENU_SLIST1,
|
MENU_SLIST1,
|
||||||
MENU_SLIST2,
|
MENU_SLIST2,
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
MENU_AL_MOD,
|
MENU_AL_MOD,
|
||||||
#endif
|
#endif
|
||||||
MENU_ANI_ID,
|
MENU_ANI_ID,
|
||||||
MENU_UPCODE,
|
MENU_UPCODE,
|
||||||
MENU_DWCODE,
|
MENU_DWCODE,
|
||||||
|
MENU_PTT_ID,
|
||||||
MENU_D_ST,
|
MENU_D_ST,
|
||||||
MENU_D_RSP,
|
MENU_D_RSP,
|
||||||
MENU_D_HOLD,
|
MENU_D_HOLD,
|
||||||
MENU_D_PRE,
|
MENU_D_PRE,
|
||||||
MENU_PTT_ID,
|
|
||||||
MENU_D_DCD,
|
MENU_D_DCD,
|
||||||
MENU_D_LIST,
|
MENU_D_LIST,
|
||||||
MENU_D_LIVE_DEC,
|
MENU_D_LIVE_DEC,
|
||||||
@@ -92,19 +94,16 @@ enum
|
|||||||
MENU_VOL,
|
MENU_VOL,
|
||||||
MENU_BAT_TXT,
|
MENU_BAT_TXT,
|
||||||
MENU_AM,
|
MENU_AM,
|
||||||
#ifdef ENABLE_AM_FIX
|
#ifdef ENABLE_AM_FIX
|
||||||
MENU_AM_FIX,
|
MENU_AM_FIX,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
MENU_AM_FIX_TEST1,
|
MENU_AM_FIX_TEST1,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
MENU_NOAA_S,
|
MENU_NOAA_S,
|
||||||
#endif
|
#endif
|
||||||
MENU_RESET,
|
MENU_RESET,
|
||||||
|
|
||||||
// items after here are normally hidden
|
|
||||||
|
|
||||||
MENU_F_LOCK,
|
MENU_F_LOCK,
|
||||||
MENU_200TX,
|
MENU_200TX,
|
||||||
MENU_350TX,
|
MENU_350TX,
|
||||||
@@ -113,9 +112,18 @@ enum
|
|||||||
MENU_SCREN,
|
MENU_SCREN,
|
||||||
|
|
||||||
MENU_TX_EN, // enable TX
|
MENU_TX_EN, // enable TX
|
||||||
MENU_F_CALI // reference xtal calibration
|
#ifdef ENABLE_F_CAL_MENU
|
||||||
|
MENU_F_CALI, // reference xtal calibration
|
||||||
|
#endif
|
||||||
|
MENU_BATCAL, // battery voltage calibration
|
||||||
|
MENU_F1SHRT,
|
||||||
|
MENU_F1LONG,
|
||||||
|
MENU_F2SHRT,
|
||||||
|
MENU_F2LONG,
|
||||||
|
MENU_MLONG
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const uint8_t FIRST_HIDDEN_MENU_ITEM;
|
||||||
extern const t_menu_item MenuList[];
|
extern const t_menu_item MenuList[];
|
||||||
|
|
||||||
extern const char gSubMenu_TXP[3][5];
|
extern const char gSubMenu_TXP[3][5];
|
||||||
@@ -124,36 +132,39 @@ extern const char gSubMenu_W_N[2][7];
|
|||||||
extern const char gSubMenu_OFF_ON[2][4];
|
extern const char gSubMenu_OFF_ON[2][4];
|
||||||
extern const char gSubMenu_SAVE[5][4];
|
extern const char gSubMenu_SAVE[5][4];
|
||||||
extern const char gSubMenu_TOT[11][7];
|
extern const char gSubMenu_TOT[11][7];
|
||||||
extern const char gSubMenu_CHAN[3][7];
|
extern const char* gSubMenu_RXMode[4];
|
||||||
extern const char gSubMenu_XB[3][7];
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
extern const char gSubMenu_VOICE[3][4];
|
extern const char gSubMenu_VOICE[3][4];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_SC_REV[3][3];
|
extern const char gSubMenu_SC_REV[3][8];
|
||||||
extern const char gSubMenu_MDF[4][8];
|
extern const char* gSubMenu_MDF[4];
|
||||||
#ifdef ENABLE_ALARM
|
#ifdef ENABLE_ALARM
|
||||||
extern const char gSubMenu_AL_MOD[2][5];
|
extern const char gSubMenu_AL_MOD[2][5];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_D_RSP[4][6];
|
extern const char gSubMenu_D_RSP[4][11];
|
||||||
extern const char gSubMenu_PTT_ID[4][5];
|
extern const char* gSubMenu_PTT_ID[5];
|
||||||
extern const char gSubMenu_PONMSG[4][5];
|
extern const char gSubMenu_PONMSG[4][8];
|
||||||
extern const char gSubMenu_ROGER[3][6];
|
extern const char* gSubMenu_ROGER[3];
|
||||||
extern const char gSubMenu_RESET[2][4];
|
extern const char gSubMenu_RESET[2][4];
|
||||||
extern const char gSubMenu_F_LOCK[6][4];
|
extern const char gSubMenu_F_LOCK[6][4];
|
||||||
extern const char gSubMenu_BACKLIGHT[8][7];
|
extern const char gSubMenu_BACKLIGHT[8][7];
|
||||||
#ifdef ENABLE_COMPANDER
|
extern const char gSubMenu_RX_TX[4][6];
|
||||||
extern const char gSubMenu_Compand[4][6];
|
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_AM_FIX_TEST1
|
#ifdef ENABLE_AM_FIX_TEST1
|
||||||
extern const char gSubMenu_AM_fix_test1[4][8];
|
extern const char gSubMenu_AM_fix_test1[4][8];
|
||||||
#endif
|
#endif
|
||||||
extern const char gSubMenu_BAT_TXT[3][8];
|
extern const char gSubMenu_BAT_TXT[3][8];
|
||||||
|
|
||||||
extern const char gSubMenu_SCRAMBLER[11][7];
|
extern const char gSubMenu_SCRAMBLER[11][7];
|
||||||
|
|
||||||
|
typedef struct {char* name; uint8_t id;} t_sidefunction;
|
||||||
|
extern const uint8_t gSubMenu_SIDEFUNCTIONS_size;
|
||||||
|
extern const t_sidefunction* gSubMenu_SIDEFUNCTIONS;
|
||||||
|
|
||||||
extern bool gIsInSubMenu;
|
extern bool gIsInSubMenu;
|
||||||
|
|
||||||
extern uint8_t gMenuCursor;
|
extern uint8_t gMenuCursor;
|
||||||
|
int GetCurrentMenuId();
|
||||||
extern int8_t gMenuScrollDirection;
|
extern int8_t gMenuScrollDirection;
|
||||||
extern int32_t gSubMenuSelection;
|
extern int32_t gSubMenuSelection;
|
||||||
|
|
||||||
|
|||||||
156
ui/status.c
@@ -28,6 +28,7 @@
|
|||||||
#include "helper/battery.h"
|
#include "helper/battery.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
#include "ui/battery.h"
|
||||||
#include "ui/helper.h"
|
#include "ui/helper.h"
|
||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
@@ -45,12 +46,26 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
// **************
|
// **************
|
||||||
|
|
||||||
// POWER-SAVE indicator
|
// POWER-SAVE indicator
|
||||||
|
if (gCurrentFunction == FUNCTION_TRANSMIT)
|
||||||
|
{
|
||||||
|
memmove(line + x, BITMAP_TX, sizeof(BITMAP_TX));
|
||||||
|
x1 = x + sizeof(BITMAP_TX);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (gCurrentFunction == FUNCTION_RECEIVE ||
|
||||||
|
gCurrentFunction == FUNCTION_MONITOR ||
|
||||||
|
gCurrentFunction == FUNCTION_INCOMING)
|
||||||
|
{
|
||||||
|
memmove(line + x, BITMAP_RX, sizeof(BITMAP_RX));
|
||||||
|
x1 = x + sizeof(BITMAP_RX);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
if (gCurrentFunction == FUNCTION_POWER_SAVE || test_display)
|
||||||
{
|
{
|
||||||
memmove(line + x, BITMAP_PowerSave, sizeof(BITMAP_PowerSave));
|
memmove(line + x, BITMAP_POWERSAVE, sizeof(BITMAP_POWERSAVE));
|
||||||
x1 = x + sizeof(BITMAP_PowerSave);
|
x1 = x + sizeof(BITMAP_POWERSAVE);
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_PowerSave);
|
x += sizeof(BITMAP_POWERSAVE);
|
||||||
|
|
||||||
#ifdef ENABLE_NOAA
|
#ifdef ENABLE_NOAA
|
||||||
// NOASS SCAN indicator
|
// NOASS SCAN indicator
|
||||||
@@ -70,22 +85,27 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
x1 = x + 10;
|
x1 = x + 10;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
// FM indicator
|
|
||||||
if (gFmRadioMode || test_display)
|
|
||||||
{
|
|
||||||
memmove(line + x, BITMAP_FM, sizeof(BITMAP_FM));
|
|
||||||
x1 = x + sizeof(BITMAP_FM);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
// SCAN indicator
|
// SCAN indicator
|
||||||
if (gScanState != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
if (gScanStateDir != SCAN_OFF || gScreenToDisplay == DISPLAY_SCANNER || test_display)
|
||||||
{
|
{
|
||||||
memmove(line + x, BITMAP_SC, sizeof(BITMAP_SC));
|
if (IS_MR_CHANNEL(gNextMrChannel) && gScreenToDisplay != DISPLAY_SCANNER)
|
||||||
x1 = x + sizeof(BITMAP_SC);
|
{ // channel mode
|
||||||
|
if (gEeprom.SCAN_LIST_DEFAULT == 0)
|
||||||
|
UI_PrintStringSmallBuffer("1", line + x);
|
||||||
|
else
|
||||||
|
if (gEeprom.SCAN_LIST_DEFAULT == 1)
|
||||||
|
UI_PrintStringSmallBuffer("2", line + x);
|
||||||
|
else
|
||||||
|
if (gEeprom.SCAN_LIST_DEFAULT == 2)
|
||||||
|
UI_PrintStringSmallBuffer("*", line + x);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // frequency mode
|
||||||
|
UI_PrintStringSmallBuffer("S", line + x);
|
||||||
|
}
|
||||||
|
x1 = x + 7;
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_SC);
|
x += 7; // font character width
|
||||||
|
|
||||||
#ifdef ENABLE_VOICE
|
#ifdef ENABLE_VOICE
|
||||||
// VOICE indicator
|
// VOICE indicator
|
||||||
@@ -94,36 +114,38 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
memmove(line + x, BITMAP_VoicePrompt, sizeof(BITMAP_VoicePrompt));
|
||||||
x1 = x + sizeof(BITMAP_VoicePrompt);
|
x1 = x + sizeof(BITMAP_VoicePrompt);
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_VoicePrompt);
|
x += sizeof(BITMAP_VoicePrompt) + 1;
|
||||||
#else
|
#else
|
||||||
// hmmm, what to put in it's place
|
// hmmm, what to put in it's place
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// DUAL-WATCH indicator
|
x++;
|
||||||
if (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF || test_display)
|
if(gScreenToDisplay != DISPLAY_SCANNER) {
|
||||||
{
|
uint8_t dw = (gEeprom.DUAL_WATCH != DUAL_WATCH_OFF) + (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF) * 2;
|
||||||
if (gDualWatchActive || test_display)
|
if(dw == 1 || dw == 3 || test_display) { // DWR - dual watch + respond
|
||||||
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1));
|
if(gDualWatchActive || test_display)
|
||||||
else
|
memmove(line + x, BITMAP_TDR1, sizeof(BITMAP_TDR1) - (dw==1?0:5));
|
||||||
memmove(line + x, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
else
|
||||||
|
memmove(line + x + 3, BITMAP_TDR2, sizeof(BITMAP_TDR2));
|
||||||
|
}
|
||||||
|
else if(dw == 2) { // XB - crossband
|
||||||
|
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
x += sizeof(BITMAP_TDR1);
|
x += sizeof(BITMAP_TDR1) + 2;
|
||||||
|
|
||||||
// CROSS-VFO indicator
|
|
||||||
if (gEeprom.CROSS_BAND_RX_TX != CROSS_BAND_OFF || test_display)
|
|
||||||
{
|
|
||||||
memmove(line + x, BITMAP_XB, sizeof(BITMAP_XB));
|
|
||||||
x1 = x + sizeof(BITMAP_XB);
|
|
||||||
}
|
|
||||||
x += sizeof(BITMAP_XB);
|
|
||||||
|
|
||||||
// VOX indicator
|
#ifdef ENABLE_VOX
|
||||||
if (gEeprom.VOX_SWITCH || test_display)
|
// VOX indicator
|
||||||
{
|
if (gEeprom.VOX_SWITCH || test_display)
|
||||||
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
{
|
||||||
x1 = x + sizeof(BITMAP_VOX);
|
memmove(line + x, BITMAP_VOX, sizeof(BITMAP_VOX));
|
||||||
}
|
x1 = x + sizeof(BITMAP_VOX);
|
||||||
x += sizeof(BITMAP_VOX);
|
}
|
||||||
|
x += sizeof(BITMAP_VOX) + 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
x = MAX(x, 61u);
|
||||||
|
x1 = x;
|
||||||
|
|
||||||
// KEY-LOCK indicator
|
// KEY-LOCK indicator
|
||||||
if (gEeprom.KEY_LOCK || test_display)
|
if (gEeprom.KEY_LOCK || test_display)
|
||||||
@@ -169,8 +191,7 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
|
|
||||||
case 2: // percentage
|
case 2: // percentage
|
||||||
{
|
{
|
||||||
const uint16_t percent = BATTERY_VoltsToPercent(gBatteryVoltageAverage);
|
sprintf(s, "%u%%", BATTERY_VoltsToPercent(gBatteryVoltageAverage));
|
||||||
sprintf(s, "%u%%", percent);
|
|
||||||
space_needed = (7 * strlen(s));
|
space_needed = (7 * strlen(s));
|
||||||
if (x2 >= (x1 + space_needed))
|
if (x2 >= (x1 + space_needed))
|
||||||
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
UI_PrintStringSmallBuffer(s, line + x2 - space_needed);
|
||||||
@@ -188,55 +209,8 @@ void UI_DisplayStatus(const bool test_display)
|
|||||||
x += sizeof(BITMAP_USB_C);
|
x += sizeof(BITMAP_USB_C);
|
||||||
|
|
||||||
// BATTERY LEVEL indicator
|
// BATTERY LEVEL indicator
|
||||||
#if 1
|
UI_DrawBattery(line + x, gBatteryDisplayLevel, gLowBatteryBlink);
|
||||||
if (gBatteryDisplayLevel >= 2 && !gLowBattery)
|
|
||||||
{
|
|
||||||
line += x;
|
|
||||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
#ifndef ENABLE_REVERSE_BAT_SYMBOL
|
|
||||||
line += sizeof(BITMAP_BatteryLevel1);
|
|
||||||
if (gBatteryDisplayLevel >= 2)
|
|
||||||
memmove(line - 4, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 5)
|
|
||||||
memmove(line - 7, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 7)
|
|
||||||
memmove(line - 10, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 9)
|
|
||||||
memmove(line - 13, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
#else
|
|
||||||
if (gBatteryDisplayLevel >= 2)
|
|
||||||
memmove(line + 3, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 5)
|
|
||||||
memmove(line + 6, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 7)
|
|
||||||
memmove(line + 9, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
if (gBatteryDisplayLevel >= 9)
|
|
||||||
memmove(line + 12, BITMAP_BatteryLevel, sizeof(BITMAP_BatteryLevel));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (gLowBatteryBlink == 1)
|
|
||||||
memmove(line + x, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
#else
|
|
||||||
// UI_DisplayBattery(gBatteryDisplayLevel);
|
|
||||||
|
|
||||||
line += x;
|
|
||||||
if (gBatteryDisplayLevel > 0)
|
|
||||||
{
|
|
||||||
const uint8_t level = (gBatteryDisplayLevel <= 11) ? gBatteryDisplayLevel : 11;
|
|
||||||
memmove(line, BITMAP_BatteryLevel1, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
#ifdef ENABLE_REVERSE_BAT_SYMBOL
|
|
||||||
for (uint8_t i = 0; i < level; i++)
|
|
||||||
line[3 + i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
|
||||||
#else
|
|
||||||
for (uint8_t i = 0; i < level; i++)
|
|
||||||
line[sizeof(BITMAP_BatteryLevel1) - 3 - i] = (i & 1u) ? 0b01011101 : 0b01011101;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
memset(line, 0, sizeof(BITMAP_BatteryLevel1));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// **************
|
// **************
|
||||||
|
|
||||||
ST7565_BlitStatusLine();
|
ST7565_BlitStatusLine();
|
||||||
|
|||||||
46
ui/ui.c
@@ -77,34 +77,28 @@ void GUI_DisplayScreen(void)
|
|||||||
|
|
||||||
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
void GUI_SelectNextDisplay(GUI_DisplayType_t Display)
|
||||||
{
|
{
|
||||||
if (Display != DISPLAY_INVALID)
|
if (Display == DISPLAY_INVALID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (gScreenToDisplay != Display)
|
||||||
{
|
{
|
||||||
if (gScreenToDisplay != Display)
|
DTMF_clear_input_box();
|
||||||
{
|
|
||||||
gInputBoxIndex = 0;
|
|
||||||
gIsInSubMenu = false;
|
|
||||||
gCssScanMode = CSS_SCAN_MODE_OFF;
|
|
||||||
gScanState = SCAN_OFF;
|
|
||||||
#ifdef ENABLE_FMRADIO
|
|
||||||
gFM_ScanState = FM_SCAN_OFF;
|
|
||||||
#endif
|
|
||||||
gAskForConfirmation = 0;
|
|
||||||
gDTMF_InputMode = false;
|
|
||||||
gDTMF_InputIndex = 0;
|
|
||||||
gF_LOCK = false;
|
|
||||||
gAskToSave = false;
|
|
||||||
gAskToDelete = false;
|
|
||||||
|
|
||||||
if (gWasFKeyPressed)
|
gInputBoxIndex = 0;
|
||||||
{
|
gIsInSubMenu = false;
|
||||||
gWasFKeyPressed = false;
|
gCssScanMode = CSS_SCAN_MODE_OFF;
|
||||||
gUpdateStatus = true;
|
gScanStateDir = SCAN_OFF;
|
||||||
}
|
#ifdef ENABLE_FMRADIO
|
||||||
|
gFM_ScanState = FM_SCAN_OFF;
|
||||||
|
#endif
|
||||||
|
gAskForConfirmation = 0;
|
||||||
|
gAskToSave = false;
|
||||||
|
gAskToDelete = false;
|
||||||
|
gWasFKeyPressed = false;
|
||||||
|
|
||||||
gUpdateStatus = true;
|
gUpdateStatus = true;
|
||||||
}
|
|
||||||
|
|
||||||
gUpdateDisplay = true;
|
|
||||||
gScreenToDisplay = Display;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gScreenToDisplay = Display;
|
||||||
|
gUpdateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|||||||
12
ui/welcome.c
@@ -27,6 +27,18 @@
|
|||||||
#include "ui/status.h"
|
#include "ui/status.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
void UI_DisplayReleaseKeys(void)
|
||||||
|
{
|
||||||
|
memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||||
|
memset(gFrameBuffer, 0, sizeof(gFrameBuffer));
|
||||||
|
|
||||||
|
UI_PrintString("RELEASE", 0, 127, 1, 10);
|
||||||
|
UI_PrintString("ALL KEYS", 0, 127, 3, 10);
|
||||||
|
|
||||||
|
ST7565_BlitStatusLine(); // blank status line
|
||||||
|
ST7565_BlitFullScreen();
|
||||||
|
}
|
||||||
|
|
||||||
void UI_DisplayWelcome(void)
|
void UI_DisplayWelcome(void)
|
||||||
{
|
{
|
||||||
char WelcomeString0[16];
|
char WelcomeString0[16];
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#ifndef UI_WELCOME_H
|
#ifndef UI_WELCOME_H
|
||||||
#define UI_WELCOME_H
|
#define UI_WELCOME_H
|
||||||
|
|
||||||
|
void UI_DisplayReleaseKeys(void);
|
||||||
void UI_DisplayWelcome(void);
|
void UI_DisplayWelcome(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
123
utils/main.cpp
@@ -93,15 +93,29 @@ void create_gain_table(const char *filename)
|
|||||||
mixer_dB[orig_mixer] +
|
mixer_dB[orig_mixer] +
|
||||||
pga_dB[orig_pga];
|
pga_dB[orig_pga];
|
||||||
|
|
||||||
const uint8_t lna_short_min = 0; // 0
|
#if 1
|
||||||
const uint8_t lna_min = 0; // 0
|
// full table
|
||||||
const uint8_t mixer_min = 0; // 0
|
const uint8_t lna_short_min = 0; // 0
|
||||||
const uint8_t pga_min = 0; // 0
|
const uint8_t lna_min = 0; // 0
|
||||||
|
const uint8_t mixer_min = 0; // 0
|
||||||
|
const uint8_t pga_min = 0; // 0
|
||||||
|
|
||||||
const uint8_t lna_short_max = 3; // 3
|
const uint8_t lna_short_max = 3; // 3
|
||||||
const uint8_t lna_max = 7; // 5
|
const uint8_t lna_max = 7; // 5
|
||||||
const uint8_t mixer_max = 3; // 3
|
const uint8_t mixer_max = 3; // 3
|
||||||
const uint8_t pga_max = 7; // 7
|
const uint8_t pga_max = 7; // 7
|
||||||
|
#else
|
||||||
|
// just one register changes
|
||||||
|
const uint8_t lna_short_min = 0;
|
||||||
|
const uint8_t lna_min = 2;
|
||||||
|
const uint8_t mixer_min = 3;
|
||||||
|
const uint8_t pga_min = 6;
|
||||||
|
|
||||||
|
const uint8_t lna_short_max = 3;
|
||||||
|
const uint8_t lna_max = 2;
|
||||||
|
const uint8_t mixer_max = 3;
|
||||||
|
const uint8_t pga_max = 6;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t lna_short = lna_short_min;
|
uint8_t lna_short = lna_short_min;
|
||||||
uint8_t lna = lna_min;
|
uint8_t lna = lna_min;
|
||||||
@@ -244,37 +258,90 @@ void create_gain_table(const char *filename)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
fprintf(file, "\tconst t_am_fix_gain_table am_fix_gain_table[] =\n");
|
fprintf(file, "\tstatic const t_am_fix_gain_table am_fix_gain_table[] =\n");
|
||||||
fprintf(file, "\t{\n");
|
fprintf(file, "\t{\n");
|
||||||
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < gain_table.size(); i++)
|
#if 0
|
||||||
|
fprintf(file, "\t\t{.lna_short = 3, .lna = 2, .mixer = 3, .pga = 6}, // 0 0dB -14dB 0dB -3dB .. -17dB original\n\n");
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
1 + i,
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
char s[1024];
|
//BK4819_WriteRegister(BK4819_REG_13, ((uint16_t)gains.lna_short << 8) | ((uint16_t)gains.lna << 5) | ((uint16_t)gains.mixer << 3) | ((uint16_t)gains.pga << 0));
|
||||||
|
|
||||||
const t_gain_table entry = gain_table[i];
|
uint16_t reg_val;
|
||||||
|
int16_t sum_dB;
|
||||||
|
|
||||||
sprintf(s, "\t\t{%u, %u, %u, %u}, // %3u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
reg_val = ((uint16_t)orig_lna_short << 8) | ((uint16_t)orig_lna << 5) | ((uint16_t)orig_mixer << 3) | ((uint16_t)orig_pga << 0);
|
||||||
entry.lna_short,
|
sum_dB = lna_short_dB[orig_lna_short] + lna_dB[orig_lna] + mixer_dB[orig_mixer] + pga_dB[orig_pga];
|
||||||
entry.lna,
|
fprintf(file, "\t\t{0x%04X, %-3d}, // 0 .. %u %u %u %u .. 0dB -14dB 0dB -3dB .. -17dB original\n\n",
|
||||||
entry.mixer,
|
reg_val,
|
||||||
entry.pga,
|
sum_dB,
|
||||||
1 + i,
|
orig_lna_short,
|
||||||
entry.lna_short_dB,
|
orig_lna,
|
||||||
entry.lna_dB,
|
orig_mixer,
|
||||||
entry.mixer_dB,
|
orig_pga);
|
||||||
entry.pga_dB,
|
|
||||||
entry.sum_dB);
|
|
||||||
|
|
||||||
if (i == original_index)
|
for (unsigned int i = 0; i < gain_table.size(); i++)
|
||||||
strcat(s, " original");
|
{
|
||||||
|
char s[1024];
|
||||||
|
|
||||||
fprintf(file, "%s\n", s);
|
const t_gain_table entry = gain_table[i];
|
||||||
|
|
||||||
|
reg_val = ((uint16_t)entry.lna_short << 8) | ((uint16_t)entry.lna << 5) | ((uint16_t)entry.mixer << 3) | ((uint16_t)entry.pga << 0);
|
||||||
|
sum_dB = lna_short_dB[entry.lna_short] + lna_dB[entry.lna] + mixer_dB[entry.mixer] + pga_dB[entry.pga];
|
||||||
|
|
||||||
|
sprintf(s, "\t\t{0x%04X, %-3d}, // %3u .. %u %u %u %u .. %3ddB %3ddB %2ddB %3ddB .. %3ddB",
|
||||||
|
reg_val,
|
||||||
|
sum_dB,
|
||||||
|
|
||||||
|
1 + i,
|
||||||
|
|
||||||
|
entry.lna_short,
|
||||||
|
entry.lna,
|
||||||
|
entry.mixer,
|
||||||
|
entry.pga,
|
||||||
|
|
||||||
|
entry.lna_short_dB,
|
||||||
|
entry.lna_dB,
|
||||||
|
entry.mixer_dB,
|
||||||
|
entry.pga_dB,
|
||||||
|
|
||||||
|
entry.sum_dB);
|
||||||
|
|
||||||
|
if (i == original_index)
|
||||||
|
strcat(s, " original");
|
||||||
|
|
||||||
|
fprintf(file, "%s\n", s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
fprintf(file, "\t};\n\n");
|
fprintf(file, "\t};\n\n");
|
||||||
|
|
||||||
fprintf(file, "\tconst unsigned int original_index = %u;\n", 1 + original_index);
|
fprintf(file, "\tstatic const unsigned int original_index = %u;\n", 1 + original_index);
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|||||||