UI Redesign for Portapack-Havoc (#268)

* Power: Turn off additional peripheral clock branches.

* Update schematic with new symbol table and KiCad standard symbols.
Fix up wires.

* Schematic: Update power net labels.

* Schematic: Update footprint names to match library changes.

* Schematic: Update header vendor and part numbers.

* Schematic: Specify (arbitrary) value for PDN# net.

* Schematic: Remove fourth fiducial. Not standard practice, and was taking up valuable board space.

* Schematic: Add reference oscillator -- options for clipped sine or HCMOS output.

* Schematic: Update copyright year.

* Schematic: Remove CLKOUT to CPLD. It was a half-baked idea.

* Schematic: Add (experimental) GPS circuit.
Add note about charging circuit.
Update date and revision to match PCB.

* PCB: Update from schematic change: now revision 20180819.
Diff was extensive due to net renumbering...

* PCB: Fix GPS courtyard to accommodate crazy solder paste recommendation in integration manual.
PCB: Address DRC clearance violation between via and oscillator pad.

* PCB: Update copyright on drawing.

* Update schematic and PCB date and revision.

* gitignore: Sublime Text editor project/workspace files

* Power: Power up or power down peripheral clock at appropriate times, so firmware doesn't freeze...

* Clocking: Fix incorrect shift for CGU IDIVx_CTRL.PD field.

* LPC43xx: Add CGU IDIVx struct/union type.

* Power: Switch off unused IDIV dividers. Make note of active IDIVs and their use.

* HackRF Mode: Upgrade firmware to 2018.01.1 (API 1.02)

* MAX V CPLD: Refactor class to look more like Xilinx CoolRunner II CPLD class.

* MAX V CPLD: Add BYPASS, SAMPLE support.
Rename enter_isp -> enable, exit_isp -> disable.
Use SAMPLE at start of flash process, which somehow addresses the problem where CFM wouldn't load into SRAM (and become the active bitstream) after flashing.

* MAX V CPLD: Reverse verify data checking logic to make it a little faster.

* CPLD: After reprogramming flash, immediately clamp I/O signals, load to SRAM, and "execute" the new bitstream.

* Si5351: Refactor code, make one of the registers more type-safe.
Clock Manager: Track selected reference clock source for later use in user interface.

* Clock Manager: Add note about PPM only affecting Si5351C PLLA, which always runs from the HackRF 25MHz crystal.
It is assumed an external clock does not need adjustment, though I am open to being convinced otherwise...

* PPM UI: Show "EXT" when showing PPM adjustment and reference clock is external.

* CPLD: Add pins and logic for new PortaPack hardware feature(s).

* CPLD: Bitstream to support new hardware features.

* Clock Generator: Add a couple more setter methods for ClockControl registers.

* Clock Manager: Use shared MCU CLKIN clock control configuration constant.

* Clock Manager: Reduce MCU CLKIN driver current. 2mA should be plenty.

* Clock Manager: Remove redundant clock generator output enable.

* Bootstrap: Remove unnecessary ldscript hack to locate SPIFI mode change code in RAM.

* Bootstrap: Get CPU operating at max frequency as soon as possible.
Update SPIFI speed comment.
Make some more LPC43xx types into unions with uint32_t.

* Bootstrap: Explicitly configure IDIVB for SPIFI, despite LPC43xx bootloader setting it.

* Clock Manager: Init peripherals before CPLD reconfig. Do the clock generator setup after, so we can check presence of PortaPack reference clock with the help of the latest CPLD bitstream.

* Clock Manager: Reverse sense of conditional that determines crystal or non-crystal reference source. This is for an expected upcoming change where multiple external options can be differentiated.

* Bootstrap: Consolidate clock configuration, update SPIFI rate comment.

* Clock Manager: Use IDIVA for clock source for all peripherals, instead of PLL1. Should make switching easier going forward.
Don't use IRC as clock during initial clock manager configuration. Until we switch to GP_CLKIN, we should go flat out...

* ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution.

* PortaPack IO: Expose method to set reference oscillator enable pin.

* Pin configuration: Do SPIFI pin config with other pins, in preparation for eliminating separate bootloader.

* Pin configuration: Disable input buffers on pins that are never read.

* Revert "ChibiOS M0: Change default clock speed to 204MHz, since bootstrap now maxes out clock speed before starting M0 execution."

This reverts commit c0e2bb6cc4cc656769323bdbb8ee5a16d2d5bb03.

* PCB: Change PCB stackup, Tg, clarify solder mask color, use more metric.

* PCB: Move HackRF header P9 to B.CrtYd layer.

* PCB: Change a Tg reference I missed.

* PCB: Update footprints for parts with mismatched CAD->tape rotation.
Adjust a few layer choice and line thickness bits.

* PCB: Got cold feet, switched back to rectangular pads.

* PCB: Add Eco layers to be visible and Gerber output.

* PCB: Use aux origin for plotting, for tidier coordinates.

* PCB: Output Gerber job file, because why not?

* Schematic: Correct footprints for two reference-related components.

* Schematic: Remove manfuacturer and part number for DNP component.

* Schematic: Specify resistor value, manufacturer, part number for reference oscillator series termination.

* PCB: Update netlist and footprints from schematic.

* Netlist: Updated component values, footprints.

* PCB: Nudge some components and traces to address DRC clearance violations.

* PCB: Allow KiCad to update zone timestamps (again?!).

* PCB: Generate *all* Gerber layers.

* Schematic, PCB: Update revision to 20181025.

* PCB: Adjust fab layer annotations orientation and font size.

* PCB: Hide mounting hole reference designators on silk layer.

* PCB: Shrink U1, U3 pads to get 0.2mm space between pads.

* PCB: Set pad-to-mask clearance to zero, leave up to fab. Set minimum mask web to 0.2mm for non-black options.

* PCB: Revise U1 pad shape, mask, paste, thermal drills.
Clearance is improved at corner pads.

* PCB: Tweak U3 for better thermal pad/drill/mask/paste design.

* PCB: Change solder mask color to blue.

* Schematic, PCB: Update revision to 20181029.

* PCB: Bump minimum mask web down a tiny bit because KiCad is having trouble with math.

* Update schematic

* Remove unused board files.

* Add LPC43xx functions.

* chibios: Replace code with per-peripheral structs defining clocks, interrupts, and reset bits.

* LPC43xx: Add MCPWM peripheral struct.

* clock generator: Use recommended PLL reset register value.

Datasheet recommends a value. AN619 is quiet on the topic, claims the low nibble is default 0b0000.

* GPIO: Tweak masking of SCU function.

I don't remember why I thought this was necessary...

* HAL: Explicitly turn on timer peripheral clocks used as systicks, during init.

* SCU: Add struct to hold pin configuration.

* PAL: Add functions to address The Glitch.

https://greatscottgadgets.com/2018/02-28-we-fixed-the-glitch/

* PAL/board: New IO initialization code

Declare initial state for SCU pin config, GPIOs. Apply initial state during PAL init. Perform VAA slow turn-on to address The Glitch.

* Merge M0 and M4 to eliminate need for bootstrap firmware

During _early_init, detect if we're running on the M4 or M0.
If M4: do M4-specific core initialization, reset peripherals, speed up SPIFI clock, start M0, go to sleep.
If M0: do all the other things.

* Pins: Miscellaneous SCU configuration tweaks.

* Little code clarity improvement.

* bootstrap: Remove, not necessary.

* Clock Manager: Large re-working to support external references.

* Clock Manager: Actually store chosen clock reference

Similarly-named local was covering a member and discarding the value.

* Clock Manager: Reference type which contains source, frequency.

* Setup: Display reference source, frequency in frequency correction screen.

* LPC43xx API: Add extern "C" for use from C++.

* Use LPC43xx API for SGPIO, GPDMA, I2S initialization.

* I2S: Add BASE_AUDIO_CLK management.

* Add MOTOCON_PWM clock/reset structure.

* Serial: Fix dumb typos.

* Serial: Remove extra reference operator.

* Serial: Cut-and-paste error in structure type name.

* Move SCU structure from PAL to LPC43xx API.

It'd be nice if I gave some thought to where code should live before I commit it.

* VAA power: Move code to HackRF board file

It doesn't belong in PAL.

* MAX5 CPLD: Add SAMPLE and EXTEST methods.

* Flash image: Change packing scheme to use flash more efficiently.

Application is now a single image for both M4 bootstrap and M0.
Baseband images come immediately after application binary. No need to align to large blocks (and waste lots of flash).

* Clock Manager: Remove PLL1 power down function.

* Move and rename peripherals reset function to board module.

* Remove unused peripheral/clock management.

* Clock Manager: Extract switch to IRC into separate function.

* Clock Manager: More explicit shutdown of clocks, clock generator.

* Move initialization to board module.

* ChibiOS: Rename "application" board, add "baseband" board.

There are now two ChibiOS "boards", one which runs the application and does the hardware setup. The other board, "baseband", does very little setup.

* Clock Manager: Remove unused crystal enable/disable code.

* Clock Manager: Restore clock configuration to SPIFI bootloader state before app shutdown.

* Reset peripherals on app shutdown.

Be careful not to reset M0APP (the core we're running on) or GPIO (which is holding the hardware in a stable state).

* M4/baseband hal_lld_init: use IDIVA, which is configured earlier by M0.

This was causing problems during restart into HackRF mode. Baseband hal_lld_init changed M4 clock from IDIVA (set by M0) to PLL1, which was unceremoniously turned off during shutdown.

* Audio app: Stop audio PLL on shutdown.

* M4 HAL: Make LPC43XX_M4_CLK_SRC optional.

This was changing the BASE_M4_CLK when a baseband was run.

* LPC43xx C++ layer: Fix IDIVx constructor IDIV narrow field width.

* Application board: hide the peripherals_reset function, as it isn't useful except during hardware init.

* Consolidate hardware init code to some degree.

ClockManager is super-overloaded and murky in its purpose.
Migrate audio from IDIVC to IDIVD, to more closely resemble initial clock scheme, so it's simpler to get back to it during shutdown.

* Migrate some startup code to application board.

* Si5351: Use correct methods for reset().

update_output_enable_control() doesn't reset the enabled outputs to the reset state, unless the object is freshly initialized, which it isn't when performing firmware shutdown.
For similar reasons, use set_clock_control() instead of setting internal state and then using the update function.

* GPIO: Set SPIFI CS pin to match input buffer state coming out of bootloader.

* Change application board.c to .cpp, with required dependent changes

* Board: Clean up SCU configuration code/data.

* I2S: Add shutdown code and use it.

* LPC43xx: Consolidate a bunch of structures that had been scattered all over.

...because I'm an undisciplined coder.

* I2S: Fix ordering of branch and base clock disable.

Core was hanging, presumably because the register interface on the branch/peripheral was unresponsive after the base clock was disabled.

* Controls: Save and expose raw navigation wheel switch state

I need to do some work on debouncing and ignoring simultaneous key presses.

* Controls: Add debug view for switches state.

* Controls: Ignore all key presses until all keys are released.

This should address some mechanical quirks of the navigation wheel used on the PortaPack.

* Clock Manager: Wait for only the necessary PLL to lock.

Wasn't working on PortaPacks without a built-in clock reference, as that uses the other PLL.
TODO: Switching PLLs may be kind of pointless now...

* CMake: Pull HackRF project from GitHub and build.

* CMake: Remove commented code.

* CMake: Clone HackRF via HTTPS, not SSH.

* CMake: Extra pause for slow post-DFU firmware boot-up.

* CMake: TODO to fix SVF/XSVF file source.

* CMake: Ask HackRF hackrf_usb to make DFU binary.

* Travis-CI: Add dfu-util, now that HackRF firmware is being built for inclusion.

* Travis-CI: Update build environment to Ubuntu xenial

Previously Trusty.

* Travis-CI: Incorrectly structured my request for dfu-util package.

I'm soooo talented.

* ldscript: Mark flash, ram with correct R/W/X flags.

* ldscript: Enlarge M0 flash region to 1Mbyte, the size of the HackRF SPI flash.

* Receiver: Hide PPM adjustment if clock source is not HackRF crystal.

* Documentation: Update product photos and README.

* Documentation: Add TCXO feature to README description.

* Application: Rearrange files to match HAVOC directory structure.

* Map view in AIS (#213)

* Added GeoMapView to AISRecentEntryDetailView

* Added autoupdate in AIS map

* Revert "Map view in AIS (#213)"

This reverts commit 262c030224.

This commit will be cherry-picked onto a clean branch, then re-committed after a troublesome pull request is reverted.

* Revert "Upstream merge to make new revision of PortaPack work (#206)"

This reverts commit 920b98f7c9.

This pull request was missing some changes and was preventing firmware from functioning on older PortaPacks.

* CPLD: Pull bitstream from HackRF project.

* SGPIO: Identify pins on CPLD by their new functions. Pull down HOST_SYNC_EN.

* CPLD: Don't load HackRF CPLD bitstream into RAM.

Trying to converge CPLD implementations, so this shouldn't be necesssary. HOWEVER, it would be good to *check* the CPLD contents and provide a way to update, if necessary.

* CPLD: Tweak clock generator config to match CPLD timing changes in HackRF.

* PinConfig: Drive CPLD pins correctly.

* CMake: Use jboone/hackrf master branch, now that CPLD fixes are there.

* CMake: Fix HackRF CPLD SVF dependency.

Build would break on the first pass, but work if you restarted make.

* CMake: Fix my misuse of the HackRF CMake configuration -- was building from too deep in the directory tree

* CMake: Work-around for CMake 3.5 not supporting ExternalProject_Add SOURCE_SUBDIR.

* CMake: Choose a CMP0005 policy to quiet CMake warnings.

* Settings: Show active clock reference. Only show PPM adjustment for HackRF source.

* Setup: Format clock reference frequency in MHz, not Hz.

* Radio Settings: Change reference clock text color.

Make consistent color with other un-editable text.
TODO: This is a bit of a hack to get ui::Text objects to support custom colors, like the Label structures used elsewhere.

* Pin config: VREGMODE=1, add other pins for completeness, comment detail

* Pin setup: More useful comments.

* Pin setup: Change some defaults, only set up PortaPack pins if detected.

* Pin setup: Disable LPC pull-ups on PP CPLD data bus, as CPLD is pulling up.

* Baseband: Allow larger HackRF firmware image.

* HackRF: Remove USER_INTERFACE CMake variable.

* CPLD: Make use of HackRF CPLD tool to generate code.

* Release: Add generation of MD5SUMS, SHA256SUMS during "make release"

* Clock generator: Match clock output currents to HackRF firmware.

Someday, we will share a code base again...

* CMake: Make "firmware" target part of the "all" target.

So now an unqualified "make" will make the firmware binary.

* CMake: Change how HackRF firmware is incorporated into binary.

Use the separate HackRF "RAM" binary. Get rid of the strip-dfu utility, since there's no longer a need to extract the binary from the DFU.

* CMake: Renamed GIT_REVISION* -> GIT_VERSION* to match HackRF build env.

* CMake: Bring git version handling closer to HackRF for code reuse.

* Travis-CI: Rework CI release artifact output.

* Travis-CI: Don't assign PROJECT_NAME within deploy-nightly.sh

* Travis-CI: Oops, don't include distro package for compiler...

...when also installing it from a third-party PPA.

* Travis-CI: Update GCC package, old one seems "retired"?

* Travis-CI: OK, the gcc-arm-none-eabi package is NOT current. Undoing...

* Travis-CI: Path oopsies.

* Travis-CI: More path confusion. I think this will do it. *touch wood*

* Travis-CI: Update build message sent to FreeNode #portapack IRC.

* Travis-CI: Break out BUILD_DATE from BUILD_NAME.

* Travis-CI: Introduce build directories, include MD5 and SHA256 hashes.

* Travis-CI: Fix MD5SUMS/SHA256SUMS paths.

* Travis-CI: Fix typo generating name for binary links.

* Power: Keep 1V8 off until after VAA is brought up.

* Power: Bring up VAA in several steps to keep voltage swing small.

* About: Show longer commit/tag version string.

* Versioning: Report non-CI builds with "local-" version prefix.

* Travis-CI: Report new nightly build site in IRC notification.

* Change use of GIT_VERSION to VERSION_STRING
Required by prior merge.

* Git: add "hackrf" submodule.

* CMake: Use hackrf submodule for build, stop pulling during build.

* Travis: Fix build paths due to CMake submodule changes.

* Travis: Explicitly update submodules recursively

* Revert "Travis: Explicitly update submodules recursively"

This reverts commit b246438d805f431e727e01b7407540e932e89ee1.

* Travis: Try to sort out hackrf submodule output paths...

* Travis: I don't know what I'm doing.

* CMake: "make firmware" problem due to target vs. path used for dependency.

* HackRF: Incorporate YAML security fix.

* CMake: Fix more places where targets should be used...

...instead of paths to outputs.

* CMake: Add DFU file to "make firmware" outputs

* HackRF: Update submodule for CMake m0_bin.s path fix.

* added encoder support to alphanum

* added encoder support to freq-keypad

* UI Redesign -
added BtnGrid & NewButton widgets and created a new button-based
layout, with both encoder and touchscreen are supported.

* Scanner changes:
- using SCANNER.TXT for frequencies, ranges also supported. file
format is the same as any other frequency file, thus can be edited
via the Frequency Manager.
- add nfm bw selector & time-to-wait to the UI
- add SCANNER.TXT to sdcard dir

orignal idea & scanner file adopted from user 'bicurico'

* small changes to scanner

* remember last category on frequency manager

* fix: cast int16_t instead of uint16_t (although i doubt we will
have more than 32767 buttons in the array...)

* added a missing last_category_id on freq manager
This commit is contained in:
Ziggy 2019-10-29 23:53:54 +02:00 committed by Furrtek
parent 73cda37e5b
commit b690165da3
29 changed files with 862 additions and 202 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "hackrf"]
path = hackrf
url = https://github.com/jboone/hackrf.git

View File

@ -7,6 +7,16 @@ matrix:
cache: apt cache: apt
dist: xenial dist: xenial
env:
global:
- PROJECT_NAME=PortaPack-HAVOC
- SHORT_COMMIT_HASH=`git rev-parse --short HEAD`
- VERSION_STRING=nightly-$SHORT_COMMIT_HASH
- BUILD_DATE="`date +%Y-%m-%d`"
- BUILD_NAME="$PROJECT_NAME-$BUILD_DATE-$SHORT_COMMIT_HASH"
- ARTEFACT_BASE=$TRAVIS_BUILD_DIR/artefacts/
- ARTEFACT_PATH=$ARTEFACT_BASE/$BUILD_NAME
notifications: notifications:
irc: irc:
channels: channels:
@ -16,7 +26,7 @@ notifications:
- "Change view : %{compare_url}" - "Change view : %{compare_url}"
- "Build details : %{build_url}" - "Build details : %{build_url}"
# TODO: The "build_number.1" in this URL is almost certainly wrong, but correct value not available from Travis? # TODO: The "build_number.1" in this URL is almost certainly wrong, but correct value not available from Travis?
- "Firmware download : https://portapack-h1-builds.s3.amazonaws.com/%{repository_slug}/%{build_number}/%{build_number}.1/build/firmware/portapack-h1-firmware-%{commit}.tar.bz2" - "Firmware download : https://jboone.github.io/portapack-havoc-nightly/"
before_install: before_install:
- sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y - sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y
@ -25,17 +35,39 @@ before_install:
script: script:
# TODO: Introduce top-level Makefile, this is lame. # TODO: Introduce top-level Makefile, this is lame.
- sed -e "s/\#set(VERSION.*/set(VERSION \"$VERSION_STRING\")/" -i".bak" CMakeLists.txt
- mkdir build/ - mkdir build/
- pushd build/ - pushd build/
- cmake .. - cmake ..
- make release - make firmware
- popd - popd
after_success:
- mkdir -p $ARTEFACT_PATH
# Copy firmware to firmware-bin directory
- cd $TRAVIS_BUILD_DIR/build
- cp firmware/portapack-h1-havoc.bin $ARTEFACT_PATH/
- cp hackrf/firmware/hackrf_usb/hackrf_usb.dfu $ARTEFACT_PATH/
- cd $TRAVIS_BUILD_DIR
- cp LICENSE $ARTEFACT_PATH/
# Build the archive
- cd $ARTEFACT_BASE
- tar -cJvf $ARTEFACT_BASE/$BUILD_NAME.tar.xz $BUILD_NAME
- md5sum --binary $BUILD_NAME.tar.xz >MD5SUMS
- sha256sum --binary $BUILD_NAME.tar.xz >SHA256SUMS
addons: addons:
apt: apt:
packages: packages:
- coreutils
- tar
- sed
- cmake
- dfu-util - dfu-util
artifacts:
paths: deploy:
- $(ls build/firmware/portapack-h1-havoc-*.tar.bz2 | tr "\n" ":") provider: script
- $(ls build/firmware/portapack-h1-havoc-*.zip | tr "\n" ":") skip-cleanup: true
script: bash $TRAVIS_BUILD_DIR/tools/deploy-nightly.sh
on:
branch: master

View File

@ -25,21 +25,37 @@ set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/firmware/toolchain-arm-cortex
project(portapack-h1) project(portapack-h1)
execute_process( #set(VERSION "")
COMMAND git log -n 1 --format=%h if (NOT DEFINED VERSION)
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} execute_process(
RESULT_VARIABLE GIT_REVISION_FOUND COMMAND git log -n 1 --format=%h
ERROR_QUIET WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GIT_REVISION RESULT_VARIABLE GIT_VERSION_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
) OUTPUT_VARIABLE GIT_VERSION
if (GIT_REVISION_FOUND) OUTPUT_STRIP_TRAILING_WHITESPACE
set(VERSION "unknown") )
else (GIT_REVISION_FOUND) if (GIT_VERSION_FOUND)
set(VERSION ${GIT_REVISION}) set(VERSION "unknown")
endif (GIT_REVISION_FOUND) else (GIT_VERSION_FOUND)
set(VERSION "local-${GIT_VERSION}")
endif (GIT_VERSION_FOUND)
endif()
set(LICENSE_PATH ${CMAKE_CURRENT_LIST_DIR}/LICENSE) set(LICENSE_PATH ${CMAKE_CURRENT_LIST_DIR}/LICENSE)
set(HARDWARE_PATH ${CMAKE_CURRENT_LIST_DIR}/hardware) set(HARDWARE_PATH ${CMAKE_CURRENT_LIST_DIR}/hardware)
add_subdirectory(hackrf/firmware/hackrf_usb)
set(HACKRF_FIRMWARE_DFU_FILENAME hackrf_usb.dfu)
set(HACKRF_FIRMWARE_BIN_FILENAME hackrf_usb_ram.bin)
set(HACKRF_CPLD_XSVF_FILENAME default.xsvf)
set(HACKRF_PATH ${CMAKE_CURRENT_LIST_DIR}/hackrf)
set(HACKRF_CPLD_TOOL ${HACKRF_PATH}/firmware/tools/cpld_bitstream.py)
set(HACKRF_CPLD_XSVF_PATH ${HACKRF_PATH}/firmware/cpld/sgpio_if/${HACKRF_CPLD_XSVF_FILENAME})
set(HACKRF_FIRMWARE_DFU_IMAGE ${hackrf_usb_BINARY_DIR}/${HACKRF_FIRMWARE_DFU_FILENAME})
set(HACKRF_FIRMWARE_BIN_IMAGE ${hackrf_usb_BINARY_DIR}/${HACKRF_FIRMWARE_BIN_FILENAME})
add_subdirectory(firmware) add_subdirectory(firmware)

View File

@ -26,37 +26,12 @@ set(CHIBIOS ${PROJECT_SOURCE_DIR}/chibios)
set(CHIBIOS_PORTAPACK ${PROJECT_SOURCE_DIR}/chibios-portapack) set(CHIBIOS_PORTAPACK ${PROJECT_SOURCE_DIR}/chibios-portapack)
set(EXTRACT_CPLD_DATA ${PROJECT_SOURCE_DIR}/tools/extract_cpld_data.py) set(EXTRACT_CPLD_DATA ${PROJECT_SOURCE_DIR}/tools/extract_cpld_data.py)
set(STRIP_DFU ${PROJECT_SOURCE_DIR}/tools/strip_dfu.py)
set(MAKE_SPI_IMAGE ${PROJECT_SOURCE_DIR}/tools/make_spi_image.py) set(MAKE_SPI_IMAGE ${PROJECT_SOURCE_DIR}/tools/make_spi_image.py)
set(MAKE_IMAGE_CHUNK ${PROJECT_SOURCE_DIR}/tools/make_image_chunk.py) set(MAKE_IMAGE_CHUNK ${PROJECT_SOURCE_DIR}/tools/make_image_chunk.py)
set(FIRMWARE_NAME portapack-h1-havoc) set(FIRMWARE_NAME portapack-h1-havoc)
set(FIRMWARE_FILENAME ${FIRMWARE_NAME}.bin) set(FIRMWARE_FILENAME ${FIRMWARE_NAME}.bin)
include(ExternalProject)
find_program(MAKE_EXE NAMES gmake nmake make)
ExternalProject_Add(hackrf
GIT_REPOSITORY https://github.com/jboone/hackrf.git
# SOURCE_SUBDIR firmware
# SOURCE_SUBDIR isn't available in CMake 3.5 (Ubuntu 16.04 LTS), so the following is a work-around:
CONFIGURE_COMMAND ${CMAKE_COMMAND} "-GUnix Makefiles" ../hackrf/firmware
BUILD_COMMAND ${MAKE_EXE} hackrf_usb.dfu
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(hackrf SOURCE_DIR)
ExternalProject_Get_Property(hackrf BINARY_DIR)
set(hackrf_SOURCE_DIR ${SOURCE_DIR})
set(hackrf_BINARY_DIR ${BINARY_DIR})
set(HACKRF_FIRMWARE_DFU_FILENAME hackrf_usb.dfu)
set(HACKRF_FIRMWARE_BIN_FILENAME hackrf_usb.bin)
set(HACKRF_FIRMWARE_DFU_IMAGE ${hackrf_BINARY_DIR}/hackrf_usb/${HACKRF_FIRMWARE_DFU_FILENAME})
set(HACKRF_FIRMWARE_BIN_IMAGE ${hackrf_BINARY_DIR}/hackrf_usb/${HACKRF_FIRMWARE_BIN_FILENAME})
set(HACKRF_CPLD_TOOL ${hackrf_SOURCE_DIR}/firmware/tools/cpld_bitstream.py)
set(HACKRF_CPLD_XSVF_FILENAME default.xsvf)
set(HACKRF_CPLD_XSVF_PATH ${hackrf_SOURCE_DIR}/firmware/cpld/sgpio_if/${HACKRF_CPLD_XSVF_FILENAME})
add_subdirectory(application) add_subdirectory(application)
add_subdirectory(baseband) add_subdirectory(baseband)
@ -70,8 +45,8 @@ add_custom_command(
) )
add_custom_target( add_custom_target(
firmware firmware ALL
DEPENDS ${FIRMWARE_FILENAME} DEPENDS ${FIRMWARE_FILENAME} ${HACKRF_FIRMWARE_DFU_FILENAME}
) )
add_custom_target( add_custom_target(
@ -79,22 +54,29 @@ add_custom_target(
COMMAND dfu-util --device 1fc9:000c --download ${HACKRF_FIRMWARE_DFU_IMAGE} COMMAND dfu-util --device 1fc9:000c --download ${HACKRF_FIRMWARE_DFU_IMAGE}
COMMAND sleep 3s COMMAND sleep 3s
COMMAND hackrf_spiflash -w ${FIRMWARE_FILENAME} COMMAND hackrf_spiflash -w ${FIRMWARE_FILENAME}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FIRMWARE_FILENAME} DEPENDS ${FIRMWARE_FILENAME}
) )
# TODO: Bad hack to fix location of LICENSE file for tar. # TODO: Bad hack to fix location of LICENSE file for tar.
add_custom_command( add_custom_command(
OUTPUT ${FIRMWARE_NAME}-${GIT_REVISION}.tar.bz2 ${FIRMWARE_NAME}-${GIT_REVISION}.zip OUTPUT ${FIRMWARE_NAME}-${VERSION}.tar.bz2 ${FIRMWARE_NAME}-${VERSION}.zip
COMMAND cp ${LICENSE_PATH} LICENSE COMMAND cp ${LICENSE_PATH} LICENSE
COMMAND cp ${HACKRF_FIRMWARE_DFU_IMAGE} ${HACKRF_FIRMWARE_DFU_FILENAME} COMMAND cp ${HACKRF_FIRMWARE_DFU_IMAGE} ${HACKRF_FIRMWARE_DFU_FILENAME}
COMMAND tar -c -j -f ${FIRMWARE_NAME}-${GIT_REVISION}.tar.bz2 ${FIRMWARE_FILENAME} ${HACKRF_FIRMWARE_DFU_FILENAME} LICENSE COMMAND tar -c -j -f ${FIRMWARE_NAME}-${VERSION}.tar.bz2 ${FIRMWARE_FILENAME} ${HACKRF_FIRMWARE_DFU_FILENAME} LICENSE
COMMAND zip -9 -q ${FIRMWARE_NAME}-${GIT_REVISION}.zip ${FIRMWARE_FILENAME} ${HACKRF_FIRMWARE_DFU_FILENAME} LICENSE COMMAND zip -9 -q ${FIRMWARE_NAME}-${VERSION}.zip ${FIRMWARE_FILENAME} ${HACKRF_FIRMWARE_DFU_FILENAME} LICENSE
COMMAND rm -f LICENSE ${HACKRF_FIRMWARE_DFU_FILENAME} COMMAND rm -f LICENSE ${HACKRF_FIRMWARE_DFU_FILENAME}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FIRMWARE_FILENAME} ${LICENSE_PATH} ${HACKRF_FIRMWARE_DFU_IMAGE} DEPENDS ${FIRMWARE_FILENAME} ${LICENSE_PATH} ${HACKRF_FIRMWARE_DFU_FILENAME}
VERBATIM VERBATIM
) )
add_custom_command(
OUTPUT MD5SUMS SHA256SUMS
COMMAND md5sum --binary ${FIRMWARE_NAME}-${VERSION}.tar.bz2 ${FIRMWARE_NAME}-${VERSION}.zip >MD5SUMS
COMMAND sha256sum --binary ${FIRMWARE_NAME}-${VERSION}.tar.bz2 ${FIRMWARE_NAME}-${VERSION}.zip >SHA256SUMS
DEPENDS ${FIRMWARE_NAME}-${VERSION}.tar.bz2 ${FIRMWARE_NAME}-${VERSION}.zip
)
add_custom_target( add_custom_target(
release release
DEPENDS ${FIRMWARE_NAME}-${GIT_REVISION}.tar.bz2 ${FIRMWARE_NAME}-${GIT_REVISION}.zip DEPENDS MD5SUMS SHA256SUMS
) )

