diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b1fac45 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/Makefile b/Makefile index 2fb3bcf..6cf6d8a 100644 --- a/Makefile +++ b/Makefile @@ -39,12 +39,12 @@ VPATH = .. ############################################################################### # Project settings -PROJECT := DeBroglie -MBED := mbed-os -MBED_STM := $(MBED)/targets/TARGET_STM -MBED_STM32F7 := $(MBED_STM)/TARGET_STM32F7 -MBED_STM32F746xG := $(MBED_STM32F7)/TARGET_STM32F746xG -BSP := bsp +PROJECT = MiniG +MBED = mbed-os +MBED_STM = $(MBED)/targets/TARGET_STM +MBED_STM32F7 = $(MBED_STM)/TARGET_STM32F7 +MBED_STM32F746xG = $(MBED_STM32F7)/TARGET_STM32F746xG +BSP = bsp # Project settings ############################################################################### @@ -53,12 +53,22 @@ BSP := bsp # main OBJECTS += main.o -CFLAGS += -I$(NANOPB_DIR) # drivers OBJECTS += drivers/max11300/max11300.o OBJECTS += drivers/ad9959/ad9959.o +OBJECTS += util/dds_config.o OBJECTS += minig.o +#### Protobuf Build +# Include the nanopb provided Makefile rules +include $(VPATH)/nanopb/extra/nanopb.mk + +# C source code files that are required +OBJECTS += pb_encode.o # The nanopb encoder +OBJECTS += pb_decode.o # The nanopb decoder +OBJECTS += pb_common.o # The nanopb common parts +OBJECTS += gravity.pb.o # The compiled protocol definition + SYS_OBJECTS += $(MBED)/drivers/AnalogIn.o SYS_OBJECTS += $(MBED)/drivers/BusIn.o SYS_OBJECTS += $(MBED)/drivers/BusInOut.o @@ -256,8 +266,10 @@ INCLUDE_PATHS += -I../$(MBED)/drivers INCLUDE_PATHS += -I../$(MBED)/hal INCLUDE_PATHS += -I../$(MBED)/platform +INCLUDE_PATHS += -I$(NANOPB_DIR) + LIBRARY_PATHS := -L../$(MBED_STM32F746xG)/device/TOOLCHAIN_GCC_ARM -# LIBRARIES := -l$(MBED) +# LIBRARIES := -l$(MBED) LINKER_SCRIPT ?= ../$(BSP)/STM32F746xG.ld # Objects and Paths @@ -423,21 +435,19 @@ LD_SYS_LIBS :=-Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--en all: $(PROJECT).bin $(PROJECT).hex size +# Build rule for the protocol +gravity.pb.c: gravity.proto + $(PROTOC) $(PROTOC_OPTS) --nanopb_out=. --proto_path=$(VPATH) gravity.proto .s.o: +@$(call MAKEDIR,$(dir $@)) +@echo "Assemble: $(notdir $<)" - @$(AS) -c $(ASM_FLAGS) -o $@ $< - - .S.o: +@$(call MAKEDIR,$(dir $@)) +@echo "Assemble: $(notdir $<)" - @$(AS) -c $(ASM_FLAGS) -o $@ $< - .c.o: +@$(call MAKEDIR,$(dir $@)) @@ -449,18 +459,13 @@ all: $(PROJECT).bin $(PROJECT).hex size +@echo "Compile: $(notdir $<)" @$(CPP) $(CXX_FLAGS) $(INCLUDE_PATHS) -o $@ $< - $(PROJECT).link_script.ld: $(LINKER_SCRIPT) @$(PREPROC) $< -o $@ - - -$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(PROJECT).link_script.ld +$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(PROJECT).link_script.ld +@echo "link: $(notdir $@)" @$(LD) $(LD_FLAGS) -T $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS) - - $(PROJECT).bin: $(PROJECT).elf $(ELF2BIN) -O binary $< $@ +@echo "===== bin file ready to flash: $(OBJDIR)/$@ =====" diff --git a/README.md b/README.md index 700e095..5ee4558 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# De Broglie ~ Taking AMO outside the lab +# Embedded Control System for Mobile Atom Interferometers -This project supports an mbed based application to run AMO experiments. It has been developed and tested on an STM32F47GZ development board. +Please refer to [this paper](https://arxiv.org/abs/1812.01028) for details about the project. ## Setup -To successfully build and use the code in this repository, make sure that you can build code for ARM Cortex-M* MCUs by installing the correct build tools for your system from: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm +To successfully build and use the code, install the correct build tools for your system from [here](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm). The current gcc version used for this project is gcc-7-2018-q2-update -The current gcc version used for this project is gcc-7-2018-q2-update +To modify the MAX11300 pins, use this [EV Kit Configuratione Software](https://www.maximintegrated.com/en/design/software-description.html/swpart=SFW0003260A). + +Please refer to the hardware schematic for setting up the system using [Nucleo-F746ZG](https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f746zg.html#design-scroll) development board, [MAX11300 evaluation kit](https://www.maximintegrated.com/en/products/analog/data-converters/analog-to-digital-converters/MAX11300PMB1.html), and [AD9959 Evaluatoin Board](https://www.analog.com/en/design-center/evaluation-hardware-and-software/evaluation-boards-kits/EVAL-AD9959.html) \ No newline at end of file diff --git a/bsp/PeripheralPins.d b/bsp/PeripheralPins.d new file mode 100644 index 0000000..05b0b72 --- /dev/null +++ b/bsp/PeripheralPins.d @@ -0,0 +1,86 @@ +../bsp/PeripheralPins.o: ../bsp/PeripheralPins.c .././mbed_config.h \ + ../mbed-os/targets/TARGET_STM/PeripheralPins.h ../mbed-os/hal/pinmap.h \ + ../bsp/PinNames.h ../mbed-os/targets/TARGET_STM/PinNamesTypes.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./cmsis.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./stm32f7xx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./stm32f746xx.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./core_cm7.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_version.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_compiler.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_gcc.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./mpu_armv7.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./system_stm32f7xx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_conf.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rcc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_def.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./stm32f7xx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32_hal_legacy.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rcc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_gpio.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_gpio_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cortex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_adc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_adc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_adc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_can_legacy.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cec.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_crc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_crc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cryp.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma2d.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dac.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dac_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dcmi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_eth.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_flash.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_flash_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sram.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_fmc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_nor.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_nand.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sdram.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_hash.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2c.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2c_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2s.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_iwdg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_lptim.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_ltdc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pwr.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pwr_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_qspi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rng.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rtc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rtc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sai.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_sdmmc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_spdifrx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_spi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_tim.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_tim_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_uart.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_uart_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_usart.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_usart_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_irda.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_irda_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smartcard.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smartcard_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_wwdg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pcd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_usb.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pcd_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_hcd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dfsdm.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dsi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_jpeg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_mdios.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smbus.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_mmc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./cmsis_nvic.h \ + ../bsp/PeripheralNames.h ../mbed-os/platform/mbed_toolchain.h \ + ../mbed-os/platform/mbed_preprocessor.h diff --git a/bsp/system_clock.d b/bsp/system_clock.d new file mode 100644 index 0000000..db7e813 --- /dev/null +++ b/bsp/system_clock.d @@ -0,0 +1,82 @@ +../bsp/system_clock.o: ../bsp/system_clock.c .././mbed_config.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./stm32f7xx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./stm32f746xx.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./core_cm7.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_version.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_compiler.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./cmsis_gcc.h \ + ../mbed-os/cmsis/TARGET_CORTEX_M/./mpu_armv7.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/device/./system_stm32f7xx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_conf.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rcc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_def.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32_hal_legacy.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rcc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_gpio.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_gpio_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cortex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_adc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_adc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_adc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_can_legacy.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cec.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_crc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_crc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_cryp.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dma2d.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dac.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dac_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dcmi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_eth.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_flash.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_flash_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sram.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_fmc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_nor.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_nand.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sdram.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_hash.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2c.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2c_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_i2s.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_iwdg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_lptim.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_ltdc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pwr.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pwr_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_qspi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rng.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rtc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_rtc_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sai.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_sd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_sdmmc.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_spdifrx.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_spi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_tim.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_tim_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_uart.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_uart_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_usart.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_usart_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_irda.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_irda_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smartcard.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smartcard_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_wwdg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pcd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_ll_usb.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_pcd_ex.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_hcd.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dfsdm.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_dsi.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_jpeg.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_mdios.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_smbus.h \ + ../mbed-os/targets/TARGET_STM/TARGET_STM32F7/device/./stm32f7xx_hal_mmc.h \ + ../mbed-os/targets/TARGET_STM/nvic_addr.h \ + ../mbed-os/platform/mbed_assert.h \ + ../mbed-os/platform/mbed_preprocessor.h diff --git a/bsm_delay.h b/cycle_count_delay.h similarity index 56% rename from bsm_delay.h rename to cycle_count_delay.h index c946e39..8140681 100644 --- a/bsm_delay.h +++ b/cycle_count_delay.h @@ -1,5 +1,8 @@ -#ifndef _BSM_DELAY_H_ -#define _BSM_DELAY_H_ +// Taken from Anthony VH +// http://www.anthonyvh.com/2017/05/18/cortex_m-cycle_counter/ + +#ifndef _CYCLE_DELAY_H_ +#define _CYCLE_DELAY_H_ #include #include @@ -8,12 +11,19 @@ #include +static bool module_init = false; + inline void enableCycleCounter() { + if (module_init) { + return; + } CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; DWT->LAR = 0xC5ACCE55; DWT->CYCCNT = 0; DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk; + + module_init = true; } inline void delayCycles(uint32_t const numCycles) { @@ -23,17 +33,15 @@ inline void delayCycles(uint32_t const numCycles) { } inline uint32_t usToCycles(uint32_t const us) { - // return ceil(us * ((float)SystemCoreClock / 1e6f)) - 56; return ceil(us * ((float)SystemCoreClock / 1e6f)) - 16; } inline uint32_t nsToCycles(uint32_t const ns) { - // return ceil(us * ((float)SystemCoreClock / 1e6f)) - 56; return ceil(ns * ((float)SystemCoreClock / 1e9f)) - 16; } -inline void bsm_delay_ns(uint32_t const ns) { delayCycles(nsToCycles(ns)); } -inline void bsm_delay_us(uint32_t const us) { delayCycles(usToCycles(us)); } -inline void bsm_delay_ms(uint32_t const ms) { delayCycles(usToCycles(ms * 1000)); } +inline void cycle_delay_ns(uint32_t const ns) { delayCycles(nsToCycles(ns)); } +inline void cycle_delay_us(uint32_t const us) { delayCycles(usToCycles(us)); } +inline void cycle_delay_ms(uint32_t const ms) { delayCycles(usToCycles(ms * 1000)); } -#endif // _BSM_DELAY_H_ +#endif // _CYCLE_DELAY_H_ diff --git a/dds_params/T_130_fringes.h b/dds_params/T_130_fringes.h index f7a1dd1..e98e776 100644 --- a/dds_params/T_130_fringes.h +++ b/dds_params/T_130_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.993167, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c03b283, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.993174, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1502c5e2, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.993183, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.993195, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.993204, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.993214, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.993224, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1e8fab78, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.993233, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x19dc073e, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.993241, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.993254, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.993265, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x19dc073e, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.993270, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1e8fab78, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.993280, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.993286, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 15, .clk_transition_hex = 0x158ee78e, .chirp_start_hex = 0x16695b9c, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.993291, .detuning = 500.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x219e096a, @@ -191,7 +191,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .detuning = 500.000000}; constexpr size_t NUM_POINTS_INTER = 16; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, diff --git a/dds_params/declare_20e6_fringes.h b/dds_params/declare_20e6_fringes.h index febb5b8..e0b4446 100644 --- a/dds_params/declare_20e6_fringes.h +++ b/dds_params/declare_20e6_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 10, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 23.365796, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 14, .clk_transition_hex = 0xb8c8e55, .chirp_start_hex = 0xc30655f, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 23.365804, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 11, .clk_transition_hex = 0xeb2e3b2, .chirp_start_hex = 0xf8369bf, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 23.365824, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 10, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 23.365849, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 13, .clk_transition_hex = 0xc6ffbbe, .chirp_start_hex = 0xd206d2c, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 23.365863, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 15, .clk_transition_hex = 0xac773c7, .chirp_start_hex = 0xb605e9d, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 23.365870, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 11, .clk_transition_hex = 0xeb2e3b2, .chirp_start_hex = 0xf8369bf, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 23.365883, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 10, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 23.365889, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 14, .clk_transition_hex = 0xb8c8e55, .chirp_start_hex = 0xc30655f, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 23.365898, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 18, .clk_transition_hex = 0x8fb8b26, .chirp_start_hex = 0x97af983, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 23.365916, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 11, .clk_transition_hex = 0xeb2e3b2, .chirp_start_hex = 0xf8369bf, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 23.365933, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 12, .clk_transition_hex = 0xd7950b9, .chirp_start_hex = 0xe387645, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 23.365940, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 17, .clk_transition_hex = 0x982cf91, .chirp_start_hex = 0xa09bce5, @@ -155,7 +155,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 13; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_10_fringes.h b/dds_params/declare_T_10_fringes.h index 3f78435..1d39ccf 100644 --- a/dds_params/declare_T_10_fringes.h +++ b/dds_params/declare_T_10_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.980066, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.981066, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.982127, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.983207, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.984244, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.985258, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.986319, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.987406, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.988462, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.989495, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.990502, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.992026, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.993195, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.994282, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.995296, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.996327, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 22.997383, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 22.998494, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 22.999618, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -239,7 +239,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 20; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_115_fringes_17e_7.h b/dds_params/declare_T_115_fringes_17e_7.h index 9db5fc9..2df44fa 100644 --- a/dds_params/declare_T_115_fringes_17e_7.h +++ b/dds_params/declare_T_115_fringes_17e_7.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x222e374a, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.993503, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x222e374a, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.993519, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f12bde7, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.993532, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f12bde7, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.993548, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f12bde7, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.993562, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f12bde7, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.993574, .detuning = 720.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141b2f95, @@ -83,7 +83,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .detuning = 720.000000}; constexpr size_t NUM_POINTS_INTER = 7; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, diff --git a/dds_params/declare_T_120_16_fringes.h b/dds_params/declare_T_120_16_fringes.h index 0f81098..3567c73 100644 --- a/dds_params/declare_T_120_16_fringes.h +++ b/dds_params/declare_T_120_16_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.993603, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.993614, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.993626, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x22211bd9, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.993634, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.993647, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.993657, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.993667, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.993675, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.993686, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.993696, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.993705, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.993719, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.993727, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.993738, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x22211bd9, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.993748, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -191,7 +191,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 16; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_120_fringes.h b/dds_params/declare_T_120_fringes.h index 6d7d7ef..7391eeb 100644 --- a/dds_params/declare_T_120_fringes.h +++ b/dds_params/declare_T_120_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x22211bd9, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.993566, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.993578, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.993590, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.993603, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.993614, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.993626, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.993638, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.993647, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -107,7 +107,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 9; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_1_2_fringes.h b/dds_params/declare_T_1_2_fringes.h index e3a995c..8d78818 100644 --- a/dds_params/declare_T_1_2_fringes.h +++ b/dds_params/declare_T_1_2_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.000120, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.200131, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.400248, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.600328, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.800367, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 23.000438, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 23.200500, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 23.400548, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 23.600561, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 23.801513, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -131,7 +131,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 11; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_20_fringes.h b/dds_params/declare_T_20_fringes.h index 038271f..065ed78 100644 --- a/dds_params/declare_T_20_fringes.h +++ b/dds_params/declare_T_20_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.991049, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.991259, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.991507, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.991765, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.992026, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.992251, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.992461, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.992690, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.992929, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.993169, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.993391, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.993599, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.993806, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.994033, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.994268, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.994483, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 22.994691, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 22.994908, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -227,7 +227,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 19; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_2_fringes.h b/dds_params/declare_T_2_fringes.h index 8c40ed6..312d710 100644 --- a/dds_params/declare_T_2_fringes.h +++ b/dds_params/declare_T_2_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.500002, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.550079, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.600094, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.650127, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.700988, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.751167, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.801346, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.851412, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.901535, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.951764, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 23.001792, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 23.051885, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 23.101974, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 23.152034, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 23.202080, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 23.252158, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 23.302227, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 23.352359, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 23.402465, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -238,7 +238,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .actual_chirp = 23.452601, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_20 = { +constexpr DDSConfig::params_t inter_dds_params_20 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -251,7 +251,7 @@ constexpr MiniG::dds_params_t inter_dds_params_20 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 21; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_40_fringes.h b/dds_params/declare_T_40_fringes.h index 370f807..a676e90 100644 --- a/dds_params/declare_T_40_fringes.h +++ b/dds_params/declare_T_40_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x22211bd9, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.992026, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.992082, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.992141, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.992193, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.992251, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.992302, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.992352, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.992413, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.992472, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.992534, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.992600, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.992652, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 15, .clk_transition_hex = 0x158ee78e, .chirp_start_hex = 0x16c0bd3b, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.992706, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.992759, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.992821, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.992875, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 22.992929, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 22.992980, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 19, .clk_transition_hex = 0x110507a6, .chirp_start_hex = 0x11f67a72, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 22.993034, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -239,7 +239,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 20; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_5_fringes.h b/dds_params/declare_T_5_fringes.h index f18e8a2..0fd6038 100644 --- a/dds_params/declare_T_5_fringes.h +++ b/dds_params/declare_T_5_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.900053, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.910083, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.920211, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.930291, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.940319, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.950449, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.960468, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.970540, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.980568, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.990620, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 23.000845, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 23.010925, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 23.020937, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 23.030955, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 23.041013, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 23.051161, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 23.061321, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 23.071400, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 23.081479, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -238,7 +238,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .actual_chirp = 23.091495, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_20 = { +constexpr DDSConfig::params_t inter_dds_params_20 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -251,7 +251,7 @@ constexpr MiniG::dds_params_t inter_dds_params_20 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 21; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_T_80_fringes.h b/dds_params/declare_T_80_fringes.h index 58571b7..a82b95b 100644 --- a/dds_params/declare_T_80_fringes.h +++ b/dds_params/declare_T_80_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.992216, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.992237, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.992256, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.992274, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.992289, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.992310, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.992329, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.992348, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.992367, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.992383, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.992402, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.992420, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.992442, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.992457, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.992477, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.992499, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 22.992514, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 22.992534, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 22.992557, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -239,7 +239,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 20; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_fringes.h b/dds_params/declare_fringes.h index 95cdbd1..6935315 100644 --- a/dds_params/declare_fringes.h +++ b/dds_params/declare_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.993703, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 13, .clk_transition_hex = 0x18dff77d, .chirp_start_hex = 0x1a40da58, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.993719, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 15, .clk_transition_hex = 0x158ee78e, .chirp_start_hex = 0x16c0bd3b, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.993738, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.993760, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 12, .clk_transition_hex = 0x1af2a172, .chirp_start_hex = 0x1c70ec8a, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.993784, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.993799, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 18, .clk_transition_hex = 0x11f7164c, .chirp_start_hex = 0x12f5f307, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.993817, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.993834, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 10, .clk_transition_hex = 0x20565b56, .chirp_start_hex = 0x22211bd9, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.993856, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 17, .clk_transition_hex = 0x13059f23, .chirp_start_hex = 0x141379cb, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.993875, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 14, .clk_transition_hex = 0x17191cab, .chirp_start_hex = 0x1860cabf, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.993891, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.993910, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 16, .clk_transition_hex = 0x1435f916, .chirp_start_hex = 0x1554b167, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.993926, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 15, .clk_transition_hex = 0x158ee78e, .chirp_start_hex = 0x16c0bd3b, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.993941, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.993956, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.993978, .detuning = 700.000000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 11, .clk_transition_hex = 0x1d65c765, .chirp_start_hex = 0x1f06d37f, @@ -203,7 +203,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .detuning = 700.000000}; constexpr size_t NUM_POINTS_INTER = 9; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { // inter_dds_params_0, // inter_dds_params_1, inter_dds_params_2, diff --git a/dds_params/declare_ramsey_fringes.h b/dds_params/declare_ramsey_fringes.h index b16f394..0710dc1 100644 --- a/dds_params/declare_ramsey_fringes.h +++ b/dds_params/declare_ramsey_fringes.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t inter_dds_params_0 = { +constexpr DDSConfig::params_t inter_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2547, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t inter_dds_params_0 = { .actual_chirp = 22.989991, .detuning = -0.100000}; -constexpr MiniG::dds_params_t inter_dds_params_1 = { +constexpr DDSConfig::params_t inter_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b261e, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t inter_dds_params_1 = { .actual_chirp = 22.989991, .detuning = -0.090000}; -constexpr MiniG::dds_params_t inter_dds_params_2 = { +constexpr DDSConfig::params_t inter_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b26f5, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t inter_dds_params_2 = { .actual_chirp = 22.989991, .detuning = -0.080000}; -constexpr MiniG::dds_params_t inter_dds_params_3 = { +constexpr DDSConfig::params_t inter_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b27cb, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t inter_dds_params_3 = { .actual_chirp = 22.989991, .detuning = -0.070000}; -constexpr MiniG::dds_params_t inter_dds_params_4 = { +constexpr DDSConfig::params_t inter_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b28a2, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t inter_dds_params_4 = { .actual_chirp = 22.989991, .detuning = -0.060000}; -constexpr MiniG::dds_params_t inter_dds_params_5 = { +constexpr DDSConfig::params_t inter_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2979, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t inter_dds_params_5 = { .actual_chirp = 22.989991, .detuning = -0.050000}; -constexpr MiniG::dds_params_t inter_dds_params_6 = { +constexpr DDSConfig::params_t inter_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2a50, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t inter_dds_params_6 = { .actual_chirp = 22.989991, .detuning = -0.040000}; -constexpr MiniG::dds_params_t inter_dds_params_7 = { +constexpr DDSConfig::params_t inter_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2b26, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t inter_dds_params_7 = { .actual_chirp = 22.989991, .detuning = -0.030000}; -constexpr MiniG::dds_params_t inter_dds_params_8 = { +constexpr DDSConfig::params_t inter_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2bfd, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t inter_dds_params_8 = { .actual_chirp = 22.989991, .detuning = -0.020000}; -constexpr MiniG::dds_params_t inter_dds_params_9 = { +constexpr DDSConfig::params_t inter_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2cd4, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t inter_dds_params_9 = { .actual_chirp = 22.989991, .detuning = -0.010000}; -constexpr MiniG::dds_params_t inter_dds_params_10 = { +constexpr DDSConfig::params_t inter_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2dab, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t inter_dds_params_10 = { .actual_chirp = 22.989991, .detuning = -0.000000}; -constexpr MiniG::dds_params_t inter_dds_params_11 = { +constexpr DDSConfig::params_t inter_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2e81, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t inter_dds_params_11 = { .actual_chirp = 22.989991, .detuning = 0.010000}; -constexpr MiniG::dds_params_t inter_dds_params_12 = { +constexpr DDSConfig::params_t inter_dds_params_12 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b2f58, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t inter_dds_params_12 = { .actual_chirp = 22.989991, .detuning = 0.020000}; -constexpr MiniG::dds_params_t inter_dds_params_13 = { +constexpr DDSConfig::params_t inter_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b302f, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t inter_dds_params_13 = { .actual_chirp = 22.989991, .detuning = 0.030000}; -constexpr MiniG::dds_params_t inter_dds_params_14 = { +constexpr DDSConfig::params_t inter_dds_params_14 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b3106, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t inter_dds_params_14 = { .actual_chirp = 22.989991, .detuning = 0.040000}; -constexpr MiniG::dds_params_t inter_dds_params_15 = { +constexpr DDSConfig::params_t inter_dds_params_15 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b31dc, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t inter_dds_params_15 = { .actual_chirp = 22.989991, .detuning = 0.050000}; -constexpr MiniG::dds_params_t inter_dds_params_16 = { +constexpr DDSConfig::params_t inter_dds_params_16 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b32b3, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t inter_dds_params_16 = { .actual_chirp = 22.989991, .detuning = 0.060000}; -constexpr MiniG::dds_params_t inter_dds_params_17 = { +constexpr DDSConfig::params_t inter_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b338a, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t inter_dds_params_17 = { .actual_chirp = 22.989991, .detuning = 0.070000}; -constexpr MiniG::dds_params_t inter_dds_params_18 = { +constexpr DDSConfig::params_t inter_dds_params_18 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b3461, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t inter_dds_params_18 = { .actual_chirp = 22.989991, .detuning = 0.080000}; -constexpr MiniG::dds_params_t inter_dds_params_19 = { +constexpr DDSConfig::params_t inter_dds_params_19 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b3537, @@ -238,7 +238,7 @@ constexpr MiniG::dds_params_t inter_dds_params_19 = { .actual_chirp = 22.989991, .detuning = 0.090000}; -constexpr MiniG::dds_params_t inter_dds_params_20 = { +constexpr DDSConfig::params_t inter_dds_params_20 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x102b360e, @@ -250,7 +250,7 @@ constexpr MiniG::dds_params_t inter_dds_params_20 = { .actual_chirp = 22.989991, .detuning = 0.100000}; constexpr size_t NUM_POINTS_INTER = 21; -constexpr MiniG::dds_params_t fringes[NUM_POINTS_INTER] = { +constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_dds_params_0, inter_dds_params_1, inter_dds_params_2, inter_dds_params_3, inter_dds_params_4, inter_dds_params_5, inter_dds_params_6, inter_dds_params_7, inter_dds_params_8, diff --git a/dds_params/declare_spectroscopy.h b/dds_params/declare_spectroscopy.h index 37f735c..d94521b 100644 --- a/dds_params/declare_spectroscopy.h +++ b/dds_params/declare_spectroscopy.h @@ -1,4 +1,4 @@ -constexpr MiniG::dds_params_t spec_dds_params_0 = { +constexpr DDSConfig::params_t spec_dds_params_0 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1031bb63, @@ -10,7 +10,7 @@ constexpr MiniG::dds_params_t spec_dds_params_0 = { .actual_chirp = 22.983025, .detuning = 20.000000}; -constexpr MiniG::dds_params_t spec_dds_params_1 = { +constexpr DDSConfig::params_t spec_dds_params_1 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1038491c, @@ -22,7 +22,7 @@ constexpr MiniG::dds_params_t spec_dds_params_1 = { .actual_chirp = 22.983025, .detuning = 40.000000}; -constexpr MiniG::dds_params_t spec_dds_params_2 = { +constexpr DDSConfig::params_t spec_dds_params_2 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x103ed6d5, @@ -34,7 +34,7 @@ constexpr MiniG::dds_params_t spec_dds_params_2 = { .actual_chirp = 22.983025, .detuning = 60.000000}; -constexpr MiniG::dds_params_t spec_dds_params_3 = { +constexpr DDSConfig::params_t spec_dds_params_3 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1045648e, @@ -46,7 +46,7 @@ constexpr MiniG::dds_params_t spec_dds_params_3 = { .actual_chirp = 22.983025, .detuning = 80.000000}; -constexpr MiniG::dds_params_t spec_dds_params_4 = { +constexpr DDSConfig::params_t spec_dds_params_4 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x104bf246, @@ -58,7 +58,7 @@ constexpr MiniG::dds_params_t spec_dds_params_4 = { .actual_chirp = 22.983025, .detuning = 100.000000}; -constexpr MiniG::dds_params_t spec_dds_params_5 = { +constexpr DDSConfig::params_t spec_dds_params_5 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10527fff, @@ -70,7 +70,7 @@ constexpr MiniG::dds_params_t spec_dds_params_5 = { .actual_chirp = 22.983025, .detuning = 120.000000}; -constexpr MiniG::dds_params_t spec_dds_params_6 = { +constexpr DDSConfig::params_t spec_dds_params_6 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10590db8, @@ -82,7 +82,7 @@ constexpr MiniG::dds_params_t spec_dds_params_6 = { .actual_chirp = 22.983025, .detuning = 140.000000}; -constexpr MiniG::dds_params_t spec_dds_params_7 = { +constexpr DDSConfig::params_t spec_dds_params_7 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x105f9b71, @@ -94,7 +94,7 @@ constexpr MiniG::dds_params_t spec_dds_params_7 = { .actual_chirp = 22.983025, .detuning = 160.000000}; -constexpr MiniG::dds_params_t spec_dds_params_8 = { +constexpr DDSConfig::params_t spec_dds_params_8 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10662929, @@ -106,7 +106,7 @@ constexpr MiniG::dds_params_t spec_dds_params_8 = { .actual_chirp = 22.983025, .detuning = 180.000000}; -constexpr MiniG::dds_params_t spec_dds_params_9 = { +constexpr DDSConfig::params_t spec_dds_params_9 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x106cb6e2, @@ -118,7 +118,7 @@ constexpr MiniG::dds_params_t spec_dds_params_9 = { .actual_chirp = 22.983025, .detuning = 200.000000}; -constexpr MiniG::dds_params_t spec_dds_params_10 = { +constexpr DDSConfig::params_t spec_dds_params_10 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1073449b, @@ -130,7 +130,7 @@ constexpr MiniG::dds_params_t spec_dds_params_10 = { .actual_chirp = 22.983025, .detuning = 220.000000}; -constexpr MiniG::dds_params_t spec_dds_params_11 = { +constexpr DDSConfig::params_t spec_dds_params_11 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1079d253, @@ -142,7 +142,7 @@ constexpr MiniG::dds_params_t spec_dds_params_11 = { .actual_chirp = 22.983025, .detuning = 240.000000}; -constexpr MiniG::dds_params_t spec_dds_params_12 = { +constexpr DDSConfig::params_t spec_dds_params_12 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1080600c, @@ -154,7 +154,7 @@ constexpr MiniG::dds_params_t spec_dds_params_12 = { .actual_chirp = 22.983025, .detuning = 260.000000}; -constexpr MiniG::dds_params_t spec_dds_params_13 = { +constexpr DDSConfig::params_t spec_dds_params_13 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1086edc5, @@ -166,7 +166,7 @@ constexpr MiniG::dds_params_t spec_dds_params_13 = { .actual_chirp = 22.983025, .detuning = 280.000000}; -constexpr MiniG::dds_params_t spec_dds_params_14 = { +constexpr DDSConfig::params_t spec_dds_params_14 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x108d7b7e, @@ -178,7 +178,7 @@ constexpr MiniG::dds_params_t spec_dds_params_14 = { .actual_chirp = 22.983025, .detuning = 300.000000}; -constexpr MiniG::dds_params_t spec_dds_params_15 = { +constexpr DDSConfig::params_t spec_dds_params_15 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10940936, @@ -190,7 +190,7 @@ constexpr MiniG::dds_params_t spec_dds_params_15 = { .actual_chirp = 22.983025, .detuning = 320.000000}; -constexpr MiniG::dds_params_t spec_dds_params_16 = { +constexpr DDSConfig::params_t spec_dds_params_16 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x109a96ef, @@ -202,7 +202,7 @@ constexpr MiniG::dds_params_t spec_dds_params_16 = { .actual_chirp = 22.983025, .detuning = 340.000000}; -constexpr MiniG::dds_params_t spec_dds_params_17 = { +constexpr DDSConfig::params_t spec_dds_params_17 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10a124a8, @@ -214,7 +214,7 @@ constexpr MiniG::dds_params_t spec_dds_params_17 = { .actual_chirp = 22.983025, .detuning = 360.000000}; -constexpr MiniG::dds_params_t spec_dds_params_18 = { +constexpr DDSConfig::params_t spec_dds_params_18 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10a7b261, @@ -226,7 +226,7 @@ constexpr MiniG::dds_params_t spec_dds_params_18 = { .actual_chirp = 22.983025, .detuning = 380.000000}; -constexpr MiniG::dds_params_t spec_dds_params_19 = { +constexpr DDSConfig::params_t spec_dds_params_19 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10ae4019, @@ -238,7 +238,7 @@ constexpr MiniG::dds_params_t spec_dds_params_19 = { .actual_chirp = 22.983025, .detuning = 400.000000}; -constexpr MiniG::dds_params_t spec_dds_params_20 = { +constexpr DDSConfig::params_t spec_dds_params_20 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10b4cdd2, @@ -250,7 +250,7 @@ constexpr MiniG::dds_params_t spec_dds_params_20 = { .actual_chirp = 22.983025, .detuning = 420.000000}; -constexpr MiniG::dds_params_t spec_dds_params_21 = { +constexpr DDSConfig::params_t spec_dds_params_21 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10bb5b8b, @@ -262,7 +262,7 @@ constexpr MiniG::dds_params_t spec_dds_params_21 = { .actual_chirp = 22.983025, .detuning = 440.000000}; -constexpr MiniG::dds_params_t spec_dds_params_22 = { +constexpr DDSConfig::params_t spec_dds_params_22 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10c1e943, @@ -274,7 +274,7 @@ constexpr MiniG::dds_params_t spec_dds_params_22 = { .actual_chirp = 22.983025, .detuning = 460.000000}; -constexpr MiniG::dds_params_t spec_dds_params_23 = { +constexpr DDSConfig::params_t spec_dds_params_23 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10c876fc, @@ -286,7 +286,7 @@ constexpr MiniG::dds_params_t spec_dds_params_23 = { .actual_chirp = 22.983025, .detuning = 480.000000}; -constexpr MiniG::dds_params_t spec_dds_params_24 = { +constexpr DDSConfig::params_t spec_dds_params_24 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10cf04b5, @@ -298,7 +298,7 @@ constexpr MiniG::dds_params_t spec_dds_params_24 = { .actual_chirp = 22.983025, .detuning = 500.000000}; -constexpr MiniG::dds_params_t spec_dds_params_25 = { +constexpr DDSConfig::params_t spec_dds_params_25 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10d5926e, @@ -310,7 +310,7 @@ constexpr MiniG::dds_params_t spec_dds_params_25 = { .actual_chirp = 22.983025, .detuning = 520.000000}; -constexpr MiniG::dds_params_t spec_dds_params_26 = { +constexpr DDSConfig::params_t spec_dds_params_26 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10dc2026, @@ -322,7 +322,7 @@ constexpr MiniG::dds_params_t spec_dds_params_26 = { .actual_chirp = 22.983025, .detuning = 540.000000}; -constexpr MiniG::dds_params_t spec_dds_params_27 = { +constexpr DDSConfig::params_t spec_dds_params_27 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10e2addf, @@ -334,7 +334,7 @@ constexpr MiniG::dds_params_t spec_dds_params_27 = { .actual_chirp = 22.983025, .detuning = 560.000000}; -constexpr MiniG::dds_params_t spec_dds_params_28 = { +constexpr DDSConfig::params_t spec_dds_params_28 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10e93b98, @@ -346,7 +346,7 @@ constexpr MiniG::dds_params_t spec_dds_params_28 = { .actual_chirp = 22.983025, .detuning = 580.000000}; -constexpr MiniG::dds_params_t spec_dds_params_29 = { +constexpr DDSConfig::params_t spec_dds_params_29 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10efc951, @@ -358,7 +358,7 @@ constexpr MiniG::dds_params_t spec_dds_params_29 = { .actual_chirp = 22.983025, .detuning = 600.000000}; -constexpr MiniG::dds_params_t spec_dds_params_30 = { +constexpr DDSConfig::params_t spec_dds_params_30 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10f65709, @@ -370,7 +370,7 @@ constexpr MiniG::dds_params_t spec_dds_params_30 = { .actual_chirp = 22.983025, .detuning = 620.000000}; -constexpr MiniG::dds_params_t spec_dds_params_31 = { +constexpr DDSConfig::params_t spec_dds_params_31 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x10fce4c2, @@ -382,7 +382,7 @@ constexpr MiniG::dds_params_t spec_dds_params_31 = { .actual_chirp = 22.983025, .detuning = 640.000000}; -constexpr MiniG::dds_params_t spec_dds_params_32 = { +constexpr DDSConfig::params_t spec_dds_params_32 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1103727b, @@ -394,7 +394,7 @@ constexpr MiniG::dds_params_t spec_dds_params_32 = { .actual_chirp = 22.983025, .detuning = 660.000000}; -constexpr MiniG::dds_params_t spec_dds_params_33 = { +constexpr DDSConfig::params_t spec_dds_params_33 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x110a0034, @@ -406,7 +406,7 @@ constexpr MiniG::dds_params_t spec_dds_params_33 = { .actual_chirp = 22.983025, .detuning = 680.000000}; -constexpr MiniG::dds_params_t spec_dds_params_34 = { +constexpr DDSConfig::params_t spec_dds_params_34 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11108dec, @@ -418,7 +418,7 @@ constexpr MiniG::dds_params_t spec_dds_params_34 = { .actual_chirp = 22.983025, .detuning = 700.000000}; -constexpr MiniG::dds_params_t spec_dds_params_35 = { +constexpr DDSConfig::params_t spec_dds_params_35 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11171ba5, @@ -430,7 +430,7 @@ constexpr MiniG::dds_params_t spec_dds_params_35 = { .actual_chirp = 22.983025, .detuning = 720.000000}; -constexpr MiniG::dds_params_t spec_dds_params_36 = { +constexpr DDSConfig::params_t spec_dds_params_36 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x111da95e, @@ -442,7 +442,7 @@ constexpr MiniG::dds_params_t spec_dds_params_36 = { .actual_chirp = 22.983025, .detuning = 740.000000}; -constexpr MiniG::dds_params_t spec_dds_params_37 = { +constexpr DDSConfig::params_t spec_dds_params_37 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11243716, @@ -454,7 +454,7 @@ constexpr MiniG::dds_params_t spec_dds_params_37 = { .actual_chirp = 22.983025, .detuning = 760.000000}; -constexpr MiniG::dds_params_t spec_dds_params_38 = { +constexpr DDSConfig::params_t spec_dds_params_38 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x112ac4cf, @@ -466,7 +466,7 @@ constexpr MiniG::dds_params_t spec_dds_params_38 = { .actual_chirp = 22.983025, .detuning = 780.000000}; -constexpr MiniG::dds_params_t spec_dds_params_39 = { +constexpr DDSConfig::params_t spec_dds_params_39 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11315288, @@ -478,7 +478,7 @@ constexpr MiniG::dds_params_t spec_dds_params_39 = { .actual_chirp = 22.983025, .detuning = 800.000000}; -constexpr MiniG::dds_params_t spec_dds_params_40 = { +constexpr DDSConfig::params_t spec_dds_params_40 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1137e041, @@ -490,7 +490,7 @@ constexpr MiniG::dds_params_t spec_dds_params_40 = { .actual_chirp = 22.983025, .detuning = 820.000000}; -constexpr MiniG::dds_params_t spec_dds_params_41 = { +constexpr DDSConfig::params_t spec_dds_params_41 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x113e6df9, @@ -502,7 +502,7 @@ constexpr MiniG::dds_params_t spec_dds_params_41 = { .actual_chirp = 22.983025, .detuning = 840.000000}; -constexpr MiniG::dds_params_t spec_dds_params_42 = { +constexpr DDSConfig::params_t spec_dds_params_42 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1144fbb2, @@ -514,7 +514,7 @@ constexpr MiniG::dds_params_t spec_dds_params_42 = { .actual_chirp = 22.983025, .detuning = 860.000000}; -constexpr MiniG::dds_params_t spec_dds_params_43 = { +constexpr DDSConfig::params_t spec_dds_params_43 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x114b896b, @@ -526,7 +526,7 @@ constexpr MiniG::dds_params_t spec_dds_params_43 = { .actual_chirp = 22.983025, .detuning = 880.000000}; -constexpr MiniG::dds_params_t spec_dds_params_44 = { +constexpr DDSConfig::params_t spec_dds_params_44 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11521724, @@ -538,7 +538,7 @@ constexpr MiniG::dds_params_t spec_dds_params_44 = { .actual_chirp = 22.983025, .detuning = 900.000000}; -constexpr MiniG::dds_params_t spec_dds_params_45 = { +constexpr DDSConfig::params_t spec_dds_params_45 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1158a4dc, @@ -550,7 +550,7 @@ constexpr MiniG::dds_params_t spec_dds_params_45 = { .actual_chirp = 22.983025, .detuning = 920.000000}; -constexpr MiniG::dds_params_t spec_dds_params_46 = { +constexpr DDSConfig::params_t spec_dds_params_46 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x115f3295, @@ -562,7 +562,7 @@ constexpr MiniG::dds_params_t spec_dds_params_46 = { .actual_chirp = 22.983025, .detuning = 940.000000}; -constexpr MiniG::dds_params_t spec_dds_params_47 = { +constexpr DDSConfig::params_t spec_dds_params_47 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1165c04e, @@ -574,7 +574,7 @@ constexpr MiniG::dds_params_t spec_dds_params_47 = { .actual_chirp = 22.983025, .detuning = 960.000000}; -constexpr MiniG::dds_params_t spec_dds_params_48 = { +constexpr DDSConfig::params_t spec_dds_params_48 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x116c4e06, @@ -586,7 +586,7 @@ constexpr MiniG::dds_params_t spec_dds_params_48 = { .actual_chirp = 22.983025, .detuning = 980.000000}; -constexpr MiniG::dds_params_t spec_dds_params_49 = { +constexpr DDSConfig::params_t spec_dds_params_49 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1172dbbf, @@ -598,7 +598,7 @@ constexpr MiniG::dds_params_t spec_dds_params_49 = { .actual_chirp = 22.983025, .detuning = 1000.000000}; -constexpr MiniG::dds_params_t spec_dds_params_50 = { +constexpr DDSConfig::params_t spec_dds_params_50 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x11796978, @@ -610,7 +610,7 @@ constexpr MiniG::dds_params_t spec_dds_params_50 = { .actual_chirp = 22.983025, .detuning = 1020.000000}; -constexpr MiniG::dds_params_t spec_dds_params_51 = { +constexpr DDSConfig::params_t spec_dds_params_51 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x117ff731, @@ -622,7 +622,7 @@ constexpr MiniG::dds_params_t spec_dds_params_51 = { .actual_chirp = 22.983025, .detuning = 1040.000000}; -constexpr MiniG::dds_params_t spec_dds_params_52 = { +constexpr DDSConfig::params_t spec_dds_params_52 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x118684e9, @@ -634,7 +634,7 @@ constexpr MiniG::dds_params_t spec_dds_params_52 = { .actual_chirp = 22.983025, .detuning = 1060.000000}; -constexpr MiniG::dds_params_t spec_dds_params_53 = { +constexpr DDSConfig::params_t spec_dds_params_53 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x118d12a2, @@ -646,7 +646,7 @@ constexpr MiniG::dds_params_t spec_dds_params_53 = { .actual_chirp = 22.983025, .detuning = 1080.000000}; -constexpr MiniG::dds_params_t spec_dds_params_54 = { +constexpr DDSConfig::params_t spec_dds_params_54 = { .mult = 20, .clk_transition_hex = 0x102b2dab, .chirp_start_hex = 0x1193a05b, @@ -658,7 +658,7 @@ constexpr MiniG::dds_params_t spec_dds_params_54 = { .actual_chirp = 22.983025, .detuning = 1100.000000}; constexpr size_t NUM_POINTS_SPEC = 55; -constexpr MiniG::dds_params_t specs[NUM_POINTS_SPEC] = { +constexpr DDSConfig::params_t specs[NUM_POINTS_SPEC] = { spec_dds_params_0, spec_dds_params_1, spec_dds_params_2, spec_dds_params_3, spec_dds_params_4, spec_dds_params_5, spec_dds_params_6, spec_dds_params_7, spec_dds_params_8, diff --git a/dds_params/k_down.h b/dds_params/k_down.h new file mode 100644 index 0000000..0987198 --- /dev/null +++ b/dds_params/k_down.h @@ -0,0 +1,280 @@ +constexpr DDSConfig::params_t inter_params_0 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cdbcb, //5683683.12 + .mw_time_hex = 0xff, + .mw_freq_hex = 0x5746, //520.19 + .chirp_time_hex = 0xff, + .chirp_freq_hex = 0x2759, //234.53 + .actual_chirp = -22.993167, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_1 = { + .mult = 12, + .clk_transition_hex = 0x1af2a172, //12631769.98 + .chirp_start_hex = 0x19dc1a47, //12121769.98 + .chirp_stop_hex = 0xc200c3e, //5683681.31 + .mw_time_hex = 0xd5, + .mw_freq_hex = 0x32a0, //362.10 + .chirp_time_hex = 0xd5, + .chirp_freq_hex = 0x16d3, //163.25 + .actual_chirp = -22.993174, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_2 = { + .mult = 16, + .clk_transition_hex = 0x1435f916, //12631770.00 + .chirp_start_hex = 0x136513b5, //12121769.97 + .chirp_stop_hex = 0x91808ed, //5683678.87 + .mw_time_hex = 0x97, + .mw_freq_hex = 0x1430, //192.52 + .chirp_time_hex = 0x97, + .chirp_freq_hex = 0x91a, //86.80 + .actual_chirp = -22.993183, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_3 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cda80, //5683675.41 + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x5538, //507.94 + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x266c, //229.01 + .actual_chirp = -22.993195, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_4 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cda0f, //5683672.78 + .mw_time_hex = 0xf7, + .mw_freq_hex = 0x5489, //503.87 + .chirp_time_hex = 0xf7, + .chirp_freq_hex = 0x261d, //227.17 + .actual_chirp = -22.993204, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_5 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd99b, //5683670.08 + .mw_time_hex = 0xf5, + .mw_freq_hex = 0x53da, //499.79 + .chirp_time_hex = 0xf5, + .chirp_freq_hex = 0x25ce, //225.33 + .actual_chirp = -22.993214, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_6 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd925, //5683667.33 + .mw_time_hex = 0xf3, + .mw_freq_hex = 0x532b, //495.72 + .chirp_time_hex = 0xf3, + .chirp_freq_hex = 0x257f, //223.49 + .actual_chirp = -22.993224, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_7 = { + .mult = 11, + .clk_transition_hex = 0x1d65c765, //12631769.98 + .chirp_start_hex = 0x1c35ee1f, //12121769.98 + .chirp_stop_hex = 0xd3a3962, //5683664.81 + .mw_time_hex = 0xf6, + .mw_freq_hex = 0x4595, //456.22 + .chirp_time_hex = 0xf6, + .chirp_freq_hex = 0x1f5f, //205.68 + .actual_chirp = -22.993233, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_8 = { + .mult = 13, + .clk_transition_hex = 0x18dff77d, //12631769.98 + .chirp_start_hex = 0x17dedd2e, //12121769.99 + .chirp_stop_hex = 0xb3143f7, //5683662.62 + .mw_time_hex = 0xfe, + .mw_freq_hex = 0x3370, //398.57 + .chirp_time_hex = 0xfe, + .chirp_freq_hex = 0x1731, //179.70 + .actual_chirp = -22.993241, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_9 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd7b9, //5683658.85 + .mw_time_hex = 0xed, + .mw_freq_hex = 0x511d, //483.47 + .chirp_time_hex = 0xed, + .chirp_freq_hex = 0x2492, //217.98 + .actual_chirp = -22.993254, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_10 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd73b, //5683655.92 + .mw_time_hex = 0xeb, + .mw_freq_hex = 0x506e, //479.40 + .chirp_time_hex = 0xeb, + .chirp_freq_hex = 0x2443, //216.14 + .actual_chirp = -22.993265, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_11 = { + .mult = 13, + .clk_transition_hex = 0x18dff77d, //12631769.98 + .chirp_start_hex = 0x17dedd2e, //12121769.99 + .chirp_stop_hex = 0xb3142e5, //5683654.33 + .mw_time_hex = 0x83, + .mw_freq_hex = 0x1a87, //205.55 + .chirp_time_hex = 0x83, + .chirp_freq_hex = 0xbf6, //92.68 + .actual_chirp = -22.993270, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_12 = { + .mult = 11, + .clk_transition_hex = 0x1d65c765, //12631769.98 + .chirp_start_hex = 0x1c35ee1f, //12121769.98 + .chirp_stop_hex = 0xd3a375b, //5683651.51 + .mw_time_hex = 0xb5, + .mw_freq_hex = 0x3332, //335.66 + .chirp_time_hex = 0xb5, + .chirp_freq_hex = 0x1715, //151.34 + .actual_chirp = -22.993280, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_13 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd639, //5683649.91 + .mw_time_hex = 0xe7, + .mw_freq_hex = 0x4f0f, //471.23 + .chirp_time_hex = 0xe7, + .chirp_freq_hex = 0x23a5, //212.46 + .actual_chirp = -22.993286, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_14 = { + .mult = 15, + .clk_transition_hex = 0x158ee78e, //12631769.97 + .chirp_start_hex = 0x14b01506, //12121770.00 + .chirp_stop_hex = 0x9b3394f, //5683648.37 + .mw_time_hex = 0xe6, + .mw_freq_hex = 0x22fc, //312.78 + .chirp_time_hex = 0xe6, + .chirp_freq_hex = 0xfc6, //141.03 + .actual_chirp = -22.993291, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_15 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd5b5, //5683646.84 + .mw_time_hex = 0xe5, + .mw_freq_hex = 0x4e60, //467.15 + .chirp_time_hex = 0xe5, + .chirp_freq_hex = 0x2356, //210.62 + .actual_chirp = -22.993297, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_16 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd52e, //5683643.70 + .mw_time_hex = 0xe3, + .mw_freq_hex = 0x4db1, //463.08 + .chirp_time_hex = 0xe3, + .chirp_freq_hex = 0x2307, //208.78 + .actual_chirp = -22.993308, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_17 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd4a5, //5683640.51 + .mw_time_hex = 0xe1, + .mw_freq_hex = 0x4d01, //458.98 + .chirp_time_hex = 0xe1, + .chirp_freq_hex = 0x22b8, //206.94 + .actual_chirp = -22.993320, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_18 = { + .mult = 10, + .clk_transition_hex = 0x20565b56, //12631769.99 + .chirp_start_hex = 0x1f081f89, //12121770.00 + .chirp_stop_hex = 0xe8cd41a, //5683637.27 + .mw_time_hex = 0xdf, + .mw_freq_hex = 0x4c52, //454.90 + .chirp_time_hex = 0xdf, + .chirp_freq_hex = 0x2269, //205.10 + .actual_chirp = -22.993331, + .detuning = -510.00 +}; + + +constexpr DDSConfig::params_t inter_params_19 = { + .mult = 18, + .clk_transition_hex = 0x11f7164c, //12631769.98 + .chirp_start_hex = 0x113d66da, //12121769.98 + .chirp_stop_hex = 0x815593e, //5683635.69 + .mw_time_hex = 0x97, + .mw_freq_hex = 0xff3, //171.12 + .chirp_time_hex = 0x97, + .chirp_freq_hex = 0x731, //77.16 + .actual_chirp = -22.993337, + .detuning = -510.00 +}; + +constexpr size_t NUM_POINTS_INTER = 20; constexpr DDSConfig::params_t fringes[NUM_POINTS_INTER] = { inter_params_0, inter_params_1, inter_params_2, inter_params_3, inter_params_4, inter_params_5, inter_params_6, inter_params_7, inter_params_8, inter_params_9, inter_params_10, inter_params_11, inter_params_12, inter_params_13, inter_params_14, inter_params_15, inter_params_16, inter_params_17, inter_params_18, inter_params_19, }; diff --git a/dds_params/k_down_spec.h b/dds_params/k_down_spec.h new file mode 100644 index 0000000..4a248ef --- /dev/null +++ b/dds_params/k_down_spec.h @@ -0,0 +1,1400 @@ +// chirp_start: 12621770.00, chirp_stop: 6665419.80 +constexpr DDSConfig::params_t spec_params_0 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x1027e6ce, + .chirp_stop_hex = 0x8881ff0, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x6a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -10.00 +}; + +// chirp_start: 12611770.00, chirp_stop: 6655419.80 +constexpr DDSConfig::params_t spec_params_1 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x10249ff2, + .chirp_stop_hex = 0x884d913, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xd5, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -20.00 +}; + +// chirp_start: 12601770.00, chirp_stop: 6645419.80 +constexpr DDSConfig::params_t spec_params_2 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x10215916, + .chirp_stop_hex = 0x8819237, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x140, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -30.00 +}; + +// chirp_start: 12591770.00, chirp_stop: 6635419.80 +constexpr DDSConfig::params_t spec_params_3 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x101e1239, + .chirp_stop_hex = 0x87e4b5b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1ab, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -40.00 +}; + +// chirp_start: 12581770.00, chirp_stop: 6625419.80 +constexpr DDSConfig::params_t spec_params_4 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x101acb5d, + .chirp_stop_hex = 0x87b047e, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x216, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -50.00 +}; + +// chirp_start: 12571770.00, chirp_stop: 6615419.80 +constexpr DDSConfig::params_t spec_params_5 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x10178481, + .chirp_stop_hex = 0x877bda2, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x281, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -60.00 +}; + +// chirp_start: 12561770.00, chirp_stop: 6605419.80 +constexpr DDSConfig::params_t spec_params_6 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x10143da4, + .chirp_stop_hex = 0x87476c6, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2ec, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -70.00 +}; + +// chirp_start: 12551770.00, chirp_stop: 6595419.80 +constexpr DDSConfig::params_t spec_params_7 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x1010f6c8, + .chirp_stop_hex = 0x8712fe9, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x357, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -80.00 +}; + +// chirp_start: 12541770.00, chirp_stop: 6585419.80 +constexpr DDSConfig::params_t spec_params_8 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x100dafeb, + .chirp_stop_hex = 0x86de90d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x3c2, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -90.00 +}; + +// chirp_start: 12531770.00, chirp_stop: 6575419.80 +constexpr DDSConfig::params_t spec_params_9 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x100a690f, + .chirp_stop_hex = 0x86aa230, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x42d, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -100.00 +}; + +// chirp_start: 12521770.00, chirp_stop: 6565419.80 +constexpr DDSConfig::params_t spec_params_10 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x10072233, + .chirp_stop_hex = 0x8675b54, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x498, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -110.00 +}; + +// chirp_start: 12511770.00, chirp_stop: 6555419.80 +constexpr DDSConfig::params_t spec_params_11 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x1003db56, + .chirp_stop_hex = 0x8641478, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x503, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -120.00 +}; + +// chirp_start: 12501770.00, chirp_stop: 6545419.80 +constexpr DDSConfig::params_t spec_params_12 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0x1000947a, + .chirp_stop_hex = 0x860cd9b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x56e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -130.00 +}; + +// chirp_start: 12491770.00, chirp_stop: 6535419.80 +constexpr DDSConfig::params_t spec_params_13 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xffd4d9e, + .chirp_stop_hex = 0x85d86bf, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x5d9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -140.00 +}; + +// chirp_start: 12481770.00, chirp_stop: 6525419.80 +constexpr DDSConfig::params_t spec_params_14 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xffa06c1, + .chirp_stop_hex = 0x85a3fe3, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x644, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -150.00 +}; + +// chirp_start: 12471770.00, chirp_stop: 6515419.80 +constexpr DDSConfig::params_t spec_params_15 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xff6bfe5, + .chirp_stop_hex = 0x856f906, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x6af, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -160.00 +}; + +// chirp_start: 12461770.00, chirp_stop: 6505419.80 +constexpr DDSConfig::params_t spec_params_16 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xff37909, + .chirp_stop_hex = 0x853b22a, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x71a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -170.00 +}; + +// chirp_start: 12451770.00, chirp_stop: 6495419.80 +constexpr DDSConfig::params_t spec_params_17 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xff0322c, + .chirp_stop_hex = 0x8506b4e, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x785, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -180.00 +}; + +// chirp_start: 12441770.00, chirp_stop: 6485419.80 +constexpr DDSConfig::params_t spec_params_18 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfeceb50, + .chirp_stop_hex = 0x84d2471, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x7ef, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -190.00 +}; + +// chirp_start: 12431770.00, chirp_stop: 6475419.80 +constexpr DDSConfig::params_t spec_params_19 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfe9a473, + .chirp_stop_hex = 0x849dd95, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x85a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -200.00 +}; + +// chirp_start: 12421770.00, chirp_stop: 6465419.80 +constexpr DDSConfig::params_t spec_params_20 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfe65d97, + .chirp_stop_hex = 0x84696b8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x8c5, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -210.00 +}; + +// chirp_start: 12411770.00, chirp_stop: 6455419.80 +constexpr DDSConfig::params_t spec_params_21 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfe316bb, + .chirp_stop_hex = 0x8434fdc, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x930, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -220.00 +}; + +// chirp_start: 12401770.00, chirp_stop: 6445419.80 +constexpr DDSConfig::params_t spec_params_22 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfdfcfde, + .chirp_stop_hex = 0x8400900, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x99b, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -230.00 +}; + +// chirp_start: 12391770.00, chirp_stop: 6435419.80 +constexpr DDSConfig::params_t spec_params_23 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfdc8902, + .chirp_stop_hex = 0x83cc223, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xa06, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -240.00 +}; + +// chirp_start: 12381770.00, chirp_stop: 6425419.80 +constexpr DDSConfig::params_t spec_params_24 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfd94226, + .chirp_stop_hex = 0x8397b47, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xa71, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -250.00 +}; + +// chirp_start: 12371770.00, chirp_stop: 6415419.80 +constexpr DDSConfig::params_t spec_params_25 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfd5fb49, + .chirp_stop_hex = 0x836346b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xadc, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -260.00 +}; + +// chirp_start: 12361770.00, chirp_stop: 6405419.80 +constexpr DDSConfig::params_t spec_params_26 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfd2b46d, + .chirp_stop_hex = 0x832ed8e, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xb47, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -270.00 +}; + +// chirp_start: 12351770.00, chirp_stop: 6395419.80 +constexpr DDSConfig::params_t spec_params_27 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfcf6d90, + .chirp_stop_hex = 0x82fa6b2, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xbb2, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -280.00 +}; + +// chirp_start: 12341770.00, chirp_stop: 6385419.80 +constexpr DDSConfig::params_t spec_params_28 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfcc26b4, + .chirp_stop_hex = 0x82c5fd6, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xc1d, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -290.00 +}; + +// chirp_start: 12331770.00, chirp_stop: 6375419.80 +constexpr DDSConfig::params_t spec_params_29 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfc8dfd8, + .chirp_stop_hex = 0x82918f9, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xc88, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -300.00 +}; + +// chirp_start: 12321770.00, chirp_stop: 6365419.80 +constexpr DDSConfig::params_t spec_params_30 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfc598fb, + .chirp_stop_hex = 0x825d21d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xcf3, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -310.00 +}; + +// chirp_start: 12311770.00, chirp_stop: 6355419.80 +constexpr DDSConfig::params_t spec_params_31 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfc2521f, + .chirp_stop_hex = 0x8228b40, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xd5e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -320.00 +}; + +// chirp_start: 12301770.00, chirp_stop: 6345419.80 +constexpr DDSConfig::params_t spec_params_32 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfbf0b43, + .chirp_stop_hex = 0x81f4464, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xdc9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -330.00 +}; + +// chirp_start: 12291770.00, chirp_stop: 6335419.80 +constexpr DDSConfig::params_t spec_params_33 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfbbc466, + .chirp_stop_hex = 0x81bfd88, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xe34, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -340.00 +}; + +// chirp_start: 12281770.00, chirp_stop: 6325419.80 +constexpr DDSConfig::params_t spec_params_34 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfb87d8a, + .chirp_stop_hex = 0x818b6ab, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xe9f, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -350.00 +}; + +// chirp_start: 12271770.00, chirp_stop: 6315419.80 +constexpr DDSConfig::params_t spec_params_35 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfb536ae, + .chirp_stop_hex = 0x8156fcf, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xf0a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -360.00 +}; + +// chirp_start: 12261770.00, chirp_stop: 6305419.80 +constexpr DDSConfig::params_t spec_params_36 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfb1efd1, + .chirp_stop_hex = 0x81228f3, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xf74, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -370.00 +}; + +// chirp_start: 12251770.00, chirp_stop: 6295419.80 +constexpr DDSConfig::params_t spec_params_37 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfaea8f5, + .chirp_stop_hex = 0x80ee216, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0xfdf, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -380.00 +}; + +// chirp_start: 12241770.00, chirp_stop: 6285419.80 +constexpr DDSConfig::params_t spec_params_38 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfab6218, + .chirp_stop_hex = 0x80b9b3a, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x104a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -390.00 +}; + +// chirp_start: 12231770.00, chirp_stop: 6275419.80 +constexpr DDSConfig::params_t spec_params_39 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfa81b3c, + .chirp_stop_hex = 0x808545e, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x10b5, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -400.00 +}; + +// chirp_start: 12221770.00, chirp_stop: 6265419.80 +constexpr DDSConfig::params_t spec_params_40 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfa4d460, + .chirp_stop_hex = 0x8050d81, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1120, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -410.00 +}; + +// chirp_start: 12211770.00, chirp_stop: 6255419.80 +constexpr DDSConfig::params_t spec_params_41 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xfa18d83, + .chirp_stop_hex = 0x801c6a5, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x118b, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -420.00 +}; + +// chirp_start: 12201770.00, chirp_stop: 6245419.80 +constexpr DDSConfig::params_t spec_params_42 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf9e46a7, + .chirp_stop_hex = 0x7fe7fc8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x11f6, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -430.00 +}; + +// chirp_start: 12191770.00, chirp_stop: 6235419.80 +constexpr DDSConfig::params_t spec_params_43 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf9affcb, + .chirp_stop_hex = 0x7fb38ec, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1261, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -440.00 +}; + +// chirp_start: 12181770.00, chirp_stop: 6225419.80 +constexpr DDSConfig::params_t spec_params_44 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf97b8ee, + .chirp_stop_hex = 0x7f7f210, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x12cc, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -450.00 +}; + +// chirp_start: 12171770.00, chirp_stop: 6215419.80 +constexpr DDSConfig::params_t spec_params_45 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf947212, + .chirp_stop_hex = 0x7f4ab33, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1337, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -460.00 +}; + +// chirp_start: 12161770.00, chirp_stop: 6205419.80 +constexpr DDSConfig::params_t spec_params_46 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf912b36, + .chirp_stop_hex = 0x7f16457, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x13a2, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -470.00 +}; + +// chirp_start: 12151770.00, chirp_stop: 6195419.80 +constexpr DDSConfig::params_t spec_params_47 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf8de459, + .chirp_stop_hex = 0x7ee1d7b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x140d, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -480.00 +}; + +// chirp_start: 12141770.00, chirp_stop: 6185419.80 +constexpr DDSConfig::params_t spec_params_48 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf8a9d7d, + .chirp_stop_hex = 0x7ead69e, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1478, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -490.00 +}; + +// chirp_start: 12131770.00, chirp_stop: 6175419.80 +constexpr DDSConfig::params_t spec_params_49 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf8756a0, + .chirp_stop_hex = 0x7e78fc2, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x14e3, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -500.00 +}; + +// chirp_start: 12121770.00, chirp_stop: 6165419.80 +constexpr DDSConfig::params_t spec_params_50 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf840fc4, + .chirp_stop_hex = 0x7e448e6, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x154e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -510.00 +}; + +// chirp_start: 12111770.00, chirp_stop: 6155419.80 +constexpr DDSConfig::params_t spec_params_51 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf80c8e8, + .chirp_stop_hex = 0x7e10209, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x15b9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -520.00 +}; + +// chirp_start: 12101770.00, chirp_stop: 6145419.80 +constexpr DDSConfig::params_t spec_params_52 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf7d820b, + .chirp_stop_hex = 0x7ddbb2d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1624, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -530.00 +}; + +// chirp_start: 12091770.00, chirp_stop: 6135419.80 +constexpr DDSConfig::params_t spec_params_53 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf7a3b2f, + .chirp_stop_hex = 0x7da7450, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x168f, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -540.00 +}; + +// chirp_start: 12081770.00, chirp_stop: 6125419.80 +constexpr DDSConfig::params_t spec_params_54 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf76f453, + .chirp_stop_hex = 0x7d72d74, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x16f9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -550.00 +}; + +// chirp_start: 12071770.00, chirp_stop: 6115419.80 +constexpr DDSConfig::params_t spec_params_55 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf73ad76, + .chirp_stop_hex = 0x7d3e698, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1764, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -560.00 +}; + +// chirp_start: 12061770.00, chirp_stop: 6105419.80 +constexpr DDSConfig::params_t spec_params_56 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf70669a, + .chirp_stop_hex = 0x7d09fbb, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x17cf, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -570.00 +}; + +// chirp_start: 12051770.00, chirp_stop: 6095419.80 +constexpr DDSConfig::params_t spec_params_57 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf6d1fbe, + .chirp_stop_hex = 0x7cd58df, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x183a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -580.00 +}; + +// chirp_start: 12041770.00, chirp_stop: 6085419.80 +constexpr DDSConfig::params_t spec_params_58 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf69d8e1, + .chirp_stop_hex = 0x7ca1203, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x18a5, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -590.00 +}; + +// chirp_start: 12031770.00, chirp_stop: 6075419.80 +constexpr DDSConfig::params_t spec_params_59 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf669205, + .chirp_stop_hex = 0x7c6cb26, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1910, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -600.00 +}; + +// chirp_start: 12021770.00, chirp_stop: 6065419.80 +constexpr DDSConfig::params_t spec_params_60 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf634b28, + .chirp_stop_hex = 0x7c3844a, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x197b, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -610.00 +}; + +// chirp_start: 12011770.00, chirp_stop: 6055419.80 +constexpr DDSConfig::params_t spec_params_61 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf60044c, + .chirp_stop_hex = 0x7c03d6d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x19e6, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -620.00 +}; + +// chirp_start: 12001770.00, chirp_stop: 6045419.80 +constexpr DDSConfig::params_t spec_params_62 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf5cbd70, + .chirp_stop_hex = 0x7bcf691, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1a51, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -630.00 +}; + +// chirp_start: 11991770.00, chirp_stop: 6035419.80 +constexpr DDSConfig::params_t spec_params_63 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf597693, + .chirp_stop_hex = 0x7b9afb5, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1abc, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -640.00 +}; + +// chirp_start: 11981770.00, chirp_stop: 6025419.80 +constexpr DDSConfig::params_t spec_params_64 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf562fb7, + .chirp_stop_hex = 0x7b668d8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1b27, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -650.00 +}; + +// chirp_start: 11971770.00, chirp_stop: 6015419.80 +constexpr DDSConfig::params_t spec_params_65 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf52e8db, + .chirp_stop_hex = 0x7b321fc, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1b92, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -660.00 +}; + +// chirp_start: 11961770.00, chirp_stop: 6005419.80 +constexpr DDSConfig::params_t spec_params_66 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf4fa1fe, + .chirp_stop_hex = 0x7afdb20, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1bfd, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -670.00 +}; + +// chirp_start: 11951770.00, chirp_stop: 5995419.80 +constexpr DDSConfig::params_t spec_params_67 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf4c5b22, + .chirp_stop_hex = 0x7ac9443, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1c68, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -680.00 +}; + +// chirp_start: 11941770.00, chirp_stop: 5985419.80 +constexpr DDSConfig::params_t spec_params_68 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf491446, + .chirp_stop_hex = 0x7a94d67, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1cd3, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -690.00 +}; + +// chirp_start: 11931770.00, chirp_stop: 5975419.80 +constexpr DDSConfig::params_t spec_params_69 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf45cd69, + .chirp_stop_hex = 0x7a6068b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1d3e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -700.00 +}; + +// chirp_start: 11921770.00, chirp_stop: 5965419.80 +constexpr DDSConfig::params_t spec_params_70 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf42868d, + .chirp_stop_hex = 0x7a2bfae, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1da9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -710.00 +}; + +// chirp_start: 11911770.00, chirp_stop: 5955419.80 +constexpr DDSConfig::params_t spec_params_71 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf3f3fb0, + .chirp_stop_hex = 0x79f78d2, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1e14, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -720.00 +}; + +// chirp_start: 11901770.00, chirp_stop: 5945419.80 +constexpr DDSConfig::params_t spec_params_72 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf3bf8d4, + .chirp_stop_hex = 0x79c31f5, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1e7e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -730.00 +}; + +// chirp_start: 11891770.00, chirp_stop: 5935419.80 +constexpr DDSConfig::params_t spec_params_73 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf38b1f8, + .chirp_stop_hex = 0x798eb19, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1ee9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -740.00 +}; + +// chirp_start: 11881770.00, chirp_stop: 5925419.80 +constexpr DDSConfig::params_t spec_params_74 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf356b1b, + .chirp_stop_hex = 0x795a43d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1f54, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -750.00 +}; + +// chirp_start: 11871770.00, chirp_stop: 5915419.80 +constexpr DDSConfig::params_t spec_params_75 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf32243f, + .chirp_stop_hex = 0x7925d60, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x1fbf, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -760.00 +}; + +// chirp_start: 11861770.00, chirp_stop: 5905419.80 +constexpr DDSConfig::params_t spec_params_76 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf2edd63, + .chirp_stop_hex = 0x78f1684, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x202a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -770.00 +}; + +// chirp_start: 11851770.00, chirp_stop: 5895419.80 +constexpr DDSConfig::params_t spec_params_77 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf2b9686, + .chirp_stop_hex = 0x78bcfa8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2095, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -780.00 +}; + +// chirp_start: 11841770.00, chirp_stop: 5885419.80 +constexpr DDSConfig::params_t spec_params_78 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf284faa, + .chirp_stop_hex = 0x78888cb, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2100, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -790.00 +}; + +// chirp_start: 11831770.00, chirp_stop: 5875419.80 +constexpr DDSConfig::params_t spec_params_79 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf2508ce, + .chirp_stop_hex = 0x78541ef, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x216b, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -800.00 +}; + +// chirp_start: 11821770.00, chirp_stop: 5865419.80 +constexpr DDSConfig::params_t spec_params_80 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf21c1f1, + .chirp_stop_hex = 0x781fb13, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x21d6, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -810.00 +}; + +// chirp_start: 11811770.00, chirp_stop: 5855419.80 +constexpr DDSConfig::params_t spec_params_81 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf1e7b15, + .chirp_stop_hex = 0x77eb436, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2241, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -820.00 +}; + +// chirp_start: 11801770.00, chirp_stop: 5845419.80 +constexpr DDSConfig::params_t spec_params_82 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf1b3438, + .chirp_stop_hex = 0x77b6d5a, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x22ac, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -830.00 +}; + +// chirp_start: 11791770.00, chirp_stop: 5835419.80 +constexpr DDSConfig::params_t spec_params_83 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf17ed5c, + .chirp_stop_hex = 0x778267d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2317, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -840.00 +}; + +// chirp_start: 11781770.00, chirp_stop: 5825419.80 +constexpr DDSConfig::params_t spec_params_84 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf14a680, + .chirp_stop_hex = 0x774dfa1, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2382, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -850.00 +}; + +// chirp_start: 11771770.00, chirp_stop: 5815419.80 +constexpr DDSConfig::params_t spec_params_85 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf115fa3, + .chirp_stop_hex = 0x77198c5, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x23ed, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -860.00 +}; + +// chirp_start: 11761770.00, chirp_stop: 5805419.80 +constexpr DDSConfig::params_t spec_params_86 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf0e18c7, + .chirp_stop_hex = 0x76e51e8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2458, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -870.00 +}; + +// chirp_start: 11751770.00, chirp_stop: 5795419.80 +constexpr DDSConfig::params_t spec_params_87 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf0ad1eb, + .chirp_stop_hex = 0x76b0b0c, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x24c3, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -880.00 +}; + +// chirp_start: 11741770.00, chirp_stop: 5785419.80 +constexpr DDSConfig::params_t spec_params_88 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf078b0e, + .chirp_stop_hex = 0x767c430, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x252e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -890.00 +}; + +// chirp_start: 11731770.00, chirp_stop: 5775419.80 +constexpr DDSConfig::params_t spec_params_89 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf044432, + .chirp_stop_hex = 0x7647d53, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2599, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -900.00 +}; + +// chirp_start: 11721770.00, chirp_stop: 5765419.80 +constexpr DDSConfig::params_t spec_params_90 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xf00fd56, + .chirp_stop_hex = 0x7613677, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2603, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -910.00 +}; + +// chirp_start: 11711770.00, chirp_stop: 5755419.80 +constexpr DDSConfig::params_t spec_params_91 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xefdb679, + .chirp_stop_hex = 0x75def9b, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x266e, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -920.00 +}; + +// chirp_start: 11701770.00, chirp_stop: 5745419.80 +constexpr DDSConfig::params_t spec_params_92 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xefa6f9d, + .chirp_stop_hex = 0x75aa8be, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x26d9, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -930.00 +}; + +// chirp_start: 11691770.00, chirp_stop: 5735419.80 +constexpr DDSConfig::params_t spec_params_93 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xef728c0, + .chirp_stop_hex = 0x75761e2, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2744, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -940.00 +}; + +// chirp_start: 11681770.00, chirp_stop: 5725419.80 +constexpr DDSConfig::params_t spec_params_94 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xef3e1e4, + .chirp_stop_hex = 0x7541b05, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x27af, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -950.00 +}; + +// chirp_start: 11671770.00, chirp_stop: 5715419.80 +constexpr DDSConfig::params_t spec_params_95 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xef09b08, + .chirp_stop_hex = 0x750d429, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x281a, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -960.00 +}; + +// chirp_start: 11661770.00, chirp_stop: 5705419.80 +constexpr DDSConfig::params_t spec_params_96 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xeed542b, + .chirp_stop_hex = 0x74d8d4d, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x2885, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -970.00 +}; + +// chirp_start: 11651770.00, chirp_stop: 5695419.80 +constexpr DDSConfig::params_t spec_params_97 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xeea0d4f, + .chirp_stop_hex = 0x74a4670, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x28f0, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -980.00 +}; + +// chirp_start: 11641770.00, chirp_stop: 5685419.80 +constexpr DDSConfig::params_t spec_params_98 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xee6c673, + .chirp_stop_hex = 0x746ff94, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x295b, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -990.00 +}; + +// chirp_start: 11631770.00, chirp_stop: 5675419.80 +constexpr DDSConfig::params_t spec_params_99 = { + .mult = 20, + .clk_transition_hex = 0x102b2dab, + .chirp_start_hex = 0xee37f96, + .chirp_stop_hex = 0x743b8b8, + .mw_time_hex = 0xf9, + .mw_freq_hex = 0x29c6, + .chirp_time_hex = 0xf9, + .chirp_freq_hex = 0x992, + .actual_chirp = -22.909039, + .detuning = -1000.00 +}; +constexpr size_t NUM_POINTS_SPEC = 100; constexpr DDSConfig::params_t specs[NUM_POINTS_SPEC] = { spec_params_0, spec_params_1, spec_params_2, spec_params_3, spec_params_4, spec_params_5, spec_params_6, spec_params_7, spec_params_8, spec_params_9, spec_params_10, spec_params_11, spec_params_12, spec_params_13, spec_params_14, spec_params_15, spec_params_16, spec_params_17, spec_params_18, spec_params_19, spec_params_20, spec_params_21, spec_params_22, spec_params_23, spec_params_24, spec_params_25, spec_params_26, spec_params_27, spec_params_28, spec_params_29, spec_params_30, spec_params_31, spec_params_32, spec_params_33, spec_params_34, spec_params_35, spec_params_36, spec_params_37, spec_params_38, spec_params_39, spec_params_40, spec_params_41, spec_params_42, spec_params_43, spec_params_44, spec_params_45, spec_params_46, spec_params_47, spec_params_48, spec_params_49, spec_params_50, spec_params_51, spec_params_52, spec_params_53, spec_params_54, spec_params_55, spec_params_56, spec_params_57, spec_params_58, spec_params_59, spec_params_60, spec_params_61, spec_params_62, spec_params_63, spec_params_64, spec_params_65, spec_params_66, spec_params_67, spec_params_68, spec_params_69, spec_params_70, spec_params_71, spec_params_72, spec_params_73, spec_params_74, spec_params_75, spec_params_76, spec_params_77, spec_params_78, spec_params_79, spec_params_80, spec_params_81, spec_params_82, spec_params_83, spec_params_84, spec_params_85, spec_params_86, spec_params_87, spec_params_88, spec_params_89, spec_params_90, spec_params_91, spec_params_92, spec_params_93, spec_params_94, spec_params_95, spec_params_96, spec_params_97, spec_params_98, spec_params_99, }; diff --git a/drivers/ad9959/ad9959.cpp b/drivers/ad9959/ad9959.cpp index 9e55f5c..9c09435 100644 --- a/drivers/ad9959/ad9959.cpp +++ b/drivers/ad9959/ad9959.cpp @@ -1,3 +1,23 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + #include "ad9959.h" namespace { @@ -71,6 +91,7 @@ void AD9959::set_freq_linear_sweep_params( uint32_t end_freq_word, uint32_t step_word_up, uint32_t step_word_down, uint8_t time_word_up, uint8_t time_word_down) { MBED_ASSERT((ch & Channel0) | (ch & Channel1)); + MBED_ASSERT(end_freq_word > start_freq_word); set_csr(ch); mult_ = mult; @@ -81,6 +102,7 @@ void AD9959::set_freq_linear_sweep_params( cfr_params.linear_sweep_enable = 1; cfr_params.linear_sweep_no_dwell = 0; cfr_params.load_srr_at_io_update = 1; + cfr_params.autoclear_sweep_accumulator = 0; cfr_params.dac_full_scale_current_control = 0b11; // TODO(bsm): make enum write_register(AD9959::CFR, cfr_params.bits); diff --git a/drivers/ad9959/ad9959.h b/drivers/ad9959/ad9959.h index fff0bf6..52d1407 100644 --- a/drivers/ad9959/ad9959.h +++ b/drivers/ad9959/ad9959.h @@ -1,12 +1,31 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + /* - * Simple (and imcomplete) driver for Analog Devices AD9959 DDS chip + * Simple (and incomplete) driver for Analog Devices AD9959 DDS chip * * This library assumes that you are pulling down the power down pin externally. - * If you are not - * doing so, nothing will work because the chip won't be turned out. + * If you are not doing so, nothing will work because the chip won't be turned out. + * Refer to the hardware schematic for more details. * - * So far linear sweep is only supported for up to two channels via the Profile - * pins. + * So far linear sweep is only supported for up to two channels via the Profile pins. */ #ifndef _DRIVERS_AD9959_AD9959_H_ @@ -216,7 +235,7 @@ class AD9959 { // the datasheet to run properly on a little endian system. There are no // checks // nor compatible implementation for big endian systems at tihs time. - // TODO(bolamalek): add edianess check and big endian support. + // TODO: add edianess check and big endian support. typedef union { struct { uint8_t lsb_first : 1; // use LsbMode enum diff --git a/drivers/max11300/max11300.cpp b/drivers/max11300/max11300.cpp index e8c96cb..8eb06c4 100644 --- a/drivers/max11300/max11300.cpp +++ b/drivers/max11300/max11300.cpp @@ -30,7 +30,7 @@ * ownership rights. **********************************************************************/ -#include "bsm_delay.h" +#include "cycle_count_delay.h" #include "max11300.h" namespace { @@ -262,7 +262,7 @@ void MAX11300::run_ramps(RampAction *ramp_action) { Callback(this, &MAX11300::spi_write_cb)); while (!m_write_done) ; - bsm_delay_us(static_cast(wait_time_us)); + cycle_delay_us(static_cast(wait_time_us)); } } diff --git a/experiment/settings.h b/experiment/settings.h new file mode 100644 index 0000000..e680c42 --- /dev/null +++ b/experiment/settings.h @@ -0,0 +1,72 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + +// Analog values +constexpr float AO1_MOT = 6.6; +constexpr float AO2_MOT = 1.76; +constexpr float AO3_MOT = 5; +constexpr float EO_MOT = 8.93; +constexpr float NS_MOT = 0.7; +constexpr float WE_MOT = 1.2; +constexpr float BIAS_MOT = 0.11; + +constexpr float AO1_PGC = AO1_MOT; +constexpr float AO2_PGC = 2.20; +constexpr float AO3_PGC = 1.95; +constexpr float EO_PGC = 9.78; + +constexpr float AO1_MW = 7.8; +constexpr float AO2_MW = 0; +constexpr float AO3_MW = 10; +constexpr float NS_MW = NS_MOT; +constexpr float WE_MW = 2.2; +constexpr float EO_MW = 9.21; +constexpr float BIAS_MW = BIAS_MOT; + +constexpr float AO1_RAMAN = 8.1; +constexpr float AO2_RAMAN = 2.5; +constexpr float NS_RAMAN = 0; +constexpr float WE_RAMAN = 0; +constexpr float EO_RAMAN = 6.5; +// constexpr float BIAS_RAMAN = 3; +constexpr float BIAS_RAMAN = 6; + +constexpr float AO1_IMAGE = 7.30; +constexpr float AO2_IMAGE = 1.75; +constexpr float NS_IMAGE = 0.04; +constexpr float WE_IMAGE = 0.25; +constexpr float EO_IMAGE = 8.88; + +#define K_UP 0 + +// DDS Paramaeters +// TODO(split out for different experiment and maybe pass in as object) + +// #include "dds_params/declare_T_80_fringes.h" +// #include "dds_params/declare_T_120_fringes.h" +// #include "dds_params/declare_T_120_16_fringes.h" +// #include "dds_params/declare_T_115_fringes_17e_7.h" +#if K_UP +#include "dds_params/T_130_fringes.h" +#include "dds_params/declare_spectroscopy.h" +#else +#include "dds_params/k_down.h" +#include "dds_params/k_down_spec.h" +#endif diff --git a/gravity.proto b/gravity.proto new file mode 100644 index 0000000..9373b7a --- /dev/null +++ b/gravity.proto @@ -0,0 +1,24 @@ +// A protocol definition to allow to sending chirp values back and forth. + +syntax = "proto2"; + +package minig; + +message DDS { + required uint32 mult = 1; + required uint32 clk_transition_hex = 2; + required uint32 chirp_start_hex = 3; + required uint32 chirp_stop_hex = 4; + required uint32 mw_time_hex = 5; + required uint32 mw_freq_hex = 6; + required uint32 chirp_time_hex = 7; + required uint32 chirp_freq_hex = 8; + required float actual_chirp = 9; + required float detuning = 10; +} + +message FringeParams { + repeated DDS k_up_params = 1; + repeated DDS k_down_params = 2; +} + diff --git a/main.cpp b/main.cpp index 6545b3d..598aa2f 100644 --- a/main.cpp +++ b/main.cpp @@ -1,26 +1,73 @@ -#include "bsm_delay.h" -#include "drivers/max11300/max11300.h" +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + +#include "cycle_count_delay.h" #include "mbed.h" #include "minig.h" +#include "util/macros.h" + +#if !DEVICE_FLASH +#error [NOT_SUPPORTED] Flash API not supported for this target +#endif + +#define K_UP 0 + + +#include "FlashIAP.h" -#define WRITE_IO(PORT, ON_BITS, OFF_BITS) \ - PORT->ODR = ((PORT->ODR & ~(OFF_BITS)) | (ON_BITS)) -#define BITS_NONE (0) +// Create flash IAP block device +FlashIAP bd; +void test_bd() { + printf("FlashIAPBlockDevice test\n"); -#define RUN_MINIG 1 + // Initialize the flash IAP block device and print the memory layout + bd.init(); + printf("Flash block device size: %lu\n", bd.get_flash_size()); + printf("Flash block device read size: %lu\n", bd.get_page_size()); + printf("Flash block device program size: %lu\n", bd.get_page_size()); + printf("Flash block device erase size: %lu\n", + bd.get_sector_size(bd.get_flash_start())); -// volatile uint8_t triggered = 0; -// void trigger() { -// triggered++; -// } -// -// uint16_t samples[1024]; + // Write "Hello World!" to the first block + char *buffer = (char *)malloc(bd.get_page_size()); + sprintf(buffer, "Hello World!\n"); + bd.erase(0, bd.get_page_size()); + bd.program(buffer, 0, bd.get_page_size()); + + // Read back what was stored + bd.read(buffer, 0, bd.get_page_size()); + printf("%s", buffer); + + // Deinitialize the device + bd.deinit(); +} int main() { - printf("\nhello debugging!\n"); enableCycleCounter(); + test_bd(); - MiniG minig; +#if K_UP + MiniG minig(true); +#else + MiniG minig(false); +#endif minig.init(); while (1) { minig.run(); @@ -35,27 +82,4 @@ int main() { // WRITE_IO(GPIOG, BITS_NONE, GPIO_PIN_2); // bsm_delay_us(4); // } - - // InterruptIn pg0{PG_0}; - // pg0.rise(&trigger); - - // while (1) { - // if (triggered) { - // minig.pixi_.max_speed_adc_read(drivers::max11300::MAX11300::PORT0, - // samples, 3*127); - // printf("ListPlot[{"); - // size_t i = 0; - // for (; i < 127; i++) { - // printf("%d,", samples[i]); - // } - // for (; i < 127 + 127; i++) { - // printf("%d,", samples[i]); - // } - // for (; i < 127 + 127 + 127; i++) { - // printf("%d,", samples[i]); - // } - // printf("}]\n\n"); - // triggered = 0; - // } - // } } diff --git a/mappings.txt b/mappings.txt deleted file mode 100644 index 28c03e5..0000000 --- a/mappings.txt +++ /dev/null @@ -1,27 +0,0 @@ -coils_ D43 -liquid_crystal_1_ D44 -under_vac_shutter_ D46 -ao_2_ D47 -ao_3_ D48 -cooling_shutter_ D49 -mot_eo_ D50 -raman_eo_ D51 -m_horn_switch_ D52 -m_lock_ D53 -analog_trigger_ D54 -dds_switch_ D56 -dds_trigger_1_ D57 -dds_trigger_2_ D58 -oscillscope_trigger_ D59 -camera_ttl_ D60 -ao1_freq_ OUT0} -ao2_atten_ OUT1} -ao3_atten_ OUT2} -z_field_ OUT3} -ns_field_ OUT4} -we_field_ OUT5} -eo_freq_ OUT6} -bias_field_ OUT7} -laser_jump_ OUT8} -photodiode_ IN0} - diff --git a/minig.cpp b/minig.cpp index f996c87..90df3b6 100644 --- a/minig.cpp +++ b/minig.cpp @@ -1,28 +1,52 @@ -#include "bsm_delay.h" +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All +Rights Reserved. +Permission to use, copy, modify, and distribute this software and its +documentation for +educational, research, and not-for-profit purposes, without fee and without a +signed licensing +agreement, is hereby granted, provided that the above copyright notice, this +paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. +Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, +CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for +commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS +SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE +AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO +OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + +#include "cycle_count_delay.h" #include "minig.h" #include "pinmap.h" +#include "util/dds_config.h" +#include "util/macros.h" using drivers::ad9959::AD9959; using drivers::max11300::MAX11300; - -#define WRITE_IO(PORT, ON_BITS, OFF_BITS) \ - PORT->ODR = ((PORT->ODR & ~(OFF_BITS)) | (ON_BITS)) -#define BITS_NONE (0) - -#define ARRAYSIZE(a) \ - ((sizeof(a) / sizeof(*(a))) / \ - static_cast(!(sizeof(a) % sizeof(*(a))))) - -#define STOP \ - while (1) \ - ; +using util::DDSConfig; #define SPECTROSCOPY 0 #define RAMAN_RABI 0 #define MW_RABI 0 #define INTER 1 #define DEBUG_PD 0 -#define USE_CAMERA 1 +#define USE_CAMERA 0 #define CENTER_PD 0 #define TUNE 0 @@ -43,51 +67,14 @@ constexpr int16_t to_dac(double volts) { constexpr size_t num_samples = 1200; uint16_t samples[num_samples]; -// #include "dds_params/declare_T_80_fringes.h" -// #include "dds_params/declare_T_120_fringes.h" -// #include "dds_params/declare_T_120_16_fringes.h" -#include "dds_params/T_130_fringes.h" -// #include "dds_params/declare_T_115_fringes_17e_7.h" -#include "dds_params/declare_spectroscopy.h" - -constexpr float AO1_MOT = 6.6; -constexpr float AO2_MOT = 1.76; -constexpr float AO3_MOT = 5; -constexpr float EO_MOT = 8.93; -constexpr float NS_MOT = 0.7; -constexpr float WE_MOT = 1.2; -constexpr float BIAS_MOT = 0.11; - -constexpr float AO1_PGC = AO1_MOT; -constexpr float AO2_PGC = 2.20; -constexpr float AO3_PGC = 1.95; -constexpr float EO_PGC = 9.78; - -constexpr float AO1_MW = 7.8; -constexpr float AO2_MW = 0; -constexpr float AO3_MW = 10; -constexpr float NS_MW = NS_MOT; -constexpr float WE_MW = 2.2; -constexpr float EO_MW = 9.21; -constexpr float BIAS_MW = BIAS_MOT; - -constexpr float AO1_RAMAN = 8.1; -constexpr float AO2_RAMAN = 2.5; -constexpr float NS_RAMAN = 0; -constexpr float WE_RAMAN = 0; -constexpr float EO_RAMAN = 6.5; -constexpr float BIAS_RAMAN = 3; - -constexpr float AO1_IMAGE = 7.30; -constexpr float AO2_IMAGE = 1.75; -constexpr float NS_IMAGE = 0.04; -constexpr float WE_IMAGE = 0.25; -constexpr float EO_IMAGE = 8.88; +DDSConfig dds_config; +#include "experiment/settings.h" } // namepsace // clang-format off -MiniG::MiniG() : +MiniG::MiniG(bool k_up) : + k_up_{k_up}, coils_{GPIO_PIN_0}, //GPIOE liquid_crystal_1_{GPIO_PIN_2}, //GPIOE under_vac_shutter_{GPIO_PIN_3}, //GPIOG @@ -128,19 +115,6 @@ MiniG::MiniG() : pixi_{pixi_spi_, SPI_CS} {} // clang-format on - -void MiniG::set_dds_params(dds_params_t params) { - dds_.reset(); - dds_.set_freq_linear_sweep_params( - AD9959::Channel0, params.mult, params.chirp_start_hex, - params.chirp_stop_hex, params.chirp_freq_hex, params.chirp_time_hex); - - dds_.set_freq_linear_sweep_params( - AD9959::Channel1, params.mult, params.clk_transition_hex, - params.chirp_start_hex, params.mw_freq_hex, params.mw_time_hex); - dds_.io_update(); -} - void MiniG::init() { __HAL_RCC_GPIOE_CLK_ENABLE(); @@ -229,17 +203,20 @@ void MiniG::init() { // no reason. dds_.init(); pixi_.init(); - // set_dds_params(22.9, 720); - set_dds_params(fringes[0]); + if (k_up_) { + dds_config.configure_up(dds_, fringes[0]); + } else { + dds_config.configure_down(dds_, fringes[0]); + } reset(AO1_MOT); } -void MiniG::reset(float var, bool k_up) { +void MiniG::reset(float var) { uint32_t ON_PINS = liquid_crystal_1_ | ao_3_ | raman_eo_ | m_lock_ | - dds_switch_ | m_horn_switch_; + dds_switch_ | m_horn_switch_; uint32_t OFF_PINS = coils_ | ao_2_ | cooling_shutter_ | mot_eo_ | raman_eo_ | - analog_trigger_ | camera_ttl_ | laser_jump_; - if (k_up) { + analog_trigger_ | camera_ttl_ | laser_jump_; + if (k_up_) { OFF_PINS |= mw_dds_profile_pin_ | inter_dds_profile_pin_; } else { ON_PINS |= mw_dds_profile_pin_ | inter_dds_profile_pin_; @@ -257,297 +234,311 @@ void MiniG::reset(float var, bool k_up) { pixi_.single_ended_dac_write(bias_field_, to_dac(0)); #if TUNE - // pixi_.single_ended_dac_write(ao1_freq_, to_dac(var)); - // MAX11300::Ramp image_on_ramps[] = { - // {ao1_freq_, to_dac(AO1_RAMAN), to_dac(var)}, - // {ao2_atten_, to_dac(AO2_RAMAN), to_dac(AO2_IMAGE)}, - // {eo_freq_, to_dac(EO_RAMAN), to_dac(EO_IMAGE)}, - // {ns_field_, to_dac(NS_RAMAN), to_dac(NS_IMAGE)}, - // {we_field_, to_dac(WE_RAMAN), to_dac(WE_IMAGE)}, - // }; - // image_on_ramp_.configured = 1; - // image_on_ramp_.num_ramps = ARRAYSIZE(image_on_ramps); - // image_on_ramp_.num_steps = 30; - // image_on_ramp_.step_time_us = 100; - // pixi_.prepare_ramps(&image_on_ramp_, image_on_ramps); - - // MAX11300::Ramp pgc_on_ramps[] = { - // // {ao1_freq_, to_dac(AO1_MOT), to_dac(AO1_PGC)}, - // {ao2_atten_, to_dac(AO2_MOT), to_dac(var)}, - // {ao3_atten_, to_dac(AO3_MOT), to_dac(AO3_PGC)}, - // {eo_freq_, to_dac(EO_MOT), to_dac(EO_PGC)}, - // }; - // pgc_on_ramp_.configured = 1; - // pgc_on_ramp_.num_ramps = ARRAYSIZE(pgc_on_ramps); - // pgc_on_ramp_.num_steps = 5; - // pgc_on_ramp_.step_time_us = 100; - // pixi_.prepare_ramps(&pgc_on_ramp_, pgc_on_ramps); - +// pixi_.single_ended_dac_write(ao1_freq_, to_dac(var)); +// MAX11300::Ramp image_on_ramps[] = { +// {ao1_freq_, to_dac(AO1_RAMAN), to_dac(var)}, +// {ao2_atten_, to_dac(AO2_RAMAN), to_dac(AO2_IMAGE)}, +// {eo_freq_, to_dac(EO_RAMAN), to_dac(EO_IMAGE)}, +// {ns_field_, to_dac(NS_RAMAN), to_dac(NS_IMAGE)}, +// {we_field_, to_dac(WE_RAMAN), to_dac(WE_IMAGE)}, +// }; +// image_on_ramp_.configured = 1; +// image_on_ramp_.num_ramps = ARRAYSIZE(image_on_ramps); +// image_on_ramp_.num_steps = 30; +// image_on_ramp_.step_time_us = 100; +// pixi_.prepare_ramps(&image_on_ramp_, image_on_ramps); + +// MAX11300::Ramp pgc_on_ramps[] = { +// // {ao1_freq_, to_dac(AO1_MOT), to_dac(AO1_PGC)}, +// {ao2_atten_, to_dac(AO2_MOT), to_dac(var)}, +// {ao3_atten_, to_dac(AO3_MOT), to_dac(AO3_PGC)}, +// {eo_freq_, to_dac(EO_MOT), to_dac(EO_PGC)}, +// }; +// pgc_on_ramp_.configured = 1; +// pgc_on_ramp_.num_ramps = ARRAYSIZE(pgc_on_ramps); +// pgc_on_ramp_.num_steps = 5; +// pgc_on_ramp_.step_time_us = 100; +// pixi_.prepare_ramps(&pgc_on_ramp_, pgc_on_ramps); + #endif - bsm_delay_ms(2); + cycle_delay_ms(2); } void MiniG::run() { #if TUNE - for(float var = 6.4; var <= 7.5; var += 0.1) { + for (float var = 6.4; var <= 7.5; var += 0.1) { #endif #if CENTER_PD - for(float d_fall = -3000; d_fall <= 0; d_fall += 500) { + for (float d_fall = -3000; d_fall <= 0; d_fall += 500) { #endif #if MW_RABI for (int pulse = 0; pulse <= 800; pulse += 20) { #endif #if RAMAN_RABI - for (uint32_t raman = 0; raman <= 30; raman += 1) { + for (uint32_t raman = 0; raman <= 30; raman += 1) { + if (k_up_) { + dds_config.configure_up(dds_, fringes[0]); + } else { + dds_config.configure_down(dds_, fringes[0]); + } #endif #if SPECTROSCOPY - for (size_t j = 0; j < NUM_POINTS_SPEC; j++) { - set_dds_params(specs[j]); + for (size_t j = 0; j < NUM_POINTS_SPEC; j++) { + if (k_up_) { + dds_config.configure_up(dds_, specs[j]); + } else { + dds_config.configure_down(dds_, specs[j]); + } + #endif #if INTER - for (size_t j = 0; j < NUM_POINTS_INTER; j++) { - set_dds_params(fringes[j]); -#endif -#if RAMAN_RABI - set_dds_params(fringes[0]); + for (size_t j = 0; j < NUM_POINTS_INTER; j++) { + if (k_up_) { + dds_config.configure_up(dds_, fringes[j]); + } else { + dds_config.configure_down(dds_, fringes[j]); + } + #endif #if TUNE - reset(var); + reset(var); #else - reset(AO1_MOT); + reset(AO1_MOT); #endif - mot(); - pgc(); + mot(); + pgc(); #if !MW_RABI - int pulse = 300; + int pulse = 300; #endif - mw(pulse); - uint32_t T = 130; - float fall_ms = 0.5; - uint32_t fall_us = static_cast(fall_ms * 1000); + mw(pulse); + uint32_t T = 129; + float fall_ms = 0.5; + uint32_t fall_us = static_cast(fall_ms * 1000); #if CENTER_PD - fall_us += d_fall; + fall_us += d_fall; #endif #if !RAMAN_RABI - uint32_t raman = 8; + uint32_t raman = 8; #endif - interferometry(T, fall_us, raman); + interferometry(T, fall_us, raman); - image(); + image(); #if USE_CAMERA - bsm_delay_ms(300); + cycle_delay_ms(300); #endif #if SPECTROSCOPY - printf("rd: %f\n", specs[j].detuning); + printf("rd: %f\n", specs[j].detuning); #elif INTER - printf("rd: %f\n", fringes[j].actual_chirp); + printf("rd: %f\n", fringes[j].actual_chirp); #elif MW_RABI - printf("rd: %d\n", pulse); + printf("rd: %d\n", pulse); #elif RAMAN_RABI - printf("rd: %lu\n", raman); + printf("rd: %lu\n", raman); #elif CENTER_PD - printf("rd: %f\n", d_fall); + printf("rd: %f\n", d_fall); #elif TUNE - printf("rd: %f\n", var); + printf("rd: %f\n", var); #endif - uint32_t f4 = 0, f34 = 0, bg = 6; - size_t i = 0; + uint32_t f4 = 0, f34 = 0, bg = 6; + size_t i = 0; #if DEBUG_PD - printf("ListPlot[{"); + printf("ListPlot[{"); #endif - for (; i < 127; i++) { - f4 += samples[i]; + for (; i < 127; i++) { + f4 += samples[i]; #if DEBUG_PD - printf("%d,", samples[i]); + printf("%d,", samples[i]); #endif - } - for (; i < 127 + 127; i++) { - f34 += samples[i]; + } + for (; i < 127 + 127; i++) { + f34 += samples[i]; #if DEBUG_PD - printf("%d,", samples[i]); + printf("%d,", samples[i]); #endif - } - for (; i < 127 + 127 + 127; i++) { - bg += samples[i]; + } + for (; i < 127 + 127 + 127; i++) { + bg += samples[i]; #if DEBUG_PD - printf("%d,", samples[i]); + printf("%d,", samples[i]); #endif - } + } #if DEBUG_PD - printf("}]\n\n"); + printf("}]\n\n"); #endif - double detection = - (static_cast(f4) - static_cast(bg)) / - (static_cast(f34) - static_cast(bg)); + double detection = + (static_cast(f4) - static_cast(bg)) / + (static_cast(f34) - static_cast(bg)); #if MW_RABI | CENTER_PD | TUNE - printf("fr: %lu\n", f34 - bg); + printf("fr: %lu\n", f34 - bg); #elif RAMAN_RABI | SPECTROSCOPY | INTER - printf("fr: %f\n", detection); - printf("atom_num: %lu\n\n", f34 - bg); + printf("fr: %f\n", detection); + printf("atom_num: %lu\n\n", f34 - bg); #endif #if CENTER_PD | RAMAN_RABI | SPECTROSCOPY | INTER | MW_RABI | TUNE - } + } #endif - } +} - void MiniG::mot() { - WRITE_IO(GPIOE, ao_2_ | cooling_shutter_, m_lock_); +void MiniG::mot() { + WRITE_IO(GPIOE, ao_2_ | cooling_shutter_, m_lock_); - pixi_.run_ramps(&mot_on_ramp_); + pixi_.run_ramps(&mot_on_ramp_); - // Actual MOT Stage - WRITE_IO(GPIOE, coils_, BITS_NONE); - bsm_delay_ms(150); + // Actual MOT Stage + WRITE_IO(GPIOE, coils_, BITS_NONE); + cycle_delay_ms(150); - // Turn the MOT off - WRITE_IO(GPIOE, BITS_NONE, coils_); + // Turn the MOT off + WRITE_IO(GPIOE, BITS_NONE, coils_); - bsm_delay_ms(9); - } + cycle_delay_ms(9); +} - void MiniG::pgc() { - WRITE_IO(GPIOE, laser_jump_, BITS_NONE); - pixi_.run_ramps(&pgc_on_ramp_); - bsm_delay_us(500); +void MiniG::pgc() { + WRITE_IO(GPIOE, laser_jump_, BITS_NONE); + pixi_.run_ramps(&pgc_on_ramp_); + cycle_delay_us(500); - // Just hold it to cool - bsm_delay_ms(10); + // Just hold it to cool + cycle_delay_ms(10); - // Turn off PGC - WRITE_IO(GPIOE, BITS_NONE, cooling_shutter_); - bsm_delay_ms(6); - } + // Turn off PGC + WRITE_IO(GPIOE, BITS_NONE, cooling_shutter_); + cycle_delay_ms(6); +} - void MiniG::mw(int pulse_duration, bool k_up) { - WRITE_IO(GPIOE, cooling_shutter_, - laser_jump_ | liquid_crystal_1_ | ao_2_ | ao_3_); +void MiniG::mw(int pulse_duration) { + WRITE_IO(GPIOE, cooling_shutter_, + laser_jump_ | liquid_crystal_1_ | ao_2_ | ao_3_); - pixi_.run_ramps(&mw_on_ramp_); - bsm_delay_ms(2); + pixi_.run_ramps(&mw_on_ramp_); + cycle_delay_ms(2); - // Actually turn on Microwave - WRITE_IO(GPIOE, BITS_NONE, m_horn_switch_); - bsm_delay_us(pulse_duration); + // Actually turn on Microwave + WRITE_IO(GPIOE, BITS_NONE, m_horn_switch_); + cycle_delay_us(pulse_duration); - // Stop Microwave - WRITE_IO(GPIOE, m_horn_switch_, BITS_NONE); - bsm_delay_ms(1); + // Stop Microwave + WRITE_IO(GPIOE, m_horn_switch_, BITS_NONE); + cycle_delay_ms(1); - // Blow away - uint32_t on_bits = ao_3_ | mot_eo_; - uint32_t off_bits = BITS_NONE; - if (k_up) { - on_bits |= mw_dds_profile_pin_; - } else { - off_bits |= mw_dds_profile_pin_; - } - WRITE_IO(GPIOE, on_bits, off_bits); + // Blow away + uint32_t on_bits = ao_3_ | mot_eo_; + uint32_t off_bits = BITS_NONE; + if (k_up_) { + on_bits |= mw_dds_profile_pin_; + } else { + off_bits |= mw_dds_profile_pin_; + } + WRITE_IO(GPIOE, on_bits, off_bits); #if MW_RABI - bsm_delay_us(4000); + cycle_delay_us(4000); #else - bsm_delay_us(4000 - pulse_duration); + cycle_delay_us(4000 - pulse_duration); #endif - } - - // Start Interformetry - void MiniG::interferometry(uint32_t T, uint32_t fall, uint32_t raman, bool k_up) { - WRITE_IO(GPIOE, BITS_NONE, - ao_3_ | cooling_shutter_ | raman_eo_ | dds_switch_); - pixi_.run_ramps(&raman_on_ramp_); - // last 5 ms - bsm_delay_ms(2); - - // Freefall - if (k_up) { - WRITE_IO(GPIOE, inter_dds_profile_pin_, BITS_NONE); - } else { - WRITE_IO(GPIOE, BITS_NONE, inter_dds_profile_pin_); - } +} +// Start Interformetry +void MiniG::interferometry(uint32_t T, uint32_t fall, + uint32_t raman) { + WRITE_IO(GPIOE, BITS_NONE, + ao_3_ | cooling_shutter_ | raman_eo_); + pixi_.run_ramps(&raman_on_ramp_); + // last 5 ms + cycle_delay_ms(2); + WRITE_IO(GPIOE, BITS_NONE, dds_switch_); + + // Freefall + if (k_up_) { + WRITE_IO(GPIOE, inter_dds_profile_pin_, BITS_NONE); + } else { + WRITE_IO(GPIOE, BITS_NONE, inter_dds_profile_pin_); + } + cycle_delay_ms(2); + + WRITE_IO(GPIOG, scope_, BITS_NONE); #if INTER - WRITE_IO(GPIOE, ao_2_|ao_3_, BITS_NONE); - bsm_delay_us(5); + WRITE_IO(GPIOE, ao_2_ | ao_3_, BITS_NONE); + cycle_delay_us(5); +#elif RAMAN_RABI + WRITE_IO(GPIOE, ao_2_ | ao_3_, BITS_NONE); + cycle_delay_us(raman); #endif - WRITE_IO(GPIOE, BITS_NONE, ao_2_|ao_3_); + WRITE_IO(GPIOE, BITS_NONE, ao_2_ | ao_3_); - bsm_delay_ms(T); + cycle_delay_ms(T); - - WRITE_IO(GPIOG, scope_, BITS_NONE); #if INTER | SPECTROSCOPY - WRITE_IO(GPIOE, ao_2_|ao_3_, BITS_NONE); - bsm_delay_us(10); -#elif RAMAN_RABI - WRITE_IO(GPIOE, ao_2_|ao_3_, BITS_NONE); - bsm_delay_us(raman); + WRITE_IO(GPIOE, ao_2_ | ao_3_, BITS_NONE); + cycle_delay_us(10); #endif - WRITE_IO(GPIOE, BITS_NONE, ao_2_|ao_3_); + WRITE_IO(GPIOE, BITS_NONE, ao_2_ | ao_3_); - bsm_delay_ms(T); + cycle_delay_ms(T); #if INTER - WRITE_IO(GPIOE, ao_2_|ao_3_, BITS_NONE); - bsm_delay_us(5); + WRITE_IO(GPIOE, ao_2_ | ao_3_, BITS_NONE); + cycle_delay_us(5); #endif - WRITE_IO(GPIOE, BITS_NONE, ao_2_|ao_3_); + WRITE_IO(GPIOE, BITS_NONE, ao_2_ | ao_3_); - WRITE_IO(GPIOG, BITS_NONE, scope_); - bsm_delay_us(fall); + WRITE_IO(GPIOG, BITS_NONE, scope_); + cycle_delay_us(fall); - // Stop sweeping - } + // Stop sweeping +} - void MiniG::image() { - WRITE_IO(GPIOE, cooling_shutter_ | dds_switch_ | raman_eo_, BITS_NONE); - pixi_.run_ramps(&image_on_ramp_); - // takes 3 ms - bsm_delay_ms(7); +void MiniG::image() { + WRITE_IO(GPIOE, cooling_shutter_ | dds_switch_ | raman_eo_, + BITS_NONE); + pixi_.run_ramps(&image_on_ramp_); + // takes 3 ms + cycle_delay_ms(7); - // Stabilize - WRITE_IO(GPIOE, BITS_NONE, mot_eo_); - bsm_delay_ms(1); - bsm_delay_us(50); + // Stabilize + WRITE_IO(GPIOE, BITS_NONE, mot_eo_); + cycle_delay_ms(1); + cycle_delay_us(50); - // Turn laser on - WRITE_IO(GPIOE, m_lock_ | ao_3_ + // Turn laser on + WRITE_IO(GPIOE, m_lock_ | ao_3_ #if USE_CAMERA - | camera_ttl_ + | camera_ttl_ #endif - , - BITS_NONE); - // TODO(bsm): write code for this in a minute - bsm_delay_us(20); - pixi_.max_speed_adc_read(photodiode_, samples, 127); - - // Repumping Stage - WRITE_IO(GPIOE, ao_2_, BITS_NONE + , BITS_NONE); + // TODO(bsm): write code for this in a minute + cycle_delay_us(20); + pixi_.max_speed_adc_read(photodiode_, samples, 127); + + // Repumping Stage + WRITE_IO(GPIOE, ao_2_, BITS_NONE #if USE_CAMERA - | camera_ttl_ + | camera_ttl_ #endif - ); - bsm_delay_us(150); + ); + cycle_delay_us(150); - // Second Sample - WRITE_IO(GPIOE, BITS_NONE, ao_2_); - pixi_.max_speed_adc_read(photodiode_, &samples[127], 127); + // Second Sample + WRITE_IO(GPIOE, BITS_NONE, ao_2_); + pixi_.max_speed_adc_read(photodiode_, &samples[127], 127); - // Wait before background - bsm_delay_ms(5); + // Wait before background + cycle_delay_ms(5); - // Third detection for background - pixi_.max_speed_adc_read(photodiode_, &samples[127 + 127], 127); + // Third detection for background + pixi_.max_speed_adc_read(photodiode_, &samples[127 + 127], 127); #if USE_CAMERA - // Wait long time before Camera Background - bsm_delay_ms(40); + // Wait long time before Camera Background + cycle_delay_ms(40); - // Take background image - WRITE_IO(GPIOE, camera_ttl_, BITS_NONE); + // Take background image + WRITE_IO(GPIOE, camera_ttl_, BITS_NONE); - bsm_delay_ms(10); + cycle_delay_ms(10); #endif - } +} diff --git a/minig.h b/minig.h index adcd977..b97c0ba 100644 --- a/minig.h +++ b/minig.h @@ -1,3 +1,23 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + #ifndef _EXPERIMENT_MINIG_H_ #define _EXPERIMENT_MINIG_H_ @@ -8,34 +28,19 @@ class MiniG { public: - MiniG(); + MiniG(bool k_up = true); void init(); void run(); - struct dds_params_t { - uint8_t mult; - uint32_t clk_transition_hex; - uint32_t chirp_start_hex; - uint32_t chirp_stop_hex; - uint32_t mw_time_hex; - uint32_t mw_freq_hex; - uint32_t chirp_time_hex; - uint32_t chirp_freq_hex; - double actual_chirp; - double detuning; - }; - protected: - void reset(float var, bool k_up = true); + void reset(float var); void mot(); void pgc(); - void mw(int pulse, bool k_up = true); - void interferometry(uint32_t T, uint32_t fall, uint32_t raman, - bool k_up = true); + void mw(int pulse); + void interferometry(uint32_t T, uint32_t fall, uint32_t raman); void image(); - void set_dds_params(dds_params_t params); - void set_dds_params(double chirp_rate_kHz_p_ms, double raman_detuning_kHz); + const bool k_up_; const uint32_t coils_; const uint32_t liquid_crystal_1_; const uint32_t under_vac_shutter_; diff --git a/nanopb b/nanopb new file mode 160000 index 0000000..580d7c8 --- /dev/null +++ b/nanopb @@ -0,0 +1 @@ +Subproject commit 580d7c809c3c974537568e93d3be9bc7f533a105 diff --git a/pb_common.c b/pb_common.c new file mode 100644 index 0000000..4fb7186 --- /dev/null +++ b/pb_common.c @@ -0,0 +1,97 @@ +/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c. + * + * 2014 Petteri Aimonen + */ + +#include "pb_common.h" + +bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct) +{ + iter->start = fields; + iter->pos = fields; + iter->required_field_index = 0; + iter->dest_struct = dest_struct; + iter->pData = (char*)dest_struct + iter->pos->data_offset; + iter->pSize = (char*)iter->pData + iter->pos->size_offset; + + return (iter->pos->tag != 0); +} + +bool pb_field_iter_next(pb_field_iter_t *iter) +{ + const pb_field_t *prev_field = iter->pos; + + if (prev_field->tag == 0) + { + /* Handle empty message types, where the first field is already the terminator. + * In other cases, the iter->pos never points to the terminator. */ + return false; + } + + iter->pos++; + + if (iter->pos->tag == 0) + { + /* Wrapped back to beginning, reinitialize */ + (void)pb_field_iter_begin(iter, iter->start, iter->dest_struct); + return false; + } + else + { + /* Increment the pointers based on previous field size */ + size_t prev_size = prev_field->data_size; + + if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF && + PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF && + iter->pos->data_offset == PB_SIZE_MAX) + { + /* Don't advance pointers inside unions */ + return true; + } + else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC && + PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED) + { + /* In static arrays, the data_size tells the size of a single entry and + * array_size is the number of entries */ + prev_size *= prev_field->array_size; + } + else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER) + { + /* Pointer fields always have a constant size in the main structure. + * The data_size only applies to the dynamically allocated area. */ + prev_size = sizeof(void*); + } + + if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED) + { + /* Count the required fields, in order to check their presence in the + * decoder. */ + iter->required_field_index++; + } + + iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset; + iter->pSize = (char*)iter->pData + iter->pos->size_offset; + return true; + } +} + +bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag) +{ + const pb_field_t *start = iter->pos; + + do { + if (iter->pos->tag == tag && + PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION) + { + /* Found the wanted field */ + return true; + } + + (void)pb_field_iter_next(iter); + } while (iter->pos != start); + + /* Searched all the way back to start, and found nothing. */ + return false; +} + + diff --git a/pb_decode.c b/pb_decode.c new file mode 100644 index 0000000..d08259c --- /dev/null +++ b/pb_decode.c @@ -0,0 +1,1528 @@ +/* pb_decode.c -- decode a protobuf using minimal resources + * + * 2011 Petteri Aimonen + */ + +/* Use the GCC warn_unused_result attribute to check that all return values + * are propagated correctly. On other compilers and gcc before 3.4.0 just + * ignore the annotation. + */ +#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) + #define checkreturn +#else + #define checkreturn __attribute__((warn_unused_result)) +#endif + +#include "pb.h" +#include "pb_decode.h" +#include "pb_common.h" + +/************************************** + * Declarations internal to this file * + **************************************/ + +typedef bool (*pb_decoder_t)(pb_istream_t *stream, const pb_field_t *field, void *dest) checkreturn; + +static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); +static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size); +static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); +static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); +static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter); +static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension); +static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type); +static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter); +static bool checkreturn find_extension_field(pb_field_iter_t *iter); +static void pb_field_set_to_default(pb_field_iter_t *iter); +static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct); +static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof); +static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_dec_fixed_length_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest); +static bool checkreturn pb_skip_varint(pb_istream_t *stream); +static bool checkreturn pb_skip_string(pb_istream_t *stream); + +#ifdef PB_ENABLE_MALLOC +static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size); +static bool checkreturn pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter); +static void pb_release_single_field(const pb_field_iter_t *iter); +#endif + +#ifdef PB_WITHOUT_64BIT +#define pb_int64_t int32_t +#define pb_uint64_t uint32_t +#else +#define pb_int64_t int64_t +#define pb_uint64_t uint64_t +#endif + +/* --- Function pointers to field decoders --- + * Order in the array must match pb_action_t LTYPE numbering. + */ +static const pb_decoder_t PB_DECODERS[PB_LTYPES_COUNT] = { + &pb_dec_varint, + &pb_dec_uvarint, + &pb_dec_svarint, + &pb_dec_fixed32, + &pb_dec_fixed64, + + &pb_dec_bytes, + &pb_dec_string, + &pb_dec_submessage, + NULL, /* extensions */ + &pb_dec_fixed_length_bytes +}; + +/******************************* + * pb_istream_t implementation * + *******************************/ + +static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) +{ + size_t i; + const pb_byte_t *source = (const pb_byte_t*)stream->state; + stream->state = (pb_byte_t*)stream->state + count; + + if (buf != NULL) + { + for (i = 0; i < count; i++) + buf[i] = source[i]; + } + + return true; +} + +bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) +{ +#ifndef PB_BUFFER_ONLY + if (buf == NULL && stream->callback != buf_read) + { + /* Skip input bytes */ + pb_byte_t tmp[16]; + while (count > 16) + { + if (!pb_read(stream, tmp, 16)) + return false; + + count -= 16; + } + + return pb_read(stream, tmp, count); + } +#endif + + if (stream->bytes_left < count) + PB_RETURN_ERROR(stream, "end-of-stream"); + +#ifndef PB_BUFFER_ONLY + if (!stream->callback(stream, buf, count)) + PB_RETURN_ERROR(stream, "io error"); +#else + if (!buf_read(stream, buf, count)) + return false; +#endif + + stream->bytes_left -= count; + return true; +} + +/* Read a single byte from input stream. buf may not be NULL. + * This is an optimization for the varint decoding. */ +static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf) +{ + if (stream->bytes_left == 0) + PB_RETURN_ERROR(stream, "end-of-stream"); + +#ifndef PB_BUFFER_ONLY + if (!stream->callback(stream, buf, 1)) + PB_RETURN_ERROR(stream, "io error"); +#else + *buf = *(const pb_byte_t*)stream->state; + stream->state = (pb_byte_t*)stream->state + 1; +#endif + + stream->bytes_left--; + + return true; +} + +pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize) +{ + pb_istream_t stream; + /* Cast away the const from buf without a compiler error. We are + * careful to use it only in a const manner in the callbacks. + */ + union { + void *state; + const void *c_state; + } state; +#ifdef PB_BUFFER_ONLY + stream.callback = NULL; +#else + stream.callback = &buf_read; +#endif + state.c_state = buf; + stream.state = state.state; + stream.bytes_left = bufsize; +#ifndef PB_NO_ERRMSG + stream.errmsg = NULL; +#endif + return stream; +} + +/******************** + * Helper functions * + ********************/ + +static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof) +{ + pb_byte_t byte; + uint32_t result; + + if (!pb_readbyte(stream, &byte)) + { + if (stream->bytes_left == 0) + { + if (eof) + { + *eof = true; + } + } + + return false; + } + + if ((byte & 0x80) == 0) + { + /* Quick case, 1 byte value */ + result = byte; + } + else + { + /* Multibyte case */ + uint_fast8_t bitpos = 7; + result = byte & 0x7F; + + do + { + if (!pb_readbyte(stream, &byte)) + return false; + + if (bitpos >= 32) + { + /* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */ + uint8_t sign_extension = (bitpos < 63) ? 0xFF : 0x01; + + if ((byte & 0x7F) != 0x00 && ((result >> 31) == 0 || byte != sign_extension)) + { + PB_RETURN_ERROR(stream, "varint overflow"); + } + } + else + { + result |= (uint32_t)(byte & 0x7F) << bitpos; + } + bitpos = (uint_fast8_t)(bitpos + 7); + } while (byte & 0x80); + + if (bitpos == 35 && (byte & 0x70) != 0) + { + /* The last byte was at bitpos=28, so only bottom 4 bits fit. */ + PB_RETURN_ERROR(stream, "varint overflow"); + } + } + + *dest = result; + return true; +} + +bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest) +{ + return pb_decode_varint32_eof(stream, dest, NULL); +} + +#ifndef PB_WITHOUT_64BIT +bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest) +{ + pb_byte_t byte; + uint_fast8_t bitpos = 0; + uint64_t result = 0; + + do + { + if (bitpos >= 64) + PB_RETURN_ERROR(stream, "varint overflow"); + + if (!pb_readbyte(stream, &byte)) + return false; + + result |= (uint64_t)(byte & 0x7F) << bitpos; + bitpos = (uint_fast8_t)(bitpos + 7); + } while (byte & 0x80); + + *dest = result; + return true; +} +#endif + +bool checkreturn pb_skip_varint(pb_istream_t *stream) +{ + pb_byte_t byte; + do + { + if (!pb_read(stream, &byte, 1)) + return false; + } while (byte & 0x80); + return true; +} + +bool checkreturn pb_skip_string(pb_istream_t *stream) +{ + uint32_t length; + if (!pb_decode_varint32(stream, &length)) + return false; + + return pb_read(stream, NULL, length); +} + +bool checkreturn pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof) +{ + uint32_t temp; + *eof = false; + *wire_type = (pb_wire_type_t) 0; + *tag = 0; + + if (!pb_decode_varint32_eof(stream, &temp, eof)) + { + return false; + } + + if (temp == 0) + { + *eof = true; /* Special feature: allow 0-terminated messages. */ + return false; + } + + *tag = temp >> 3; + *wire_type = (pb_wire_type_t)(temp & 7); + return true; +} + +bool checkreturn pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type) +{ + switch (wire_type) + { + case PB_WT_VARINT: return pb_skip_varint(stream); + case PB_WT_64BIT: return pb_read(stream, NULL, 8); + case PB_WT_STRING: return pb_skip_string(stream); + case PB_WT_32BIT: return pb_read(stream, NULL, 4); + default: PB_RETURN_ERROR(stream, "invalid wire_type"); + } +} + +/* Read a raw value to buffer, for the purpose of passing it to callback as + * a substream. Size is maximum size on call, and actual size on return. + */ +static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size) +{ + size_t max_size = *size; + switch (wire_type) + { + case PB_WT_VARINT: + *size = 0; + do + { + (*size)++; + if (*size > max_size) return false; + if (!pb_read(stream, buf, 1)) return false; + } while (*buf++ & 0x80); + return true; + + case PB_WT_64BIT: + *size = 8; + return pb_read(stream, buf, 8); + + case PB_WT_32BIT: + *size = 4; + return pb_read(stream, buf, 4); + + case PB_WT_STRING: + /* Calling read_raw_value with a PB_WT_STRING is an error. + * Explicitly handle this case and fallthrough to default to avoid + * compiler warnings. + */ + + default: PB_RETURN_ERROR(stream, "invalid wire_type"); + } +} + +/* Decode string length from stream and return a substream with limited length. + * Remember to close the substream using pb_close_string_substream(). + */ +bool checkreturn pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream) +{ + uint32_t size; + if (!pb_decode_varint32(stream, &size)) + return false; + + *substream = *stream; + if (substream->bytes_left < size) + PB_RETURN_ERROR(stream, "parent stream too short"); + + substream->bytes_left = size; + stream->bytes_left -= size; + return true; +} + +bool checkreturn pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream) +{ + if (substream->bytes_left) { + if (!pb_read(substream, NULL, substream->bytes_left)) + return false; + } + + stream->state = substream->state; + +#ifndef PB_NO_ERRMSG + stream->errmsg = substream->errmsg; +#endif + return true; +} + +/************************* + * Decode a single field * + *************************/ + +static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) +{ + pb_type_t type; + pb_decoder_t func; + + type = iter->pos->type; + func = PB_DECODERS[PB_LTYPE(type)]; + + switch (PB_HTYPE(type)) + { + case PB_HTYPE_REQUIRED: + return func(stream, iter->pos, iter->pData); + + case PB_HTYPE_OPTIONAL: + if (iter->pSize != iter->pData) + *(bool*)iter->pSize = true; + return func(stream, iter->pos, iter->pData); + + case PB_HTYPE_REPEATED: + if (wire_type == PB_WT_STRING + && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE) + { + /* Packed array */ + bool status = true; + pb_size_t *size = (pb_size_t*)iter->pSize; + + pb_istream_t substream; + if (!pb_make_string_substream(stream, &substream)) + return false; + + while (substream.bytes_left > 0 && *size < iter->pos->array_size) + { + void *pItem = (char*)iter->pData + iter->pos->data_size * (*size); + if (!func(&substream, iter->pos, pItem)) + { + status = false; + break; + } + (*size)++; + } + + if (substream.bytes_left != 0) + PB_RETURN_ERROR(stream, "array overflow"); + if (!pb_close_string_substream(stream, &substream)) + return false; + + return status; + } + else + { + /* Repeated field */ + pb_size_t *size = (pb_size_t*)iter->pSize; + char *pItem = (char*)iter->pData + iter->pos->data_size * (*size); + + if ((*size)++ >= iter->pos->array_size) + PB_RETURN_ERROR(stream, "array overflow"); + + return func(stream, iter->pos, pItem); + } + + case PB_HTYPE_ONEOF: + *(pb_size_t*)iter->pSize = iter->pos->tag; + if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE) + { + /* We memset to zero so that any callbacks are set to NULL. + * Then set any default values. */ + memset(iter->pData, 0, iter->pos->data_size); + pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData); + } + return func(stream, iter->pos, iter->pData); + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } +} + +#ifdef PB_ENABLE_MALLOC +/* Allocate storage for the field and store the pointer at iter->pData. + * array_size is the number of entries to reserve in an array. + * Zero size is not allowed, use pb_free() for releasing. + */ +static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size) +{ + void *ptr = *(void**)pData; + + if (data_size == 0 || array_size == 0) + PB_RETURN_ERROR(stream, "invalid size"); + + /* Check for multiplication overflows. + * This code avoids the costly division if the sizes are small enough. + * Multiplication is safe as long as only half of bits are set + * in either multiplicand. + */ + { + const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4); + if (data_size >= check_limit || array_size >= check_limit) + { + const size_t size_max = (size_t)-1; + if (size_max / array_size < data_size) + { + PB_RETURN_ERROR(stream, "size too large"); + } + } + } + + /* Allocate new or expand previous allocation */ + /* Note: on failure the old pointer will remain in the structure, + * the message must be freed by caller also on error return. */ + ptr = pb_realloc(ptr, array_size * data_size); + if (ptr == NULL) + PB_RETURN_ERROR(stream, "realloc failed"); + + *(void**)pData = ptr; + return true; +} + +/* Clear a newly allocated item in case it contains a pointer, or is a submessage. */ +static void initialize_pointer_field(void *pItem, pb_field_iter_t *iter) +{ + if (PB_LTYPE(iter->pos->type) == PB_LTYPE_STRING || + PB_LTYPE(iter->pos->type) == PB_LTYPE_BYTES) + { + *(void**)pItem = NULL; + } + else if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE) + { + /* We memset to zero so that any callbacks are set to NULL. + * Then set any default values. */ + memset(pItem, 0, iter->pos->data_size); + pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, pItem); + } +} +#endif + +static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) +{ +#ifndef PB_ENABLE_MALLOC + PB_UNUSED(wire_type); + PB_UNUSED(iter); + PB_RETURN_ERROR(stream, "no malloc support"); +#else + pb_type_t type; + pb_decoder_t func; + + type = iter->pos->type; + func = PB_DECODERS[PB_LTYPE(type)]; + + switch (PB_HTYPE(type)) + { + case PB_HTYPE_REQUIRED: + case PB_HTYPE_OPTIONAL: + case PB_HTYPE_ONEOF: + if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && + *(void**)iter->pData != NULL) + { + /* Duplicate field, have to release the old allocation first. */ + pb_release_single_field(iter); + } + + if (PB_HTYPE(type) == PB_HTYPE_ONEOF) + { + *(pb_size_t*)iter->pSize = iter->pos->tag; + } + + if (PB_LTYPE(type) == PB_LTYPE_STRING || + PB_LTYPE(type) == PB_LTYPE_BYTES) + { + return func(stream, iter->pos, iter->pData); + } + else + { + if (!allocate_field(stream, iter->pData, iter->pos->data_size, 1)) + return false; + + initialize_pointer_field(*(void**)iter->pData, iter); + return func(stream, iter->pos, *(void**)iter->pData); + } + + case PB_HTYPE_REPEATED: + if (wire_type == PB_WT_STRING + && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE) + { + /* Packed array, multiple items come in at once. */ + bool status = true; + pb_size_t *size = (pb_size_t*)iter->pSize; + size_t allocated_size = *size; + void *pItem; + pb_istream_t substream; + + if (!pb_make_string_substream(stream, &substream)) + return false; + + while (substream.bytes_left) + { + if ((size_t)*size + 1 > allocated_size) + { + /* Allocate more storage. This tries to guess the + * number of remaining entries. Round the division + * upwards. */ + allocated_size += (substream.bytes_left - 1) / iter->pos->data_size + 1; + + if (!allocate_field(&substream, iter->pData, iter->pos->data_size, allocated_size)) + { + status = false; + break; + } + } + + /* Decode the array entry */ + pItem = *(char**)iter->pData + iter->pos->data_size * (*size); + initialize_pointer_field(pItem, iter); + if (!func(&substream, iter->pos, pItem)) + { + status = false; + break; + } + + if (*size == PB_SIZE_MAX) + { +#ifndef PB_NO_ERRMSG + stream->errmsg = "too many array entries"; +#endif + status = false; + break; + } + + (*size)++; + } + if (!pb_close_string_substream(stream, &substream)) + return false; + + return status; + } + else + { + /* Normal repeated field, i.e. only one item at a time. */ + pb_size_t *size = (pb_size_t*)iter->pSize; + void *pItem; + + if (*size == PB_SIZE_MAX) + PB_RETURN_ERROR(stream, "too many array entries"); + + (*size)++; + if (!allocate_field(stream, iter->pData, iter->pos->data_size, *size)) + return false; + + pItem = *(char**)iter->pData + iter->pos->data_size * (*size - 1); + initialize_pointer_field(pItem, iter); + return func(stream, iter->pos, pItem); + } + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } +#endif +} + +static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) +{ + pb_callback_t *pCallback = (pb_callback_t*)iter->pData; +#ifdef PB_OLD_CALLBACK_STYLE + void *arg; +#else + void **arg; +#endif + + if (pCallback == NULL || pCallback->funcs.decode == NULL) + return pb_skip_field(stream, wire_type); + +#ifdef PB_OLD_CALLBACK_STYLE + arg = pCallback->arg; +#else + arg = &(pCallback->arg); +#endif + + if (wire_type == PB_WT_STRING) + { + pb_istream_t substream; + + if (!pb_make_string_substream(stream, &substream)) + return false; + + do + { + if (!pCallback->funcs.decode(&substream, iter->pos, arg)) + PB_RETURN_ERROR(stream, "callback failed"); + } while (substream.bytes_left); + + if (!pb_close_string_substream(stream, &substream)) + return false; + + return true; + } + else + { + /* Copy the single scalar value to stack. + * This is required so that we can limit the stream length, + * which in turn allows to use same callback for packed and + * not-packed fields. */ + pb_istream_t substream; + pb_byte_t buffer[10]; + size_t size = sizeof(buffer); + + if (!read_raw_value(stream, wire_type, buffer, &size)) + return false; + substream = pb_istream_from_buffer(buffer, size); + + return pCallback->funcs.decode(&substream, iter->pos, arg); + } +} + +static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *iter) +{ +#ifdef PB_ENABLE_MALLOC + /* When decoding an oneof field, check if there is old data that must be + * released first. */ + if (PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF) + { + if (!pb_release_union_field(stream, iter)) + return false; + } +#endif + + switch (PB_ATYPE(iter->pos->type)) + { + case PB_ATYPE_STATIC: + return decode_static_field(stream, wire_type, iter); + + case PB_ATYPE_POINTER: + return decode_pointer_field(stream, wire_type, iter); + + case PB_ATYPE_CALLBACK: + return decode_callback_field(stream, wire_type, iter); + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } +} + +static void iter_from_extension(pb_field_iter_t *iter, pb_extension_t *extension) +{ + /* Fake a field iterator for the extension field. + * It is not actually safe to advance this iterator, but decode_field + * will not even try to. */ + const pb_field_t *field = (const pb_field_t*)extension->type->arg; + (void)pb_field_iter_begin(iter, field, extension->dest); + iter->pData = extension->dest; + iter->pSize = &extension->found; + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { + /* For pointer extensions, the pointer is stored directly + * in the extension structure. This avoids having an extra + * indirection. */ + iter->pData = &extension->dest; + } +} + +/* Default handler for extension fields. Expects a pb_field_t structure + * in extension->type->arg. */ +static bool checkreturn default_extension_decoder(pb_istream_t *stream, + pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type) +{ + const pb_field_t *field = (const pb_field_t*)extension->type->arg; + pb_field_iter_t iter; + + if (field->tag != tag) + return true; + + iter_from_extension(&iter, extension); + extension->found = true; + return decode_field(stream, wire_type, &iter); +} + +/* Try to decode an unknown field as an extension field. Tries each extension + * decoder in turn, until one of them handles the field or loop ends. */ +static bool checkreturn decode_extension(pb_istream_t *stream, + uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter) +{ + pb_extension_t *extension = *(pb_extension_t* const *)iter->pData; + size_t pos = stream->bytes_left; + + while (extension != NULL && pos == stream->bytes_left) + { + bool status; + if (extension->type->decode) + status = extension->type->decode(stream, extension, tag, wire_type); + else + status = default_extension_decoder(stream, extension, tag, wire_type); + + if (!status) + return false; + + extension = extension->next; + } + + return true; +} + +/* Step through the iterator until an extension field is found or until all + * entries have been checked. There can be only one extension field per + * message. Returns false if no extension field is found. */ +static bool checkreturn find_extension_field(pb_field_iter_t *iter) +{ + const pb_field_t *start = iter->pos; + + do { + if (PB_LTYPE(iter->pos->type) == PB_LTYPE_EXTENSION) + return true; + (void)pb_field_iter_next(iter); + } while (iter->pos != start); + + return false; +} + +/* Initialize message fields to default values, recursively */ +static void pb_field_set_to_default(pb_field_iter_t *iter) +{ + pb_type_t type; + type = iter->pos->type; + + if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) + { + pb_extension_t *ext = *(pb_extension_t* const *)iter->pData; + while (ext != NULL) + { + pb_field_iter_t ext_iter; + ext->found = false; + iter_from_extension(&ext_iter, ext); + pb_field_set_to_default(&ext_iter); + ext = ext->next; + } + } + else if (PB_ATYPE(type) == PB_ATYPE_STATIC) + { + bool init_data = true; + if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && iter->pSize != iter->pData) + { + /* Set has_field to false. Still initialize the optional field + * itself also. */ + *(bool*)iter->pSize = false; + } + else if (PB_HTYPE(type) == PB_HTYPE_REPEATED || + PB_HTYPE(type) == PB_HTYPE_ONEOF) + { + /* REPEATED: Set array count to 0, no need to initialize contents. + ONEOF: Set which_field to 0. */ + *(pb_size_t*)iter->pSize = 0; + init_data = false; + } + + if (init_data) + { + if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE) + { + /* Initialize submessage to defaults */ + pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, iter->pData); + } + else if (iter->pos->ptr != NULL) + { + /* Initialize to default value */ + memcpy(iter->pData, iter->pos->ptr, iter->pos->data_size); + } + else + { + /* Initialize to zeros */ + memset(iter->pData, 0, iter->pos->data_size); + } + } + } + else if (PB_ATYPE(type) == PB_ATYPE_POINTER) + { + /* Initialize the pointer to NULL. */ + *(void**)iter->pData = NULL; + + /* Initialize array count to 0. */ + if (PB_HTYPE(type) == PB_HTYPE_REPEATED || + PB_HTYPE(type) == PB_HTYPE_ONEOF) + { + *(pb_size_t*)iter->pSize = 0; + } + } + else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK) + { + /* Don't overwrite callback */ + } +} + +static void pb_message_set_to_defaults(const pb_field_t fields[], void *dest_struct) +{ + pb_field_iter_t iter; + + if (!pb_field_iter_begin(&iter, fields, dest_struct)) + return; /* Empty message type */ + + do + { + pb_field_set_to_default(&iter); + } while (pb_field_iter_next(&iter)); +} + +/********************* + * Decode all fields * + *********************/ + +bool checkreturn pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) +{ + uint32_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 31) / 32] = {0, 0}; + const uint32_t allbits = ~(uint32_t)0; + uint32_t extension_range_start = 0; + pb_field_iter_t iter; + + /* 'fixed_count_field' and 'fixed_count_size' track position of a repeated fixed + * count field. This can only handle _one_ repeated fixed count field that + * is unpacked and unordered among other (non repeated fixed count) fields. + */ + const pb_field_t *fixed_count_field = NULL; + pb_size_t fixed_count_size = 0; + + /* Return value ignored, as empty message types will be correctly handled by + * pb_field_iter_find() anyway. */ + (void)pb_field_iter_begin(&iter, fields, dest_struct); + + while (stream->bytes_left) + { + uint32_t tag; + pb_wire_type_t wire_type; + bool eof; + + if (!pb_decode_tag(stream, &wire_type, &tag, &eof)) + { + if (eof) + break; + else + return false; + } + + if (!pb_field_iter_find(&iter, tag)) + { + /* No match found, check if it matches an extension. */ + if (tag >= extension_range_start) + { + if (!find_extension_field(&iter)) + extension_range_start = (uint32_t)-1; + else + extension_range_start = iter.pos->tag; + + if (tag >= extension_range_start) + { + size_t pos = stream->bytes_left; + + if (!decode_extension(stream, tag, wire_type, &iter)) + return false; + + if (pos != stream->bytes_left) + { + /* The field was handled */ + continue; + } + } + } + + /* No match found, skip data */ + if (!pb_skip_field(stream, wire_type)) + return false; + continue; + } + + /* If a repeated fixed count field was found, get size from + * 'fixed_count_field' as there is no counter contained in the struct. + */ + if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REPEATED + && iter.pSize == iter.pData) + { + if (fixed_count_field != iter.pos) { + /* If the new fixed count field does not match the previous one, + * check that the previous one is NULL or that it finished + * receiving all the expected data. + */ + if (fixed_count_field != NULL && + fixed_count_size != fixed_count_field->array_size) + { + PB_RETURN_ERROR(stream, "wrong size for fixed count field"); + } + + fixed_count_field = iter.pos; + fixed_count_size = 0; + } + + iter.pSize = &fixed_count_size; + } + + if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REQUIRED + && iter.required_field_index < PB_MAX_REQUIRED_FIELDS) + { + uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31)); + fields_seen[iter.required_field_index >> 5] |= tmp; + } + + if (!decode_field(stream, wire_type, &iter)) + return false; + } + + /* Check that all elements of the last decoded fixed count field were present. */ + if (fixed_count_field != NULL && + fixed_count_size != fixed_count_field->array_size) + { + PB_RETURN_ERROR(stream, "wrong size for fixed count field"); + } + + /* Check that all required fields were present. */ + { + /* First figure out the number of required fields by + * seeking to the end of the field array. Usually we + * are already close to end after decoding. + */ + unsigned req_field_count; + pb_type_t last_type; + unsigned i; + do { + req_field_count = iter.required_field_index; + last_type = iter.pos->type; + } while (pb_field_iter_next(&iter)); + + /* Fixup if last field was also required. */ + if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.pos->tag != 0) + req_field_count++; + + if (req_field_count > PB_MAX_REQUIRED_FIELDS) + req_field_count = PB_MAX_REQUIRED_FIELDS; + + if (req_field_count > 0) + { + /* Check the whole words */ + for (i = 0; i < (req_field_count >> 5); i++) + { + if (fields_seen[i] != allbits) + PB_RETURN_ERROR(stream, "missing required field"); + } + + /* Check the remaining bits (if any) */ + if ((req_field_count & 31) != 0) + { + if (fields_seen[req_field_count >> 5] != + (allbits >> (32 - (req_field_count & 31)))) + { + PB_RETURN_ERROR(stream, "missing required field"); + } + } + } + } + + return true; +} + +bool checkreturn pb_decode(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) +{ + bool status; + pb_message_set_to_defaults(fields, dest_struct); + status = pb_decode_noinit(stream, fields, dest_struct); + +#ifdef PB_ENABLE_MALLOC + if (!status) + pb_release(fields, dest_struct); +#endif + + return status; +} + +bool pb_decode_delimited_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) +{ + pb_istream_t substream; + bool status; + + if (!pb_make_string_substream(stream, &substream)) + return false; + + status = pb_decode_noinit(&substream, fields, dest_struct); + + if (!pb_close_string_substream(stream, &substream)) + return false; + return status; +} + +bool pb_decode_delimited(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) +{ + pb_istream_t substream; + bool status; + + if (!pb_make_string_substream(stream, &substream)) + return false; + + status = pb_decode(&substream, fields, dest_struct); + + if (!pb_close_string_substream(stream, &substream)) + return false; + return status; +} + +bool pb_decode_nullterminated(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct) +{ + /* This behaviour will be separated in nanopb-0.4.0, see issue #278. */ + return pb_decode(stream, fields, dest_struct); +} + +#ifdef PB_ENABLE_MALLOC +/* Given an oneof field, if there has already been a field inside this oneof, + * release it before overwriting with a different one. */ +static bool pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *iter) +{ + pb_size_t old_tag = *(pb_size_t*)iter->pSize; /* Previous which_ value */ + pb_size_t new_tag = iter->pos->tag; /* New which_ value */ + + if (old_tag == 0) + return true; /* Ok, no old data in union */ + + if (old_tag == new_tag) + return true; /* Ok, old data is of same type => merge */ + + /* Release old data. The find can fail if the message struct contains + * invalid data. */ + if (!pb_field_iter_find(iter, old_tag)) + PB_RETURN_ERROR(stream, "invalid union tag"); + + pb_release_single_field(iter); + + /* Restore iterator to where it should be. + * This shouldn't fail unless the pb_field_t structure is corrupted. */ + if (!pb_field_iter_find(iter, new_tag)) + PB_RETURN_ERROR(stream, "iterator error"); + + return true; +} + +static void pb_release_single_field(const pb_field_iter_t *iter) +{ + pb_type_t type; + type = iter->pos->type; + + if (PB_HTYPE(type) == PB_HTYPE_ONEOF) + { + if (*(pb_size_t*)iter->pSize != iter->pos->tag) + return; /* This is not the current field in the union */ + } + + /* Release anything contained inside an extension or submsg. + * This has to be done even if the submsg itself is statically + * allocated. */ + if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) + { + /* Release fields from all extensions in the linked list */ + pb_extension_t *ext = *(pb_extension_t**)iter->pData; + while (ext != NULL) + { + pb_field_iter_t ext_iter; + iter_from_extension(&ext_iter, ext); + pb_release_single_field(&ext_iter); + ext = ext->next; + } + } + else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK) + { + /* Release fields in submessage or submsg array */ + void *pItem = iter->pData; + pb_size_t count = 1; + + if (PB_ATYPE(type) == PB_ATYPE_POINTER) + { + pItem = *(void**)iter->pData; + } + + if (PB_HTYPE(type) == PB_HTYPE_REPEATED) + { + if (PB_ATYPE(type) == PB_ATYPE_STATIC && iter->pSize == iter->pData) { + /* No _count field so use size of the array */ + count = iter->pos->array_size; + } else { + count = *(pb_size_t*)iter->pSize; + } + + if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size) + { + /* Protect against corrupted _count fields */ + count = iter->pos->array_size; + } + } + + if (pItem) + { + while (count--) + { + pb_release((const pb_field_t*)iter->pos->ptr, pItem); + pItem = (char*)pItem + iter->pos->data_size; + } + } + } + + if (PB_ATYPE(type) == PB_ATYPE_POINTER) + { + if (PB_HTYPE(type) == PB_HTYPE_REPEATED && + (PB_LTYPE(type) == PB_LTYPE_STRING || + PB_LTYPE(type) == PB_LTYPE_BYTES)) + { + /* Release entries in repeated string or bytes array */ + void **pItem = *(void***)iter->pData; + pb_size_t count = *(pb_size_t*)iter->pSize; + while (count--) + { + pb_free(*pItem); + *pItem++ = NULL; + } + } + + if (PB_HTYPE(type) == PB_HTYPE_REPEATED) + { + /* We are going to release the array, so set the size to 0 */ + *(pb_size_t*)iter->pSize = 0; + } + + /* Release main item */ + pb_free(*(void**)iter->pData); + *(void**)iter->pData = NULL; + } +} + +void pb_release(const pb_field_t fields[], void *dest_struct) +{ + pb_field_iter_t iter; + + if (!dest_struct) + return; /* Ignore NULL pointers, similar to free() */ + + if (!pb_field_iter_begin(&iter, fields, dest_struct)) + return; /* Empty message type */ + + do + { + pb_release_single_field(&iter); + } while (pb_field_iter_next(&iter)); +} +#endif + +/* Field decoders */ + +bool pb_decode_svarint(pb_istream_t *stream, pb_int64_t *dest) +{ + pb_uint64_t value; + if (!pb_decode_varint(stream, &value)) + return false; + + if (value & 1) + *dest = (pb_int64_t)(~(value >> 1)); + else + *dest = (pb_int64_t)(value >> 1); + + return true; +} + +bool pb_decode_fixed32(pb_istream_t *stream, void *dest) +{ + union { + uint32_t fixed32; + pb_byte_t bytes[4]; + } u; + + if (!pb_read(stream, u.bytes, 4)) + return false; + +#if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && CHAR_BIT == 8 + /* fast path - if we know that we're on little endian, assign directly */ + *(uint32_t*)dest = u.fixed32; +#else + *(uint32_t*)dest = ((uint32_t)u.bytes[0] << 0) | + ((uint32_t)u.bytes[1] << 8) | + ((uint32_t)u.bytes[2] << 16) | + ((uint32_t)u.bytes[3] << 24); +#endif + return true; +} + +#ifndef PB_WITHOUT_64BIT +bool pb_decode_fixed64(pb_istream_t *stream, void *dest) +{ + union { + uint64_t fixed64; + pb_byte_t bytes[8]; + } u; + + if (!pb_read(stream, u.bytes, 8)) + return false; + +#if defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN && CHAR_BIT == 8 + /* fast path - if we know that we're on little endian, assign directly */ + *(uint64_t*)dest = u.fixed64; +#else + *(uint64_t*)dest = ((uint64_t)u.bytes[0] << 0) | + ((uint64_t)u.bytes[1] << 8) | + ((uint64_t)u.bytes[2] << 16) | + ((uint64_t)u.bytes[3] << 24) | + ((uint64_t)u.bytes[4] << 32) | + ((uint64_t)u.bytes[5] << 40) | + ((uint64_t)u.bytes[6] << 48) | + ((uint64_t)u.bytes[7] << 56); +#endif + return true; +} +#endif + +static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + pb_uint64_t value; + pb_int64_t svalue; + pb_int64_t clamped; + if (!pb_decode_varint(stream, &value)) + return false; + + /* See issue 97: Google's C++ protobuf allows negative varint values to + * be cast as int32_t, instead of the int64_t that should be used when + * encoding. Previous nanopb versions had a bug in encoding. In order to + * not break decoding of such messages, we cast <=32 bit fields to + * int32_t first to get the sign correct. + */ + if (field->data_size == sizeof(pb_int64_t)) + svalue = (pb_int64_t)value; + else + svalue = (int32_t)value; + + /* Cast to the proper field size, while checking for overflows */ + if (field->data_size == sizeof(pb_int64_t)) + clamped = *(pb_int64_t*)dest = svalue; + else if (field->data_size == sizeof(int32_t)) + clamped = *(int32_t*)dest = (int32_t)svalue; + else if (field->data_size == sizeof(int_least16_t)) + clamped = *(int_least16_t*)dest = (int_least16_t)svalue; + else if (field->data_size == sizeof(int_least8_t)) + clamped = *(int_least8_t*)dest = (int_least8_t)svalue; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + + if (clamped != svalue) + PB_RETURN_ERROR(stream, "integer too large"); + + return true; +} + +static bool checkreturn pb_dec_uvarint(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + pb_uint64_t value, clamped; + if (!pb_decode_varint(stream, &value)) + return false; + + /* Cast to the proper field size, while checking for overflows */ + if (field->data_size == sizeof(pb_uint64_t)) + clamped = *(pb_uint64_t*)dest = value; + else if (field->data_size == sizeof(uint32_t)) + clamped = *(uint32_t*)dest = (uint32_t)value; + else if (field->data_size == sizeof(uint_least16_t)) + clamped = *(uint_least16_t*)dest = (uint_least16_t)value; + else if (field->data_size == sizeof(uint_least8_t)) + clamped = *(uint_least8_t*)dest = (uint_least8_t)value; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + + if (clamped != value) + PB_RETURN_ERROR(stream, "integer too large"); + + return true; +} + +static bool checkreturn pb_dec_svarint(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + pb_int64_t value, clamped; + if (!pb_decode_svarint(stream, &value)) + return false; + + /* Cast to the proper field size, while checking for overflows */ + if (field->data_size == sizeof(pb_int64_t)) + clamped = *(pb_int64_t*)dest = value; + else if (field->data_size == sizeof(int32_t)) + clamped = *(int32_t*)dest = (int32_t)value; + else if (field->data_size == sizeof(int_least16_t)) + clamped = *(int_least16_t*)dest = (int_least16_t)value; + else if (field->data_size == sizeof(int_least8_t)) + clamped = *(int_least8_t*)dest = (int_least8_t)value; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + + if (clamped != value) + PB_RETURN_ERROR(stream, "integer too large"); + + return true; +} + +static bool checkreturn pb_dec_fixed32(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + PB_UNUSED(field); + return pb_decode_fixed32(stream, dest); +} + +static bool checkreturn pb_dec_fixed64(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + PB_UNUSED(field); +#ifndef PB_WITHOUT_64BIT + return pb_decode_fixed64(stream, dest); +#else + PB_UNUSED(dest); + PB_RETURN_ERROR(stream, "no 64bit support"); +#endif +} + +static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + uint32_t size; + size_t alloc_size; + pb_bytes_array_t *bdest; + + if (!pb_decode_varint32(stream, &size)) + return false; + + if (size > PB_SIZE_MAX) + PB_RETURN_ERROR(stream, "bytes overflow"); + + alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size); + if (size > alloc_size) + PB_RETURN_ERROR(stream, "size too large"); + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { +#ifndef PB_ENABLE_MALLOC + PB_RETURN_ERROR(stream, "no malloc support"); +#else + if (!allocate_field(stream, dest, alloc_size, 1)) + return false; + bdest = *(pb_bytes_array_t**)dest; +#endif + } + else + { + if (alloc_size > field->data_size) + PB_RETURN_ERROR(stream, "bytes overflow"); + bdest = (pb_bytes_array_t*)dest; + } + + bdest->size = (pb_size_t)size; + return pb_read(stream, bdest->bytes, size); +} + +static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + uint32_t size; + size_t alloc_size; + bool status; + if (!pb_decode_varint32(stream, &size)) + return false; + + /* Space for null terminator */ + alloc_size = size + 1; + + if (alloc_size < size) + PB_RETURN_ERROR(stream, "size too large"); + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { +#ifndef PB_ENABLE_MALLOC + PB_RETURN_ERROR(stream, "no malloc support"); +#else + if (!allocate_field(stream, dest, alloc_size, 1)) + return false; + dest = *(void**)dest; +#endif + } + else + { + if (alloc_size > field->data_size) + PB_RETURN_ERROR(stream, "string overflow"); + } + + status = pb_read(stream, (pb_byte_t*)dest, size); + *((pb_byte_t*)dest + size) = 0; + return status; +} + +static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + bool status; + pb_istream_t substream; + const pb_field_t* submsg_fields = (const pb_field_t*)field->ptr; + + if (!pb_make_string_substream(stream, &substream)) + return false; + + if (field->ptr == NULL) + PB_RETURN_ERROR(stream, "invalid field descriptor"); + + /* New array entries need to be initialized, while required and optional + * submessages have already been initialized in the top-level pb_decode. */ + if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED) + status = pb_decode(&substream, submsg_fields, dest); + else + status = pb_decode_noinit(&substream, submsg_fields, dest); + + if (!pb_close_string_substream(stream, &substream)) + return false; + return status; +} + +static bool checkreturn pb_dec_fixed_length_bytes(pb_istream_t *stream, const pb_field_t *field, void *dest) +{ + uint32_t size; + + if (!pb_decode_varint32(stream, &size)) + return false; + + if (size > PB_SIZE_MAX) + PB_RETURN_ERROR(stream, "bytes overflow"); + + if (size == 0) + { + /* As a special case, treat empty bytes string as all zeros for fixed_length_bytes. */ + memset(dest, 0, field->data_size); + return true; + } + + if (size != field->data_size) + PB_RETURN_ERROR(stream, "incorrect fixed length bytes size"); + + return pb_read(stream, (pb_byte_t*)dest, field->data_size); +} diff --git a/pb_encode.c b/pb_encode.c new file mode 100644 index 0000000..f37ceec --- /dev/null +++ b/pb_encode.c @@ -0,0 +1,893 @@ +/* pb_encode.c -- encode a protobuf using minimal resources + * + * 2011 Petteri Aimonen + */ + +#include "pb.h" +#include "pb_encode.h" +#include "pb_common.h" + +/* Use the GCC warn_unused_result attribute to check that all return values + * are propagated correctly. On other compilers and gcc before 3.4.0 just + * ignore the annotation. + */ +#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) + #define checkreturn +#else + #define checkreturn __attribute__((warn_unused_result)) +#endif + +/************************************** + * Declarations internal to this file * + **************************************/ +typedef bool (*pb_encoder_t)(pb_ostream_t *stream, const pb_field_t *field, const void *src) checkreturn; + +static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); +static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field, const void *pData, size_t count, pb_encoder_t func); +static bool checkreturn encode_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData); +static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension); +static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_t *field, const void *pData); +static void *pb_const_cast(const void *p); +static bool checkreturn pb_encode_varint_32(pb_ostream_t *stream, uint32_t low, uint32_t high); +static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src); +static bool checkreturn pb_enc_fixed_length_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src); + +#ifdef PB_WITHOUT_64BIT +#define pb_int64_t int32_t +#define pb_uint64_t uint32_t +#else +#define pb_int64_t int64_t +#define pb_uint64_t uint64_t +#endif + +/* --- Function pointers to field encoders --- + * Order in the array must match pb_action_t LTYPE numbering. + */ +static const pb_encoder_t PB_ENCODERS[PB_LTYPES_COUNT] = { + &pb_enc_varint, + &pb_enc_uvarint, + &pb_enc_svarint, + &pb_enc_fixed32, + &pb_enc_fixed64, + + &pb_enc_bytes, + &pb_enc_string, + &pb_enc_submessage, + NULL, /* extensions */ + &pb_enc_fixed_length_bytes +}; + +/******************************* + * pb_ostream_t implementation * + *******************************/ + +static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) +{ + size_t i; + pb_byte_t *dest = (pb_byte_t*)stream->state; + stream->state = dest + count; + + for (i = 0; i < count; i++) + dest[i] = buf[i]; + + return true; +} + +pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize) +{ + pb_ostream_t stream; +#ifdef PB_BUFFER_ONLY + stream.callback = (void*)1; /* Just a marker value */ +#else + stream.callback = &buf_write; +#endif + stream.state = buf; + stream.max_size = bufsize; + stream.bytes_written = 0; +#ifndef PB_NO_ERRMSG + stream.errmsg = NULL; +#endif + return stream; +} + +bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) +{ + if (stream->callback != NULL) + { + if (stream->bytes_written + count > stream->max_size) + PB_RETURN_ERROR(stream, "stream full"); + +#ifdef PB_BUFFER_ONLY + if (!buf_write(stream, buf, count)) + PB_RETURN_ERROR(stream, "io error"); +#else + if (!stream->callback(stream, buf, count)) + PB_RETURN_ERROR(stream, "io error"); +#endif + } + + stream->bytes_written += count; + return true; +} + +/************************* + * Encode a single field * + *************************/ + +/* Encode a static array. Handles the size calculations and possible packing. */ +static bool checkreturn encode_array(pb_ostream_t *stream, const pb_field_t *field, + const void *pData, size_t count, pb_encoder_t func) +{ + size_t i; + const void *p; + size_t size; + + if (count == 0) + return true; + + if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size) + PB_RETURN_ERROR(stream, "array max size exceeded"); + + /* We always pack arrays if the datatype allows it. */ + if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE) + { + if (!pb_encode_tag(stream, PB_WT_STRING, field->tag)) + return false; + + /* Determine the total size of packed array. */ + if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32) + { + size = 4 * count; + } + else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64) + { + size = 8 * count; + } + else + { + pb_ostream_t sizestream = PB_OSTREAM_SIZING; + p = pData; + for (i = 0; i < count; i++) + { + if (!func(&sizestream, field, p)) + return false; + p = (const char*)p + field->data_size; + } + size = sizestream.bytes_written; + } + + if (!pb_encode_varint(stream, (pb_uint64_t)size)) + return false; + + if (stream->callback == NULL) + return pb_write(stream, NULL, size); /* Just sizing.. */ + + /* Write the data */ + p = pData; + for (i = 0; i < count; i++) + { + if (!func(stream, field, p)) + return false; + p = (const char*)p + field->data_size; + } + } + else + { + p = pData; + for (i = 0; i < count; i++) + { + if (!pb_encode_tag_for_field(stream, field)) + return false; + + /* Normally the data is stored directly in the array entries, but + * for pointer-type string and bytes fields, the array entries are + * actually pointers themselves also. So we have to dereference once + * more to get to the actual data. */ + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER && + (PB_LTYPE(field->type) == PB_LTYPE_STRING || + PB_LTYPE(field->type) == PB_LTYPE_BYTES)) + { + if (!func(stream, field, *(const void* const*)p)) + return false; + } + else + { + if (!func(stream, field, p)) + return false; + } + p = (const char*)p + field->data_size; + } + } + + return true; +} + +/* In proto3, all fields are optional and are only encoded if their value is "non-zero". + * This function implements the check for the zero value. */ +static bool pb_check_proto3_default_value(const pb_field_t *field, const void *pData) +{ + pb_type_t type = field->type; + const void *pSize = (const char*)pData + field->size_offset; + + if (PB_HTYPE(type) == PB_HTYPE_REQUIRED) + { + /* Required proto2 fields inside proto3 submessage, pretty rare case */ + return false; + } + else if (PB_HTYPE(type) == PB_HTYPE_REPEATED) + { + /* Repeated fields inside proto3 submessage: present if count != 0 */ + return *(const pb_size_t*)pSize == 0; + } + else if (PB_HTYPE(type) == PB_HTYPE_ONEOF) + { + /* Oneof fields */ + return *(const pb_size_t*)pSize == 0; + } + else if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->size_offset != 0) + { + /* Proto2 optional fields inside proto3 submessage */ + return *(const bool*)pSize == false; + } + + /* Rest is proto3 singular fields */ + + if (PB_ATYPE(type) == PB_ATYPE_STATIC) + { + if (PB_LTYPE(type) == PB_LTYPE_BYTES) + { + const pb_bytes_array_t *bytes = (const pb_bytes_array_t*)pData; + return bytes->size == 0; + } + else if (PB_LTYPE(type) == PB_LTYPE_STRING) + { + return *(const char*)pData == '\0'; + } + else if (PB_LTYPE(type) == PB_LTYPE_FIXED_LENGTH_BYTES) + { + /* Fixed length bytes is only empty if its length is fixed + * as 0. Which would be pretty strange, but we can check + * it anyway. */ + return field->data_size == 0; + } + else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE) + { + /* Check all fields in the submessage to find if any of them + * are non-zero. The comparison cannot be done byte-per-byte + * because the C struct may contain padding bytes that must + * be skipped. + */ + pb_field_iter_t iter; + if (pb_field_iter_begin(&iter, (const pb_field_t*)field->ptr, pb_const_cast(pData))) + { + do + { + if (!pb_check_proto3_default_value(iter.pos, iter.pData)) + { + return false; + } + } while (pb_field_iter_next(&iter)); + } + return true; + } + } + + { + /* Catch-all branch that does byte-per-byte comparison for zero value. + * + * This is for all pointer fields, and for static PB_LTYPE_VARINT, + * UVARINT, SVARINT, FIXED32, FIXED64, EXTENSION fields, and also + * callback fields. These all have integer or pointer value which + * can be compared with 0. + */ + pb_size_t i; + const char *p = (const char*)pData; + for (i = 0; i < field->data_size; i++) + { + if (p[i] != 0) + { + return false; + } + } + + return true; + } +} + +/* Encode a field with static or pointer allocation, i.e. one whose data + * is available to the encoder directly. */ +static bool checkreturn encode_basic_field(pb_ostream_t *stream, + const pb_field_t *field, const void *pData) +{ + pb_encoder_t func; + bool implicit_has; + const void *pSize = &implicit_has; + + func = PB_ENCODERS[PB_LTYPE(field->type)]; + + if (field->size_offset) + { + /* Static optional, repeated or oneof field */ + pSize = (const char*)pData + field->size_offset; + } + else if (PB_HTYPE(field->type) == PB_HTYPE_OPTIONAL) + { + /* Proto3 style field, optional but without explicit has_ field. */ + implicit_has = !pb_check_proto3_default_value(field, pData); + } + else + { + /* Required field, always present */ + implicit_has = true; + } + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { + /* pData is a pointer to the field, which contains pointer to + * the data. If the 2nd pointer is NULL, it is interpreted as if + * the has_field was false. + */ + pData = *(const void* const*)pData; + implicit_has = (pData != NULL); + } + + switch (PB_HTYPE(field->type)) + { + case PB_HTYPE_REQUIRED: + if (!pData) + PB_RETURN_ERROR(stream, "missing required field"); + if (!pb_encode_tag_for_field(stream, field)) + return false; + if (!func(stream, field, pData)) + return false; + break; + + case PB_HTYPE_OPTIONAL: + if (*(const bool*)pSize) + { + if (!pb_encode_tag_for_field(stream, field)) + return false; + + if (!func(stream, field, pData)) + return false; + } + break; + + case PB_HTYPE_REPEATED: { + pb_size_t count; + if (field->size_offset != 0) { + count = *(const pb_size_t*)pSize; + } else { + count = field->array_size; + } + if (!encode_array(stream, field, pData, count, func)) + return false; + break; + } + + case PB_HTYPE_ONEOF: + if (*(const pb_size_t*)pSize == field->tag) + { + if (!pb_encode_tag_for_field(stream, field)) + return false; + + if (!func(stream, field, pData)) + return false; + } + break; + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } + + return true; +} + +/* Encode a field with callback semantics. This means that a user function is + * called to provide and encode the actual data. */ +static bool checkreturn encode_callback_field(pb_ostream_t *stream, + const pb_field_t *field, const void *pData) +{ + const pb_callback_t *callback = (const pb_callback_t*)pData; + +#ifdef PB_OLD_CALLBACK_STYLE + const void *arg = callback->arg; +#else + void * const *arg = &(callback->arg); +#endif + + if (callback->funcs.encode != NULL) + { + if (!callback->funcs.encode(stream, field, arg)) + PB_RETURN_ERROR(stream, "callback error"); + } + return true; +} + +/* Encode a single field of any callback or static type. */ +static bool checkreturn encode_field(pb_ostream_t *stream, + const pb_field_t *field, const void *pData) +{ + switch (PB_ATYPE(field->type)) + { + case PB_ATYPE_STATIC: + case PB_ATYPE_POINTER: + return encode_basic_field(stream, field, pData); + + case PB_ATYPE_CALLBACK: + return encode_callback_field(stream, field, pData); + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } +} + +/* Default handler for extension fields. Expects to have a pb_field_t + * pointer in the extension->type->arg field. */ +static bool checkreturn default_extension_encoder(pb_ostream_t *stream, + const pb_extension_t *extension) +{ + const pb_field_t *field = (const pb_field_t*)extension->type->arg; + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { + /* For pointer extensions, the pointer is stored directly + * in the extension structure. This avoids having an extra + * indirection. */ + return encode_field(stream, field, &extension->dest); + } + else + { + return encode_field(stream, field, extension->dest); + } +} + +/* Walk through all the registered extensions and give them a chance + * to encode themselves. */ +static bool checkreturn encode_extension_field(pb_ostream_t *stream, + const pb_field_t *field, const void *pData) +{ + const pb_extension_t *extension = *(const pb_extension_t* const *)pData; + PB_UNUSED(field); + + while (extension) + { + bool status; + if (extension->type->encode) + status = extension->type->encode(stream, extension); + else + status = default_extension_encoder(stream, extension); + + if (!status) + return false; + + extension = extension->next; + } + + return true; +} + +/********************* + * Encode all fields * + *********************/ + +static void *pb_const_cast(const void *p) +{ + /* Note: this casts away const, in order to use the common field iterator + * logic for both encoding and decoding. */ + union { + void *p1; + const void *p2; + } t; + t.p2 = p; + return t.p1; +} + +bool checkreturn pb_encode(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) +{ + pb_field_iter_t iter; + if (!pb_field_iter_begin(&iter, fields, pb_const_cast(src_struct))) + return true; /* Empty message type */ + + do { + if (PB_LTYPE(iter.pos->type) == PB_LTYPE_EXTENSION) + { + /* Special case for the extension field placeholder */ + if (!encode_extension_field(stream, iter.pos, iter.pData)) + return false; + } + else + { + /* Regular field */ + if (!encode_field(stream, iter.pos, iter.pData)) + return false; + } + } while (pb_field_iter_next(&iter)); + + return true; +} + +bool pb_encode_delimited(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) +{ + return pb_encode_submessage(stream, fields, src_struct); +} + +bool pb_encode_nullterminated(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) +{ + const pb_byte_t zero = 0; + + if (!pb_encode(stream, fields, src_struct)) + return false; + + return pb_write(stream, &zero, 1); +} + +bool pb_get_encoded_size(size_t *size, const pb_field_t fields[], const void *src_struct) +{ + pb_ostream_t stream = PB_OSTREAM_SIZING; + + if (!pb_encode(&stream, fields, src_struct)) + return false; + + *size = stream.bytes_written; + return true; +} + +/******************** + * Helper functions * + ********************/ + +/* This function avoids 64-bit shifts as they are quite slow on many platforms. */ +static bool checkreturn pb_encode_varint_32(pb_ostream_t *stream, uint32_t low, uint32_t high) +{ + size_t i = 0; + pb_byte_t buffer[10]; + pb_byte_t byte = (pb_byte_t)(low & 0x7F); + low >>= 7; + + while (i < 4 && (low != 0 || high != 0)) + { + byte |= 0x80; + buffer[i++] = byte; + byte = (pb_byte_t)(low & 0x7F); + low >>= 7; + } + + if (high) + { + byte = (pb_byte_t)(byte | ((high & 0x07) << 4)); + high >>= 3; + + while (high) + { + byte |= 0x80; + buffer[i++] = byte; + byte = (pb_byte_t)(high & 0x7F); + high >>= 7; + } + } + + buffer[i++] = byte; + + return pb_write(stream, buffer, i); +} + +bool checkreturn pb_encode_varint(pb_ostream_t *stream, pb_uint64_t value) +{ + if (value <= 0x7F) + { + /* Fast path: single byte */ + pb_byte_t byte = (pb_byte_t)value; + return pb_write(stream, &byte, 1); + } + else + { +#ifdef PB_WITHOUT_64BIT + return pb_encode_varint_32(stream, value, 0); +#else + return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)(value >> 32)); +#endif + } +} + +bool checkreturn pb_encode_svarint(pb_ostream_t *stream, pb_int64_t value) +{ + pb_uint64_t zigzagged; + if (value < 0) + zigzagged = ~((pb_uint64_t)value << 1); + else + zigzagged = (pb_uint64_t)value << 1; + + return pb_encode_varint(stream, zigzagged); +} + +bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value) +{ + uint32_t val = *(const uint32_t*)value; + pb_byte_t bytes[4]; + bytes[0] = (pb_byte_t)(val & 0xFF); + bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); + bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); + bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); + return pb_write(stream, bytes, 4); +} + +#ifndef PB_WITHOUT_64BIT +bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value) +{ + uint64_t val = *(const uint64_t*)value; + pb_byte_t bytes[8]; + bytes[0] = (pb_byte_t)(val & 0xFF); + bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); + bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); + bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); + bytes[4] = (pb_byte_t)((val >> 32) & 0xFF); + bytes[5] = (pb_byte_t)((val >> 40) & 0xFF); + bytes[6] = (pb_byte_t)((val >> 48) & 0xFF); + bytes[7] = (pb_byte_t)((val >> 56) & 0xFF); + return pb_write(stream, bytes, 8); +} +#endif + +bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number) +{ + pb_uint64_t tag = ((pb_uint64_t)field_number << 3) | wiretype; + return pb_encode_varint(stream, tag); +} + +bool checkreturn pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_t *field) +{ + pb_wire_type_t wiretype; + switch (PB_LTYPE(field->type)) + { + case PB_LTYPE_VARINT: + case PB_LTYPE_UVARINT: + case PB_LTYPE_SVARINT: + wiretype = PB_WT_VARINT; + break; + + case PB_LTYPE_FIXED32: + wiretype = PB_WT_32BIT; + break; + + case PB_LTYPE_FIXED64: + wiretype = PB_WT_64BIT; + break; + + case PB_LTYPE_BYTES: + case PB_LTYPE_STRING: + case PB_LTYPE_SUBMESSAGE: + case PB_LTYPE_FIXED_LENGTH_BYTES: + wiretype = PB_WT_STRING; + break; + + default: + PB_RETURN_ERROR(stream, "invalid field type"); + } + + return pb_encode_tag(stream, wiretype, field->tag); +} + +bool checkreturn pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size) +{ + if (!pb_encode_varint(stream, (pb_uint64_t)size)) + return false; + + return pb_write(stream, buffer, size); +} + +bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_field_t fields[], const void *src_struct) +{ + /* First calculate the message size using a non-writing substream. */ + pb_ostream_t substream = PB_OSTREAM_SIZING; + size_t size; + bool status; + + if (!pb_encode(&substream, fields, src_struct)) + { +#ifndef PB_NO_ERRMSG + stream->errmsg = substream.errmsg; +#endif + return false; + } + + size = substream.bytes_written; + + if (!pb_encode_varint(stream, (pb_uint64_t)size)) + return false; + + if (stream->callback == NULL) + return pb_write(stream, NULL, size); /* Just sizing */ + + if (stream->bytes_written + size > stream->max_size) + PB_RETURN_ERROR(stream, "stream full"); + + /* Use a substream to verify that a callback doesn't write more than + * what it did the first time. */ + substream.callback = stream->callback; + substream.state = stream->state; + substream.max_size = size; + substream.bytes_written = 0; +#ifndef PB_NO_ERRMSG + substream.errmsg = NULL; +#endif + + status = pb_encode(&substream, fields, src_struct); + + stream->bytes_written += substream.bytes_written; + stream->state = substream.state; +#ifndef PB_NO_ERRMSG + stream->errmsg = substream.errmsg; +#endif + + if (substream.bytes_written != size) + PB_RETURN_ERROR(stream, "submsg size changed"); + + return status; +} + +/* Field encoders */ + +static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + pb_int64_t value = 0; + + if (field->data_size == sizeof(int_least8_t)) + value = *(const int_least8_t*)src; + else if (field->data_size == sizeof(int_least16_t)) + value = *(const int_least16_t*)src; + else if (field->data_size == sizeof(int32_t)) + value = *(const int32_t*)src; + else if (field->data_size == sizeof(pb_int64_t)) + value = *(const pb_int64_t*)src; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + +#ifdef PB_WITHOUT_64BIT + if (value < 0) + return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)-1); + else +#endif + return pb_encode_varint(stream, (pb_uint64_t)value); +} + +static bool checkreturn pb_enc_uvarint(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + pb_uint64_t value = 0; + + if (field->data_size == sizeof(uint_least8_t)) + value = *(const uint_least8_t*)src; + else if (field->data_size == sizeof(uint_least16_t)) + value = *(const uint_least16_t*)src; + else if (field->data_size == sizeof(uint32_t)) + value = *(const uint32_t*)src; + else if (field->data_size == sizeof(pb_uint64_t)) + value = *(const pb_uint64_t*)src; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + + return pb_encode_varint(stream, value); +} + +static bool checkreturn pb_enc_svarint(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + pb_int64_t value = 0; + + if (field->data_size == sizeof(int_least8_t)) + value = *(const int_least8_t*)src; + else if (field->data_size == sizeof(int_least16_t)) + value = *(const int_least16_t*)src; + else if (field->data_size == sizeof(int32_t)) + value = *(const int32_t*)src; + else if (field->data_size == sizeof(pb_int64_t)) + value = *(const pb_int64_t*)src; + else + PB_RETURN_ERROR(stream, "invalid data_size"); + + return pb_encode_svarint(stream, value); +} + +static bool checkreturn pb_enc_fixed64(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + PB_UNUSED(field); +#ifndef PB_WITHOUT_64BIT + return pb_encode_fixed64(stream, src); +#else + PB_UNUSED(src); + PB_RETURN_ERROR(stream, "no 64bit support"); +#endif +} + +static bool checkreturn pb_enc_fixed32(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + PB_UNUSED(field); + return pb_encode_fixed32(stream, src); +} + +static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + const pb_bytes_array_t *bytes = NULL; + + bytes = (const pb_bytes_array_t*)src; + + if (src == NULL) + { + /* Treat null pointer as an empty bytes field */ + return pb_encode_string(stream, NULL, 0); + } + + if (PB_ATYPE(field->type) == PB_ATYPE_STATIC && + PB_BYTES_ARRAY_T_ALLOCSIZE(bytes->size) > field->data_size) + { + PB_RETURN_ERROR(stream, "bytes size exceeded"); + } + + return pb_encode_string(stream, bytes->bytes, bytes->size); +} + +static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + size_t size = 0; + size_t max_size = field->data_size; + const char *p = (const char*)src; + + if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) + { + max_size = (size_t)-1; + } + else + { + /* pb_dec_string() assumes string fields end with a null + * terminator when the type isn't PB_ATYPE_POINTER, so we + * shouldn't allow more than max-1 bytes to be written to + * allow space for the null terminator. + */ + if (max_size == 0) + PB_RETURN_ERROR(stream, "zero-length string"); + + max_size -= 1; + } + + + if (src == NULL) + { + size = 0; /* Treat null pointer as an empty string */ + } + else + { + /* strnlen() is not always available, so just use a loop */ + while (size < max_size && *p != '\0') + { + size++; + p++; + } + + if (*p != '\0') + { + PB_RETURN_ERROR(stream, "unterminated string"); + } + } + + return pb_encode_string(stream, (const pb_byte_t*)src, size); +} + +static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + if (field->ptr == NULL) + PB_RETURN_ERROR(stream, "invalid field descriptor"); + + return pb_encode_submessage(stream, (const pb_field_t*)field->ptr, src); +} + +static bool checkreturn pb_enc_fixed_length_bytes(pb_ostream_t *stream, const pb_field_t *field, const void *src) +{ + return pb_encode_string(stream, (const pb_byte_t*)src, field->data_size); +} + diff --git a/simple.proto b/simple.proto deleted file mode 100644 index 5c73a3b..0000000 --- a/simple.proto +++ /dev/null @@ -1,9 +0,0 @@ -// A very simple protocol definition, consisting of only -// one message. - -syntax = "proto2"; - -message SimpleMessage { - required int32 lucky_number = 1; -} - diff --git a/util/dds_config.cpp b/util/dds_config.cpp new file mode 100644 index 0000000..42c21c0 --- /dev/null +++ b/util/dds_config.cpp @@ -0,0 +1,84 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All +Rights Reserved. +Permission to use, copy, modify, and distribute this software and its +documentation for +educational, research, and not-for-profit purposes, without fee and without a +signed licensing +agreement, is hereby granted, provided that the above copyright notice, this +paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. +Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, +CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for +commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS +SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE +AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO +OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + +#include "dds_config.h" + +using drivers::ad9959::AD9959; + +namespace util { +void DDSConfig::configure_up(AD9959 dds, params_t params) { + dds.reset(); + dds.set_freq_linear_sweep_params(AD9959::Channel0, params.mult, + params.chirp_start_hex, + params.chirp_stop_hex, + params.chirp_freq_hex, // up + params.chirp_freq_hex * 10, // down + params.chirp_time_hex, // up + params.chirp_time_hex // down + ); + + dds.set_freq_linear_sweep_params(AD9959::Channel1, params.mult, + params.clk_transition_hex, + params.chirp_start_hex, + params.mw_freq_hex, // up + params.mw_freq_hex * 10, // down + params.mw_time_hex, // up + params.mw_time_hex // down + ); + + dds.io_update(); +} +void DDSConfig::configure_down(AD9959 dds, params_t params) { + dds.reset(); + dds.set_freq_linear_sweep_params(AD9959::Channel0, params.mult, + params.chirp_stop_hex, + params.chirp_start_hex, + params.chirp_freq_hex * 10, // up + params.chirp_freq_hex, // down + params.chirp_time_hex, // up + params.chirp_time_hex // down + ); + + dds.set_freq_linear_sweep_params(AD9959::Channel1, params.mult, + params.chirp_start_hex, + params.clk_transition_hex, + params.mw_freq_hex * 10, // up + params.mw_freq_hex, // down + params.mw_time_hex, // up + params.mw_time_hex // down + ); + + dds.io_update(); +} + +} // namespace util diff --git a/util/dds_config.h b/util/dds_config.h new file mode 100644 index 0000000..11cbf4f --- /dev/null +++ b/util/dds_config.h @@ -0,0 +1,50 @@ +/*********************************** +Copyright ©2019. The Regents of the University of California (Regents). All Rights Reserved. +Permission to use, copy, modify, and distribute this software and its documentation for +educational, research, and not-for-profit purposes, without fee and without a signed licensing +agreement, is hereby granted, provided that the above copyright notice, this paragraph and the +following two paragraphs appear in all copies, modifications, and distributions. Contact The Office +of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, +(510) 643-7201, otl@berkeley.edu, http://ipira.berkeley.edu/industry-info for commercial licensing +opportunities. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR +CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING +DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +***********************************/ + +#ifndef _UTIL_DDS_H_ +#define _UTIL_DDS_H_ + +#include "drivers/ad9959/ad9959.h" + +namespace util { + +class DDSConfig +{ + public: + struct params_t + { + uint8_t mult; + uint32_t clk_transition_hex; + uint32_t chirp_start_hex; + uint32_t chirp_stop_hex; + uint32_t mw_time_hex; + uint32_t mw_freq_hex; + uint32_t chirp_time_hex; + uint32_t chirp_freq_hex; + double actual_chirp; + double detuning; + }; + + void configure_up(drivers::ad9959::AD9959 dds, params_t params); + void configure_down(drivers::ad9959::AD9959 dds, params_t params); +}; + +} // namespace util +#endif // _UTIL_DDS_H_ diff --git a/util/macros.h b/util/macros.h new file mode 100644 index 0000000..eabab90 --- /dev/null +++ b/util/macros.h @@ -0,0 +1,9 @@ +#define WRITE_IO(PORT, ON_BITS, OFF_BITS) \ + PORT->ODR = ((PORT->ODR & ~(OFF_BITS)) | (ON_BITS)) +#define BITS_NONE (0) + +#define ARRAYSIZE(a) \ + ((sizeof(a) / sizeof(*(a))) / \ + static_cast(!(sizeof(a) % sizeof(*(a))))) + +#define STOP while(1); \ No newline at end of file