View File

@ -206,6 +206,7 @@ set(CPPSRC
ui/ui_font_fixed_8x16.cpp ui/ui_font_fixed_8x16.cpp
ui/ui_geomap.cpp ui/ui_geomap.cpp
ui/ui_menu.cpp ui/ui_menu.cpp
ui/ui_btngrid.cpp
ui/ui_receiver.cpp ui/ui_receiver.cpp
ui/ui_rssi.cpp ui/ui_rssi.cpp
ui/ui_spectrum.cpp ui/ui_spectrum.cpp
@ -346,8 +347,7 @@ set(CPPWARN "-Wall -Wextra -Wno-psabi")
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
# TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI? # TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI?
# NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types # NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types
set(DDEFS "-DLPC43XX -DLPC43XX_M0 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -D'VERSION_STRING=\"${VERSION}\"'")
set(DDEFS -DLPC43XX -DLPC43XX_M0 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -DGIT_REVISION=\"${GIT_REVISION}\")
# List all default ASM defines here, like -D_DEBUG=1 # List all default ASM defines here, like -D_DEBUG=1
set(DADEFS) set(DADEFS)
@ -408,7 +408,7 @@ add_custom_command(
add_custom_command( add_custom_command(
OUTPUT ${HACKRF_CPLD_DATA_CPP} OUTPUT ${HACKRF_CPLD_DATA_CPP}
COMMAND ${HACKRF_CPLD_TOOL} --xsvf ${HACKRF_CPLD_XSVF_PATH} --portapack-data ${HACKRF_CPLD_DATA_CPP} COMMAND ${HACKRF_CPLD_TOOL} --xsvf ${HACKRF_CPLD_XSVF_PATH} --portapack-data ${HACKRF_CPLD_DATA_CPP}
DEPENDS ${HACKRF_CPLD_TOOL} ${HACKRF_CPLD_XSVF_PATH} hackrf DEPENDS ${HACKRF_CPLD_TOOL} ${HACKRF_CPLD_XSVF_PATH}
) )
add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC}) add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC})

View File

@ -75,7 +75,7 @@ private:
const credits_t credits[25] = { const credits_t credits[25] = {
// 012345678901234567890123456789 // 012345678901234567890123456789
{ 60, "PortaPack|HAVOC", 0 }, { 60, "PortaPack|HAVOC", 0 },
{ 7 * 8, "Git hash " GIT_REVISION, 16 }, { 4 * 8, "Version " VERSION_STRING, 16 },
{ 11 * 8, "Gurus J. Boone", 0 }, { 11 * 8, "Gurus J. Boone", 0 },
{ 18 * 8, "M. Ossmann", 16 }, { 18 * 8, "M. Ossmann", 16 },
{ 11 * 8, "HAVOC Furrtek", 16 }, { 11 * 8, "HAVOC Furrtek", 16 },

View File

@ -131,7 +131,7 @@ private:
Text text_firmware { Text text_firmware {
{ 0, 236, 240, 16 }, { 0, 236, 240, 16 },
"Git Commit Hash " GIT_REVISION, "Version " VERSION_STRING,
}; };
Text text_cpld_hackrf { Text text_cpld_hackrf {

View File

@ -29,6 +29,8 @@ using namespace portapack;
namespace ui { namespace ui {
static int32_t last_category_id { 0 };
FreqManBaseView::FreqManBaseView( FreqManBaseView::FreqManBaseView(
NavigationView& nav NavigationView& nav
) : nav_ (nav) ) : nav_ (nav)
@ -80,7 +82,7 @@ void FreqManBaseView::populate_categories() {
}); });
options_category.set_options(categories); options_category.set_options(categories);
options_category.set_selected_index(0); options_category.set_selected_index(last_category_id);
options_category.on_change = [this](size_t category_id, int32_t) { options_category.on_change = [this](size_t category_id, int32_t) {
if (on_change_category) if (on_change_category)
@ -92,7 +94,7 @@ void FreqManBaseView::change_category(int32_t category_id) {
if (!file_list.size()) return; if (!file_list.size()) return;
current_category_id = category_id; last_category_id = current_category_id = category_id;
if (!load_freqman_file(file_list[categories[current_category_id].second], database)) if (!load_freqman_file(file_list[categories[current_category_id].second], database))
error_ = ERROR_ACCESS; error_ = ERROR_ACCESS;
@ -219,7 +221,7 @@ FrequencyLoadView::FrequencyLoadView(
nav.pop(); nav.pop();
}; };
change_category(0); change_category(last_category_id);
refresh_list(); refresh_list();
on_select_frequency = [&nav, this]() { on_select_frequency = [&nav, this]() {
@ -308,7 +310,7 @@ FrequencyManagerView::FrequencyManagerView(
nav.pop(); nav.pop();
}; };
change_category(0); change_category(last_category_id);
refresh_list(); refresh_list();
on_select_frequency = [this]() { on_select_frequency = [this]() {

View File

@ -78,7 +78,9 @@ void ScannerThread::run() {
} }
void ScannerView::handle_retune(uint32_t i) { void ScannerView::handle_retune(uint32_t i) {
text_cycle.set(to_string_dec_uint(i) + "/" + to_string_dec_uint(frequency_list.size())); text_cycle.set( to_string_dec_uint(i) + "/" +
to_string_dec_uint(frequency_list.size()) + " : " +
to_string_dec_uint(frequency_list[i]) );
} }
void ScannerView::focus() { void ScannerView::focus() {
@ -101,20 +103,46 @@ ScannerView::ScannerView(
&field_vga, &field_vga,
&field_rf_amp, &field_rf_amp,
&field_volume, &field_volume,
&field_bw,
&field_squelch, &field_squelch,
&field_wait,
//&record_view, //&record_view,
&text_cycle, &text_cycle,
//&waterfall, //&waterfall,
}); });
// DEBUG std::string scanner_file = "SCANNER";
frequency_list.push_back(466025000); if (load_freqman_file(scanner_file, database)) {
frequency_list.push_back(466050000); for(auto& entry : database) {
frequency_list.push_back(466075000); // FIXME
frequency_list.push_back(466175000); if (entry.type == RANGE) {
frequency_list.push_back(466206250); for (uint32_t i=entry.frequency_a; i < entry.frequency_b; i+= 1000000) {
frequency_list.push_back(466231250); frequency_list.push_back(i);
}
} else {
frequency_list.push_back(entry.frequency_a);
}
}
} else {
// DEBUG
frequency_list.push_back(466025000);
frequency_list.push_back(466050000);
frequency_list.push_back(466075000);
frequency_list.push_back(466175000);
frequency_list.push_back(466206250);
frequency_list.push_back(466231250);
}
field_bw.set_selected_index(2);
field_bw.on_change = [this](size_t n, OptionsField::value_t) {
receiver_model.set_nbfm_configuration(n);
};
field_wait.on_change = [this](int32_t v) {
wait = v;
};
field_wait.set_value(5);
field_squelch.on_change = [this](int32_t v) { field_squelch.on_change = [this](int32_t v) {
squelch = v; squelch = v;
}; };
@ -134,7 +162,7 @@ ScannerView::ScannerView(
receiver_model.set_baseband_bandwidth(1750000); receiver_model.set_baseband_bandwidth(1750000);
receiver_model.enable(); receiver_model.enable();
receiver_model.set_squelch_level(0); receiver_model.set_squelch_level(0);
receiver_model.set_nbfm_configuration(2); // 16k receiver_model.set_nbfm_configuration(field_bw.selected_index());
audio::output::unmute(); audio::output::unmute();
// TODO: Scanning thread here // TODO: Scanning thread here
@ -144,11 +172,11 @@ ScannerView::ScannerView(
void ScannerView::on_statistics_update(const ChannelStatistics& statistics) { void ScannerView::on_statistics_update(const ChannelStatistics& statistics) {
int32_t max_db = statistics.max_db; int32_t max_db = statistics.max_db;
if (timer < 6) if (timer <= wait)
timer++; timer++;
if (max_db < -squelch) { if (max_db < -squelch) {
if (timer == 5) { if (timer == wait) {
//audio::output::stop(); //audio::output::stop();
scan_thread->set_scanning(true); scan_thread->set_scanning(true);
} }

View File

@ -24,6 +24,7 @@
#include "ui_receiver.hpp" #include "ui_receiver.hpp"
#include "ui_font_fixed_8x16.hpp" #include "ui_font_fixed_8x16.hpp"
#include "freqman.hpp"
namespace ui { namespace ui {
@ -67,10 +68,12 @@ private:
std::vector<rf::Frequency> frequency_list { }; std::vector<rf::Frequency> frequency_list { };
int32_t squelch { 0 }; int32_t squelch { 0 };
uint32_t timer { 0 }; uint32_t timer { 0 };
uint32_t wait { 0 };
freqman_db database { };
Labels labels { Labels labels {
{ { 0 * 8, 0 * 16 }, "LNA: VGA: AMP: VOL:", Color::light_grey() }, { { 0 * 8, 0 * 16 }, "LNA: VGA: AMP: VOL:", Color::light_grey() },
{ { 0 * 8, 1 * 16 }, "SQUELCH: /99", Color::light_grey() }, { { 0 * 8, 1 * 16 }, "BW: SQUELCH: /99 WAIT:", Color::light_grey() },
{ { 0 * 8, 3 * 16 }, "Work in progress...", Color::light_grey() } { { 0 * 8, 3 * 16 }, "Work in progress...", Color::light_grey() }
}; };
@ -93,15 +96,33 @@ private:
1, 1,
' ', ' ',
}; };
OptionsField field_bw {
{ 3 * 8, 1 * 16 },
3,
{
{ "8k5", 0 },
{ "11k", 0 },
{ "16k", 0 },
}
};
NumberField field_squelch { NumberField field_squelch {
{ 8 * 8, 1 * 16 }, { 15 * 8, 1 * 16 },
2, 2,
{ 0, 99 }, { 0, 99 },
1, 1,
' ', ' ',
}; };
NumberField field_wait {
{ 26 * 8, 1 * 16 },
2,
{ 0, 99 },
1,
' ',
};
Text text_cycle { Text text_cycle {
{ 0, 5 * 16, 240, 16 }, { 0, 5 * 16, 240, 16 },
"--/--" "--/--"

View File

@ -471,15 +471,16 @@ void ModInfoView::focus() {
SettingsMenuView::SettingsMenuView(NavigationView& nav) { SettingsMenuView::SettingsMenuView(NavigationView& nav) {
add_items({ add_items({
{ "Audio", ui::Color::white(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } }, //{ "..", ui::Color::light_grey(), &bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "Radio", ui::Color::white(), nullptr, [&nav](){ nav.push<SetRadioView>(); } }, { "Audio", ui::Color::dark_cyan(), &bitmap_icon_speaker, [&nav](){ nav.push<SetAudioView>(); } },
{ "UI", ui::Color::white(), nullptr, [&nav](){ nav.push<SetUIView>(); } }, { "Radio", ui::Color::dark_cyan(), nullptr, [&nav](){ nav.push<SetRadioView>(); } },
//{ "SD card modules", ui::Color::white(), [&nav](){ nav.push<ModInfoView>(); } }, { "UI", ui::Color::dark_cyan(), nullptr, [&nav](){ nav.push<SetUIView>(); } },
{ "Date/Time", ui::Color::white(), nullptr, [&nav](){ nav.push<SetDateTimeView>(); } }, //{ "SD card modules", ui::Color::dark_cyan(), [&nav](){ nav.push<ModInfoView>(); } },
{ "Touch screen", ui::Color::white(), nullptr, [&nav](){ nav.push<TouchCalibrationView>(); } }, { "Date/Time", ui::Color::dark_cyan(), nullptr, [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Play dead", ui::Color::white(), &bitmap_icon_playdead, [&nav](){ nav.push<SetPlayDeadView>(); } } { "Touch screen", ui::Color::dark_cyan(), nullptr, [&nav](){ nav.push<TouchCalibrationView>(); } },
{ "Play dead", ui::Color::dark_cyan(), &bitmap_icon_playdead, [&nav](){ nav.push<SetPlayDeadView>(); } }
}); });
on_left = [&nav](){ nav.pop(); }; set_max_rows(2); // allow wider buttons
} }
} /* namespace ui */ } /* namespace ui */

View File

@ -356,7 +356,7 @@ private:
}; };
};*/ };*/
class SettingsMenuView : public MenuView { class SettingsMenuView : public BtnGridView {
public: public:
SettingsMenuView(NavigationView& nav); SettingsMenuView(NavigationView& nav);

View File

@ -181,8 +181,8 @@ constexpr ClockControls si5351_clock_control_common { {
{ ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Group, ClockControl::ClockInvert::Invert, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Group, ClockControl::ClockInvert::Invert, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Group, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Group, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_8mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_8mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_8mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_6mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Invert, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_6mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_4mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Fractional, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Fractional, ClockControl::ClockPowerDown::Power_Off },
{ ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off }, { ClockControl::ClockCurrentDrive::_2mA, ClockControl::ClockSource::MS_Self, ClockControl::ClockInvert::Normal, get_reference_clock_generator_pll(ClockManager::ReferenceSource::Xtal), ClockControl::MultiSynthMode::Integer, ClockControl::ClockPowerDown::Power_Off },
} }; } };

View File

@ -54,6 +54,10 @@ AlphanumView::AlphanumView(
n = 0; n = 0;
for (auto& button : buttons) { for (auto& button : buttons) {
button.id = n;
button.on_highlight = [this](Button& button) {
focused_button = button.id;
};
button.on_select = button_fn; button.on_select = button_fn;
button.set_parent_rect({ button.set_parent_rect({
static_cast<Coord>((n % 5) * (240 / 5)), static_cast<Coord>((n % 5) * (240 / 5)),
@ -120,4 +124,16 @@ void AlphanumView::on_button(Button& button) {
update_text(); update_text();
} }
bool AlphanumView::on_encoder(const EncoderEvent delta) {
focused_button += delta;
if (focused_button < 0) {
focused_button = buttons.size() - 1;
}
else if (focused_button >= (int16_t)buttons.size()) {
focused_button = 0;
}
buttons[focused_button].focus();
return true;
}
} }

View File

@ -41,6 +41,7 @@ public:
AlphanumView& operator=(AlphanumView&&) = delete; AlphanumView& operator=(AlphanumView&&) = delete;
void paint(Painter& painter) override; void paint(Painter& painter) override;
bool on_encoder(const EncoderEvent delta) override;
private: private:
const char * const keys_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ' .<"; const char * const keys_upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ' .<";
@ -53,6 +54,7 @@ private:
{ "Digit", keys_digit } { "Digit", keys_digit }
}; };
int16_t focused_button = 0;
uint32_t mode = 0; // Uppercase uint32_t mode = 0; // Uppercase
void set_mode(const uint32_t new_mode); void set_mode(const uint32_t new_mode);

View File

@ -0,0 +1,220 @@
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
* Copyright (C) 2019 Elia Yehuda (z4ziggy)
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "ui_btngrid.hpp"
#include "rtc_time.hpp"
namespace ui {
/* BtnGridView **************************************************************/
BtnGridView::BtnGridView(
Rect new_parent_rect,
bool keep_highlight
) : keep_highlight { keep_highlight }
{
set_parent_rect(new_parent_rect);
set_focusable(true);
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
this->on_tick_second();
};
add_child(&arrow_more);
arrow_more.set_focusable(false);
arrow_more.set_foreground(Color::black());
}
BtnGridView::~BtnGridView() {
rtc_time::signal_tick_second -= signal_token_tick_second;
for (auto item : menu_item_views) {
delete item;
}
}
void BtnGridView::set_max_rows(int rows) {
rows_ = rows;
}
int BtnGridView::rows() {
return rows_;
}
void BtnGridView::set_parent_rect(const Rect new_parent_rect) {
View::set_parent_rect(new_parent_rect);
displayed_max = (parent_rect().size().height() / button_h);
arrow_more.set_parent_rect( { 228, (Coord)(displayed_max * button_h), 8, 8 } );
displayed_max *= rows_;
// TODO: Clean this up :(
if (menu_item_views.size()) {
for (auto item : menu_item_views) {
remove_child(item);
delete item;
}
menu_item_views.clear();
}
button_w = 240 / rows_;
for (size_t c = 0; c < displayed_max; c++) {
auto item = new NewButton { };
menu_item_views.push_back(item);
add_child(item);
item->set_parent_rect({
(int)(c % rows_) * button_w,
(int)(c / rows_) * button_h,
button_w, button_h
});
}
update_items();
}
void BtnGridView::on_tick_second() {
if (more && blink)
arrow_more.set_foreground(Color::white());
else
arrow_more.set_foreground(Color::black());
blink = !blink;
arrow_more.set_dirty();
}
void BtnGridView::clear() {
menu_items.clear();
}
void BtnGridView::add_items(std::initializer_list<GridItem> new_items) {
for (auto item : new_items) {
menu_items.push_back(item);
}
update_items();
}
void BtnGridView::update_items() {
size_t i = 0;
if ((menu_items.size()) > (displayed_max + offset)) {
more = true;
blink = true;
} else
more = false;
for (NewButton* item : menu_item_views) {
if (i >= menu_items.size()) break;
// Assign item data to NewButtons according to offset
item->set_text(menu_items[i + offset].text);
item->set_bitmap(menu_items[i + offset].bitmap);
item->set_color(menu_items[i + offset].color);
item->on_select = menu_items[i + offset].on_select;
item->set_dirty();
i++;
}
}
NewButton* BtnGridView::item_view(size_t index) const {
return menu_item_views[index];
}
bool BtnGridView::set_highlighted(int32_t new_value) {
int32_t item_count = (int32_t)menu_items.size();
if (new_value < 0)
return false;
if (new_value >= item_count)
new_value = item_count - 1;
if (((uint32_t)new_value > offset) && ((new_value - offset) >= displayed_max)) {
// Shift BtnGridView up
highlighted_item = new_value;
offset = new_value - displayed_max + rows_;
update_items();
} else if ((uint32_t)new_value < offset) {
// Shift BtnGridView down
highlighted_item = new_value;
offset = (new_value / rows_) * rows_;
update_items();
} else {
// Just update highlight
highlighted_item = new_value;
if (visible())
item_view(highlighted_item - offset)->focus();
}
return true;
}
uint32_t BtnGridView::highlighted_index() {
return highlighted_item;
}
void BtnGridView::on_focus() {
item_view(highlighted_item - offset)->focus();
}
void BtnGridView::on_blur() {
#if 0
if (!keep_highlight)
item_view(highlighted_item - offset)->unhighlight();
#endif
}
bool BtnGridView::on_key(const KeyEvent key) {
switch(key) {
case KeyEvent::Up:
return set_highlighted(highlighted_item - rows_);
case KeyEvent::Down:
return set_highlighted(highlighted_item + rows_);
case KeyEvent::Right:
return set_highlighted(highlighted_item + 1);
case KeyEvent::Left:
return set_highlighted(highlighted_item - 1);
case KeyEvent::Select:
if( menu_items[highlighted_item].on_select ) {
menu_items[highlighted_item].on_select();
}
return true;
default:
return false;
}
}
bool BtnGridView::on_encoder(const EncoderEvent event) {
return set_highlighted(highlighted_item + event);
}
} /* namespace ui */

View File

@ -0,0 +1,99 @@
/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
* Copyright (C) 2016 Furrtek
* Copyright (C) 2019 Elia Yehuda (z4ziggy)
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __UI_BTNGRID_H__
#define __UI_BTNGRID_H__
#include "ui.hpp"
#include "ui_widget.hpp"
#include "ui_painter.hpp"
#include "bitmap.hpp"
#include "signal.hpp"
#include <cstddef>
#include <string>
#include <functional>
namespace ui {
struct GridItem {
std::string text;
ui::Color color;
const Bitmap* bitmap;
std::function<void(void)> on_select;
// TODO: Prevent default-constructed GridItems.
};
class BtnGridView : public View {
public:
BtnGridView(Rect new_parent_rect = { 0, 0, 240, 304 }, bool keep_highlight = false);
~BtnGridView();
void add_items(std::initializer_list<GridItem> new_items);
void set_max_rows(int rows);
int rows();
void clear();
NewButton* item_view(size_t index) const;
bool set_highlighted(int32_t new_value);
uint32_t highlighted_index();
void set_parent_rect(const Rect new_parent_rect) override;
void on_focus() override;
void on_blur() override;
bool on_key(const KeyEvent event) override;
bool on_encoder(const EncoderEvent event) override;
private:
int rows_ { 3 };
void update_items();
void on_tick_second();
bool keep_highlight { false };
SignalToken signal_token_tick_second { };
std::vector<GridItem> menu_items { };
std::vector<NewButton*> menu_item_views { };
Image arrow_more {
{ 228, 320 - 8, 8, 8 },
&bitmap_more,
Color::white(),
Color::black()
};
int button_w = 240 / rows_;
static constexpr int button_h = 48;
bool blink = false;
bool more = false;
size_t displayed_max { 0 };
size_t highlighted_item { 0 };
size_t offset { 0 };
};
} /* namespace ui */
#endif/*__UI_BTNGRID_H__*/

View File

@ -110,6 +110,18 @@ rf::Frequency FrequencyField::clamp_value(rf::Frequency value) {
/* FrequencyKeypadView ***************************************************/ /* FrequencyKeypadView ***************************************************/
bool FrequencyKeypadView::on_encoder(const EncoderEvent delta) {
focused_button += delta;
if (focused_button < 0) {
focused_button = buttons.size() - 1;
}
else if (focused_button >= (int16_t)buttons.size()) {
focused_button = 0;
}
buttons[focused_button].focus();
return true;
}
FrequencyKeypadView::FrequencyKeypadView( FrequencyKeypadView::FrequencyKeypadView(
NavigationView& nav, NavigationView& nav,
const rf::Frequency value const rf::Frequency value
@ -128,6 +140,10 @@ FrequencyKeypadView::FrequencyKeypadView(
const std::string label { const std::string label {
key_caps[n] key_caps[n]
}; };
button.id = n;
button.on_highlight = [this](Button& button) {
focused_button = button.id;
};
button.on_select = button_fn; button.on_select = button_fn;
button.set_parent_rect({ button.set_parent_rect({
(n % 3) * button_w, (n % 3) * button_w,

View File

@ -185,8 +185,10 @@ public:
rf::Frequency value() const; rf::Frequency value() const;
void set_value(const rf::Frequency new_value); void set_value(const rf::Frequency new_value);
bool on_encoder(const EncoderEvent delta) override;
private: private:
int16_t focused_button = 0;
static constexpr int button_w = 240 / 3; static constexpr int button_w = 240 / 3;
static constexpr int button_h = 48; static constexpr int button_h = 48;

View File

@ -342,23 +342,23 @@ void NavigationView::focus() {
ReceiversMenuView::ReceiversMenuView(NavigationView& nav) { ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
add_items({ add_items({
{ "ADS-B: Planes", ui::Color::green(), &bitmap_icon_adsb, [&nav](){ nav.replace<ADSBRxView>(); }, }, //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "ACARS: Planes", ui::Color::yellow(),&bitmap_icon_adsb, [&nav](){ nav.replace<ACARSAppView>(); }, }, { "ADS-B", ui::Color::green(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBRxView>(); }, },
{ "AIS: Boats", ui::Color::green(), &bitmap_icon_ais, [&nav](){ nav.replace<AISAppView>(); } }, { "ACARS", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ACARSAppView>(); }, },
{ "AFSK", ui::Color::yellow(),&bitmap_icon_receivers, [&nav](){ nav.replace<AFSKRxView>(); } }, { "AIS Boats", ui::Color::green(), &bitmap_icon_ais, [&nav](){ nav.push<AISAppView>(); } },
{ "Audio", ui::Color::green(), &bitmap_icon_speaker, [&nav](){ nav.replace<AnalogAudioView>(); } }, { "AFSK", ui::Color::yellow(), &bitmap_icon_receivers, [&nav](){ nav.push<AFSKRxView>(); } },
{ "ERT: Utility Meters", ui::Color::green(), &bitmap_icon_ert, [&nav](){ nav.replace<ERTAppView>(); } }, { "Audio", ui::Color::green(), &bitmap_icon_speaker, [&nav](){ nav.push<AnalogAudioView>(); } },
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.replace<POCSAGAppView>(); } }, { "ERT Meter", ui::Color::green(), &bitmap_icon_ert, [&nav](){ nav.push<ERTAppView>(); } },
{ "Radiosondes", ui::Color::yellow(),&bitmap_icon_sonde, [&nav](){ nav.replace<SondeView>(); } }, { "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGAppView>(); } },
{ "TPMS: Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav](){ nav.replace<TPMSAppView>(); } }, { "Radiosnde", ui::Color::yellow(), &bitmap_icon_sonde, [&nav](){ nav.push<SondeView>(); } },
{ "APRS", ui::Color::grey(), &bitmap_icon_aprs, [&nav](){ nav.replace<NotImplementedView>(); } }, { "TPMS Cars", ui::Color::green(), &bitmap_icon_tpms, [&nav](){ nav.push<TPMSAppView>(); } },
{ "DMR framing", ui::Color::grey(), &bitmap_icon_dmr, [&nav](){ nav.replace<NotImplementedView>(); } }, { "APRS", ui::Color::dark_grey(), &bitmap_icon_aprs, [&nav](){ nav.push<NotImplementedView>(); } },
{ "SIGFOX", ui::Color::grey(), &bitmap_icon_fox, [&nav](){ nav.replace<NotImplementedView>(); } }, // SIGFRXView { "DMR", ui::Color::dark_grey(), &bitmap_icon_dmr, [&nav](){ nav.push<NotImplementedView>(); } },
{ "LoRa", ui::Color::grey(), &bitmap_icon_lora, [&nav](){ nav.replace<NotImplementedView>(); } }, { "SIGFOX", ui::Color::dark_grey(), &bitmap_icon_fox, [&nav](){ nav.push<NotImplementedView>(); } }, // SIGFRXView
{ "SSTV", ui::Color::grey(), &bitmap_icon_sstv, [&nav](){ nav.replace<NotImplementedView>(); } }, { "LoRa", ui::Color::dark_grey(), &bitmap_icon_lora, [&nav](){ nav.push<NotImplementedView>(); } },
{ "TETRA framing", ui::Color::grey(), &bitmap_icon_tetra, [&nav](){ nav.replace<NotImplementedView>(); } }, { "SSTV", ui::Color::dark_grey(), &bitmap_icon_sstv, [&nav](){ nav.push<NotImplementedView>(); } },
{ "TETRA", ui::Color::dark_grey(), &bitmap_icon_tetra, [&nav](){ nav.push<NotImplementedView>(); } },
}); });
on_left = [&nav](){ nav.pop(); };
set_highlighted(4); // Default selection is "Audio" set_highlighted(4); // Default selection is "Audio"
} }
@ -367,43 +367,44 @@ ReceiversMenuView::ReceiversMenuView(NavigationView& nav) {
TransmittersMenuView::TransmittersMenuView(NavigationView& nav) { TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
add_items({ add_items({
{ "ADS-B Mode S", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } }, //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "ADS-B [S]", ui::Color::yellow(), &bitmap_icon_adsb, [&nav](){ nav.push<ADSBTxView>(); } },
{ "APRS", ui::Color::orange(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } }, { "APRS", ui::Color::orange(), &bitmap_icon_aprs, [&nav](){ nav.push<APRSTXView>(); } },
{ "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } }, { "BHT Xy/EP", ui::Color::green(), &bitmap_icon_bht, [&nav](){ nav.push<BHTView>(); } },
{ "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } }, { "Jammer", ui::Color::yellow(), &bitmap_icon_jammer, [&nav](){ nav.push<JammerView>(); } },
{ "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push<KeyfobView>(); } }, { "Key fob", ui::Color::orange(), &bitmap_icon_keyfob, [&nav](){ nav.push<KeyfobView>(); } },
{ "LGE tool", ui::Color::yellow(), &bitmap_icon_lge, [&nav](){ nav.push<LGEView>(); } }, { "LGE tool", ui::Color::yellow(), &bitmap_icon_lge, [&nav](){ nav.push<LGEView>(); } },
{ "Microphone", ui::Color::green(), &bitmap_icon_microphone, [&nav](){ nav.push<MicTXView>(); } }, { "Mic", ui::Color::green(), &bitmap_icon_microphone,[&nav](){ nav.push<MicTXView>(); } },
{ "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } }, { "Morse", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
{ "Burger pagers", ui::Color::yellow(), &bitmap_icon_burger, [&nav](){ nav.push<CoasterPagerView>(); } }, { "BurgerPgr", ui::Color::yellow(), &bitmap_icon_burger, [&nav](){ nav.push<CoasterPagerView>(); } },
//{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } }, //{ "Nuoptix DTMF", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } },
{ "OOK encoders", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } }, { "OOK", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } },
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } }, { "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
{ "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } }, { "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push<RDSView>(); } },
{ "Soundboard", ui::Color::green(), &bitmap_icon_soundboard, [&nav](){ nav.push<SoundBoardView>(); } }, { "Soundbrd", ui::Color::green(), &bitmap_icon_soundboard,[&nav](){ nav.push<SoundBoardView>(); } },
{ "SSTV", ui::Color::green(), &bitmap_icon_sstv, [&nav](){ nav.push<SSTVTXView>(); } }, { "SSTV", ui::Color::green(), &bitmap_icon_sstv, [&nav](){ nav.push<SSTVTXView>(); } },
{ "TEDI/LCR AFSK", ui::Color::yellow(), &bitmap_icon_lcr, [&nav](){ nav.push<LCRView>(); } }, { "TEDI/LCR", ui::Color::yellow(), &bitmap_icon_lcr, [&nav](){ nav.push<LCRView>(); } },
{ "TouchTunes remote", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<TouchTunesView>(); } }, { "TouchTune", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<TouchTunesView>(); } },
{ "Custom remote", ui::Color::grey(), &bitmap_icon_remote, [&nav](){ nav.push<RemoteView>(); } }, { "Remote", ui::Color::dark_grey(), &bitmap_icon_remote, [&nav](){ nav.push<RemoteView>(); } },
}); });
on_left = [&nav](){ nav.pop(); };
} }
/* UtilitiesMenuView *****************************************************/ /* UtilitiesMenuView *****************************************************/
UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) { UtilitiesMenuView::UtilitiesMenuView(NavigationView& nav) {
add_items({ add_items({
//{ "Test app", ui::Color::grey(), nullptr, [&nav](){ nav.push<TestView>(); } }, //{ "Test app", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<TestView>(); } },
{ "Frequency manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push<FrequencyManagerView>(); } }, //{ "..", ui::Color::light_grey(),&bitmap_icon_previous, [&nav](){ nav.pop(); } },
{ "Freq manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push<FrequencyManagerView>(); } },
{ "File manager", ui::Color::yellow(), &bitmap_icon_file, [&nav](){ nav.push<FileManagerView>(); } }, { "File manager", ui::Color::yellow(), &bitmap_icon_file, [&nav](){ nav.push<FileManagerView>(); } },
{ "Notepad", ui::Color::grey(), &bitmap_icon_notepad, [&nav](){ nav.push<NotImplementedView>(); } }, { "Notepad", ui::Color::dark_grey(), &bitmap_icon_notepad, [&nav](){ nav.push<NotImplementedView>(); } },
{ "Signal generator", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push<SigGenView>(); } }, { "Signal gen", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push<SigGenView>(); } },
//{ "Tone search", ui::Color::grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } }, //{ "Tone search", ui::Color::dark_grey(), nullptr, [&nav](){ nav.push<ToneSearchView>(); } },
{ "Wave file viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } }, { "Wave viewer", ui::Color::blue(), nullptr, [&nav](){ nav.push<ViewWavView>(); } },
{ "Whip antenna length", ui::Color::yellow(), nullptr, [&nav](){ nav.push<WhipCalcView>(); } }, { "Antenna length", ui::Color::yellow(), nullptr, [&nav](){ nav.push<WhipCalcView>(); } },
{ "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } }, { "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push<WipeSDView>(); } },
}); });
on_left = [&nav](){ nav.pop(); }; set_max_rows(2); // allow wider buttons
} }
/* SystemMenuView ********************************************************/ /* SystemMenuView ********************************************************/
@ -421,17 +422,17 @@ void SystemMenuView::hackrf_mode(NavigationView& nav) {
SystemMenuView::SystemMenuView(NavigationView& nav) { SystemMenuView::SystemMenuView(NavigationView& nav) {
add_items({ add_items({
{ "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } }, { "Play dead", ui::Color::red(), &bitmap_icon_playdead, [&nav](){ nav.push<PlayDeadView>(); } },
{ "Receivers", ui::Color::cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } }, { "Receivers", ui::Color::dark_cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } },
{ "Transmitters", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } }, { "Transmit", ui::Color::green(), &bitmap_icon_transmit, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } }, { "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } }, { "Replay", ui::Color::purple(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "Search/Close call", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } }, { "Calls", ui::Color::yellow(), &bitmap_icon_closecall, [&nav](){ nav.push<SearchView>(); } },
{ "Scanner", ui::Color::grey(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } }, { "Scanner", ui::Color::orange(), &bitmap_icon_scanner, [&nav](){ nav.push<ScannerView>(); } },
{ "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } }, { "Utilities", ui::Color::light_grey(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Settings", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } }, { "Settings", ui::Color::cyan(), &bitmap_icon_setup, [&nav](){ nav.push<SettingsMenuView>(); } },
//{ "Debug", ui::Color::white(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } }, //{ "Debug", ui::Color::cyan(), nullptr, [&nav](){ nav.push<DebugMenuView>(); } },
{ "HackRF mode", ui::Color::white(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } }, { "HackRF", ui::Color::cyan(), &bitmap_icon_hackrf, [this, &nav](){ hackrf_mode(nav); } },
{ "About", ui::Color::white(), nullptr, [&nav](){ nav.push<AboutView>(); } } { "About", ui::Color::cyan(), nullptr, [&nav](){ nav.push<AboutView>(); } }
}); });
set_highlighted(1); // Startup selection is "Receivers" set_highlighted(1); // Startup selection is "Receivers"

View File

@ -27,6 +27,7 @@
#include "ui_widget.hpp" #include "ui_widget.hpp"
#include "ui_focus.hpp" #include "ui_focus.hpp"
#include "ui_menu.hpp" #include "ui_menu.hpp"
#include "ui_btngrid.hpp"
#include "ui_rssi.hpp" #include "ui_rssi.hpp"
#include "ui_channel.hpp" #include "ui_channel.hpp"
@ -198,8 +199,8 @@ public:
private: private:
Text text_info { Text text_info {
{ 76, 284, 20 * 8, 16 }, { 4*8, 284, 20 * 8, 16 },
"GIT " GIT_REVISION "Version " VERSION_STRING
}; };
Button button_done { Button button_done {
@ -208,25 +209,25 @@ private:
}; };
}; };
class ReceiversMenuView : public MenuView { class ReceiversMenuView : public BtnGridView {
public: public:
ReceiversMenuView(NavigationView& nav); ReceiversMenuView(NavigationView& nav);
std::string title() const override { return "Receivers"; }; std::string title() const override { return "Receivers"; };
}; };
class TransmittersMenuView : public MenuView { class TransmittersMenuView : public BtnGridView {
public: public:
TransmittersMenuView(NavigationView& nav); TransmittersMenuView(NavigationView& nav);
std::string title() const override { return "Transmitters"; }; std::string title() const override { return "Transmitters"; };
}; };
class UtilitiesMenuView : public MenuView { class UtilitiesMenuView : public BtnGridView {
public: public:
UtilitiesMenuView(NavigationView& nav); UtilitiesMenuView(NavigationView& nav);
std::string title() const override { return "Utilities"; }; std::string title() const override { return "Utilities"; };
}; };
class SystemMenuView : public MenuView { class SystemMenuView : public BtnGridView {
public: public:
SystemMenuView(NavigationView& nav); SystemMenuView(NavigationView& nav);
private: private:

View File

@ -201,7 +201,7 @@ set(CPPWARN "-Wall -Wextra")
# List all default C defines here, like -D_DEBUG=1 # List all default C defines here, like -D_DEBUG=1
# TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI? # TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI?
# NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types # NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types
set(DDEFS -DLPC43XX -DLPC43XX_M4 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -DGIT_REVISION=\"${GIT_REVISION}\") set(DDEFS "-DLPC43XX -DLPC43XX_M4 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -D'VERSION_STRING=\"${VERSION}\"'")
# List all default ASM defines here, like -D_DEBUG=1 # List all default ASM defines here, like -D_DEBUG=1
set(DADEFS) set(DADEFS)
@ -469,10 +469,9 @@ DeclareTargets(PWFM wfm_audio)
### HackRF "factory" firmware ### HackRF "factory" firmware
add_custom_command( add_custom_command(
OUTPUT hackrf.bin hackrf.img OUTPUT hackrf.img
COMMAND ${STRIP_DFU} ${HACKRF_FIRMWARE_DFU_IMAGE} hackrf.bin COMMAND ${MAKE_IMAGE_CHUNK} ${HACKRF_FIRMWARE_BIN_IMAGE} HRF1 hackrf.img 98304
COMMAND ${MAKE_IMAGE_CHUNK} hackrf.bin HRF1 hackrf.img 98304 DEPENDS ${HACKRF_FIRMWARE_BIN_FILENAME} ${MAKE_IMAGE_CHUNK}
DEPENDS hackrf ${STRIP_DFU} ${MAKE_IMAGE_CHUNK}
VERBATIM VERBATIM
) )

View File

@ -170,7 +170,7 @@ const PALConfig pal_default_config = {
| (1 << 9) // P7_1: PortaPack GPIO3_9(IO) | (1 << 9) // P7_1: PortaPack GPIO3_9(IO)
| (1 << 8) // P7_0: PortaPack GPIO3_8(IO) | (1 << 8) // P7_0: PortaPack GPIO3_8(IO)
| (1 << 7) // P6_11: VREGMODE | (1 << 7) // P6_11: VREGMODE
| (1 << 6) // P6_10: EN1V8, 10K PD | (0 << 6) // P6_10: EN1V8, 10K PD
| (1 << 5) // P6_9: !TX_AMP_PWR, 10K PU | (1 << 5) // P6_9: !TX_AMP_PWR, 10K PU
| (1 << 4) // P6_5: HackRF CPLD.TMS(I) (output only when needed, pull-up internal to CPLD when 1V8 present) | (1 << 4) // P6_5: HackRF CPLD.TMS(I) (output only when needed, pull-up internal to CPLD when 1V8 present)
| (1 << 3) // P6_4: MIXER_SDATA | (1 << 3) // P6_4: MIXER_SDATA
@ -478,8 +478,8 @@ void vaa_power_on(void) {
/* Combination of pulse duration and duty cycle was arrived at empirically, to keep supply glitching /* Combination of pulse duration and duty cycle was arrived at empirically, to keep supply glitching
* to +/- 0.15V. * to +/- 0.15V.
*/ */
const uint32_t cycle_period = 128; const uint32_t cycle_period = 256;
const uint32_t enable_period = 10; uint32_t enable_period = 2;
LPC_MCPWM->TC2 = 0; LPC_MCPWM->TC2 = 0;
LPC_MCPWM->MAT2 = cycle_period - enable_period; LPC_MCPWM->MAT2 = cycle_period - enable_period;
LPC_MCPWM->LIM2 = cycle_period; LPC_MCPWM->LIM2 = cycle_period;
@ -493,7 +493,11 @@ void vaa_power_on(void) {
/* Wait until VAA rises to approximately 90% of final voltage. */ /* Wait until VAA rises to approximately 90% of final voltage. */
/* Timing assumes we're running immediately after the bootloader: 96 MHz from IRC+PLL1 /* Timing assumes we're running immediately after the bootloader: 96 MHz from IRC+PLL1
*/ */
{ volatile uint32_t delay = 12000; while(delay--); } while(enable_period < cycle_period) {
{ volatile uint32_t delay = 2000; while(delay--); }
enable_period <<= 1;
LPC_MCPWM->MAT2 = cycle_period - enable_period;
}
/* Hold !VAA_ENABLE active using a GPIO, so we can reclaim and shut down the MOTOCONPWM peripheral. */ /* Hold !VAA_ENABLE active using a GPIO, so we can reclaim and shut down the MOTOCONPWM peripheral. */
LPC_GPIO->CLR[2] = (1 << 9); // !VAA_ENABLE LPC_GPIO->CLR[2] = (1 << 9); // !VAA_ENABLE
@ -635,9 +639,11 @@ extern "C" void __late_init(void) {
*/ */
extern "C" void boardInit(void) { extern "C" void boardInit(void) {
vaa_power_on(); vaa_power_on();
LPC_GPIO->W3[6] = 1;
} }
extern "C" void _default_exit(void) { extern "C" void _default_exit(void) {
LPC_GPIO->W3[6] = 0;
vaa_power_off(); vaa_power_off();
chSysDisable(); chSysDisable();

View File

@ -918,6 +918,132 @@ bool Button::on_touch(const TouchEvent event) {
#endif #endif
} }
/* NewButton ****************************************************************/
NewButton::NewButton(
Rect parent_rect,
std::string text,
const Bitmap* bitmap
) : Widget { parent_rect },
text_ { text },
bitmap_ (bitmap)
{
set_focusable(true);
}
void NewButton::set_text(const std::string value) {
text_ = value;
set_dirty();
}
std::string NewButton::text() const {
return text_;
}
void NewButton::set_bitmap(const Bitmap* bitmap) {
bitmap_ = bitmap;
set_dirty();
}
const Bitmap* NewButton::bitmap() {
return bitmap_;
}
void NewButton::set_color(Color color) {
color_ = color;
set_dirty();
}
ui::Color NewButton::color() {
return color_;
}
void NewButton::paint(Painter& painter) {
if (!bitmap_ && text_.empty())
return;
Color bg, fg;
const auto r = screen_rect();
if (has_focus() || highlighted()) {
bg = style().foreground;
fg = Color::black();
} else {
bg = Color::grey();
fg = style().foreground;
}
const Style paint_style = { style().font, bg, fg };
painter.draw_rectangle({r.location(), {r.size().width(), 1}}, Color::light_grey());
painter.draw_rectangle({r.location().x(), r.location().y() + r.size().height() - 1, r.size().width(), 1}, Color::dark_grey());
painter.draw_rectangle({r.location().x() + r.size().width() - 1, r.location().y(), 1, r.size().height()}, Color::dark_grey());
painter.fill_rectangle(
{ r.location().x(), r.location().y() + 1, r.size().width() - 1, r.size().height() - 2 },
paint_style.background
);
int y = r.location().y();
if (bitmap_) {
painter.draw_bitmap(
{r.location().x() + (r.size().width() / 2) - 8, r.location().y() + 6},
*bitmap_,
color_, //Color::green(), //fg,
bg
);
y += 10;
}
const auto label_r = paint_style.font.size_of(text_);
painter.draw_string(
{ r.location().x() + (r.size().width() - label_r.width()) / 2, y + (r.size().height() - label_r.height()) / 2 },
paint_style,
text_
);
}
void NewButton::on_focus() {
if( on_highlight )
on_highlight(*this);
}
bool NewButton::on_key(const KeyEvent key) {
if( key == KeyEvent::Select ) {
if( on_select ) {
on_select();
return true;
}
} else {
if( on_dir ) {
return on_dir(*this, key);
}
}
return false;
}
bool NewButton::on_touch(const TouchEvent event) {
switch(event.type) {
case TouchEvent::Type::Start:
set_highlighted(true);
set_dirty();
return true;
case TouchEvent::Type::End:
set_highlighted(false);
set_dirty();
if( on_select ) {
on_select();
}
return true;
default:
return false;
}
}
/* Image *****************************************************************/ /* Image *****************************************************************/
Image::Image( Image::Image(

View File

@ -394,6 +394,40 @@ private:
std::string text_; std::string text_;
}; };
class NewButton : public Widget {
public:
std::function<void(void)> on_select { };
//std::function<void(NewButton&)> on_select { };
std::function<bool(NewButton&, KeyEvent)> on_dir { };
std::function<void(NewButton&)> on_highlight { };
NewButton(const NewButton&) = delete;
NewButton& operator=(const NewButton&) = delete;
NewButton(Rect parent_rect, std::string text, const Bitmap* bitmap);
NewButton(
) : NewButton { { }, { }, { } }
{
}
void set_bitmap(const Bitmap* bitmap);
void set_text(const std::string value);
void set_color(Color value);
std::string text() const;
const Bitmap* bitmap();
ui::Color color();
void on_focus() override;
bool on_key(const KeyEvent key) override;
bool on_touch(const TouchEvent event) override;
void paint(Painter& painter) override;
private:
std::string text_;
Color color_ = Color::dark_cyan();
const Bitmap* bitmap_;
};
class Image : public Widget { class Image : public Widget {
public: public:
Image(); Image();

View File

@ -1,55 +0,0 @@
#!/usr/bin/env python
#
# Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
#
# This file is part of PortaPack.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
import sys
usage_message = """
PortaPack DFU header stripper
Usage: <command> <dfu_file> <output_file>
"""
def read_image(path):
f = open(path, 'rb')
data = f.read()
f.close()
return data
def read_image_from_dfu(path):
data = read_image(path)
# Strip DFU header from file to get binary image.
return data[16:]
def write_image(data, path):
f = open(path, 'wb')
f.write(data)
f.close()
if len(sys.argv) != 3:
print(usage_message)
sys.exit(-1)
dfu_image = read_image_from_dfu(sys.argv[1])
output_path = sys.argv[2]
write_image(dfu_image, output_path)

1
hackrf Submodule

@ -0,0 +1 @@
Subproject commit 923f9fe617c9dcf00c97c18f5aa79e51720b9e59

View File

@ -0,0 +1,50 @@
f=118000000
f=119100000
f=121100000
f=122300000
f=122400000
f=131900000
f=133250000
f=144330000
f=145025000
f=145310000
f=145375000
f=145625000
f=145700000
f=145725000
f=145750000
f=146395000
f=152250000
f=154510000
f=155210000
f=156295000
f=156700000
f=158410000
f=161550000
f=161650000
f=161700000
f=163812500
f=170900000
f=172437500
f=172725000
f=173012500
f=173325000
f=173350000
f=430625000
f=430650000
f=430725000
f=430762500
f=431200000
f=431200000
f=431500000
f=431600000
f=431825000
f=438225000
f=438250000
f=438325000
f=438362500
f=438800000
f=438800000
f=439100000
f=439200000
f=439425000

57
tools/deploy-nightly.sh Normal file
View File

@ -0,0 +1,57 @@
#!/bin/bash
PUBLICATION_BRANCH=master
# set -x
cd $HOME
# Checkout the branch
git clone --branch=$PUBLICATION_BRANCH https://${GITHUB_TOKEN}@github.com/${ARTEFACT_REPO}.git publish
cd publish
# Update pages
BUILD_PATH=$BUILD_DATE-$SHORT_COMMIT_HASH
mkdir $BUILD_PATH
cp $ARTEFACT_BASE/$BUILD_NAME.tar.xz $BUILD_PATH/
cp $ARTEFACT_BASE/MD5SUMS $BUILD_PATH/
cp $ARTEFACT_BASE/SHA256SUMS $BUILD_PATH/
# Write index page
cd $TRAVIS_BUILD_DIR
COMMITS=`git log --oneline | awk '{print $1}'`
cd $HOME/publish
echo "
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<html><head>
<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">
<title>$PROJECT_NAME Builds</title>
</head>
<body>
<h2>$PROJECT_NAME Builds</h2>
<table>
" > index.html
for commit in $COMMITS; do
FILEPATH=`find . -maxdepth 2 -name "*-$commit.tar.xz"`
if [ "$FILEPATH" != "" ]; then
FILEDIR=`dirname "${FILEPATH}"`
FILENAME=`basename "${FILEPATH}"`
FILEPATH=${FILEPATH:2}
# pushd "${FILEDIR}"
# HASH_MD5=`md5sum --binary ${FILENAME}`
# HASH_SHA256=`sha256sum --binary ${FILENAME}`
# popd
echo "<tr><td><a href=\"$FILEPATH\">$FILENAME</a></td><td><a href=\"$FILEDIR/MD5SUMS\">MD5SUMS</a></td><td><a href=\"$FILEDIR/SHA256SUMS\">SHA256SUMS</a></td></tr>" >> index.html
fi
done
echo "
</table>
</body></html>
" >> index.html
# Commit and push latest version
git add $BUILD_PATH/$BUILD_NAME.tar.xz $BUILD_PATH/MD5SUMS $BUILD_PATH/SHA256SUMS index.html
git config user.name "Travis"
git config user.email "travis@travis-ci.org"
git commit -m "Build products for $SHORT_COMMIT_HASH, built on $TRAVIS_OS_NAME, log: $TRAVIS_BUILD_WEB_URL"
if [ "$?" != "0" ]; then
echo "Looks like the commit failed"
fi
git push -fq origin $PUBLICATION_BRANCH