├── .config ├── .gitignore ├── CHANGELOG ├── COPYING ├── Makefile ├── README ├── README.app ├── README.compiling ├── README.dongle ├── README.hacking ├── buildall.sh ├── config-stc ├── include ├── librf24 │ ├── adaptor.h │ └── usb-helper.h ├── requests.h └── rf24boot.h ├── kcnf ├── librf24pp ├── Makefile ├── TODO ├── blackjack.mk ├── include │ └── librf24 │ │ ├── easylogging++.hpp │ │ ├── librf24.hpp │ │ ├── rf24adaptor.hpp │ │ ├── rf24address.hpp │ │ ├── rf24boot.hpp │ │ ├── rf24conftransfer.hpp │ │ ├── rf24defs.h │ │ ├── rf24iotransfer.hpp │ │ ├── rf24libusbadaptor.hpp │ │ ├── rf24packet.hpp │ │ ├── rf24popentransfer.hpp │ │ ├── rf24sweeptransfer.hpp │ │ ├── rf24transfer.hpp │ │ └── rf24writetransfer.hpp ├── main.cpp ├── rf24-load.cpp ├── rf24-outlet-test.cpp ├── rf24-send.cpp ├── rf24-sweep.cpp ├── rf24adaptor.cpp ├── rf24address.cpp ├── rf24conftransfer.cpp ├── rf24iotransfer.cpp ├── rf24libusbadaptor.cpp ├── rf24packet.cpp ├── rf24popentransfer.cpp ├── rf24ptable.cpp ├── rf24sweeptransfer.cpp ├── rf24transfer.cpp └── rf24writetransfer.cpp ├── m328p_run_app.sh ├── m328p_run_boot.sh ├── prebuilt ├── nrfdongle-20000000Hz.hex ├── rf24boot-red-wisp.hex ├── rf24boot-rfoutlet.hex ├── rf24boot-strip-wisp.hex └── rf24boot-viko-wisp.hex ├── production_configs ├── nrfdongle-20M ├── rf24boot-red-wisp ├── rf24boot-rfoutlet ├── rf24boot-strip-wisp └── rf24boot-viko-wisp └── src ├── 8051 ├── Makefile └── platform-stc.c ├── .#device.c ├── .#test.c ├── Makefile ├── avr ├── Makefile ├── avr-boot-common.c ├── bootlock-avr.c └── kcnf ├── bootcond-timed.c ├── cb.c ├── cb.h ├── dummypart.c ├── hacks ├── Makefile ├── hacks-lightctl.c └── kcnf ├── master.c ├── native ├── Makefile ├── adaptor-factory.c ├── librf24.c └── main.c ├── packet-listener.c ├── packet-sender.c ├── slave.c └── uisp-app.c /.gitignore: -------------------------------------------------------------------------------- 1 | antares 2 | build 3 | *~ 4 | #*# 5 | *.o 6 | *.d 7 | tmp 8 | 9 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | == 0.3 == 2 | 3 | N.B.: Remember to update antares to the latest master 4 | 5 | rf24tool: 6 | * Detect vusb dongle bootloader and boot it 7 | * More sane debugging output with --trace 8 | * Make use of new 'bulk' transfer mode 9 | * Ditch continuity counter from the protocol, it is handled in hardware now. 10 | * rf24tool API reworked and prepared to be released as a library in the next release 11 | 12 | bootloader: 13 | * Implement DEADTIME option 14 | * Use new 'bulk' transfer mode 15 | * No more continuity counter, it is handled in hardware now 16 | * New 'dummy' partition in for benchmarking 17 | * Free up ~120 bytes of code memory 18 | 19 | 20 | == 0.2 == 21 | programming dongle: 22 | * New hardware design with 16M crystal FTW! 23 | * Ultra-cheap 5x5 cm single-sided design 24 | * Implemented hardware packet buffering and async operation 25 | (e.g. It's now flashes faster. Really faster!) 26 | 27 | rf24tool: 28 | * Refactor rf24tool code and ditch all warnings 29 | * Code cleanup (still ugly in places, but readable at least) 30 | * Implement support for multiple adaptors. 31 | * Huge performance improvements 32 | * Stability improvements with far nodes 33 | * Brand new test suite 34 | * Spectrum inspection and plotting 35 | 36 | bootloader: 37 | * Do not screw up when several packets are stuck in RX FIFO at once 38 | * Minor performance and size improvements 39 | 40 | == 0.1 == 41 | Initial release 42 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SRCDIR=antares 2 | GITURL=https://nekromant@github.com/nekromant/antares.git 3 | OBJDIR=. 4 | TMPDIR=tmp 5 | TOPDIR=. 6 | project_sources=src 7 | ANTARES_DIR:=./antares 8 | 9 | ifeq ($(ANTARES_INSTALL_DIR),) 10 | antares: 11 | git clone $(GITURL) $(ANTARES_DIR) 12 | @echo "I have fetched the antares sources for you to $(ANTARES_DIR)" 13 | @echo "Please, re-run make" 14 | else 15 | antares: 16 | ln -sf $(ANTARES_INSTALL_DIR) $(ANTARES_DIR) 17 | @echo "Using global antares installation: $(ANTARES_INSTALL_DIR)" 18 | @echo "Symlinking done, please re-run make" 19 | endif 20 | 21 | -include antares/Makefile 22 | 23 | define PKG_CONFIG 24 | CFLAGS += $$(shell pkg-config --cflags $(1)) 25 | LDFLAGS += $$(shell pkg-config --libs $(1)) 26 | endef 27 | 28 | ifeq ($(CONFIG_ROLE_USERSPACE),y) 29 | $(eval $(call PKG_CONFIG,libusb-1.0)) 30 | endif 31 | 32 | # You can define any custom make rules right here! 33 | # They will can be later hooked as default make target 34 | # in menuconfig 35 | 36 | rf24tool: 37 | cd rf24tool/ && make all 38 | 39 | rf24tool-%: 40 | cd rf24tool/ && make $(*) 41 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | What the heck is this thing? 2 | ---------------------------- 3 | 4 | It's a bootloader for AVR and other micros that can deliver your code 5 | to the MCU via cheap nrf24l01 wireless modules. 6 | 7 | Is it good? 8 | ----------- 9 | 10 | * Clean architecture 11 | * Very portable, since it's based off antares 12 | * Easy to integrate external memory devices, since 13 | it supports several memory partitions. 14 | * Easy to add your own device-specific hacks. 15 | 16 | Can I use it with arduino? 17 | -------------------------- 18 | 19 | Yes, you can. The bootloader doesn't care where you got your file from. 20 | Be it arduino, avr-gcc, avr-brainfuck compiler, /dev/urandom or even astral ;) 21 | 22 | Does it work with intel hex? 23 | ---------------------------- 24 | 25 | Not yet. rf24tool only accepts binary files. So either add -Obinary to your 26 | makefiles, or use srecord/hex2bin to get a binary file. 27 | 28 | Does it work under windows? 29 | --------------------------- 30 | 31 | No. Only Linux and other *nix flavors that have libusb. Patches welcome. 32 | 33 | Does it work under Mac OS X? 34 | --------------------------- 35 | 36 | No. Only Linux and other *nix flavors that have libusb. Patches welcome. 37 | 38 | What about usb programming dongle? 39 | ---------------------------------- 40 | 41 | See README.dongle 42 | 43 | How to connect nrf24l01 with avr/arduino? 44 | ----------------------------------------- 45 | 46 | See README.compiling. If the relevant section is not enough for you, I 47 | suggest you give official nrf24l01 datasheet a read as well as avr's 48 | datasheet. I can't pack a book 'avr for dummies' into a small README file. 49 | Sorry. 50 | 51 | Can I use nrf24l01 wired directly to Raspberry Pi/OpenWRT Router/Toaster? 52 | ------------------------------------------------------------------------- 53 | Theoretically - yes. Practically - you'll need to implement spidev or 54 | gpio-bitbang adaptor for rf24tool. 55 | See rf24tool/adaptor-uisp.c as a reference. 56 | This is TODO, yet not a priority one. 57 | 58 | Daunting documents worth reading 59 | -------------------------------- 60 | README.compiling - How to compile the bootloader for your device. 61 | README.hacking - If you want to help out by porting to new devices. 62 | README.dongle - How to get your programming dongle up and running. 63 | README.app - How to compile the userspace app. 64 | 65 | Dude, this crazy stuff is too hard on my brains 66 | ----------------------------------------------- 67 | 68 | And who said it will be easy? Go take a break, try again and send me some 69 | patches. 70 | 71 | -------------------------------------------------------------------------------- /README.app: -------------------------------------------------------------------------------- 1 | Userspace utilities 2 | ------------------- 3 | 4 | The userspace consists of only one utility (rf24tool) that is used to upload 5 | your code to the target device. 6 | Navigate to rf24tool directory and run 7 | make 8 | sudo make install 9 | Provided that you have libusb-dev installed, you'll get your app in the system. 10 | You can now plug in your adaptor and start using it. 11 | 12 | rf24tool --help provides a rough help that will let you get started. 13 | 14 | -------------------------------------------------------------------------------- /README.compiling: -------------------------------------------------------------------------------- 1 | Note: This stuff is beta! Patches welcome, dragons ahead. 2 | For info on programming dongle, see README.dongle 3 | For info on linux userspace app, see README.app 4 | 5 | Hardware connection 6 | ------------------- 7 | 8 | The rf24boot doesn't make use of the IRQ line, so you may leave it 9 | disconnected. For avr you can use either hardware SPI or soft-SPI. 10 | This can be set in "Project Settings -> Hardware config" 11 | Make sure to fill in appropriate lines. 12 | 13 | Note on SS line when using hardware SPI on AVR: 14 | The SS line needs to be specified and WILL be configured as output. 15 | You can use it for CE or CSN, but it must be set as output. 16 | This is AVR hardware weirdness. 17 | 18 | For software SPI any free GPIO pins would do with no special 19 | considerations. 20 | 21 | Prereqs 22 | -------- 23 | 24 | Install antares. Follow instructions at http://github.com/nekromant/antares 25 | 26 | Compiling the bootloader 27 | ------------------------ 28 | 29 | Copy the starting config. Use config_m328pbootldr as a starting point for the actual bootloader. 30 | 31 | cp config_m328pbootldr .config 32 | 33 | Adjust settings using 'make menuconfig' as required. 34 | Normally you'll need to set your target MCU, tick 'Run in bootloader section' 35 | and set bootloader address for AVR. 36 | 37 | PITFALL: AVR fuse calcs and datasheets show the bootloader section size in WORDS, 38 | while antares, like gcc expects a hex value in BYTES. 39 | 40 | PITFALL#2: Tripple check that fuses in config are correct for your device 41 | Otherwise you may brick you micro. 42 | 43 | Then burn it to your board with avrdude. Remember to set the fuses correctly 44 | to enable boot reset vector. Everything should work out of the box. 45 | The bootloader should fit in 4k for avr. If it doesn't, check the following stuff: 46 | * Completely disable everything in Libraries->Console and IO. 47 | * Under target platform tick "Extra size optimisations" 48 | 49 | Debugging 50 | --------- 51 | Enabling debugging will considerably (+2K) bloat the bootloader. 52 | You can burn it to application section for debugging, and test 53 | reading and writing the eeprom and dummy partitions. 54 | 55 | To enable debugging: 56 | make manuconfig 57 | 58 | Navigate to 59 | 60 | Libraries and drivers -> Console and IO 61 | 62 | Enable early console and set it to something you have on your board, 63 | like AVR HW serial port. 64 | Make sure you select avr-libc glue as well. 65 | 66 | Enable 'printk and dbg() macro support' 67 | 68 | You are done. Compile and burn it to your board, you should see debugging 69 | coming from the serial port of your choice. 70 | 71 | rf24 library debugging can be tuned in: 72 | 73 | Libraries and drivers -> Wireless devices -> nrf24L01 support 74 | 75 | 0 - stands for debugging disabled 76 | 5 - stands for very verbose 77 | 78 | Compiling the uISP app 79 | ---------------------- 80 | 81 | Normally you won't need this, since rf24tool will be in your 'uappmgr'. 82 | If you don't have it already in the list - run 'uappmgr update' 83 | 84 | Get an uISP dongle. Order, etch, make yours... Whatever. 85 | See github.com/uISP for schematics and firmware. 86 | 87 | Use config_uispdongle as a starting config. Any atmega with vusb and nrf24l01 88 | can do the trick with a little bit of hacking ;). 89 | 90 | Here are the schematics and an ultra-cheap (1 layer!) PCB design of one such dongle: 91 | https://github.com/nekromant/nrf24l01-dongle 92 | 93 | If you have this one use config_nrfdongle to get you bootloader app 94 | 95 | Compiling the rf24tool 96 | ---------------------- 97 | cd rf24tool 98 | make 99 | sudo make install 100 | 101 | Or just copy the rf24tool somewhere to your $PATH. 102 | 103 | See rf24tool --help for info on different options 104 | 105 | Enjoy, remember to share, comment post... or don't do any, 106 | but just send your patches! 107 | 108 | -------------------------------------------------------------------------------- /README.dongle: -------------------------------------------------------------------------------- 1 | For programming there are 2 dongles now available. 2 | * A hacky dongle connected ontop of uISP (http://github.com/uISP) 3 | * A more clean dongle based off atmega8 and a regular 8pin nrf24l01 module. 4 | 5 | The latter one is recommended, you can grab the schematics and PCB designs here: 6 | https://github.com/nekromant/nrf24l01-dongle 7 | 8 | 9 | 10 | Bootloader for programming adaptor that interacts with a bootloader 11 | ------------------------------------------------------------------- 12 | The dongle is based off vusb, and reuses uISP's bootloader, so once you get your 13 | hardware ready you need to burn the bootloader (yep, yet another one!). 14 | 15 | You can either get the prebuilt hex files from dongle-bootloader/ 16 | Or compile yourself. You'll have to do this if you come up with a your own 17 | hardware design. 18 | 19 | git clone https://github.com/uISP/uisp-bootloader.git 20 | cd uisp-bootloader 21 | cp config_nrfdongle .config 22 | 23 | At this point you may want to run 'menuconfig' and check that you have the correct crystal 24 | frequency, proper deployment method and etc. set up. 25 | 26 | Then run 27 | 28 | make 29 | make deploy #(Or manually burn the hex file from images/ directory) 30 | 31 | 32 | 33 | Installing userspace 34 | -------------------- 35 | 36 | Again, uISP's userspace app is reused to upload code to your device, so we'll need 37 | to compile and install it. 38 | 39 | Follow the instructions here: 40 | https://github.com/uISP/uisp-userspace 41 | 42 | Compiling dongle sourcecode 43 | --------------------------- 44 | 45 | Either grab a hex from dongle-app/ and upload it to your dongle by running 46 | 47 | uisptool -f ./dongle-app/rf24-16M.hex 48 | 49 | Or compile by hand: 50 | ----------------- 51 | 52 | 53 | cp config_nrfdongle .config 54 | make menuconfig (adjust whatever you want) 55 | make 56 | make deploy 57 | 58 | Known Issues 59 | ------------- 60 | I know at least one USB 3.0 host that screws up somewhere along the way and 61 | data corruption happens. This is likely vusb-specific. -------------------------------------------------------------------------------- /README.hacking: -------------------------------------------------------------------------------- 1 | Basically you'll find all the sources in src/ 2 | The top-level project configuration is defined in ./kcnf in kconfig format. 3 | 4 | To port to a new platform you have to: 5 | 6 | * Implement any initial code to bring up the platform. 7 | 8 | * define the rf24 instance, with all the needed stuff (e.g.initialize the spi/implement bitbang!) 9 | See src/avr/platform-avr.c for HW spi example 10 | See src/avr/platform-avrsoft.c for bitbang spi example 11 | 12 | * Define partitions and routines to read/write them. 13 | See example in src/avr/avr-boot-common.c 14 | 15 | * Define how should partitions be booted: 16 | See example in src/avr/avr-boot-common.c 17 | 18 | * Write a nice config for all you options 19 | 20 | * Any board-specific hacks should go to a separate file in src/hacks/ 21 | and have a bool option to be disabled. 22 | 23 | -------------------------------------------------------------------------------- /buildall.sh: -------------------------------------------------------------------------------- 1 | for c in `ls production_configs/`; do \ 2 | cp production_configs/$c .config; \ 3 | make clean; \ 4 | make build; \ 5 | cp images/*.hex prebuilt/; \ 6 | cp .config production_configs/$c; \ 7 | done 8 | 9 | -------------------------------------------------------------------------------- /config-stc: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Antares Firmware Config 4 | # 5 | CONFIG_ARCH_HAS_ANTARES_STARTUP=y 6 | 7 | # 8 | # Target platform settings 9 | # 10 | CONFIG_ARCH_8051=y 11 | # CONFIG_ARCH_ARM is not set 12 | # CONFIG_ARCH_AVR is not set 13 | # CONFIG_ARCH_GBZ80 is not set 14 | # CONFIG_ARCH_MIPS is not set 15 | # CONFIG_ARCH_MSP430 is not set 16 | # CONFIG_ARCH_NATIVE is not set 17 | # CONFIG_ARCH_NMC is not set 18 | # CONFIG_ARCH_PIC32 is not set 19 | CONFIG_ARCH_8051_STC=y 20 | # CONFIG_ARCH_8051_AT89 is not set 21 | CONFIG_F_CPU=13000000 22 | CONFIG_MODEL_SMALL=y 23 | # CONFIG_MODEL_MEDIUM is not set 24 | # CONFIG_MODEL_LARGE is not set 25 | # CONFIG_MODEL_HUGE is not set 26 | CONFIG_XRAM_SIZE=1024 27 | CONFIG_IRAM_SIZE=256 28 | CONFIG_FLASH_SIZE=61440 29 | 30 | # 31 | # Platform-specific libraries 32 | # 33 | CONFIG_LIB_STC_IAP=y 34 | 35 | # 36 | # Toolchain settings 37 | # 38 | # CONFIG_SHOW_ALL_TOOLCHAINS is not set 39 | CONFIG_TOOLCHAIN_SDCC=y 40 | CONFIG_SDCC_CFLAGS="" 41 | CONFIG_SDCC_ASFLAGS="" 42 | CONFIG_SDCC_LDFLAGS="" 43 | 44 | # 45 | # Libraries and drivers 46 | # 47 | # CONFIG_SHOW_BROKEN is not set 48 | CONFIG_LIB_ANTARES_CORE=y 49 | CONFIG_ANTARES_STARTUP=y 50 | CONFIG_LIB_INITCALL=y 51 | # CONFIG_LIB_INITCALL_DEBUG is not set 52 | # CONFIG_LIB_TMGR is not set 53 | 54 | # 55 | # Console and IO 56 | # 57 | CONFIG_LIB_EARLYCON=y 58 | CONFIG_LIB_EARLYCON_STCUART=y 59 | # CONFIG_LIB_EARLYCON_GLUE_NONE is not set 60 | CONFIG_LIB_EARLYCON_GLUE_SDCC=y 61 | # CONFIG_LIB_EARLYCON_ANNOUNCE is not set 62 | CONFIG_LIB_EARLYCON_ADDCR=y 63 | CONFIG_LIB_EARLYCON_STCUART_BAUD=38400 64 | # CONFIG_LIB_EARLYCON_STCUART_USE_P1 is not set 65 | # CONFIG_LIB_EARLYCON_STCUART_IAPCHECK is not set 66 | CONFIG_LIB_PRINTK=y 67 | # CONFIG_LIB_PRINTK_PREFIX is not set 68 | CONFIG_LIB_PANIC_NONE=y 69 | # CONFIG_LIB_PANIC is not set 70 | 71 | # 72 | # Wireless devices 73 | # 74 | CONFIG_LIB_RF24=y 75 | CONFIG_LIB_RF24_DEBUG=0 76 | CONFIG_LIB_RF24_SIZEOPT=y 77 | # CONFIG_LIB_RF24_SWEEP is not set 78 | CONFIG_LIB_RF24_SWEEP_CARRIER=y 79 | # CONFIG_LIB_RF24_SWEEP_RPD is not set 80 | 81 | # 82 | # Data storage devices 83 | # 84 | # CONFIG_LIB_SPISD is not set 85 | 86 | # 87 | # Misc drivers and libraries 88 | # 89 | # CONFIG_LIB_XSSCU is not set 90 | 91 | # 92 | # Data transfer protocols 93 | # 94 | # CONFIG_LIB_XMODEM is not set 95 | CONFIG_LIB_DELAY_8051=y 96 | CONFIG_LIB_DELAY=y 97 | 98 | # 99 | # Nothing to tune for 8051, everything should work out of the box 100 | # 101 | # CONFIG_LIB_STLINKY is not set 102 | # CONFIG_LIB_URPC is not set 103 | 104 | # 105 | # 3rd-party libraries 106 | # 107 | 108 | # 109 | # Project Settings 110 | # 111 | CONFIG_DEBUGGING_VERBOSITY=5 112 | 113 | # 114 | # Userspace app requires ARCH_NATIVE 115 | # 116 | 117 | # 118 | # uISP/vUSB app requires ARCH_AVR 119 | # 120 | CONFIG_ROLE_SLAVE=y 121 | 122 | # 123 | # Wireless settings 124 | # 125 | CONFIG_RF_CHANNEL=13 126 | CONFIG_RF_ADDR_0=0xb0 127 | CONFIG_RF_ADDR_1=0x0b 128 | CONFIG_RF_ADDR_2=0x10 129 | CONFIG_RF_ADDR_3=0xad 130 | CONFIG_RF_ADDR_4=0xed 131 | # CONFIG_RF_RATE_250KBPS is not set 132 | # CONFIG_RF_RATE_1MBPS is not set 133 | CONFIG_RF_RATE_2MBPS=y 134 | CONFIG_SLAVE_ID="light-ctl" 135 | # CONFIG_HAVE_DEADTIME is not set 136 | CONFIG_BOOTCOND_FOREVER=y 137 | # CONFIG_BOOTCOND_TIMED is not set 138 | CONFIG_PART_DUMMY=y 139 | CONFIG_DUMMYPART_SIZE=131072 140 | CONFIG_DUMMYPART_IOSIZE=16 141 | CONFIG_DUMMYPART_PAD=0 142 | 143 | # 144 | # Project-specific hacks 145 | # 146 | 147 | # 148 | # Deployment settings 149 | # 150 | # CONFIG_DEPLOY_ROOT is not set 151 | 152 | # 153 | # Pick the deployment methods you need below 154 | # 155 | # CONFIG_DEPLOY_RF24TOOL is not set 156 | CONFIG_DEPLOY_STCDUDE=y 157 | CONFIG_DEPLOY_STCDUDE_BAUDLOW=1200 158 | CONFIG_DEPLOY_STCDUDE_BAUDHIGH=38400 159 | CONFIG_DEPLOY_STCDUDE_PORT="/dev/ttyUSB0" 160 | CONFIG_DEPLOY_STCDUDE_COMMANDLINE="" 161 | # CONFIG_DEPLOY_ZMODEM is not set 162 | 163 | # 164 | # Custom deployment methods 165 | # 166 | 167 | # 168 | # Build System Configuration 169 | # 170 | CONFIG_MAKE_DEFTARGET="build" 171 | CONFIG_DEPLOY_DEFTARGET="avrdude" 172 | # CONFIG_NOCOLOR is not set 173 | # CONFIG_THREADED is not set 174 | CONFIG_IMAGE_FILENAME="antares" 175 | CONFIG_IMAGE_DIR="images" 176 | CONFIG_NEED_GENERATE=y 177 | # CONFIG_BUILD_VERBOSE is not set 178 | 179 | # 180 | # Version Information 181 | # 182 | 183 | # 184 | # +++ For reference only +++ 185 | # 186 | 187 | # 188 | # All values below are to be filled by Make scripts 189 | # 190 | 191 | # 192 | # Use make set_version to change 193 | # 194 | CONFIG_VERSION_MAJOR="0" 195 | CONFIG_VERSION_MINOR="2-rc1" 196 | CONFIG_VERSION_CODENAME="Insane Mushroom" 197 | CONFIG_VERSION_STRING="0.2-rc1, Insane Mushroom" 198 | CONFIG_VERSION_GIT="655864091914cb06a0aefde09536bfb422ef989f" 199 | -------------------------------------------------------------------------------- /include/librf24/adaptor.h: -------------------------------------------------------------------------------- 1 | #ifndef ADAPTOR_H 2 | #define ADAPTOR_H 3 | 4 | #include "../include/requests.h" 5 | 6 | struct rf24_transfer; 7 | 8 | typedef void (*rf24_transfer_cb_fn)(struct rf24_transfer *transfer); 9 | 10 | struct rf24_packet { 11 | uint8_t reserved[8]; /* Reserved to avoid memcopying in libusb */ 12 | uint8_t pipe; 13 | uint8_t data[32]; 14 | } __attribute__((packed)); 15 | 16 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) 17 | 18 | enum rf24_transfer_status { 19 | RF24_TRANSFER_IDLE=0, 20 | RF24_TRANSFER_RUNNING, 21 | RF24_TRANSFER_COMPLETED, 22 | RF24_TRANSFER_FAIL, /* Max retries */ 23 | RF24_TRANSFER_ERROR, /* Hardware fault */ 24 | RF24_TRANSFER_TIMED_OUT, 25 | RF24_TRANSFER_CANCELLED, 26 | RF24_TRANSFER_CANCELLING, 27 | }; 28 | 29 | enum rf24_transfer_type { 30 | RF24_TRANSFER_IOCLEAR=0, 31 | RF24_TRANSFER_READ, 32 | RF24_TRANSFER_WRITE, 33 | RF24_TRANSFER_SWEEP, 34 | RF24_TRANSFER_CONFIG, 35 | RF24_TRANSFER_OPENPIPE, 36 | }; 37 | 38 | enum rf24_queue_mode { 39 | RF24_QUEUE_TX_STREAM, 40 | RF24_QUEUE_TX_BULK, 41 | RF24_QUEUE_RX 42 | }; 43 | 44 | #define RF24_TRANSFER_FLAG_FREE 1 45 | 46 | struct rf24_transfer { 47 | struct rf24_adaptor *a; 48 | enum rf24_transfer_type type; 49 | enum rf24_transfer_status status; 50 | 51 | unsigned int flags; 52 | unsigned int timeout_ms; 53 | unsigned int timeout_ms_left; 54 | rf24_transfer_cb_fn callback; 55 | void *userdata; 56 | void *adaptordata; 57 | struct rf24_transfer *next; 58 | 59 | union { 60 | /* IO transfer */ 61 | struct { 62 | int transfermode; 63 | size_t num_allocated; 64 | size_t num_data_packets; 65 | size_t num_ack_packets; 66 | size_t num_data_packets_sent; 67 | size_t num_ack_packets_sent; 68 | struct rf24_packet *data; 69 | struct rf24_packet *ackdata; 70 | } io ; 71 | /* Sweep transfer */ 72 | struct { 73 | uint8_t sweepdata[128]; 74 | int sweeptimes; 75 | } sweep; 76 | /* config transfer */ 77 | struct rf24_config conf; 78 | /* Open pipe transfer */ 79 | struct { 80 | int pipe; 81 | char addr[5]; 82 | } pipeopen; 83 | }; 84 | }; 85 | 86 | 87 | struct rf24_adaptor { 88 | char *name; 89 | int debug; 90 | struct rf24_config *conf; 91 | 92 | struct rf24_transfer *current; 93 | struct rf24_transfer *last; 94 | 95 | int (*allocate_transferdata)(struct rf24_transfer *t); 96 | int (*init)(void *s, int argc, char* argv[]); 97 | void (*usage)(void); 98 | 99 | /* Hardware stuff */ 100 | void (*set_ce)(void *self, int ce); 101 | void (*set_csn)(void *self, int csn); 102 | void (*spi_write)(void *self, unsigned char *data, size_t len); 103 | void (*spi_read)(void *self, unsigned char *data, size_t len); 104 | 105 | int (*handle_events)(void *a); 106 | int (*handle_events_completed)(void *a, int *completion); 107 | const struct libusb_pollfd** (*get_pollfds)(struct rf24_adaptor *a); 108 | struct rf24_adaptor *next; 109 | }; 110 | 111 | void rf24tool_register_adaptor(void *a); 112 | struct rf24_adaptor *rf24_get_adaptor_by_name(char* name); 113 | struct rf24_adaptor *rf24_get_default_adaptor(); 114 | void rf24_list_adaptors(); 115 | 116 | 117 | #define TRACE(fmt, ...) if (trace) fprintf(stderr, "ENTER: %s " fmt , __FUNCTION__, ##__VA_ARGS__); 118 | 119 | /** 120 | * Power Amplifier level. 121 | * 122 | * For use with setPALevel() 123 | */ 124 | typedef enum { RF24_PA_MIN = 0,RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ; 125 | 126 | /** 127 | * Data rate. How fast data moves through the air. 128 | * 129 | * For use with setDataRate() 130 | */ 131 | typedef enum { RF24_1MBPS = 0, RF24_2MBPS, RF24_250KBPS } rf24_datarate_e; 132 | 133 | /** 134 | * CRC Length. How big (if any) of a CRC is included. 135 | * 136 | * For use with setCRCLength() 137 | */ 138 | typedef enum { RF24_CRC_DISABLED = 0, RF24_CRC_8, RF24_CRC_16 } rf24_crclength_e; 139 | 140 | 141 | #define EXPORT_ADAPTOR(name) \ 142 | void name ## _export(); \ 143 | void (*const name ## _high []) (void) \ 144 | __attribute__ ((section (".init_array"), aligned (sizeof (void *)))) = \ 145 | { \ 146 | &name ## _export \ 147 | }; \ 148 | void name ## _export() { \ 149 | rf24tool_register_adaptor(&name); \ 150 | } 151 | #endif 152 | 153 | void rf24_config(struct rf24_adaptor *a, struct rf24_config *conf); 154 | 155 | 156 | /* 157 | void rf24_mode(struct rf24_adaptor *a, int mode); 158 | void rf24_open_reading_pipe(struct rf24_adaptor *a, int pipe, char *addr); 159 | void rf24_open_writing_pipe(struct rf24_adaptor *a, char *addr); 160 | int rf24_write(struct rf24_adaptor *a, void *buffer, int size); 161 | int rf24_read(struct rf24_adaptor *a, int *pipe, void *buffer, int size); 162 | int rf24_sync(struct rf24_adaptor *a, uint16_t timeout); 163 | void rf24_flush(struct rf24_adaptor *a); 164 | int rf24_init(struct rf24_adaptor *a, int argc, char *argv[]); 165 | int rf24_sweep(struct rf24_adaptor *a, int times, uint8_t *buffer, int size); 166 | */ 167 | 168 | 169 | 170 | 171 | /* Async API */ 172 | struct rf24_transfer *rf24_allocate_io_transfer (struct rf24_adaptor *a, int npackets); 173 | struct rf24_transfer *rf24_allocate_sweep_transfer (struct rf24_adaptor *a, int times); 174 | struct rf24_transfer *rf24_allocate_config_transfer (struct rf24_adaptor *a, struct rf24_config *conf); 175 | struct rf24_transfer *rf24_allocate_openpipe_transfer (struct rf24_adaptor *a, enum rf24_pipe pipe, char* addr); 176 | 177 | 178 | int librf24_make_read_transfer(struct rf24_transfer *t, int numpackets); 179 | int librf24_make_write_transfer(struct rf24_transfer *t, int mode); 180 | 181 | int librf24_add_packet(struct rf24_transfer *t, char* data, int len, int pipe); 182 | 183 | void librf24_set_transfer_timeout(struct rf24_transfer *t, int timeout_ms); 184 | void librf24_set_transfer_callback(struct rf24_transfer *t, rf24_transfer_cb_fn callback); 185 | 186 | int librf24_submit_transfer(struct rf24_transfer *t); 187 | void librf24_cancel_transfer(struct rf24_transfer *t); 188 | 189 | int librf24_handle_events(struct rf24_adaptor *a); 190 | int librf24_handle_events_completed(struct rf24_adaptor *a, int *completion); 191 | 192 | void librf24_callback(struct rf24_transfer *t); 193 | 194 | const struct libusb_pollfd** librf24_get_pollfds(struct rf24_adaptor *a); 195 | -------------------------------------------------------------------------------- /include/librf24/usb-helper.h: -------------------------------------------------------------------------------- 1 | #ifndef USBHELPER_H 2 | #define USBHELPER_H 3 | 4 | usb_dev_handle *nc_usb_open(int vendor, int product, char *vendor_name, char *product_name, char *serial); 5 | 6 | usb_dev_handle *usb_check_device(struct usb_device *dev, 7 | char *vendor_name, 8 | char *product_name, 9 | char *serial); 10 | 11 | int usb_match_string(usb_dev_handle *handle, int index, char* string); 12 | 13 | 14 | 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /include/requests.h: -------------------------------------------------------------------------------- 1 | #ifndef REQUESTS_H 2 | #define REQUESTS_H 3 | 4 | #ifndef __attribute_packed__ 5 | #define __attribute_packed__ __attribute__((packed)) 6 | #endif 7 | 8 | struct rf24_usb_config { 9 | unsigned char channel; 10 | unsigned char pa; 11 | unsigned char rate; 12 | unsigned char num_retries; 13 | unsigned char retry_timeout; 14 | unsigned char ack_payloads; 15 | unsigned char dynamic_payloads; 16 | unsigned char payload_size; 17 | unsigned char crclen; 18 | unsigned char pipe_auto_ack; 19 | } __attribute_packed__ ; 20 | 21 | 22 | struct rf24_dongle_status { 23 | uint8_t cb_count; 24 | uint8_t cb_size; 25 | uint8_t acb_count; 26 | uint8_t acb_size; 27 | uint8_t last_tx_failed; 28 | uint8_t fifo_is_empty; 29 | } __attribute_packed__ ; 30 | 31 | enum rf24_mode { 32 | MODE_IDLE = 0, 33 | MODE_READ, 34 | MODE_WRITE_STREAM, 35 | MODE_WRITE_BULK, 36 | MODE_ANY 37 | }; 38 | 39 | enum rf24_pipe { 40 | PIPE_READ_0=0, 41 | PIPE_READ_1, 42 | PIPE_READ_2, 43 | PIPE_READ_3, 44 | PIPE_READ_4, 45 | PIPE_READ_5, 46 | PIPE_WRITE, 47 | }; 48 | 49 | enum { 50 | RQ_NOP=0, 51 | RQ_CONFIG, 52 | RQ_OPEN_PIPE, 53 | RQ_MODE, 54 | RQ_READ, 55 | RQ_WRITE, 56 | RQ_SWEEP, 57 | RQ_POLL, 58 | RQ_SYNC, 59 | RQ_FLUSH 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/rf24boot.h: -------------------------------------------------------------------------------- 1 | #ifndef RF24BOOT_H 2 | #define RF24BOOT_H 3 | 4 | #ifdef CONFIG_TOOLCHAIN_SDCC 5 | #define PACKED 6 | #else 7 | #define PACKED __attribute__ ((packed)) 8 | #endif 9 | 10 | #ifndef PACKED 11 | #define PACKED __attribute__ ((packed)) 12 | #endif 13 | 14 | enum rf24boot_op { 15 | RF_OP_HELLO = 0, 16 | RF_OP_PARTINFO, 17 | RF_OP_BOOT, 18 | RF_OP_READ, 19 | RF_OP_WRITE, 20 | RF_OP_NOP, 21 | }; 22 | 23 | #define RF24BOOT_MAX_IOSIZE 26 24 | 25 | #define RF24BOOT_CMDSIZE(iosize) \ 26 | (sizeof(struct rf24boot_cmd) - RF24BOOT_MAX_IOSIZE + iosize) 27 | 28 | /* This generic packet is just a cont. counter + opcode */ 29 | struct rf24boot_cmd 30 | { 31 | uint8_t op; /* opcode */ 32 | uint8_t data[31]; 33 | } PACKED; 34 | 35 | /* for read & write */ 36 | struct rf24boot_data 37 | { 38 | uint8_t part; 39 | uint32_t addr; 40 | uint8_t data[RF24BOOT_MAX_IOSIZE]; 41 | } PACKED; 42 | 43 | /* response to a hello packet */ 44 | struct rf24boot_hello_resp { 45 | uint8_t numparts; 46 | uint8_t is_big_endian; 47 | char id[29]; 48 | } PACKED; 49 | 50 | /* op_partinfo */ 51 | struct rf24boot_partition_header { 52 | uint8_t iosize; 53 | uint32_t size; 54 | uint16_t pad; 55 | char name[8]; 56 | } PACKED; 57 | 58 | struct rf24boot_partition { 59 | struct rf24boot_partition_header info; 60 | int (*read)(struct rf24boot_partition* part, uint32_t addr, unsigned char* buf); 61 | void (*write)(struct rf24boot_partition* part, uint32_t addr, const unsigned char* data); 62 | }; 63 | 64 | extern struct rf24 *g_radio; 65 | extern uint8_t g_rf24boot_got_hello; 66 | 67 | void rf24boot_add_part(struct rf24boot_partition *part); 68 | void rf24boot_boot_partition(struct rf24boot_partition *part); 69 | void rf24boot_boot_by_name(char* name); 70 | uint8_t rf24boot_got_hello(); 71 | void rf24boot_platform_reset(); 72 | 73 | 74 | #define BOOT_PARTITION(part) ANTARES_INIT_LOW(addpart ## part) \ 75 | { \ 76 | rf24boot_add_part( &part ) ; \ 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /kcnf: -------------------------------------------------------------------------------- 1 | config DEBUGGING_VERBOSITY 2 | int "Debugging level (See help)" 3 | help 4 | See README.compiling for detals on how to enable debug 5 | Without early console enabled this will affect nothing 6 | 7 | 8 | if !ROLE_USERSPACE && !ARCH_NATIVE 9 | comment "Userspace app requires ARCH_NATIVE" 10 | endif 11 | 12 | if !ROLE_UISP && !ARCH_AVR 13 | comment "uISP/vUSB app requires ARCH_AVR" 14 | endif 15 | 16 | choice 17 | 18 | prompt "Target" 19 | 20 | config ROLE_SLAVE 21 | bool "Bootloader for device" 22 | 23 | config ROLE_UISP 24 | bool "uISP/vUSB USB dongle" 25 | depends on ARCH_AVR 26 | 27 | config ROLE_SENDER 28 | bool "Dummy packet flooder" 29 | depends on ARCH_AVR 30 | 31 | config ROLE_LISTENER 32 | bool "Packet listener" 33 | depends on ARCH_AVR 34 | 35 | config ROLE_USERSPACE 36 | bool "Native app" 37 | depends on ARCH_NATIVE 38 | endchoice 39 | 40 | if ROLE_UISP 41 | config USB_CFG_SERIAL_NUMBER 42 | string "Device identifier" 43 | endif 44 | 45 | 46 | menu "Wireless settings" 47 | depends on ROLE_SLAVE || ROLE_SENDER || ROLE_LISTENER 48 | 49 | config RF_CHANNEL 50 | int "RF Channel" 51 | default 76 52 | 53 | config RF_ADDR_0 54 | hex "RF Device Adress byte 0" 55 | range 0 0xff 56 | 57 | config RF_ADDR_1 58 | hex "RF Device Adress byte 1" 59 | range 0 0xff 60 | 61 | config RF_ADDR_2 62 | hex "RF Device Adress byte 2" 63 | range 0 0xff 64 | 65 | config RF_ADDR_3 66 | hex "RF Device Adress byte 3" 67 | range 0 0xff 68 | 69 | config RF_ADDR_4 70 | hex "RF Device Adress byte 4" 71 | range 0 0xff 72 | 73 | choice 74 | prompt "RF Data rate" 75 | 76 | config RF_RATE_250KBPS 77 | bool "250KBPS" 78 | 79 | config RF_RATE_1MBPS 80 | bool "1MBPS" 81 | 82 | config RF_RATE_2MBPS 83 | bool "2MBPS" 84 | endchoice 85 | 86 | endmenu 87 | 88 | if ARCH_AVR 89 | source src/avr/kcnf 90 | endif 91 | 92 | 93 | 94 | if ROLE_SLAVE 95 | 96 | config SLAVE_ID 97 | string "Device Name" 98 | default "rfboot" 99 | 100 | config HAVE_DEADTIME 101 | bool "Reboot on stalled outgoing transfers (see help)" 102 | default n 103 | help 104 | With this option on the device will reboot if 105 | the outgoing transfer get stuck for more than N seconds. 106 | e.g. The host program gets interrupted. 107 | Disabling this saves a few bytes. 108 | Consider using hardware watchdog instead 109 | 110 | config DEADTIME_TIMEOUT 111 | int "Deadtime timeout, seconds" 112 | default 5 113 | depends on HAVE_DEADTIME 114 | 115 | config WDT_ENABLE 116 | bool "Enable hardware watchdog on start" 117 | depends on ARCH_AVR 118 | 119 | config WDT_DISABLE 120 | bool "Disable hadrware watchdog when executing application" 121 | depends on ARCH_AVR 122 | 123 | choice 124 | prompt "Bootloader leave condition" 125 | config BOOTCOND_FOREVER 126 | bool "Stay in bootloader until host instructs to boot" 127 | 128 | config BOOTCOND_TIMED 129 | depends on !ARCH_AVR 130 | bool "Stay in bootloader for a specified amount of time" 131 | 132 | config BOOTCOND_TIMED_AVR 133 | bool "Stay in bootloader for a specified amount of time (AVR)" 134 | depends on ARCH_AVR 135 | 136 | endchoice 137 | 138 | if BOOTCOND_TIMED || BOOTCOND_TIMED_AVR 139 | 140 | config DEFAULT_BOOTPART 141 | string "Default boot partition" 142 | default "flash" 143 | 144 | config BOOTCOND_TIMEOUT 145 | int "Timeout in ms" 146 | help 147 | If no commands are received for this time 148 | the bootloader will start user application 149 | A valid 'hello' from remote target will stop 150 | this timer. 151 | endif 152 | 153 | menuconfig PART_DUMMY 154 | bool "Dummy partition (for benchmarks)" 155 | 156 | if PART_DUMMY 157 | config DUMMYPART_SIZE 158 | int "Size" 159 | default 131072 160 | 161 | config DUMMYPART_IOSIZE 162 | int "IO Size" 163 | default 16 164 | 165 | config DUMMYPART_PAD 166 | int "Padding" 167 | default 0 168 | 169 | endif 170 | 171 | 172 | menu "Project-specific hacks" 173 | 174 | source "src/hacks/kcnf" 175 | 176 | endmenu 177 | 178 | endif 179 | 180 | if ROLE_UISP 181 | config HW_BUFFER_SIZE 182 | int "SRAM buffer size (in packets)" 183 | default 16 184 | help 185 | This value must be power of 2. e.g. 186 | 1, 2, 4, 8, 16, etc.. 187 | endif 188 | -------------------------------------------------------------------------------- /librf24pp/Makefile: -------------------------------------------------------------------------------- 1 | -include blackjack.mk 2 | -include $(objects:%.o=%.d) 3 | 4 | utils+=test 5 | objects-test+=main.o 6 | utils+=rf24-sweep 7 | objects-rf24-sweep+=rf24-sweep.o 8 | utils+=rf24-boot 9 | objects-rf24-boot+=rf24-load.o rf24ptable.o 10 | utils+=rf24-send 11 | objects-rf24-send+=rf24-send.o 12 | utils+=rf24-outlet-test 13 | objects-rf24-outlet-test+=rf24-outlet-test.o 14 | 15 | #Developer mode. TODO: Production mode with pkg-config 16 | define util_rule 17 | $(1): $$(objects-$(1)) $(objects) 18 | $$(SILENT_LD)$$(CXX) -o $$(@) $$^ $$(LDFLAGS) 19 | 20 | uobjects+=$$(objects-$(1)) 21 | endef 22 | 23 | CPPFLAGS += $(shell pkg-config --cflags libusb-1.0) 24 | CPPFLAGS +=-MD -MP -std=c++0x -Iinclude -Wall -g -fpermissive 25 | CPPFLAGS += -DELPP_DISABLE_DEBUG_LOGS 26 | LDFLAGS = $(shell pkg-config --libs libusb-1.0) 27 | 28 | objects+=\ 29 | rf24libusbadaptor.o \ 30 | rf24packet.o \ 31 | rf24transfer.o \ 32 | rf24popentransfer.o \ 33 | rf24sweeptransfer.o \ 34 | rf24iotransfer.o \ 35 | rf24conftransfer.o \ 36 | rf24adaptor.o \ 37 | rf24address.o 38 | 39 | %.o: %.cpp 40 | $(SILENT_CXX)$(CXX) -c $(CPPFLAGS) -o $(@) $< 41 | 42 | 43 | all: $(utils) 44 | 45 | $(foreach u,$(utils),$(eval $(call util_rule,$(u)))) 46 | 47 | clean: 48 | $(SILENT_CLEAN) rm -f $(utils) $(addsuffix .d,$(objects)) $(objects) $(uobjects) 49 | -------------------------------------------------------------------------------- /librf24pp/TODO: -------------------------------------------------------------------------------- 1 | rf24-utils: 2 | Implement rf24-send *SMD 3 | Implement rf24-listen *SMD 4 | Implement rf24-promisc *SMD 5 | rf24-boot: 6 | Fix EEPROM bug *ncrmnt 7 | Implement diet-nordic to reduce size (2k - our target!) *ncrmnt 8 | Fix progressbar weirdness *ncrmnt 9 | Implement verification 10 | Add more synchronos wrappers in rf24adaptor.cpp code 11 | Add Documentation 12 | -------------------------------------------------------------------------------- /librf24pp/blackjack.mk: -------------------------------------------------------------------------------- 1 | # Handle OS Specifics 2 | ifeq ($(OS),Windows_NT) 3 | HOST_OS=Windows 4 | OS_WHICH=where 5 | OS_NULL=shit 6 | OS_ECHO=cecho 7 | else 8 | HOST_OS := $(shell uname -s) 9 | OS_WHICH=which 10 | OS_NULL=/dev/null 11 | OS_ECHO=echo 12 | endif 13 | 14 | 15 | ifeq ($(HOST_OS),Windows) 16 | tb_blk=\x1b[30m 17 | tb_red=\x1b[31m 18 | tb_grn=\x1b[32m 19 | tb_ylw=\x1b[33m 20 | tb_ylw=\x1b[33m 21 | tb_blu=\x1b[34m 22 | tb_pur=\x1b[35m 23 | tb_cyn=\x1b[36m 24 | tb_wht=\x1b[37m 25 | col_rst=\x1b[0m 26 | ECHO:=cecho 27 | else 28 | 29 | OS_ECHO:=echo 30 | ifeq ($(HOST_OS),Linux) 31 | ECHOC:=echo -e '\e 32 | endif 33 | 34 | ifeq ($(HOST_OS),Darwin) 35 | ECHOC:=echo '\x1B 36 | endif 37 | 38 | 39 | t_blk=$(shell $(ECHOC)[0;30m') 40 | t_red=$(shell $(ECHOC)[0;31m') 41 | t_grn=$(shell $(ECHOC)[0;32m') 42 | t_ylw=$(shell $(ECHOC)[0;33m') 43 | t_blu=$(shell $(ECHOC)[0;34m') 44 | t_pur=$(shell $(ECHOC)[0;35m') 45 | t_cyn=$(shell $(ECHOC)[0;36m') 46 | t_wht=$(shell $(ECHOC)[0;37m') 47 | 48 | tb_blk=$(shell $(ECHOC)[1;30m') 49 | tb_red=$(shell $(ECHOC)[1;31m') 50 | tb_grn=$(shell $(ECHOC)[1;32m') 51 | tb_ylw=$(shell $(ECHOC)[1;33m') 52 | tb_blu=$(shell $(ECHOC)[1;34m') 53 | tb_pur=$(shell $(ECHOC)[1;35m') 54 | tb_cyn=$(shell $(ECHOC)[1;36m') 55 | tb_wht=$(shell $(ECHOC)[1;37m') 56 | 57 | tu_blk=$(shell $(ECHOC)[4;30m') 58 | tu_red=$(shell $(ECHOC)[4;31m') 59 | tu_grn=$(shell $(ECHOC)[4;32m') 60 | tu_ylw=$(shell $(ECHOC)[4;33m') 61 | tu_blu=$(shell $(ECHOC)[4;34m') 62 | tu_pur=$(shell $(ECHOC)[4;35m') 63 | tu_cyn=$(shell $(ECHOC)[4;36m') 64 | tu_wht=$(shell $(ECHOC)[4;37m') 65 | 66 | bg_blk=$(shell $(ECHOC)[40m') 67 | bg_red=$(shell $(ECHOC)[41m') 68 | bg_grn=$(shell $(ECHOC)[42m') 69 | bg_ylw=$(shell $(ECHOC)[43m') 70 | bg_blu=$(shell $(ECHOC)[44m') 71 | bg_pur=$(shell $(ECHOC)[45m') 72 | bg_cyn=$(shell $(ECHOC)[46m') 73 | bg_wht=$(shell $(ECHOC)[47m') 74 | col_rst=$(shell $(ECHOC)[0m') 75 | 76 | endif 77 | 78 | 79 | ifeq ($(DEBUG),) 80 | SILENT_CONFIG = @$(OS_ECHO) ' $(tb_cyn)[CONF]$(col_rst) '$(subst \,/,$(@)) && 81 | SILENT_DEP = @$(OS_ECHO) ' $(tb_wht)[DEP]$(col_rst) '$(subst \,/,$(@)).dep && 82 | SILENT_NMCPP = @$(OS_ECHO) ' $(tb_ylw)[NMCPP]$(col_rst) '$(subst \,/,$(@)) && 83 | SILENT_ASM = @$(OS_ECHO) ' $(tb_grn)[ASM]$(col_rst) '$(subst \,/,$(@)) && 84 | SILENT_LINKER = @$(OS_ECHO) ' $(tb_pur)[LINKER]$(col_rst) '$(subst \,/,$(@)) && 85 | SILENT_AR = @$(OS_ECHO) ' $(tb_cyn)[AR]$(col_rst) '$(subst \,/,$(@)) && 86 | SILENT_NMDUMP = @$(OS_ECHO) ' $(tb_blu)[NMDUMP]$(col_rst) '$(subst \,/,$(@)) && 87 | SILENT_IMG = @$(OS_ECHO) ' $(tb_cyn)[IMG]$(col_rst) '$(subst \,/,$(@)) && 88 | SILENT_CLEAN = @$(OS_ECHO) ' $(tb_cyn)[CLEAN]$(col_rst) '$(subst \,/,$(@)) && 89 | SILENT_GEN = @$(OS_ECHO) ' $(tb_grn)[GEN]$(col_rst) '$(subst \,/,$(@)) && 90 | SILENT_CHECK = @$(OS_ECHO) ' $(tb_ylw)[CHECK]$(col_rst) '$(subst \,/,$$(1)) && 91 | SILENT_CC = @$(OS_ECHO) ' $(tb_ylw)[CC]$(col_rst) ' $(subst \,/,$(@)) && 92 | SILENT_CXX = @$(OS_ECHO) ' $(tb_ylw)[CXX]$(col_rst) ' $(subst \,/,$(@)) && 93 | SILENT_LD = @$(OS_ECHO) ' $(tb_pur)[LD]$(col_rst) ' $(subst \,/,$(@)) && 94 | SILENT_DEB = @$(OS_ECHO) ' $(tb_blu)[DPKG-DEB]$(col_rst) ' nmc-utils-$(*).deb && 95 | SILENT_AR = @$(OS_ECHO) ' $(tb_cyn)[AR]$(col_rst) ' $(subst \,/,$(@)) && 96 | SILENT_PKGCONFIG = @$(OS_ECHO) ' $(tb_cyn)[PKGCONFIG]$(col_rst) ' $(subst \,/,$(@)) && 97 | SILENT_INSTALL = @$(OS_ECHO) ' $(tb_grn)[INSTALL]$(col_rst) ' $(b) && 98 | 99 | #Shut up this crap 100 | MAKEFLAGS+=--no-print-directory 101 | endif 102 | 103 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/librf24.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | inline std::ostream& operator<<(std::ostream& out, struct librf24::rf24_usb_config currentConfig) 15 | { 16 | out << "Channel : " << (int) (currentConfig.channel) << std::endl; 17 | out << "Rate : "; 18 | switch (currentConfig.rate) { 19 | case librf24::RF24_2MBPS: 20 | out << "2 Mbps" << std::endl; 21 | break; 22 | case librf24::RF24_1MBPS: 23 | out << "1 Mbps" << std::endl; 24 | break; 25 | case librf24::RF24_250KBPS: 26 | out << "250 Kbps" << std::endl; 27 | break; 28 | }; 29 | out << "Power Ampl : "; 30 | switch (currentConfig.pa) { 31 | case librf24::RF24_PA_MIN: 32 | out << "[| ], Min" << std::endl; 33 | break; 34 | case librf24::RF24_PA_LOW: 35 | out << "[|| ], Low" << std::endl; 36 | break; 37 | case librf24::RF24_PA_HIGH: 38 | out << "[||| ], High" << std::endl; 39 | break; 40 | case librf24::RF24_PA_MAX: 41 | out << "[||||], Max" << std::endl; 42 | break; 43 | default: 44 | out << "[ ? ], Error" << std::endl; 45 | break; 46 | } 47 | 48 | out << "CRC : "; 49 | switch (currentConfig.crclen) { 50 | case librf24::RF24_CRC_DISABLED: 51 | out << "Disabled" << std::endl; 52 | break; 53 | case librf24::RF24_CRC_8: 54 | out << "8 bit" << std::endl; 55 | break; 56 | case librf24::RF24_CRC_16: 57 | out << "16 bit" << std::endl; 58 | break; 59 | } 60 | 61 | out << "Retries : " << (int) currentConfig.num_retries << std::endl; 62 | out << "Retry delay : " << ((int) currentConfig.retry_timeout) * 250 << " uS " << std::endl; 63 | out << "Dynamic payloads : " << (currentConfig.dynamic_payloads ? "yes" : "no") << std::endl; 64 | out << "Payload size : " << (int) currentConfig.payload_size << std::endl; 65 | out << "Ack payloads : " << (currentConfig.ack_payloads ? "yes" : "no") << std::endl; 66 | out << "Auto-ack : "; 67 | for (int i=0; i<6; i++) { 68 | if (currentConfig.pipe_auto_ack & (1< 3 | #include 4 | #include 5 | 6 | namespace librf24 { 7 | class LibRF24Transfer; 8 | class LibRF24Packet; 9 | class LibRF24Adaptor { 10 | protected: 11 | 12 | public: 13 | LibRF24Adaptor(); 14 | ~LibRF24Adaptor(); 15 | uint64_t currentTime(); 16 | static void printAllAdaptorsHelp(); 17 | static LibRF24Adaptor *fromArgs(int argc, const char **argv); 18 | virtual bool submit(LibRF24Transfer *t); 19 | virtual bool cancel(LibRF24Transfer *t); 20 | virtual void loopOnce(); 21 | virtual void loopForever(); 22 | virtual const char* getName() { return nullptr; }; 23 | virtual std::vector> getPollFds(); 24 | enum rf24_transfer_status setConfigFromArgs(int argc, const char **argv); 25 | enum rf24_transfer_status setConfig(const struct rf24_usb_config *conf); 26 | const struct rf24_usb_config *getCurrentConfig(); 27 | enum rf24_transfer_status pipeOpen(enum rf24_pipe pipe, unsigned char addr[5]); 28 | bool write(const char *data, size_t len); 29 | size_t read(enum rf24_pipe *pipe, char *data, size_t len, int timeout_ms); 30 | protected: 31 | friend class LibRF24Transfer; 32 | friend class LibRF24IOTransfer; 33 | friend class LibRF24ConfTransfer; 34 | friend class LibRF24LibUSBAdaptor; 35 | friend class LibRF24PipeOpenTransfer; 36 | friend class LibRF24SweepTransfer; 37 | 38 | std::vector queue; 39 | LibRF24Transfer *currentTransfer = nullptr; 40 | 41 | virtual void bufferWrite(LibRF24Packet *pck); 42 | void bufferWriteDone(LibRF24Packet *pck); 43 | 44 | virtual void bufferRead(LibRF24Packet *pck); 45 | void bufferReadDone(LibRF24Packet *pck); 46 | 47 | virtual void requestStatus(); 48 | void updateStatus(int countCanWrite, int countCanRead); 49 | void updateIdleStatus(bool lastOk); 50 | 51 | virtual void configureStart(struct rf24_usb_config *conf); 52 | void configureDone(); 53 | virtual void pipeOpenStart(enum rf24_pipe pipe, unsigned char addr[5]); 54 | void pipeOpenDone(); 55 | 56 | virtual void switchMode(enum rf24_mode mode); 57 | void switchModeDone(enum rf24_mode newMode); 58 | 59 | virtual void sweepStart(int times); 60 | void sweepDone(unsigned char results[128]); 61 | 62 | LibRF24Packet *nextForRead(); 63 | LibRF24Packet *nextForWrite(); 64 | 65 | void startTransfers(); 66 | void transferCompleted(LibRF24Transfer *t); 67 | inline const int getPendingIos() { 68 | return numIosPending; 69 | } 70 | 71 | private: 72 | int numIosPending=0; /* Current async IOS pending */ 73 | int countToWrite = 0; 74 | int countToRead = 0; 75 | bool canXfer = true; 76 | enum rf24_mode currentMode = MODE_IDLE; 77 | struct rf24_usb_config currentConfig; 78 | 79 | }; 80 | }; 81 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24address.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | namespace librf24 { 9 | class LibRF24Address { 10 | public: 11 | LibRF24Address(const unsigned char *addr); 12 | LibRF24Address(const char *addrStr); 13 | LibRF24Address(std::string addrStr); 14 | void setLSB(unsigned char lsb); 15 | LibRF24Address& operator=(const LibRF24Address &rhs); 16 | private: 17 | unsigned char addr[5]; 18 | }; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24boot.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace rf24boot { 6 | #include "../../../include/rf24boot.h" 7 | class RF24BootPartitionTable { 8 | public: 9 | RF24BootPartitionTable(librf24::LibRF24Adaptor *a, unsigned char remote_addr[5]); 10 | bool is_big_endian; 11 | std::string name; 12 | void select(int i); 13 | void select(const char *name); 14 | void restore(const char *filepath); 15 | void save(const char *filepath); 16 | bool verify(const char *filepath); 17 | void run(); 18 | /* Debugging leftovers */ 19 | void writeOne(uint32_t addr, const char *data, size_t size); 20 | private: 21 | std::vector ptable; 22 | struct rf24boot_partition_header *currentPart; 23 | bool enablePbar = true; 24 | int numPacketsPerRun = 8; 25 | bool verifyFailed; 26 | FILE *fileFd; 27 | long fileSize; 28 | unsigned int currentPartId; 29 | struct timeval tv, tv0; 30 | 31 | void display_progressbar(int pad, int max, int value); 32 | librf24::LibRF24Adaptor *adaptor; 33 | void do_open(const char *filepath, const char *mode); 34 | bool readSome(librf24::LibRF24IOTransfer &io, struct rf24boot_cmd *dat); 35 | uint32_t saveSome(librf24::LibRF24IOTransfer &io); 36 | uint32_t verifySome(librf24::LibRF24IOTransfer &io, long int toverify); 37 | void timer_reset(); 38 | float timer_elapsed(); 39 | int numToQueue(uint32_t currentAddr); 40 | }; 41 | }; 42 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24conftransfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #pragma once 8 | 9 | 10 | namespace librf24 { 11 | class LibRF24Adaptor; 12 | class LibRF24Transfer; 13 | class LibRF24ConfTransfer: public LibRF24Transfer { 14 | public: 15 | LibRF24ConfTransfer(LibRF24Adaptor &a, struct rf24_usb_config *conf); 16 | ~LibRF24ConfTransfer(); 17 | protected: 18 | void transferStarted(); 19 | void adaptorNowIdle(bool lastOk); 20 | private: 21 | struct rf24_usb_config curConf; 22 | }; 23 | }; 24 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24defs.h: -------------------------------------------------------------------------------- 1 | #ifndef RF24DEFS_H 2 | #define RF24DEFS_H 3 | 4 | #ifdef __cplusplus 5 | namespace librf24 { 6 | #endif 7 | 8 | enum rf24_transfer_status { 9 | TRANSFER_IDLE=0, 10 | TRANSFER_QUEUED, 11 | TRANSFER_RUNNING, 12 | TRANSFER_COMPLETED, 13 | TRANSFER_FAIL, /* One or more packets were not delivered */ 14 | TRANSFER_ERROR, /* Hardware fault */ 15 | TRANSFER_TIMED_OUT, /* Timeout waiting for transfer to complete */ 16 | TRANSFER_CANCELLED, /* Transfer was cancelled */ 17 | TRANSFER_CANCELLING, /* Transfer is being cancelled */ 18 | }; 19 | 20 | 21 | 22 | /** 23 | * Power Amplifier level. 24 | * 25 | * For use with setPALevel() 26 | */ 27 | typedef enum { RF24_PA_MIN = 0,RF24_PA_LOW, RF24_PA_HIGH, RF24_PA_MAX, RF24_PA_ERROR } rf24_pa_dbm_e ; 28 | 29 | /** 30 | * Data rate. How fast data moves through the air. 31 | * 32 | * For use with setDataRate() 33 | */ 34 | typedef enum { RF24_1MBPS = 0, RF24_2MBPS, RF24_250KBPS } rf24_datarate_e; 35 | 36 | /** 37 | * CRC Length. How big (if any) of a CRC is included. 38 | * 39 | * For use with setCRCLength() 40 | */ 41 | typedef enum { RF24_CRC_DISABLED = 0, RF24_CRC_8, RF24_CRC_16 } rf24_crclength_e; 42 | 43 | 44 | //TODO:... 45 | #include "../../../include/requests.h" 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24iotransfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #pragma once 8 | 9 | 10 | namespace librf24 { 11 | class LibRF24Adaptor; 12 | class LibRF24Packet; 13 | class LibRF24IOTransfer: public LibRF24Transfer { 14 | public: 15 | LibRF24IOTransfer(LibRF24Adaptor &a); 16 | ~LibRF24IOTransfer(); 17 | void setSync(bool st); 18 | bool submit(); 19 | void clear(); 20 | void clearSendQueue(); 21 | void clearRecvQueue(); 22 | void makeRead(int numToRead); 23 | void makeWriteBulk(bool sync); 24 | void makeWriteStream(bool sync); 25 | 26 | void fromString(enum rf24_pipe pipe, std::string &buf); 27 | void fromBuffer(enum rf24_pipe pipe, const char *buf, size_t len); 28 | 29 | void fromString(std::string &buf); 30 | void fromBuffer(const char *buf, size_t len); 31 | 32 | void appendFromString(enum rf24_pipe pipe, std::string &buf); 33 | void appendFromBuffer(enum rf24_pipe pipe, const char *buf, size_t len); 34 | 35 | void appendFromString(std::string &buf); 36 | void appendFromBuffer(const char *buf, size_t len); 37 | 38 | inline LibRF24Packet *getPacket(int n) { 39 | return recvQueue.at(n); 40 | } 41 | 42 | inline int getPacketCount(){ 43 | return recvQueue.size(); 44 | } 45 | 46 | inline bool getLastWriteResult() { 47 | return lastWriteOk; 48 | }; 49 | protected: 50 | std::vector sendQueue; 51 | std::vector::iterator nextToSend; 52 | std::vector recvQueue; 53 | void adaptorNowIdle(bool lastOk); 54 | void transferStarted(); 55 | LibRF24Packet *nextForRead(); 56 | LibRF24Packet *nextForWrite(); 57 | void bufferWriteDone(LibRF24Packet *pck); 58 | void bufferReadDone(LibRF24Packet *pck); 59 | 60 | private: 61 | int numWriting = 0; 62 | std::vector packetPool; 63 | bool isSync = false; 64 | bool lastWriteOk = false; 65 | unsigned int countToRead = true; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24libusbadaptor.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace librf24 { 9 | class LibRF24Transfer; 10 | 11 | class LibRF24LibUSBAdaptor: public LibRF24Adaptor { 12 | 13 | public: 14 | LibRF24LibUSBAdaptor(); 15 | LibRF24LibUSBAdaptor(const char *serial); 16 | LibRF24LibUSBAdaptor(int argc, const char **argv); 17 | ~LibRF24LibUSBAdaptor(); 18 | void loopForever(); 19 | void loopOnce(); 20 | void configureStart(struct rf24_usb_config *conf); 21 | void pipeOpenStart(enum rf24_pipe pipe, unsigned char addr[5]); 22 | void sweepStart(int times); 23 | static void printAdaptorHelp(); 24 | const char *getName(); 25 | protected: 26 | void requestStatus(); 27 | void bufferWrite(LibRF24Packet *pck); 28 | void bufferRead(LibRF24Packet *pck); 29 | void switchMode(enum rf24_mode mode); 30 | 31 | private: 32 | 33 | libusb_context *ctx; 34 | libusb_device **devList = nullptr; 35 | libusb_device *thisDevice; 36 | libusb_device_handle *thisHandle; 37 | enum rf24_mode nextMode; 38 | std::string adaptorName = "libusb"; 39 | 40 | std::vector transferPool; 41 | 42 | struct libusb_transfer *interruptTransfer; 43 | bool interruptIsRunning = false; 44 | struct rf24_dongle_status interruptBuffer; 45 | unsigned char xferBuff[128]; 46 | 47 | struct libusb_device *findDevice(int vendor,int product, 48 | const char *vendor_name, 49 | const char *product_name, 50 | const char *serial); 51 | bool matchString(libusb_device_handle *dev, 52 | int index, const char* string); 53 | 54 | struct libusb_device *findBootDongle(const char* serial); 55 | struct libusb_device *findDongle(const char* serial); 56 | void bootDongle(struct libusb_device *dev); 57 | struct libusb_device *getDongle(const char* serial); 58 | struct libusb_transfer *getLibusbTransfer(); 59 | void putLibusbTransfer(struct libusb_transfer *tr); 60 | 61 | LibRF24Transfer *currentTransfer = nullptr; 62 | 63 | /* Libusb callbacks are bound to be static */ 64 | static void packetWritten(struct libusb_transfer *t); 65 | static void statusUpdateArrived(struct libusb_transfer *t); 66 | static void packetObtained(struct libusb_transfer *t); 67 | static void modeSwitched(struct libusb_transfer *t); 68 | static void configureCompleted(struct libusb_transfer *t); 69 | static void pipeOpenCompleted(struct libusb_transfer *t); 70 | static void sweepCompleted(struct libusb_transfer *t); 71 | void startWithSerial(const char *serial); 72 | }; 73 | 74 | }; 75 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24packet.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #define LIBRF24_LIBUSB_OVERHEAD (8+1) 9 | /* 10 | [ 8 bytes setup packet | 1 byte pipe number | packet body ] 11 | 12 | */ 13 | 14 | #define LIBRF24_MAX_PAYLOAD_LEN 32 15 | #define LIBRF24_MAX_PIPE 6 16 | 17 | namespace librf24 { 18 | class LibRF24Adaptor; 19 | class LibRF24LibUSBAdaptor; 20 | class LibRF24Packet { 21 | protected: 22 | friend LibRF24Adaptor; 23 | friend LibRF24LibUSBAdaptor; 24 | LibRF24Adaptor *owner = nullptr; 25 | 26 | public: 27 | LibRF24Packet(); 28 | LibRF24Packet(const char *buffer, size_t len); 29 | LibRF24Packet(const char *buffer); 30 | LibRF24Packet(enum rf24_pipe pipe, const char *buffer, size_t len); 31 | LibRF24Packet(enum rf24_pipe pipe, std::string& s); 32 | LibRF24Packet(std::string& s); 33 | 34 | char operator[](int); 35 | std::ostream& streamTo(std::ostream& os); 36 | 37 | ~LibRF24Packet(); 38 | 39 | char *c_str(); 40 | size_t inline length() { 41 | return len; 42 | }; 43 | 44 | char *raw_buffer(); 45 | std::string to_string(); 46 | static inline size_t getMaxPayload() { 47 | return LIBRF24_MAX_PAYLOAD_LEN; 48 | }; 49 | 50 | inline void setTargetPipe(enum rf24_pipe ppipe) { 51 | pipe = ppipe; 52 | } 53 | 54 | private: 55 | size_t len; 56 | enum rf24_pipe pipe; 57 | char databytes[LIBRF24_LIBUSB_OVERHEAD + LIBRF24_MAX_PAYLOAD_LEN + 1]; 58 | 59 | }; 60 | } 61 | 62 | inline std::ostream& operator<<(std::ostream& out, librf24::LibRF24Packet& p) 63 | { 64 | return p.streamTo(out); 65 | } 66 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24popentransfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #pragma once 8 | 9 | 10 | namespace librf24 { 11 | class LibRF24Adaptor; 12 | class LibRF24Transfer; 13 | class LibRF24PipeOpenTransfer: public LibRF24Transfer { 14 | public: 15 | LibRF24PipeOpenTransfer(LibRF24Adaptor &a, enum rf24_pipe pipe, unsigned char addr[5]); 16 | ~LibRF24PipeOpenTransfer(); 17 | protected: 18 | void transferStarted(); 19 | void adaptorNowIdle(bool lastOk); 20 | private: 21 | struct rf24_usb_config curConf; 22 | unsigned char curAddr[5]; 23 | enum rf24_pipe curPipe; 24 | }; 25 | }; 26 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24sweeptransfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #pragma once 8 | 9 | 10 | namespace librf24 { 11 | class LibRF24Adaptor; 12 | class LibRF24Transfer; 13 | class LibRF24SweepTransfer: public LibRF24Transfer { 14 | public: 15 | LibRF24SweepTransfer(LibRF24Adaptor &a, int times); 16 | ~LibRF24SweepTransfer(); 17 | void clear(); 18 | unsigned int getObserved(int ch); 19 | protected: 20 | void handleData(unsigned char *data, size_t size); 21 | void transferStarted(); 22 | void adaptorNowIdle(bool lastOk); 23 | private: 24 | int numTimes; 25 | unsigned int observed[128]; 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24transfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #pragma once 6 | 7 | 8 | namespace librf24 { 9 | class LibRF24Adaptor; 10 | class LibRF24Packet; 11 | class LibRF24Transfer { 12 | protected: 13 | friend class LibRF24Adaptor; 14 | LibRF24Adaptor &adaptor; 15 | bool checkTransferTimeout(bool finalize); 16 | void updateStatus(enum rf24_transfer_status newStatus, bool callback); 17 | virtual void transferStarted() { } ; 18 | virtual void bufferWriteDone(LibRF24Packet *pck); 19 | virtual void bufferReadDone(LibRF24Packet *pck); 20 | virtual LibRF24Packet *nextForRead(); 21 | virtual LibRF24Packet *nextForWrite(); 22 | virtual void adaptorNowIdle(bool lastIsOk); 23 | virtual void handleData(unsigned char *data, size_t size) { }; 24 | enum rf24_mode transferMode = MODE_ANY; 25 | public: 26 | LibRF24Transfer(LibRF24Adaptor &a); 27 | ~LibRF24Transfer(); 28 | 29 | enum rf24_transfer_status execute(); 30 | enum rf24_transfer_status status(); 31 | virtual bool submit(); 32 | 33 | void inline setTimeout(int timeout) { 34 | timeout_ms = timeout; 35 | }; 36 | 37 | void inline setCallback(void (*c)(LibRF24Transfer &t)) { 38 | cb = c; 39 | } ; 40 | 41 | int timeout_ms = 1500; 42 | int timeout_ms_left = 0; 43 | 44 | private: 45 | 46 | enum rf24_transfer_status currentStatus = TRANSFER_IDLE; 47 | uint64_t when_started; 48 | uint64_t when_timed_out; 49 | void (*cb)(LibRF24Transfer &t) = nullptr; 50 | }; 51 | }; 52 | 53 | -------------------------------------------------------------------------------- /librf24pp/include/librf24/rf24writetransfer.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #pragma once 6 | 7 | 8 | namespace librf24 { 9 | class LibRF24Adaptor; 10 | class LibRF24Packet; 11 | 12 | }; 13 | -------------------------------------------------------------------------------- /librf24pp/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace librf24; 4 | 5 | 6 | INITIALIZE_EASYLOGGINGPP 7 | 8 | 9 | int main(int argc, const char** argv) 10 | { 11 | START_EASYLOGGINGPP(argc, argv); 12 | 13 | LibRF24Adaptor *a = new LibRF24LibUSBAdaptor(); 14 | 15 | a->setConfigFromArgs(argc, argv); 16 | std::cerr << *a->getCurrentConfig(); 17 | 18 | unsigned char addr[5] = { 0xb0, 0x0b, 0x10, 0xad, 0xed }; 19 | 20 | LibRF24PipeOpenTransfer pow(*a, PIPE_WRITE, addr); 21 | pow.execute(); 22 | 23 | 24 | LibRF24IOTransfer t(*a); 25 | std::string hl("1234567890qwertyuiopasdfghjklzxcvbnm"); 26 | t.makeWriteBulk(true); 27 | t.appendFromString(PIPE_WRITE, hl); 28 | t.setTimeout(30000); 29 | std::cout << t.execute() << std::endl; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /librf24pp/rf24-load.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | 12 | using namespace rf24boot; 13 | using namespace librf24; 14 | 15 | INITIALIZE_EASYLOGGINGPP 16 | 17 | static const char prg[] = { 18 | '\\', 19 | '|', 20 | '/', 21 | '-' 22 | }; 23 | 24 | 25 | void rf24bootWaitTarget(LibRF24Adaptor *a) 26 | { 27 | LibRF24IOTransfer ping(*a); 28 | ping.makeWriteStream(true); 29 | char tmp = RF_OP_NOP; 30 | ping.fromBuffer(PIPE_WRITE, &tmp, 1); 31 | bool online = false; 32 | fprintf(stderr, "Waiting for target...."); 33 | int i=0; 34 | while (!online) { 35 | if (i>0) 36 | usleep(100000); 37 | ping.execute(); 38 | fputc(0x08, stderr); 39 | fputc(prg[i++ & 0x3], stderr); 40 | 41 | online = ping.getLastWriteResult(); 42 | if (online) 43 | fprintf(stderr, "\x8GOTCHA!\n"); 44 | } 45 | } 46 | 47 | void usage(const char* appname) 48 | { 49 | fprintf(stderr, 50 | "nRF24L01 over-the-air programmer\n\n" 51 | "USAGE: %s [options]\n" 52 | "\t --part=name - Select partition\n" 53 | "\t --file=name - Select file\n" 54 | "\t --write, --read, --verify - Action to perform (write assumes verify by default)\n" 55 | "\t --noverify - Do not auto-verify when writing\n" 56 | "\t --local-addr=0a:0b:0c:0d:0e - Select local addr\n" 57 | "\t --remote-addr=0a:0b:0c:0d:0e - Select remote addr\n" 58 | "\t --run[=partid] - Start code from part partid (default - 0)\n" 59 | "\t --help - Show this help\n" 60 | , appname); 61 | 62 | LibRF24Adaptor::printAllAdaptorsHelp(); 63 | 64 | fprintf(stderr, "\n(c) Andrew 'Necromant' Andrianov 2013-2015 \n"); 65 | fprintf(stderr, "This is free software, you can use it under the terms of GPLv2 or above\n"); 66 | } 67 | 68 | 69 | void printout(LibRF24Adaptor *a, const unsigned char *local_addr, const unsigned char *remote_addr) 70 | { 71 | fprintf(stderr, 72 | "nRF24L01 over-the-air programmer\n" 73 | "(c) Necromant 2013-2014 \n" 74 | "This is free software licensed under the terms of GPLv2 or above\n" 75 | "Adaptor: %s\n", 76 | a->getName()); 77 | 78 | std::cerr << *a->getCurrentConfig(); 79 | 80 | fprintf(stderr, 81 | "Local Address : %.2hhx:%.2hhx:%.2hhx:%.2hhx:%.2hhx\n" 82 | "Remote Address : %.2hhx:%.2hhx:%.2hhx:%.2hhx:%.2hhx\n", 83 | local_addr[0],local_addr[1],local_addr[2],local_addr[3],local_addr[4], 84 | remote_addr[0],remote_addr[1],remote_addr[2],remote_addr[3],remote_addr[4] 85 | ); 86 | } 87 | int main(int argc, const char** argv) 88 | { 89 | START_EASYLOGGINGPP(argc, argv); 90 | 91 | 92 | 93 | 94 | unsigned char remote_addr[5] = { 0xb0, 0x0b, 0x10, 0xad, 0xed }; 95 | unsigned char local_addr[5] = { 0xb0, 0x0b, 0xc0, 0xde, 0xed }; 96 | 97 | 98 | int rez; 99 | int runappid = -1; 100 | bool read = false; 101 | bool verify = false; 102 | bool noverify = false; 103 | bool write = false; 104 | const char *filename = nullptr; 105 | const char *partname = nullptr; 106 | 107 | const char* short_options = "p:f:a:b:hr:"; 108 | const struct option long_options[] = { 109 | {"part", required_argument, NULL, 'p'}, 110 | {"file", required_argument, NULL, 'f'}, 111 | {"write", no_argument, NULL, 'w' }, 112 | {"help", no_argument, NULL, 'h' }, 113 | {"read", no_argument, NULL, 'r' }, 114 | {"verify", no_argument, NULL, 'v' }, 115 | {"noverify", no_argument, NULL, 'x' }, 116 | {"local-addr", required_argument, NULL, 'a' }, 117 | {"remote-addr", required_argument, NULL, 'b' }, 118 | {"run", optional_argument, NULL, 'X' }, 119 | 120 | {NULL, 0, NULL, 0} 121 | }; 122 | 123 | optind = 0; 124 | opterr = 0; 125 | 126 | while ((rez=getopt_long(argc, (char* const*) argv, short_options, 127 | long_options, NULL))!=-1) 128 | { 129 | switch(rez) { 130 | case 'r': 131 | LOG(INFO) << "read"; 132 | read = true; 133 | break; 134 | case 'w': 135 | write = true; 136 | verify = true; 137 | break; 138 | case 'x': 139 | noverify = true; 140 | break; 141 | case 'v': 142 | verify = true; 143 | break; 144 | case 'f': 145 | filename = optarg; 146 | break; 147 | case 'a': 148 | sscanf(optarg, "%hhx:%hhx:%hhx:%hhx:%hhx", 149 | &local_addr[0],&local_addr[1],&local_addr[2],&local_addr[3],&local_addr[4]); 150 | break; 151 | case 'b': 152 | sscanf(optarg, "%hhx:%hhx:%hhx:%hhx:%hhx", 153 | &remote_addr[0],&remote_addr[1],&remote_addr[2],&remote_addr[3],&remote_addr[4]); 154 | break; 155 | case 'p': 156 | partname = optarg; 157 | break; 158 | case 'X': 159 | if (optarg) 160 | runappid = atoi(optarg); 161 | else 162 | runappid = 0; 163 | break; 164 | case 'h': 165 | usage(argv[0]); 166 | exit(1); 167 | break; 168 | } 169 | }; 170 | 171 | LibRF24Adaptor *a = LibRF24Adaptor::fromArgs(argc, argv); 172 | a->setConfigFromArgs(argc, argv); 173 | 174 | printout(a, local_addr, remote_addr); 175 | /* ToDo: Settings printout */ 176 | LibRF24PipeOpenTransfer pow(*a, PIPE_WRITE, remote_addr); 177 | pow.execute(); 178 | 179 | LibRF24PipeOpenTransfer por(*a, PIPE_READ_0, local_addr); 180 | por.execute(); 181 | 182 | rf24bootWaitTarget(a); 183 | RF24BootPartitionTable ptbl(a, local_addr); 184 | 185 | bool failed = false; 186 | 187 | if ((partname != nullptr) && (filename != nullptr)) { 188 | 189 | try { 190 | ptbl.select(partname); 191 | } catch(...) { 192 | ptbl.select(atoi(partname)); 193 | }; 194 | 195 | if (read) 196 | ptbl.save(filename); 197 | if (write) 198 | ptbl.restore(filename); 199 | if (verify && !(noverify)) 200 | failed = ptbl.verify(filename); 201 | } 202 | 203 | if (!failed && (runappid != -1)) 204 | ptbl.run(); 205 | 206 | if (failed) { 207 | std::cerr << "Errors encountered, check the log. " << std::endl; 208 | if ((runappid != -1)) { 209 | std::cerr << "Since something went wrong - I did't try to boot a broken firmware. Just in case" << std::endl; 210 | } 211 | } 212 | else 213 | std::cerr << "All done, have a nice day!\n"; 214 | 215 | return failed; 216 | } 217 | -------------------------------------------------------------------------------- /librf24pp/rf24-outlet-test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace librf24; 4 | #include 5 | #include 6 | 7 | INITIALIZE_EASYLOGGINGPP 8 | 9 | int main(int argc, const char** argv) 10 | { 11 | START_EASYLOGGINGPP(argc, argv); 12 | 13 | LibRF24Adaptor *a = LibRF24Adaptor::fromArgs(argc, argv); 14 | a->setConfigFromArgs(argc, argv); 15 | 16 | struct librf24::rf24_usb_config conf; 17 | conf.channel = 13; 18 | conf.rate = RF24_2MBPS; 19 | conf.pa = RF24_PA_MAX; 20 | conf.crclen = RF24_CRC_16; 21 | conf.num_retries = 0xf; 22 | conf.retry_timeout = 0xf; 23 | conf.dynamic_payloads = 1; 24 | conf.payload_size = 32; 25 | conf.ack_payloads = 0; 26 | conf.pipe_auto_ack = 0xff; 27 | a->setConfig(&conf); 28 | 29 | unsigned char addr[5] = { 0x8, 0x5a, 0x76, 0xa6, 0x10 }; 30 | char state; 31 | 32 | optind = 0; 33 | opterr = 0; 34 | int c; 35 | int digit_optin; 36 | while (1) { 37 | int this_option_optind = optind ? optind : 1; 38 | int option_index = 0; 39 | static struct option long_options[] = { 40 | {"relay", required_argument, 0, 'r' }, 41 | {"state", required_argument, 0, 's' }, 42 | {0, 0, 0, 0 } 43 | }; 44 | 45 | c = getopt_long(argc, argv, "r:s:", 46 | long_options, &option_index); 47 | if (c == -1) 48 | break; 49 | switch(c) { 50 | case 'r': 51 | addr[4]=atoi(optarg); 52 | LOG(INFO) << 's'; 53 | break; 54 | case 's': 55 | state=atoi(optarg); 56 | break; 57 | 58 | } 59 | } 60 | 61 | LibRF24Address acl(addr); 62 | 63 | LibRF24PipeOpenTransfer pow(*a, PIPE_WRITE, addr); 64 | pow.execute(); 65 | 66 | char data[32]; 67 | data[0]=0xf1; 68 | data[1]=state ? 0x1 : 0; 69 | LibRF24IOTransfer t(*a); 70 | t.makeWriteStream(true); 71 | t.appendFromBuffer(data, 32); 72 | t.setTimeout(3000); 73 | LOG(INFO) << "Sending!"; 74 | t.execute(); 75 | LOG(INFO) << "result: " << t.getLastWriteResult();; 76 | } 77 | -------------------------------------------------------------------------------- /librf24pp/rf24-send.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace librf24; 4 | 5 | 6 | INITIALIZE_EASYLOGGINGPP 7 | 8 | int main(int argc, const char** argv) 9 | { 10 | START_EASYLOGGINGPP(argc, argv); 11 | 12 | LibRF24Adaptor *a = LibRF24Adaptor::fromArgs(argc, argv); 13 | a->setConfigFromArgs(argc, argv); 14 | 15 | 16 | // unsigned char addr[5] = { 0xf6, 0xdc, 0x6a, 0xdd, 0xae }; 17 | unsigned char addr[5] = { 0x8, 0x5a, 0x76, 0xa6, 0x9 }; 18 | 19 | LibRF24Address acl(addr); 20 | 21 | LibRF24PipeOpenTransfer pow(*a, PIPE_WRITE, addr); 22 | pow.execute(); 23 | 24 | char data[32]; 25 | std::cin.getline(data, 32); 26 | LOG(INFO) << data; 27 | LibRF24IOTransfer t(*a); 28 | t.makeWriteStream(true); 29 | t.appendFromBuffer(data, 32); 30 | t.setTimeout(3000); 31 | LOG(INFO) << "Sending!\n"; 32 | t.execute(); 33 | LOG(INFO) << "result: " << t.getLastWriteResult();; 34 | } 35 | -------------------------------------------------------------------------------- /librf24pp/rf24-sweep.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace librf24; 5 | 6 | 7 | INITIALIZE_EASYLOGGINGPP 8 | 9 | static FILE *Gplt; 10 | 11 | void sweepDone(LibRF24Transfer &t) 12 | { 13 | LibRF24SweepTransfer &s = (LibRF24SweepTransfer &) t; 14 | 15 | for (int i=0; i<128; i++) 16 | fprintf(Gplt, "%d %d\n", 2400+i, s.getObserved(i)); 17 | 18 | fprintf(Gplt,"e\n"); 19 | fprintf(Gplt,"replot\n"); 20 | t.submit(); 21 | } 22 | 23 | int main(int argc, char** argv) 24 | { 25 | START_EASYLOGGINGPP(argc, argv); 26 | 27 | LibRF24Adaptor *a = new LibRF24LibUSBAdaptor(); 28 | 29 | LibRF24SweepTransfer t(*a, 7); 30 | t.setCallback(sweepDone); 31 | t.submit(); 32 | 33 | Gplt = popen("gnuplot", "w"); 34 | setlinebuf(Gplt); 35 | fprintf(Gplt, "set autoscale\n"); 36 | fprintf(Gplt, "plot '-' w lp\n"); 37 | 38 | while (1) { 39 | a->loopOnce(); 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /librf24pp/rf24adaptor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | using namespace librf24; 15 | 16 | typedef std::vector> pollfdlist; 17 | std::vector> LibRF24Adaptor::getPollFds() 18 | { 19 | pollfdlist dummy; 20 | return dummy; 21 | } 22 | 23 | LibRF24Adaptor::LibRF24Adaptor() 24 | { 25 | currentConfig.channel = 2; 26 | currentConfig.rate = RF24_2MBPS; 27 | currentConfig.pa = RF24_PA_MAX; 28 | currentConfig.crclen = RF24_CRC_16; 29 | currentConfig.num_retries = 15; 30 | currentConfig.retry_timeout = 15; 31 | currentConfig.dynamic_payloads = 1; 32 | currentConfig.payload_size = 32; 33 | currentConfig.ack_payloads = 0; 34 | currentConfig.pipe_auto_ack = 0xff; 35 | } 36 | 37 | LibRF24Adaptor::~LibRF24Adaptor() 38 | { 39 | 40 | } 41 | 42 | bool LibRF24Adaptor::submit(LibRF24Transfer *t) 43 | { 44 | /* 45 | * Default implementation only queues transfers, 46 | * but doesn't do anything with them 47 | */ 48 | queue.push_back(t); 49 | startTransfers(); 50 | return true; 51 | } 52 | 53 | void LibRF24Adaptor::transferCompleted(LibRF24Transfer *t) 54 | { 55 | LOG(DEBUG) << "Completing transfer!"; 56 | if (currentTransfer != t) { 57 | throw std::runtime_error("Internal bug: Attempt to complete transfer not current"); 58 | } 59 | currentTransfer = nullptr; 60 | } 61 | 62 | bool LibRF24Adaptor::cancel(LibRF24Transfer *t) 63 | { 64 | /* Base implementation deals only with queued transfers */ 65 | if (t->status() != TRANSFER_QUEUED) 66 | return false; 67 | 68 | 69 | std::vector::iterator pos = std::find(queue.begin(), queue.end(), t); 70 | 71 | if (pos == queue.end()) 72 | throw std::range_error("Attempt to cancel transfer not in adaptor queue"); 73 | 74 | queue.erase(pos); 75 | t->updateStatus(TRANSFER_CANCELLED, true); 76 | return true; 77 | } 78 | 79 | 80 | uint64_t LibRF24Adaptor::currentTime() { 81 | struct timeval tv; 82 | gettimeofday(&tv, NULL); 83 | return (tv.tv_sec *(uint64_t) 1000) + (tv.tv_usec / 1000); 84 | } 85 | 86 | void LibRF24Adaptor::bufferWrite(LibRF24Packet *pck) 87 | { 88 | bufferWriteDone(pck); 89 | } 90 | 91 | 92 | void LibRF24Adaptor::bufferRead(LibRF24Packet *pck) 93 | { 94 | bufferReadDone(pck); 95 | } 96 | 97 | 98 | 99 | /* All work happens in these callbacks */ 100 | void LibRF24Adaptor::bufferReadDone(LibRF24Packet *pck) 101 | { 102 | currentTransfer->bufferReadDone(pck); 103 | numIosPending--; 104 | /* Request a status update only if we have anything to do and there are no ops in background */ 105 | if ((numIosPending == 0) && (currentTransfer != nullptr)) 106 | requestStatus(); 107 | } 108 | 109 | void LibRF24Adaptor::bufferWriteDone(LibRF24Packet *pck) 110 | { 111 | currentTransfer->bufferWriteDone(pck); 112 | numIosPending--; 113 | /* Request a status update only if we have anything to do and there are no ops in background */ 114 | if ((numIosPending == 0) && (currentTransfer != nullptr)) 115 | requestStatus(); 116 | } 117 | 118 | void LibRF24Adaptor::updateIdleStatus(bool lastTx) 119 | { 120 | if (currentTransfer != nullptr) 121 | currentTransfer->adaptorNowIdle(lastTx); 122 | } 123 | 124 | void LibRF24Adaptor::startTransfers() 125 | { 126 | 127 | if ((currentTransfer == nullptr) && (!queue.empty())) { 128 | currentTransfer = *queue.begin(); 129 | queue.erase(queue.begin()); 130 | currentTransfer->transferStarted(); 131 | if (currentTransfer == nullptr) { /* Is it already completed ? */ 132 | requestStatus(); 133 | return; 134 | } 135 | } 136 | 137 | 138 | if (currentTransfer != nullptr) 139 | { 140 | if ((currentTransfer->transferMode != MODE_ANY) && 141 | (currentTransfer->transferMode != currentMode)) { 142 | switchMode(currentTransfer->transferMode); 143 | return; 144 | } 145 | 146 | /* Fair share: do in round-robin fasion, 147 | till we can't write/read any more 148 | */ 149 | 150 | bool somethingGoingOn; 151 | LibRF24Packet *pck; 152 | if (canXfer) { 153 | do { 154 | somethingGoingOn = false; 155 | 156 | if (countToWrite && (pck = currentTransfer->nextForWrite())) { 157 | bufferWrite(pck); 158 | somethingGoingOn = true; 159 | numIosPending++; 160 | countToWrite--; 161 | } 162 | 163 | 164 | if ((countToRead) && 165 | (pck = currentTransfer->nextForRead())) 166 | { 167 | bufferRead(pck); 168 | somethingGoingOn = true; 169 | numIosPending++; 170 | countToRead--; 171 | } 172 | 173 | } while (somethingGoingOn); 174 | } 175 | } 176 | 177 | /* Request a status update only if we have anything to do and there are no ops in background */ 178 | if ((numIosPending == 0) && (currentTransfer != nullptr)) 179 | requestStatus(); 180 | } 181 | 182 | void LibRF24Adaptor::updateStatus(int countCanWrite, int countCanRead) 183 | { 184 | if (countCanWrite >= 0) 185 | countToWrite = countCanWrite; 186 | if (countCanRead >= 0) 187 | countToRead = countCanRead; 188 | startTransfers(); 189 | } 190 | 191 | 192 | void LibRF24Adaptor::requestStatus() 193 | { 194 | updateStatus(1, 1); 195 | } 196 | 197 | void LibRF24Adaptor::configureStart(struct rf24_usb_config *conf) 198 | { 199 | /* Configure inhibints any packet queueing, since cb may change */ 200 | canXfer = false; 201 | numIosPending++; 202 | countToRead = 0; 203 | countToWrite = 0; 204 | } 205 | 206 | void LibRF24Adaptor::configureDone() 207 | { 208 | canXfer = true; 209 | numIosPending--; 210 | requestStatus(); 211 | } 212 | 213 | void LibRF24Adaptor::sweepDone(unsigned char results[128]) 214 | { 215 | canXfer = true; 216 | numIosPending++; 217 | currentTransfer->handleData(results, 128); 218 | requestStatus(); 219 | } 220 | 221 | void LibRF24Adaptor::sweepStart(int times) 222 | { 223 | canXfer = false; 224 | numIosPending++; 225 | } 226 | 227 | void LibRF24Adaptor::switchMode(enum rf24_mode mode) 228 | { 229 | canXfer = false; 230 | numIosPending++; 231 | countToRead = 0; 232 | countToWrite = 0; 233 | } 234 | 235 | void LibRF24Adaptor::pipeOpenDone() 236 | { 237 | numIosPending--; 238 | canXfer = true; 239 | requestStatus(); 240 | } 241 | 242 | void LibRF24Adaptor::pipeOpenStart(enum rf24_pipe pipe, unsigned char addr[5]) 243 | { 244 | numIosPending++; 245 | canXfer = false; 246 | } 247 | 248 | void LibRF24Adaptor::switchModeDone(enum rf24_mode newMode) 249 | { 250 | canXfer = true; 251 | numIosPending--; 252 | currentMode = newMode; 253 | requestStatus(); 254 | } 255 | 256 | 257 | void LibRF24Adaptor::loopOnce() 258 | { 259 | /* Check all transfers, if any are timed out */ 260 | for(std::vector::iterator it = queue.begin(); 261 | it != queue.end(); ++it) { 262 | if ((*it)->checkTransferTimeout(true)) 263 | queue.erase(it); 264 | } 265 | } 266 | 267 | void LibRF24Adaptor::loopForever() 268 | { 269 | while(1) { 270 | LOG(DEBUG) << "Looping..."; 271 | loopOnce(); 272 | sleep(1); 273 | } 274 | } 275 | 276 | 277 | enum rf24_transfer_status LibRF24Adaptor::setConfig(const struct rf24_usb_config *conf) 278 | { 279 | if (conf != nullptr) 280 | currentConfig = *conf; 281 | LibRF24ConfTransfer ct(*this, ¤tConfig); 282 | return ct.execute(); 283 | } 284 | 285 | const struct rf24_usb_config *LibRF24Adaptor::getCurrentConfig() 286 | { 287 | return ¤tConfig; 288 | } 289 | 290 | void LibRF24Adaptor::printAllAdaptorsHelp() { 291 | 292 | fprintf(stderr, 293 | "Wireless configuration parameters:\n" 294 | "\t --channel=N - Use Nth channel instead of default (76)\n" 295 | "\t --rate-{2m,1m,250k} - Set data rate\n" 296 | "\t --pa-{min,low,high,max} - Set power amplifier level\n" 297 | "\t --crc-{none,8,16} - Set CRC length (default - CRC16)\n" 298 | "\t --aa-disable - Disable auto-ack on all pipes\n" 299 | "\t --num-retries=n - Number of retries (0-15, default - 15)\n" 300 | "\t --retry-timeout=n - Delay between retries in 250uS units (0-15, default - 15)\n" 301 | "\t --disable-aa - Disable auto-ack on all pipes\n" 302 | "\t --disable-dpl - Disable dynamic payloads\n" 303 | "\t --payload-size=n - Set payload size (1-32 bytes). Default - 32\n" 304 | "Adaptor selection options:\n" 305 | "\t --adaptor-type=name - Use adaptor backend 'name'\n" 306 | "\t --list-adaptors - List available 'adaptors'\n" 307 | ); 308 | LibRF24LibUSBAdaptor::printAdaptorHelp(); 309 | } 310 | 311 | LibRF24Adaptor *LibRF24Adaptor::fromArgs(int argc, const char **argv) 312 | { 313 | int rez; 314 | LibRF24Adaptor *a = nullptr; 315 | int preverr = opterr; 316 | opterr = 0; 317 | optind = 0; 318 | std::string adaptor("libusb"); 319 | const char* short_options = ""; 320 | 321 | const struct option long_options[] = { 322 | {"adaptor-type", required_argument, NULL, '!' }, 323 | {NULL, 0, NULL, 0} 324 | }; 325 | while ((rez=getopt_long(argc, (char* const*) argv, short_options, 326 | long_options, NULL))!=-1) 327 | { 328 | switch (rez) { 329 | case '!': 330 | adaptor.assign(optarg); 331 | break; 332 | default: 333 | break; 334 | } 335 | }; 336 | opterr = preverr; 337 | //TODO: pass on argc/argv 338 | if (0==adaptor.compare("libusb")) { 339 | a = new LibRF24LibUSBAdaptor(argc, argv); 340 | }; 341 | 342 | if (!a) 343 | throw std::runtime_error("Invalid adaptor"); 344 | return a; 345 | } 346 | 347 | enum rf24_transfer_status LibRF24Adaptor::setConfigFromArgs(int argc, const char **argv) 348 | { 349 | int pa = -1; 350 | int rate = -1; 351 | int channel = -1; 352 | int crc = -1; 353 | int aadsbl = -1; 354 | int dpl = -1; 355 | int psz = -1; 356 | int rez; 357 | int num_retries = -1; 358 | int retr_timeout = -1; 359 | 360 | /* TODO: CRC, PipeAutoAck, etc */ 361 | const char* short_options = ""; 362 | const struct option long_options[] = { 363 | {"channel", required_argument, NULL, '!' }, 364 | {"pa-min", no_argument, &pa, RF24_PA_MIN }, 365 | {"pa-low", no_argument, &pa, RF24_PA_LOW }, 366 | {"pa-high", no_argument, &pa, RF24_PA_HIGH }, 367 | {"pa-max", no_argument, &pa, RF24_PA_MAX }, 368 | {"rate-2m", no_argument, &rate, RF24_2MBPS }, 369 | {"rate-1m", no_argument, &rate, RF24_1MBPS }, 370 | {"rate-250k", no_argument, &rate, RF24_250KBPS }, 371 | {"crc-none", no_argument, &crc, RF24_CRC_DISABLED }, 372 | {"crc-16", no_argument, &crc, RF24_CRC_16 }, 373 | {"crc-8", no_argument, &crc, RF24_CRC_8 }, 374 | {"disable-aa", no_argument, &aadsbl, 0 }, 375 | {"num-retries", required_argument, NULL, '.' }, 376 | {"disable-dpl", no_argument, &dpl, 0 }, 377 | {"payload-size", required_argument, NULL, '(' }, 378 | {"retry-timeout", required_argument, NULL, ',' }, 379 | {NULL, 0, NULL, 0} 380 | }; 381 | 382 | int preverr = opterr; 383 | opterr=0; 384 | optind=0; 385 | while ((rez=getopt_long(argc, (char* const*) argv, short_options, 386 | long_options, NULL))!=-1) 387 | { 388 | switch (rez) { 389 | case '(': 390 | psz = atoi(optarg); 391 | if ((psz > 32) || (psz < 0)) 392 | throw new std::range_error("Invalid payload size specified!"); 393 | break; 394 | case '!': 395 | channel = atoi(optarg); 396 | break; 397 | case '.': 398 | num_retries = atoi(optarg); 399 | if ((num_retries > 15) || (num_retries < 15)) 400 | throw new std::range_error("Invalid retry count specified!"); 401 | break; 402 | case ',': 403 | retr_timeout = atoi(optarg); 404 | if ((retr_timeout > 15) || (retr_timeout < 15)) 405 | throw new std::range_error("Invalid retry timeout specified!"); 406 | break; 407 | default: 408 | break; 409 | } 410 | } 411 | 412 | if (pa != -1) 413 | currentConfig.pa = pa; 414 | if (rate != -1) 415 | currentConfig.rate = rate; 416 | if (channel != -1) 417 | currentConfig.channel = channel; 418 | if (crc != -1) 419 | currentConfig.crclen = crc; 420 | if (aadsbl != -1) 421 | currentConfig.pipe_auto_ack = 0x0; 422 | if (num_retries != -1) 423 | currentConfig.num_retries = (unsigned char) num_retries; 424 | if (psz != -1) 425 | currentConfig.payload_size = (unsigned char) psz; 426 | if (dpl != -1) 427 | currentConfig.dynamic_payloads = 0x0; 428 | if (retr_timeout != -1) 429 | currentConfig.retry_timeout = (unsigned char) retr_timeout; 430 | 431 | opterr = preverr; 432 | return setConfig(nullptr); 433 | } 434 | 435 | bool LibRF24Adaptor::write(const char *data, size_t len) 436 | { 437 | LibRF24IOTransfer ping(*this); 438 | ping.makeWriteStream(true); 439 | ping.fromBuffer(data, len); 440 | if (TRANSFER_COMPLETED != ping.execute()) 441 | return false; 442 | return ping.getLastWriteResult(); 443 | } 444 | 445 | enum rf24_transfer_status LibRF24Adaptor::pipeOpen(enum rf24_pipe pipe, unsigned char addr[5]) 446 | { 447 | LibRF24PipeOpenTransfer po(*this, pipe, addr); 448 | return po.execute(); 449 | } 450 | 451 | size_t LibRF24Adaptor::read(enum rf24_pipe *pipe, char *data, size_t len, int timeout_ms) 452 | { 453 | LibRF24IOTransfer rd(*this); 454 | rd.makeRead(1); 455 | rd.setTimeout(timeout_ms); 456 | if (TRANSFER_COMPLETED != rd.execute()) 457 | return 0; 458 | LibRF24Packet *pck = rd.getPacket(0); 459 | int tocopy = std::min(len, pck->length()); 460 | memcpy(data, pck->c_str(), tocopy); 461 | return tocopy; 462 | } 463 | -------------------------------------------------------------------------------- /librf24pp/rf24address.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace librf24; 4 | 5 | LibRF24Address& LibRF24Address::operator=(const LibRF24Address &rhs) 6 | { 7 | if (this == &rhs) /* Same object? */ 8 | return *this; 9 | LOG(INFO) << "COPY!"; 10 | memcpy(this->addr, rhs.addr, 5); 11 | return *this; 12 | } 13 | 14 | LibRF24Address::LibRF24Address(const unsigned char *newAddr) 15 | { 16 | memcpy(addr, newAddr, 5); 17 | } 18 | 19 | LibRF24Address::LibRF24Address(const char *astr) 20 | { 21 | sscanf(astr, "%hhx:%hhx:%hhx:%hhx:%hhx", 22 | &addr[0], &addr[1], &addr[2], &addr[3], &addr[4]); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /librf24pp/rf24conftransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace librf24; 7 | 8 | LibRF24ConfTransfer::LibRF24ConfTransfer(LibRF24Adaptor &a, struct rf24_usb_config *conf) 9 | : LibRF24Transfer(a) 10 | { 11 | curConf = *conf; 12 | } 13 | 14 | void LibRF24ConfTransfer::transferStarted() 15 | { 16 | adaptor.configureStart(&curConf); 17 | } 18 | 19 | void LibRF24ConfTransfer::adaptorNowIdle(bool lastOk) 20 | { 21 | LOG(DEBUG) << "Conf transfer now completed"; 22 | updateStatus(TRANSFER_COMPLETED, true); 23 | } 24 | 25 | LibRF24ConfTransfer::~LibRF24ConfTransfer() 26 | { 27 | 28 | } 29 | -------------------------------------------------------------------------------- /librf24pp/rf24iotransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace librf24; 12 | 13 | void LibRF24IOTransfer::setSync(bool st) 14 | { 15 | isSync = st; 16 | } 17 | 18 | 19 | LibRF24IOTransfer::LibRF24IOTransfer(LibRF24Adaptor &__a) : LibRF24Transfer(__a) 20 | { 21 | 22 | } 23 | 24 | LibRF24IOTransfer::~LibRF24IOTransfer() 25 | { 26 | clear(); 27 | } 28 | 29 | bool LibRF24IOTransfer::submit() 30 | { 31 | nextToSend = sendQueue.begin(); 32 | return LibRF24Transfer::submit(); 33 | } 34 | 35 | void LibRF24IOTransfer::transferStarted() 36 | { 37 | LOG(DEBUG) << "IO transfer started, queue " << sendQueue.size() << " packets"; 38 | if ((transferMode != MODE_READ) && (sendQueue.end() == nextToSend)) { 39 | updateStatus(TRANSFER_COMPLETED, true); 40 | } 41 | } 42 | 43 | void LibRF24IOTransfer::fromString(std::string &buf) 44 | { 45 | fromString(PIPE_WRITE, buf); 46 | } 47 | 48 | void LibRF24IOTransfer::fromString(enum rf24_pipe pipe, std::string &buf) 49 | { 50 | clearSendQueue(); 51 | appendFromString(pipe, buf); 52 | } 53 | 54 | void LibRF24IOTransfer::fromBuffer(const char *buf, size_t len) 55 | { 56 | fromBuffer(PIPE_WRITE, buf, len); 57 | } 58 | 59 | void LibRF24IOTransfer::fromBuffer(enum rf24_pipe pipe, const char *buf, size_t len) 60 | { 61 | clearSendQueue(); 62 | appendFromBuffer(pipe, buf, len); 63 | } 64 | 65 | void LibRF24IOTransfer::appendFromString(enum rf24_pipe pipe, std::string &buf) 66 | { 67 | 68 | appendFromBuffer(pipe, buf.c_str(), buf.length()); 69 | } 70 | 71 | void LibRF24IOTransfer::appendFromString(std::string &buf) 72 | { 73 | appendFromString(PIPE_WRITE, buf); 74 | } 75 | 76 | void LibRF24IOTransfer::appendFromBuffer(enum rf24_pipe pipe, const char *buf, size_t len) 77 | { 78 | while (len) { 79 | size_t tocopy = std::min((size_t) LIBRF24_MAX_PAYLOAD_LEN, len); 80 | LibRF24Packet *pck = new LibRF24Packet(pipe, buf, tocopy); 81 | sendQueue.push_back(pck); 82 | len-=tocopy; 83 | buf+=tocopy; 84 | } 85 | } 86 | 87 | void LibRF24IOTransfer::appendFromBuffer(const char *buf, size_t len) 88 | { 89 | appendFromBuffer(PIPE_WRITE, buf, len); 90 | } 91 | 92 | void LibRF24IOTransfer::adaptorNowIdle(bool lastOk) 93 | { 94 | LOG(DEBUG) << "Idle: " << numWriting; 95 | if ((transferMode != MODE_READ) && isSync && (numWriting == 0) && (nextToSend == sendQueue.end())) 96 | { 97 | lastWriteOk = lastOk; 98 | updateStatus(TRANSFER_COMPLETED, true); 99 | } 100 | 101 | checkTransferTimeout(true); 102 | } 103 | 104 | void LibRF24IOTransfer::makeRead(int numToRead) 105 | { 106 | clear(); 107 | countToRead = numToRead; 108 | transferMode = MODE_READ; 109 | isSync = true; 110 | } 111 | 112 | void LibRF24IOTransfer::makeWriteBulk(bool sync) 113 | { 114 | clear(); 115 | transferMode = MODE_WRITE_BULK; 116 | isSync = sync; 117 | } 118 | 119 | void LibRF24IOTransfer::makeWriteStream(bool sync) 120 | { 121 | clear(); 122 | transferMode = MODE_WRITE_STREAM; 123 | isSync = sync; 124 | } 125 | 126 | 127 | void LibRF24IOTransfer::bufferReadDone(LibRF24Packet *pck) 128 | { 129 | recvQueue.push_back(pck); 130 | if (recvQueue.size() == countToRead) { 131 | updateStatus(TRANSFER_COMPLETED, true); 132 | } 133 | } 134 | 135 | void LibRF24IOTransfer::bufferWriteDone(LibRF24Packet *pck) 136 | { 137 | numWriting--; 138 | LOG(DEBUG) << "Write done: " << numWriting; 139 | if ((!isSync) && (numWriting == 0) && (nextToSend == sendQueue.end())) 140 | updateStatus(TRANSFER_COMPLETED, true); 141 | 142 | } 143 | 144 | LibRF24Packet *LibRF24IOTransfer::nextForRead() 145 | { 146 | return new LibRF24Packet(); 147 | } 148 | 149 | LibRF24Packet *LibRF24IOTransfer::nextForWrite() 150 | { 151 | if (nextToSend == sendQueue.end()) 152 | return nullptr; 153 | numWriting++; 154 | LOG(DEBUG) << "Write started: " << numWriting; 155 | return *(nextToSend++); 156 | } 157 | 158 | void LibRF24IOTransfer::clearSendQueue() 159 | { 160 | if (sendQueue.empty()) 161 | return; 162 | 163 | for(std::vector::iterator it = sendQueue.begin(); 164 | it != sendQueue.end(); 165 | it = sendQueue.erase(it)) 166 | delete *it; 167 | } 168 | 169 | void LibRF24IOTransfer::clearRecvQueue() 170 | { 171 | if (recvQueue.empty()) 172 | return; 173 | 174 | for(std::vector::iterator it = recvQueue.begin(); 175 | it != recvQueue.end(); 176 | it = recvQueue.erase(it)) 177 | delete *it; 178 | 179 | } 180 | 181 | void LibRF24IOTransfer::clear() 182 | { 183 | clearSendQueue(); 184 | clearRecvQueue(); 185 | } 186 | -------------------------------------------------------------------------------- /librf24pp/rf24packet.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace librf24; 7 | 8 | 9 | LibRF24Packet::LibRF24Packet(): len(0), pipe(PIPE_READ_0) 10 | { 11 | std::memset(&this->databytes[LIBRF24_LIBUSB_OVERHEAD], 0x0, LIBRF24_MAX_PAYLOAD_LEN + 1); 12 | } 13 | 14 | LibRF24Packet::LibRF24Packet(const char *buffer, size_t len) : pipe(PIPE_READ_0) 15 | { 16 | if (len > LIBRF24_MAX_PAYLOAD_LEN) 17 | throw std::range_error("Attempting to create a packet of more than max payload"); 18 | std::memcpy(&this->databytes[LIBRF24_LIBUSB_OVERHEAD], buffer, len); 19 | this->len = len; 20 | LOG(INFO) << "len == " << (int) this->len << std::endl; 21 | } 22 | 23 | LibRF24Packet::LibRF24Packet(const char *buffer) : pipe(PIPE_READ_0) 24 | { 25 | int len = std::strlen(buffer); 26 | if (len > LIBRF24_MAX_PAYLOAD_LEN) 27 | throw std::range_error("Attempting to create a packet of more than max payload"); 28 | std::memcpy(&this->databytes[LIBRF24_LIBUSB_OVERHEAD], buffer, len); 29 | this->len = len; 30 | } 31 | 32 | 33 | 34 | LibRF24Packet::LibRF24Packet(std::string& s) : LibRF24Packet(s.c_str(), s.length()) { } 35 | 36 | LibRF24Packet::LibRF24Packet(enum rf24_pipe pipe, std::string& s): LibRF24Packet(pipe, s.c_str(), s.length()) { } 37 | 38 | LibRF24Packet::LibRF24Packet(enum rf24_pipe pipe, const char *buffer, size_t len) : LibRF24Packet(buffer, len) 39 | { 40 | if ((pipe < 0 ) || pipe > LIBRF24_MAX_PIPE) 41 | throw std::range_error("Invalid pipe number"); 42 | this->pipe = pipe; 43 | } 44 | 45 | std::string LibRF24Packet::to_string() 46 | { 47 | return std::string(&this->databytes[LIBRF24_LIBUSB_OVERHEAD]); 48 | } 49 | 50 | char *LibRF24Packet::c_str() 51 | { 52 | return reinterpret_cast(&this->databytes[LIBRF24_LIBUSB_OVERHEAD]); 53 | } 54 | 55 | char *LibRF24Packet::raw_buffer() 56 | { 57 | return reinterpret_cast(this->databytes); 58 | } 59 | 60 | char LibRF24Packet::operator[](int n) 61 | { 62 | if ((n < 0) ||(n >= (int) len)) 63 | throw std::range_error("Out of range while indexing packet data"); 64 | return this->databytes[LIBRF24_LIBUSB_OVERHEAD + n]; 65 | } 66 | 67 | std::ostream& LibRF24Packet::streamTo(std::ostream& os) 68 | { 69 | os << "PIPE: " << this->pipe << " LEN: " << this->len << " | " << std::setw(2); 70 | for (int i=0; i < (int) this->len; i++) 71 | os << std::hex << std::setw(2) << std::setfill('0') << 72 | (int) (uint8_t) (this->databytes[LIBRF24_LIBUSB_OVERHEAD + i]) << " "; 73 | os << "| " << std::dec; 74 | for (int i=0; i < (int) this->len; i++) { 75 | char c = this->databytes[LIBRF24_LIBUSB_OVERHEAD + i]; 76 | if (isprint(c)) 77 | os << this->databytes[i + LIBRF24_LIBUSB_OVERHEAD]; 78 | else 79 | os << "."; 80 | } 81 | return os; 82 | } 83 | 84 | librf24::LibRF24Packet::~LibRF24Packet() 85 | { 86 | 87 | } 88 | -------------------------------------------------------------------------------- /librf24pp/rf24popentransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | using namespace librf24; 7 | 8 | LibRF24PipeOpenTransfer::LibRF24PipeOpenTransfer(LibRF24Adaptor &a, enum rf24_pipe pipe, unsigned char addr[5]) 9 | : LibRF24Transfer(a) 10 | { 11 | memcpy(curAddr, addr, 5); 12 | curPipe = pipe; 13 | transferMode = MODE_WRITE_BULK; 14 | } 15 | 16 | void LibRF24PipeOpenTransfer::transferStarted() 17 | { 18 | adaptor.pipeOpenStart(curPipe, curAddr); 19 | } 20 | 21 | void LibRF24PipeOpenTransfer::adaptorNowIdle(bool lastOk) 22 | { 23 | LOG(DEBUG) << "pOpen transfer now completed"; 24 | updateStatus(TRANSFER_COMPLETED, true); 25 | } 26 | 27 | LibRF24PipeOpenTransfer::~LibRF24PipeOpenTransfer() 28 | { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /librf24pp/rf24ptable.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace rf24boot; 10 | using namespace librf24; 11 | 12 | 13 | RF24BootPartitionTable::RF24BootPartitionTable(LibRF24Adaptor *a, unsigned char addr[5]) { 14 | struct rf24boot_cmd hs; 15 | adaptor = a; 16 | hs.op = RF_OP_HELLO; 17 | memcpy(hs.data, addr, 5); 18 | LibRF24IOTransfer rq(*a); 19 | rq.makeWriteStream(true); 20 | rq.fromBuffer((const char*) &hs, sizeof(hs)); 21 | rq.execute(); 22 | /* Whenever we succeeded or failed - wait for ptable */ 23 | LibRF24IOTransfer rq2(*a); 24 | rq2.makeRead(1); 25 | rq2.setTimeout(1000); 26 | 27 | if (TRANSFER_COMPLETED != rq2.execute()) { 28 | throw std::runtime_error("Ptable request failed"); 29 | } 30 | 31 | LibRF24Packet *p = rq2.getPacket(0); 32 | char *dData = p->c_str(); 33 | 34 | struct rf24boot_cmd *hcmd = (struct rf24boot_cmd *) dData; 35 | struct rf24boot_hello_resp *hello = (struct rf24boot_hello_resp *) hcmd->data; 36 | 37 | fprintf(stderr, "Target: %s\n", hello->id); 38 | fprintf(stderr, "Endianness: %s\n", hello->is_big_endian ? "BIG" : "little"); 39 | int numParts = hello->numparts; 40 | fprintf(stderr, "Partitions: %d\n", numParts); 41 | 42 | rq2.makeRead(numParts); 43 | rq2.execute(); 44 | 45 | for (int i=0; i< ((int) numParts); i++) 46 | { 47 | hcmd = (struct rf24boot_cmd *) rq2.getPacket(i)->c_str(); 48 | struct rf24boot_partition_header *hdr = (struct rf24boot_partition_header *) hcmd->data; 49 | ptable.push_back(*hdr); 50 | fprintf(stderr, "%.1d. %12s size %8d iosize %d pad %d\n", 51 | i, hdr->name, hdr->size, hdr->iosize, hdr->pad); 52 | if (hdr->pad == 0) 53 | hdr->pad = 1; /* Give us a chance. Just in case */ 54 | 55 | } 56 | }; 57 | 58 | 59 | void RF24BootPartitionTable::select(int i) { 60 | currentPartId = i; 61 | currentPart = &ptable.at(i); 62 | } 63 | 64 | void RF24BootPartitionTable::select(const char *name) 65 | { 66 | for (unsigned int i=0; i< ptable.size(); i++) { 67 | if (strcmp(ptable.at(i).name, name)==0) { 68 | select(i); 69 | return; 70 | } 71 | } 72 | throw std::runtime_error("No such partition"); 73 | } 74 | 75 | 76 | void RF24BootPartitionTable::do_open(const char *filepath, const char *mode) 77 | { 78 | fileFd = fopen(filepath, mode); 79 | if (!fileFd) { 80 | perror(filepath); 81 | throw std::runtime_error("Can't open input file"); 82 | } 83 | 84 | fseek(fileFd, 0L, SEEK_END); 85 | fileSize = ftell(fileFd); 86 | rewind(fileFd); 87 | } 88 | 89 | 90 | 91 | 92 | void RF24BootPartitionTable::display_progressbar(int pad, int max, int value) 93 | { 94 | float percent = 100.0 - (float) value * 100.0 / (float) max; 95 | int cols; 96 | struct winsize w; 97 | ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); 98 | cols = w.ws_col; 99 | 100 | int txt = printf("%.02f %% done [", percent); 101 | int max_bars = cols - txt - 7 - pad; 102 | int bars = max_bars - (int)(((float) value * max_bars) / (float) max); 103 | 104 | if (max_bars > 0) { 105 | int i; 106 | for (i=0; iname, fileSize, currentPart->size); 132 | size_t towrite = std::min((size_t) fileSize, (size_t) currentPart->size); 133 | size_t paddedsize = towrite; 134 | if (currentPart->pad > 1) 135 | towrite += (currentPart->pad - (towrite % currentPart->pad)); 136 | 137 | struct rf24boot_cmd cmd; 138 | cmd.op = RF_OP_WRITE; 139 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd.data; 140 | dat->part = (uint8_t) currentPartId; 141 | dat->addr = 0; 142 | 143 | LibRF24IOTransfer io(*adaptor); 144 | io.makeWriteBulk(false); 145 | io.setTimeout(15000); 146 | 147 | while (readSome(io, &cmd)) { 148 | int pad = printf("%u/%lu bytes | %.02f s | ", 149 | (dat->addr), 150 | paddedsize, 151 | timer_elapsed()); 152 | display_progressbar(pad, paddedsize, paddedsize - (dat->addr)); 153 | io.execute(); 154 | }; 155 | 156 | io.clear(); 157 | io.makeWriteBulk(true); /* Sync it! */ 158 | memset(dat->data, 0xaa, currentPart->iosize); 159 | size_t padded = 0 ; 160 | if (paddedsize != towrite) 161 | do { 162 | io.appendFromBuffer((char *) &cmd, sizeof(struct rf24boot_data)); 163 | dat->addr += currentPart->iosize; 164 | padded +=currentPart->iosize; 165 | } while (dat->addr % currentPart->pad); 166 | io.execute(); 167 | 168 | int pad = printf("%lu/%lu bytes | %.02f s | ", paddedsize, paddedsize, timer_elapsed()); 169 | display_progressbar(pad, paddedsize, 0); 170 | std::cout << std::endl; 171 | } 172 | 173 | int RF24BootPartitionTable::numToQueue(uint32_t currentAddr) 174 | { 175 | if (currentAddr >= currentPart->size) 176 | return 0; 177 | 178 | int remaining = (currentPart->size - currentAddr) / currentPart->iosize; 179 | return std::min(numPacketsPerRun, remaining); 180 | } 181 | 182 | bool RF24BootPartitionTable::readSome(LibRF24IOTransfer &io, struct rf24boot_cmd *cmd) 183 | { 184 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd->data; 185 | io.clear(); 186 | 187 | 188 | if (!numToQueue(dat->addr)) 189 | return false; /* Nothing to queue */ 190 | 191 | for (int i=0; i< numToQueue(dat->addr); i++) { 192 | int ret = fread(dat->data, 1, currentPart->iosize, fileFd); 193 | if (ret==0 && i==0) 194 | return false; /* Nothing to do */ 195 | io.appendFromBuffer((char *) cmd, sizeof(struct rf24boot_data)); 196 | if (ret == 0) 197 | return true; 198 | dat->addr += currentPart->iosize; 199 | if (dat->addr >= currentPart->size) 200 | return true; 201 | } 202 | return true; 203 | } 204 | 205 | uint32_t RF24BootPartitionTable::saveSome(LibRF24IOTransfer &io) 206 | { 207 | /* TODO: sanity checking */ 208 | int i; 209 | uint32_t retaddr; 210 | for (i=0; ic_str(); 215 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd->data; 216 | retaddr = dat->addr; 217 | fwrite(dat->data, currentPart->iosize, 1, fileFd); 218 | if (retaddr == currentPart->size - currentPart->iosize) { 219 | return currentPart->size; 220 | } 221 | 222 | } 223 | io.clear(); 224 | io.makeRead(numPacketsPerRun); 225 | return retaddr; 226 | } 227 | 228 | 229 | void RF24BootPartitionTable::save(const char *filepath) 230 | { 231 | do_open(filepath, "w+"); 232 | fprintf(stderr, "Reading partition %s: %u bytes \n", currentPart->name, currentPart->size); 233 | 234 | struct rf24boot_cmd cmd; 235 | cmd.op = RF_OP_READ; 236 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd.data; 237 | dat->part = (uint8_t) currentPartId; 238 | dat->addr = currentPart->size; 239 | timer_reset(); 240 | LibRF24IOTransfer io(*adaptor); 241 | io.makeWriteBulk(true); 242 | io.appendFromBuffer((char *) &cmd, sizeof(struct rf24boot_data)); 243 | io.execute(); 244 | io.setTimeout(5000); 245 | do { 246 | uint32_t addr = 0; 247 | io.makeRead(numToQueue(addr)); 248 | io.execute(); 249 | addr = saveSome(io); 250 | int pad = printf("%u/%u bytes | %.02f s | ", addr, currentPart->size, timer_elapsed()); 251 | display_progressbar(pad, currentPart->size, currentPart->size-addr); 252 | if (addr == currentPart->size) 253 | break; 254 | } while(1); 255 | std::cout << std::endl; 256 | fclose(fileFd); 257 | } 258 | 259 | 260 | void RF24BootPartitionTable::run() 261 | { 262 | struct rf24boot_cmd cmd; 263 | cmd.op = RF_OP_BOOT; 264 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd.data; 265 | dat->part = (uint8_t) currentPartId; 266 | LibRF24IOTransfer io(*adaptor); 267 | io.makeWriteBulk(true); 268 | io.appendFromBuffer((char *) &cmd, sizeof(struct rf24boot_data)); 269 | io.execute(); 270 | fprintf(stderr, "Starting app in partition %d (%s)...\n", currentPartId, ptable.at(currentPartId).name); 271 | } 272 | 273 | void RF24BootPartitionTable::writeOne(uint32_t addr, const char *data, size_t size) 274 | { 275 | struct rf24boot_cmd cmd; 276 | cmd.op = RF_OP_WRITE; 277 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd.data; 278 | dat->part = (uint8_t) currentPartId; 279 | LibRF24IOTransfer io(*adaptor); 280 | io.makeWriteBulk(true); 281 | io.appendFromBuffer((char *) &cmd, sizeof(struct rf24boot_data)); 282 | io.execute(); 283 | } 284 | 285 | uint32_t RF24BootPartitionTable::verifySome(LibRF24IOTransfer &io, long int toverify) 286 | { 287 | /* TODO: sanity checking */ 288 | int i; 289 | uint32_t retaddr; 290 | unsigned char tmp[32]; 291 | for (i=0; ic_str(); 296 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd->data; 297 | retaddr = dat->addr; 298 | 299 | int ret = fread(tmp, 1, currentPart->iosize, fileFd); 300 | if (ret==0) 301 | return toverify; /* EOF */ 302 | 303 | int j; 304 | for (j=0; jiosize; j++) { 305 | 306 | if (retaddr + currentPart->iosize + j >= toverify ) 307 | return toverify; 308 | 309 | if (tmp[j] != dat->data[j]) { 310 | if (!verifyFailed) { 311 | fprintf(stderr, "\nVerification failed at offset 0x%x: %hhx != %hhx\n", 312 | dat->addr + j, tmp[j], dat->data[j]); 313 | fprintf(stderr, "Suppressing further errors\n"); 314 | 315 | } 316 | verifyFailed = true; 317 | } 318 | } 319 | 320 | 321 | } 322 | io.clear(); 323 | io.makeRead(numToQueue(retaddr)); 324 | return retaddr; 325 | } 326 | 327 | bool RF24BootPartitionTable::verify(const char *filepath) 328 | { 329 | do_open(filepath, "r"); 330 | long int toverify = std::min((long int) currentPart->size, fileSize); 331 | verifyFailed = false; 332 | fprintf(stderr, "Verifying partition %s against file %s, %lu bytes to verify\n", 333 | currentPart->name, filepath, toverify); 334 | 335 | struct rf24boot_cmd cmd; 336 | cmd.op = RF_OP_READ; 337 | struct rf24boot_data *dat = (struct rf24boot_data *) cmd.data; 338 | dat->part = (uint8_t) currentPartId; 339 | dat->addr = toverify; 340 | 341 | timer_reset(); 342 | LibRF24IOTransfer io(*adaptor); 343 | io.makeWriteBulk(true); 344 | io.appendFromBuffer((char *) &cmd, sizeof(struct rf24boot_data)); 345 | io.execute(); 346 | io.makeRead(numToQueue(0)); 347 | io.setTimeout(2000); 348 | do { 349 | io.execute(); 350 | uint32_t addr = verifySome(io, toverify); 351 | int pad = printf("%u/%lu bytes | %.02f s | ", addr, toverify, timer_elapsed()); 352 | display_progressbar(pad, toverify, toverify-addr); 353 | if (addr == toverify) 354 | break; 355 | } while(1); 356 | std::cout << std::endl; 357 | fclose(fileFd); 358 | return verifyFailed; 359 | } 360 | -------------------------------------------------------------------------------- /librf24pp/rf24sweeptransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | using namespace librf24; 8 | 9 | LibRF24SweepTransfer::LibRF24SweepTransfer(LibRF24Adaptor &a, int times) 10 | : LibRF24Transfer(a) 11 | { 12 | numTimes = times; 13 | clear(); 14 | } 15 | 16 | void LibRF24SweepTransfer::transferStarted() 17 | { 18 | adaptor.sweepStart(numTimes); 19 | } 20 | 21 | void LibRF24SweepTransfer::clear() 22 | { 23 | for (int i=0; i<128; i++) 24 | observed[i]=0; 25 | 26 | } 27 | 28 | 29 | unsigned int LibRF24SweepTransfer::getObserved(int ch) 30 | { 31 | if (ch >=128) 32 | throw std::range_error("channel out of range"); 33 | 34 | return observed[ch]; 35 | } 36 | 37 | void LibRF24SweepTransfer::handleData(unsigned char *result, size_t size) 38 | { 39 | for (int i=0; i<128; i++) 40 | observed[i] += result[i]; 41 | 42 | updateStatus(TRANSFER_COMPLETED, true); 43 | } 44 | 45 | void LibRF24SweepTransfer::adaptorNowIdle(bool lastOk) 46 | { 47 | 48 | } 49 | 50 | 51 | LibRF24SweepTransfer::~LibRF24SweepTransfer() 52 | { 53 | 54 | } 55 | -------------------------------------------------------------------------------- /librf24pp/rf24transfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace librf24; 9 | 10 | 11 | LibRF24Transfer::LibRF24Transfer(LibRF24Adaptor &a) : adaptor(a) 12 | { 13 | 14 | } 15 | 16 | LibRF24Transfer::~LibRF24Transfer() 17 | { 18 | 19 | } 20 | 21 | enum rf24_transfer_status LibRF24Transfer::status() 22 | { 23 | return currentStatus; 24 | } 25 | 26 | 27 | enum rf24_transfer_status LibRF24Transfer::execute() 28 | { 29 | if (!submit()) 30 | return currentStatus; 31 | do { 32 | adaptor.loopOnce(); 33 | } while ((currentStatus == TRANSFER_QUEUED) || 34 | (currentStatus == TRANSFER_RUNNING)); 35 | return currentStatus; 36 | } 37 | 38 | bool LibRF24Transfer::submit() 39 | { 40 | when_started = adaptor.currentTime(); 41 | when_timed_out = when_started + timeout_ms; 42 | currentStatus = TRANSFER_QUEUED; 43 | if (checkTransferTimeout(false)) /* incorrect timeout ? */ 44 | return false; 45 | LOG(DEBUG) << "Transfer started @ " << when_started << " will time out @ " << when_timed_out; 46 | return adaptor.submit(this); 47 | } 48 | 49 | bool LibRF24Transfer::checkTransferTimeout(bool finalize) 50 | { 51 | uint64_t time = adaptor.currentTime(); 52 | timeout_ms_left = timeout_ms - (time - when_started); 53 | if (time > when_timed_out) { 54 | if (finalize && (currentStatus == TRANSFER_QUEUED)) 55 | updateStatus(TRANSFER_TIMED_OUT, true); 56 | return true; 57 | } 58 | return false; 59 | } 60 | 61 | void LibRF24Transfer::updateStatus(enum rf24_transfer_status newStatus, bool callback) 62 | { 63 | LOG(DEBUG) << "Transfer status change: " << currentStatus << " -> " << newStatus; 64 | this->currentStatus = newStatus; 65 | 66 | if (callback && (this->cb != nullptr)) 67 | this->cb(*this); 68 | 69 | if (callback) 70 | adaptor.transferCompleted(this); 71 | } 72 | 73 | 74 | void LibRF24Transfer::bufferWriteDone(LibRF24Packet *pck) 75 | { 76 | 77 | } 78 | 79 | void LibRF24Transfer::bufferReadDone(LibRF24Packet *pck) 80 | { 81 | 82 | } 83 | 84 | void LibRF24Transfer::adaptorNowIdle(bool lastOk) 85 | { 86 | 87 | } 88 | 89 | LibRF24Packet *LibRF24Transfer::nextForRead() 90 | { 91 | return nullptr; 92 | } 93 | 94 | LibRF24Packet *LibRF24Transfer::nextForWrite() 95 | { 96 | return nullptr; 97 | } 98 | 99 | -------------------------------------------------------------------------------- /librf24pp/rf24writetransfer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | -------------------------------------------------------------------------------- /m328p_run_app.sh: -------------------------------------------------------------------------------- 1 | avrdude -c usbasp -p m328p -U lfuse:w:0xe2:m -U hfuse:w:0xd1:m -B10 2 | 3 | -------------------------------------------------------------------------------- /m328p_run_boot.sh: -------------------------------------------------------------------------------- 1 | avrdude -c usbasp -p m328p -B 10 -U lfuse:w:0xe2:m -U hfuse:w:0xd0:m 2 | -------------------------------------------------------------------------------- /prebuilt/rf24boot-red-wisp.hex: -------------------------------------------------------------------------------- 1 | :107000000C9434380C9465380C9465380C946538BD 2 | :107010000C9465380C9465380C9465380C9465387C 3 | :107020000C9465380C9465380C9465380C9465386C 4 | :107030000C9465380C9465380C9465380C9465385C 5 | :107040000C9465380C9465380C9465380C9465384C 6 | :107050000C9465380C9465380C9465380C9465383C 7 | :107060000C9465380C94653811241FBECFEFD8E01E 8 | :10707000DEBFCDBF11E0A0E0B1E0E2E1FFE702C07A 9 | :1070800005900D92AC36B107D9F711E0ACE6B1E04E 10 | :1070900001C01D92A93FB107E1F7F8940E94D238D0 11 | :1070A0000E949F3E0E94A43E0E94A93E0E94E23E92 12 | :1070B0000E94FB3E78940E94103D0E94343D0E9445 13 | :1070C000B53E0E9470380C94853F0C940038FA014C 14 | :1070D000DC0102C005900D9221503040D8F7089590 15 | :1070E00080E090E008950895482F27E030E080E0A8 16 | :1070F00050E061E070E02D98FA01022E02C0F59593 17 | :10710000E7950A94E2F7E0FF02C0289A01C02898A8 18 | :107110002D9A1C9B07C0962F022E01C0990F0A942E 19 | :10712000EAF701C090E0892B2150310920F72D9812 20 | :107130000895A1E0B0E0EFE9F8E30C94163F8C016C 21 | :10714000680F07C0F80181918F0169830E9474382C 22 | :1071500069816013F7CF2196E4E00C94323FA1E0FF 23 | :10716000B0E0E5EBF8E30C94163F8C01680F08C023 24 | :107170008FEF69830E947438F80181938F016981D0 25 | :107180006013F6CF2196E4E00C94323F892B11F086 26 | :10719000439A089543980895892B11F0429A0895CF 27 | :1071A000429808953B9A3A9A84B1816284B92498AE 28 | :1071B00085B1816285B92D980895E0910001F09123 29 | :1071C00001010190F081E02D90E009950895E09192 30 | :1071D0000001F09101010280F381E02D90E009951A 31 | :1071E0000895E0910001F09101010680F781E02D02 32 | :1071F00009950895E0910001F09101010084F18565 33 | :10720000E02D09950895A2E0B0E0E9E0F9E30C94DF 34 | :10721000163F89838B0180E04A830E94DD3861E05C 35 | :10722000CE0101960E94F1384A81442321F0642F57 36 | :10723000C8010E94FA3881E00E94DD382296E4E01D 37 | :107240000C94323FA2E0B0E0E8E2F9E30C94163F80 38 | :1072500089838B0180E04A830E94DD3861E0CE01A2 39 | :1072600001960E94F1384A81442321F0642FC8011D 40 | :107270000E94F13881E00E94DD382296E4E00C940F 41 | :10728000323F862FBA018F71422F80620E942239CD 42 | :107290000895A1E0B0E0EFE4F9E30C94183F862FE5 43 | :1072A00049838F7141E0BE016F5F7F4F80620E9412 44 | :1072B00022392196E2E00C94343FA1E0B0E0E3E60D 45 | :1072C000F9E30C94183F862F41E0BE016F5F7F4FBA 46 | :1072D0008F710E94033989812196E2E00C94343F3A 47 | :1072E000A1E2B0E0E6E7F9E30C94143FFC018B0166 48 | :1072F00080EA89A3E384F42EE41608F4FE2C828548 49 | :1073000083FD02C0EF1801C0E12C4E2D50E060E07B 50 | :1073100070E0CE0101960E943F3F80E00E94DD3880 51 | :1073200061E0CE0181960E94F1386F2DC8010E9464 52 | :10733000F1386E2DCE0101960E94F13881E00E9455 53 | :10734000DD38A196E6E00C94303FA1E2B0E0EBEA34 54 | :10735000F9E30C94143FFC018B0181E689A363855A 55 | :10736000F42E641708F4F62E828583FD03C0E62E02 56 | :10737000EF1801C0E12C80E00E94DD3861E0CE0111 57 | :1073800081960E94F1386F2DC8010E94FA386E2D47 58 | :10739000CE0101960E94FA3881E00E94DD38A19664 59 | :1073A000E6E00C94303F40E060E070E082EE0E9446 60 | :1073B0000339089540E060E070E081EE0E940339F7 61 | :1073C0000895A1E0B0E0E7EEF9E30C94183F80E007 62 | :1073D0000E94DD3861E0CE0101960E94FA3881E01A 63 | :1073E0000E94DD3889812196E2E00C94343FAAE0C6 64 | :1073F000B0E0EDEFF9E30C94123F8C017B0180E0EB 65 | :107400000E94E738F7018081803808F08FE78A878B 66 | :1074100041E0BE01665F7F4F85E20E942239F7019D 67 | :107420008481F0E18F9FC0011124F70193819F7047 68 | :10743000982B998741E0BE01675F7F4F84E20E94ED 69 | :1074400022396DE1C8010E945D39C82E6CE1C80186 70 | :107450000E945D39F7012781213208F020E2F8010E 71 | :107460002387F7019681F8012285992341F09C2D0D 72 | :107470009460286022874FE3D42ED82A08C09C2D20 73 | :107480009B7F277FF801228730ECD32ED822F7018B 74 | :107490002581F8018285222341F08061828726E0E0 75 | :1074A000C22EC92AF3E0DF2A06C08F7EF801828748 76 | :1074B0008DEFC82EC922C88641E0BE01685F7F4FAC 77 | :1074C0008DE30E942239CC20F1F06DE1C8010E94C9 78 | :1074D0005D39811175C080E5898383E78A8380E007 79 | :1074E0000E94DD3862E0CE0101960E94F13881E011 80 | :1074F0000E94DD38CF8241E0BE01695F7F4F8DE39E 81 | :107500000E9422395DC0DE8241E0BE016A5F7F4F8A 82 | :107510008CE30E94223966E0C8010E945D39F801BF 83 | :107520009285292F21602287877DF70122812230D1 84 | :1075300029F49E7FF8019287806203C0213009F40C 85 | :107540008860897FF7019181933009F40AC09230F5 86 | :1075500011F4846007C0913011F4826003C094304C 87 | :1075600009F486608D8341E0BE016B5F7F4F86E248 88 | :107570000E94223960E0C8010E945D39837FF701D3 89 | :107580009085913011F4886001C08C608C8341E05B 90 | :10759000BE016C5F7F4F80E20E942239F701818536 91 | :1075A0008F738B8341E0BE016D5F7F4F81E20E944C 92 | :1075B0002239C8010E94D339C8010E94DA3905C0B6 93 | :1075C0006DE1C8010E945D399ECF2A96E8E00C94D7 94 | :1075D0002E3FFC0181E0828780E283871586168634 95 | :1075E0001786108A118A148680E00E94E73881E0AD 96 | :1075F0000E94DD3880E197E20197F1F70895A2E05B 97 | :10760000B0E0E5E0FBE30C94163F8C0160E00E94E3 98 | :107610005D3983608A8341E0BE016E5F7F4F80E207 99 | :107620000E94223980E7898341E0BE016F5F7F4F6E 100 | :1076300087E20E942239B801635F7F4F45E08AE20A 101 | :107640000E94223981E00E94E73884E091E00197AE 102 | :10765000F1F72296E4E00C94323FA1E0B0E0E3E3DE 103 | :10766000FBE30C94163F8C0180E00E94E73860E059 104 | :10767000C8010E945D398E7F898341E0BE016F5F42 105 | :107680007F4F80E20E9422390E5E1F4F45E0B80115 106 | :107690008AE20E94223945E0B80180E30E94223943 107 | :1076A0002196E4E00C94323FA2E0B0E0EAE5FBE38F 108 | :1076B0000C94163F8B010E94E139282F26952770E4 109 | :1076C000273081F00115110511F0F801208380E4C5 110 | :1076D000898341E0BE016F5F7F4F87E22A830E946A 111 | :1076E00022392A8181E090E0273011F480E090E097 112 | :1076F0002296E4E00C94323FCF93DF93EC010E949A 113 | :10770000A53967E1CE010E945D39817090E0DF917B 114 | :10771000CF910895A1E0B0E0E0E9FBE30C94143FC1 115 | :107720007C018B0145E08AE20E94223945E0B801E4 116 | :1077300080E30E942239F80120E030E08191D701F6 117 | :10774000A20FB31F52968C932F5F3F4F2530310508 118 | :10775000A9F7F7018385813208F080E2898341E04F 119 | :10776000BE016F5F7F4F81E30E9422392196E6E0E0 120 | :107770000C94303FA3E1B0E0E0ECFBE30C94143F49 121 | :107780008C01E62E86E0E1E5F1E0DE011D96019038 122 | :107790000D928A95E1F786E0E7E5F1E0DE011796C4 123 | :1077A00001900D928A95E1F786E0EDE5F1E0DE01CA 124 | :1077B000119601900D928A95E1F7611112C0FA01BC 125 | :1077C00080E090E02191D801A80FB91F1D962C935D 126 | :1077D000019685309105B1F7FE01EE0DF11D25E012 127 | :1077E0000AC086E0861738F1A1E06A17A9F3FE0106 128 | :1077F000E60FF11D21E06585C8010E944139F12C99 129 | :10780000FE01EE0DFF1DD8011B964C916781C8014A 130 | :107810000E94493962E0C8010E945D39FE01EE0D07 131 | :10782000FF1D9181982B9B8B41E0BE016D5E7F4FC8 132 | :1078300082E20E9422396396E6E00C94303FA1E098 133 | :10784000B0E0E5E2FCE30C94163F8C01198241E0C4 134 | :10785000BE016F5F7F4F80E60E94033989818132CC 135 | :1078600020F0C8010E94D33980E02196E4E00C9416 136 | :10787000323FA2E0B0E0EFE3FCE30C94123F8B0157 137 | :107880007A0169010E94E139982F80E7898341E0FC 138 | :10789000BE016F5F7F4F87E29A830E9422399A81EF 139 | :1078A000892F8072F8018083892F8071F70180838E 140 | :1078B0009074F60190832296E8E00C942E3F67E1E5 141 | :1078C0000E945D3980710895A2E0B0E0EAE6FCE331 142 | :1078D0000C94143F8C017B0167E14A830E945D395F 143 | :1078E0004A8185FF0CC080E1898341E0BE016F5F62 144 | :1078F0007F4F87E20E94223985EF9FEF09C0B701D1 145 | :10790000C8010E94703981E00E94E73880E090E071 146 | :107910002296E6E00C94303FA1E0B0E0E2E9FCE31F 147 | :107920000C94123F7C018B0181E00E94E73860E2F9 148 | :10793000C62E6EE4D62E0BC09E012F5F3F4FA901CD 149 | :10794000B901C7010E94393CC6010197F1F7C7018F 150 | :107950000E945F3C811103C00150110969F79E012B 151 | :107960002F5F3F4FA901B901C7010E94393C80E058 152 | :107970000E94E738C8012196E8E00C942E3F089554 153 | :1079800090912A01992359F0811120C08091000122 154 | :10799000909101010E942D3B10922A0108958823A5 155 | :1079A000A9F06AEF70E080910001909101010E94BE 156 | :1079B0008C3C892B11F40E94D63E8091000190915D 157 | :1079C00001010E94FF3A81E080932A0108951F93EC 158 | :1079D000CF93DF93EC01162F80E00E94C03C1F5F25 159 | :1079E000412FBE0180910001909101010E94643CF1 160 | :1079F000892BB1F7DF91CF911F91089520916D01EF 161 | :107A000030916E01F901EE0FFF1FED50FE4F918393 162 | :107A100080832F5F3F4F30936E0120936D01089557 163 | :107A200080910001909101010E94E93A6BE171E0BF 164 | :107A300080910001909101010E94F739809100012D 165 | :107A4000909101010E94BF3C45E251E060E08091CD 166 | :107A50000001909101010E94BA3B80910001909138 167 | :107A600001010E94FF3A0895A1E2B0E0EAE3FDE3DC 168 | :107A70000C94103FBE016F5D7F4F8091000190918B 169 | :107A800001010E94543B892B09F4C3C0809100017D 170 | :107A9000909101010E941F3C482F8E010F5F1F4FE4 171 | :107AA000B80180910001909101010E947C3B2981E5 172 | :107AB0002F7009F048C07E0182E0E80EF11CB7018A 173 | :107AC00080910001909101010E948A3B80916D019B 174 | :107AD0008A831B824CE150E063E671E0CE0104969C 175 | :107AE0000E94463F18A280910001909101010E94DE 176 | :107AF000D3396FE1C8010E94E73C81E080936C01BB 177 | :107B0000D12C8FE0C82E12C0EE0FFF1FED50FE4F9C 178 | :107B10000190F081E02DD7018C2D01900D928A9576 179 | :107B2000E1F76FE0C8010E94E73CD394ED2DF0E04F 180 | :107B300080916D0190916E01E817F9072CF381E0B7 181 | :107B40000E94C03C66C0EA81F0E080916D01909196 182 | :107B50006E01E817F9070CF05CC02330D1F5CB803B 183 | :107B6000DC80ED80FE801B821C821D821E82EA81E9 184 | :107B7000F0E0EE0FFF1FED50FE4F808191814B81B1 185 | :107B80005C816D817E81DC011F96ED91FC915097A7 186 | :107B90009E01295F3F4F09955C01682F6B5FC8010B 187 | :107BA0000E94E73CA501662757FD6095762F8B81E3 188 | :107BB0009C81AD81BE81480F591F6A1F7B1F4B837B 189 | :107BC0005C836D837E834C155D056E057F0578F2C1 190 | :107BD000B6CF2430A1F4EE0FFF1FED50FE4F808191 191 | :107BE00091814B815C816D817E81DC015196ED91AB 192 | :107BF000FC9152979E01295F3F4F09950AC02230A0 193 | :107C000041F4EE0FFF1FED50FE4F808191810E94E5 194 | :107C10008F3EA196EAE00C942C3FC901411520E764 195 | :107C200052076105710538F420E130E00E946738A1 196 | :107C300080E190E0089580E090E00895CB01BA01E2 197 | :107C400040E150E0C9010E946D3F0895CB01BA01A7 198 | :107C5000611544E0740740F440E150E0C9010E941E 199 | :107C6000553F80E190E0089580E090E00895CF9343 200 | :107C7000DB01CA018F779927AA27BB27DC01AF5800 201 | :107C8000BE4FC0E1F90101900D92CA95E1F7DB0109 202 | :107C9000CA014096A11DB11D8F779927AA27BB273E 203 | :107CA000892B8A2B8B2B09F038C04078CFB7F894FA 204 | :107CB000F999FECF83E0FA0180935700E89507B663 205 | :107CC00000FCFDCF6091710180E090E071E0DC018B 206 | :107CD000AF58BE4FFC01E40FF51F11962C91119780 207 | :107CE00030E0322F2227260F311D090170935700F3 208 | :107CF000E895112412966C9102968038910539F717 209 | :107D000085E0FA0180935700E89507B600FCFDCFA7 210 | :107D100081E180935700E895CFBFCF91089580917E 211 | :107D20000001909101010E942D3BF89481E1809324 212 | :107D30005700E895E0916F01F091700109958EE38D 213 | :107D400091E00E94FE3C08958BE291E00E94FE3C8F 214 | :107D5000089529E288E190E00FB6F894A895809301 215 | :107D600060000FBE209360000895A89580916C017B 216 | :107D700081111BC084EF91E028EC30E0F9013197CC 217 | :107D8000F1F70197D9F78091F1019091F2019C01EF 218 | :107D90002F5F3F4F3093F2012093F101853691051B 219 | :107DA00024F080E090E00E948F3E089529E088E171 220 | :107DB00090E00FB6F894A895809360000FBE2093D2 221 | :107DC0006000FFCF8FEF93E00E94653F8E3D59F436 222 | :107DD00080916C018F5F80936C016FEF8FEF93E068 223 | :107DE0000E94773F0895419A319904C080E090E065 224 | :107DF0000E948F3E089584B18E6084B985B1817FE1 225 | :107E000085B98AB188668AB98AB187798AB90895AD 226 | :107E10002F923F924F925F926F927F928F929F929A 227 | :107E2000AF92BF92CF92DF92EF92FF920F931F9388 228 | :107E3000CF93DF93CDB7DEB7CA1BDB0B0FB6F89439 229 | :107E4000DEBF0FBECDBF09942A88398848885F8479 230 | :107E50006E847D848C849B84AA84B984C884DF80EA 231 | :107E6000EE80FD800C811B81AA81B981CE0FD11DCE 232 | :107E70000FB6F894DEBF0FBECDBFED010895DC0153 233 | :107E800001C06D9341505040E0F70895FB01DC01C3 234 | :107E90004150504048F001900D920020C9F701C0B8 235 | :107EA0001D9241505040E0F70895DC01CB01FC01E8 236 | :107EB000F999FECF06C0F2BDE1BDF89A319600B443 237 | :107EC0000D9241505040B8F70895F999FECF92BDF8 238 | :107ED00081BDF89A992780B50895DC01CB0103C0D4 239 | :107EE0002D910E94783F41505040D0F70895262FA1 240 | :107EF000F999FECF1FBA92BD81BD20BD0FB6F8948F 241 | :107F0000FA9AF99A0FBE019608950C945D38F89488 242 | :027F1000FFCFA1 243 | :107F12000201C638CC3873389938AF3800000000F7 244 | :107F220000000000000000000000000D03010F0F20 245 | :107F320000012002FFB00B10ADED01100070000037 246 | :107F42008000666C6173680000000D3E373E1000D1 247 | :107F52000400000100656570726F6D0000263E1E10 248 | :107F62003E0A0B0C0D0E0F1112131415160102040A 249 | :0C7F72000810207265642D7769737000A0 250 | :040000030000700089 251 | :00000001FF 252 | -------------------------------------------------------------------------------- /prebuilt/rf24boot-rfoutlet.hex: -------------------------------------------------------------------------------- 1 | :107000000C9434380C9461380C9461380C946138C9 2 | :107010000C9461380C9461380C9461380C9461388C 3 | :107020000C9461380C9461380C9461380C9461387C 4 | :107030000C9461380C9461380C9461380C9461386C 5 | :107040000C9461380C9461380C9461380C9461385C 6 | :107050000C9461380C9461380C9461380C9461384C 7 | :107060000C9461380C94613811241FBECFEFD8E026 8 | :10707000DEBFCDBF11E0A0E0B1E0E0E4FEE702C07A 9 | :1070800005900D92AE36B107D9F711E0AEE6B1E04A 10 | :1070900001C01D92AB3FB107E1F7F8940E9494380C 11 | :1070A0000E94643E0E94693E0E946E3E78940E9457 12 | :1070B000D53C0E94F93C0E947A3E0E946C380C94A8 13 | :1070C0001C3F0C940038FA01DC0102C005900D92BF 14 | :1070D00021503040D8F7089580E090E00895089559 15 | :1070E00007C0FC012191CF012EBD0DB407FEFDCFDD 16 | :1070F0006150B8F708952FEF08C02EBD0DB407FEFC 17 | :10710000FDCF3EB5FC013193CF016150B0F708953A 18 | :10711000892B11F0299A089529980895892B11F047 19 | :107120002A9A08952A980895219A229A249884B137 20 | :107130008C6284B985B18C6385B980E58CBD81E0B2 21 | :107140008DBD0895E0910001F09101010190F08161 22 | :10715000E02D90E009950895E0910001F091010182 23 | :107160000280F381E02D90E009950895E0910001FF 24 | :10717000F09101010680F781E02D09950895E091D5 25 | :107180000001F09101010084F185E02D0995089539 26 | :10719000A2E0B0E0EEECF8E30C94B53E89838B01FD 27 | :1071A00080E04A830E94A23861E0CE0101960E94ED 28 | :1071B000B6384A81442321F0642FC8010E94BF38A9 29 | :1071C00081E00E94A2382296E4E00C94D13EA2E035 30 | :1071D000B0E0EDEEF8E30C94B53E89838B0180E0DE 31 | :1071E0004A830E94A23861E0CE0101960E94B6381F 32 | :1071F0004A81442321F0642FC8010E94B63881E0FF 33 | :107200000E94A2382296E4E00C94D13E862FBA0167 34 | :107210008F71422F80620E94E7380895A1E0B0E0AC 35 | :10722000E4E1F9E30C94B73E862F49838F7141E086 36 | :10723000BE016F5F7F4F80620E94E7382196E2E0D7 37 | :107240000C94D33EA1E0B0E0E8E2F9E30C94B73E41 38 | :10725000862F41E0BE016F5F7F4F8F710E94C8385B 39 | :1072600089812196E2E00C94D33EA1E2B0E0EBE309 40 | :10727000F9E30C94B33EFC018B0180EA89A3E3841B 41 | :10728000F42EE41608F4FE2C828583FD02C0EF186C 42 | :1072900001C0E12C4E2D50E060E070E0CE0101967F 43 | :1072A0000E94DE3E80E00E94A23861E0CE0181961D 44 | :1072B0000E94B6386F2DC8010E94B6386E2DCE01DF 45 | :1072C00001960E94B63881E00E94A238A196E6E0BD 46 | :1072D0000C94CF3EA1E2B0E0E0E7F9E30C94B33EBA 47 | :1072E000FC018B0181E689A36385F42E641708F401 48 | :1072F000F62E828583FD03C0E62EEF1801C0E12C37 49 | :1073000080E00E94A23861E0CE0181960E94B638EA 50 | :107310006F2DC8010E94BF386E2DCE0101960E94CC 51 | :10732000BF3881E00E94A238A196E6E00C94CF3EDF 52 | :1073300040E060E070E082EE0E94C838089540E0CE 53 | :1073400060E070E081EE0E94C8380895A1E0B0E0EE 54 | :10735000ECEAF9E30C94B73E80E00E94A23861E0C9 55 | :10736000CE0101960E94BF3881E00E94A238898137 56 | :107370002196E2E00C94D33EAAE0B0E0E2ECF9E31F 57 | :107380000C94B13E8C017B0180E00E94AC38F70187 58 | :107390008081803808F08FE78A8741E0BE01665F10 59 | :1073A0007F4F85E20E94E738F7018481F0E18F9FEB 60 | :1073B000C0011124F70193819F70982B998741E0B8 61 | :1073C000BE01675F7F4F84E20E94E7386DE1C8012C 62 | :1073D0000E942239C82E6CE1C8010E942239F701AF 63 | :1073E0002781213208F020E2F8012387F7019681F6 64 | :1073F000F8012285992341F09C2D94602860228712 65 | :107400004FE3D42ED82A08C09C2D9B7F277FF801FC 66 | :10741000228730ECD32ED822F7012581F80182850E 67 | :10742000222341F08061828726E0C22EC92AF3E040 68 | :10743000DF2A06C08F7EF80182878DEFC82EC92211 69 | :10744000C88641E0BE01685F7F4F8DE30E94E73848 70 | :10745000CC20F1F06DE1C8010E942239811175C084 71 | :1074600080E5898383E78A8380E00E94A23862E016 72 | :10747000CE0101960E94B63881E00E94A238CF82E8 73 | :1074800041E0BE01695F7F4F8DE30E94E7385DC038 74 | :10749000DE8241E0BE016A5F7F4F8CE30E94E738E5 75 | :1074A00066E0C8010E942239F8019285292F2160E7 76 | :1074B0002287877DF7012281223029F49E7FF801FF 77 | :1074C0009287806203C0213009F48860897FF701C8 78 | :1074D0009181933009F40AC0923011F4846007C09E 79 | :1074E000913011F4826003C0943009F486608D837A 80 | :1074F00041E0BE016B5F7F4F86E20E94E73860E0AB 81 | :10750000C8010E942239837FF7019085913011F4E0 82 | :10751000886001C08C608C8341E0BE016C5F7F4F4E 83 | :1075200080E20E94E738F70181858F738B8341E009 84 | :10753000BE016D5F7F4F81E20E94E738C8010E9463 85 | :107540009839C8010E949F3905C06DE1C8010E94A9 86 | :1075500022399ECF2A96E8E00C94CD3EFC0181E0D2 87 | :10756000828780E28387158616861786108A118A9D 88 | :10757000148680E00E94AC3881E00E94A23880E14D 89 | :1075800097E20197F1F70895A2E0B0E0EAECFAE3A0 90 | :107590000C94B53E8C0160E00E94223983608A839E 91 | :1075A00041E0BE016E5F7F4F80E20E94E73880E7D6 92 | :1075B000898341E0BE016F5F7F4F87E20E94E73819 93 | :1075C000B801635F7F4F45E08AE20E94E73881E0BF 94 | :1075D0000E94AC3884E091E00197F1F72296E4E054 95 | :1075E0000C94D13EA1E0B0E0E8EFFAE30C94B53E94 96 | :1075F0008C0180E00E94AC3860E0C8010E94223912 97 | :107600008E7F898341E0BE016F5F7F4F80E20E94E1 98 | :10761000E7380E5E1F4F45E0B8018AE20E94E73866 99 | :1076200045E0B80180E30E94E7382196E4E00C943D 100 | :10763000D13EA2E0B0E0EFE1FBE30C94B53E8B015C 101 | :107640000E94A639282F26952770273081F0011532 102 | :10765000110511F0F801208380E4898341E0BE0127 103 | :107660006F5F7F4F87E22A830E94E7382A8181E09B 104 | :1076700090E0273011F480E090E02296E4E00C9452 105 | :10768000D13ECF93DF93EC010E946A3967E1CE01CE 106 | :107690000E942239817090E0DF91CF910895A1E09E 107 | :1076A000B0E0E5E5FBE30C94B33E7C018B0145E0E3 108 | :1076B0008AE20E94E73845E0B80180E30E94E7389B 109 | :1076C000F80120E030E08191D701A20FB31F52965C 110 | :1076D0008C932F5F3F4F25303105A9F7F701838544 111 | :1076E000813208F080E2898341E0BE016F5F7F4F05 112 | :1076F00081E30E94E7382196E6E00C94CF3EA3E1B7 113 | :10770000B0E0E5E8FBE30C94B33E8C01E62E86E0A6 114 | :10771000E1E5F1E0DE011D9601900D928A95E1F719 115 | :1077200086E0E7E5F1E0DE01179601900D928A957B 116 | :10773000E1F786E0EDE5F1E0DE01119601900D92B2 117 | :107740008A95E1F7611112C0FA0180E090E0219181 118 | :10775000D801A80FB91F1D962C930196853091056D 119 | :10776000B1F7FE01EE0DF11D25E00AC086E0861797 120 | :1077700038F1A1E06A17A9F3FE01E60FF11D21E03F 121 | :107780006585C8010E940639F12CFE01EE0DFF1D32 122 | :10779000D8011B964C916781C8010E940E3962E0A6 123 | :1077A000C8010E942239FE01EE0DFF1D9181982B28 124 | :1077B0009B8B41E0BE016D5E7F4F82E20E94E73805 125 | :1077C0006396E6E00C94CF3EA1E0B0E0EAEEFBE386 126 | :1077D0000C94B53E8C01198241E0BE016F5F7F4F72 127 | :1077E00080E60E94C8388981813220F0C8010E9459 128 | :1077F000983980E02196E4E00C94D13EA2E0B0E01C 129 | :10780000E4E0FCE30C94B13E8B017A0169010E9433 130 | :10781000A639982F80E7898341E0BE016F5F7F4FD3 131 | :1078200087E29A830E94E7389A81892F8072F80153 132 | :107830008083892F8071F70180839074F601908393 133 | :107840002296E8E00C94CD3E67E10E9422398071D7 134 | :107850000895A2E0B0E0EFE2FCE30C94B33E8C01AB 135 | :107860007B0167E14A830E9422394A8185FF0CC06F 136 | :1078700080E1898341E0BE016F5F7F4F87E20E9414 137 | :10788000E73885EF9FEF09C0B701C8010E9435397D 138 | :1078900081E00E94AC3880E090E02296E6E00C9413 139 | :1078A000CF3EA1E0B0E0E7E5FCE30C94B13E7C0103 140 | :1078B0008B0181E00E94AC3860E2C62E6EE4D62EC9 141 | :1078C0000BC09E012F5F3F4FA901B901C7010E9464 142 | :1078D000FE3BC6010197F1F7C7010E94243C8111CC 143 | :1078E00003C00150110969F79E012F5F3F4FA901A5 144 | :1078F000B901C7010E94FE3B80E00E94AC38C8017C 145 | :107900002196E8E00C94CD3E089590912A019923A8 146 | :1079100059F0811120C080910001909101010E94D5 147 | :10792000F23A10922A0108958823A9F06AEF70E0D4 148 | :1079300080910001909101010E94513C892B11F42A 149 | :107940000E949B3E80910001909101010E94C43AE7 150 | :1079500081E080932A0108951F93CF93DF93EC0178 151 | :10796000162F80E00E94853C1F5F412FBE01809151 152 | :107970000001909101010E94293C892BB1F7DF9110 153 | :10798000CF911F91089520916F0130917001F901FD 154 | :10799000EE0FFF1FEB50FE4F918380832F5F3F4F11 155 | :1079A0003093700120936F010895809100019091B0 156 | :1079B00001010E94AE3A6BE171E08091000190916B 157 | :1079C00001010E94BC3980910001909101010E9447 158 | :1079D000843C45E251E060E080910001909101011A 159 | :1079E0000E947F3B80910001909101010E94C43A66 160 | :1079F0000895A1E2B0E0EFEFFCE30C94AF3EBE01CE 161 | :107A00006F5D7F4F80910001909101010E94193BB1 162 | :107A1000892B09F4C3C080910001909101010E945B 163 | :107A2000E43B482F8E010F5F1F4FB801809100018A 164 | :107A3000909101010E94413B29812F7009F048C0BB 165 | :107A40007E0182E0E80EF11CB70180910001909167 166 | :107A500001010E944F3B80916F018A831B824CE1A0 167 | :107A600050E063E671E0CE0104960E94E53E18A264 168 | :107A700080910001909101010E9498396FE1C80145 169 | :107A80000E94AC3C81E080936E01D12C8FE0C82E27 170 | :107A900012C0EE0FFF1FEB50FE4F0190F081E02D62 171 | :107AA000D7018C2D01900D928A95E1F76FE0C80106 172 | :107AB0000E94AC3CD394ED2DF0E080916F01909149 173 | :107AC0007001E817F9072CF381E00E94853C66C03D 174 | :107AD000EA81F0E080916F0190917001E817F90759 175 | :107AE0000CF05CC02330D1F5CB80DC80ED80FE80D3 176 | :107AF0001B821C821D821E82EA81F0E0EE0FFF1FB6 177 | :107B0000EB50FE4F808191814B815C816D817E8144 178 | :107B1000DC011F96ED91FC9150979E01295F3F4F2C 179 | :107B200009955C01682F6B5FC8010E94AC3CA50100 180 | :107B3000662757FD6095762F8B819C81AD81BE8134 181 | :107B4000480F591F6A1F7B1F4B835C836D837E83A5 182 | :107B50004C155D056E057F0578F2B6CF2430A1F493 183 | :107B6000EE0FFF1FEB50FE4F808191814B815C81B6 184 | :107B70006D817E81DC015196ED91FC9152979E01C1 185 | :107B8000295F3F4F09950AC0223041F4EE0FFF1FD5 186 | :107B9000EB50FE4F808191810E94543EA196EAE015 187 | :107BA0000C94CB3EC901411520E7520761057105D0 188 | :107BB00038F420E130E00E94633880E190E00895DD 189 | :107BC00080E090E00895CB01BA0140E150E0C901A6 190 | :107BD0000E94043F0895CB01BA01611544E0740787 191 | :107BE00040F440E150E0C9010E94F43E80E190E0A1 192 | :107BF000089580E090E00895CF93DB01CA018F776C 193 | :107C00009927AA27BB27DC01AD58BE4FC0E1F90177 194 | :107C100001900D92CA95E1F7DB01CA014096A11DC2 195 | :107C2000B11D8F779927AA27BB27892B8A2B8B2BEE 196 | :107C300009F038C04078CFB7F894F999FECF83E0C7 197 | :107C4000FA0180935700E89507B600FCFDCF6091DC 198 | :107C5000730180E090E071E0DC01AD58BE4FFC01A3 199 | :107C6000E40FF51F11962C91119730E0322F222747 200 | :107C7000260F311D090170935700E89511241296C3 201 | :107C80006C9102968038910539F785E0FA0180936E 202 | :107C90005700E89507B600FCFDCF81E180935700BF 203 | :107CA000E895CFBFCF910895809100019091010197 204 | :107CB0000E94F23AF89481E180935700E895E091B0 205 | :107CC0007101F091720109958EE391E00E94C33C2D 206 | :107CD00008958BE291E00E94C33C089529E288E177 207 | :107CE00090E00FB6F894A895809360000FBE2093A3 208 | :107CF00060000895A89580916E0181111BC084EFEA 209 | :107D000091E028EC30E0F9013197F1F70197D9F7CC 210 | :107D10008091F3019091F4019C012F5F3F4F3093CC 211 | :107D2000F4012093F3018536910524F080E090E082 212 | :107D30000E94543E089529E088E190E00FB6F8943F 213 | :107D4000A895809360000FBE20936000FFCF2F9214 214 | :107D50003F924F925F926F927F928F929F92AF92DB 215 | :107D6000BF92CF92DF92EF92FF920F931F93CF9328 216 | :107D7000DF93CDB7DEB7CA1BDB0B0FB6F894DEBFBF 217 | :107D80000FBECDBF09942A88398848885F846E84E5 218 | :107D90007D848C849B84AA84B984C884DF80EE802F 219 | :107DA000FD800C811B81AA81B981CE0FD11D0FB638 220 | :107DB000F894DEBF0FBECDBFED010895DC0101C018 221 | :107DC0006D9341505040E0F70895FB01DC014150B4 222 | :107DD000504048F001900D920020C9F701C01D925B 223 | :107DE00041505040E0F70895DC01CB01FC01F999C6 224 | :107DF000FECF06C0F2BDE1BDF89A319600B40D92F7 225 | :107E000041505040B8F70895DC01CB0103C02D91DB 226 | :107E10000E940F3F41505040D0F70895262FF99906 227 | :107E2000FECF1FBA92BD81BD20BD0FB6F894FA9A5D 228 | :107E3000F99A0FBE019608950C945938F894FFCF23 229 | :107E4000020188388E386F3870387B3800000000A7 230 | :107E500000000000000000000000000D03010F0FF3 231 | :107E600000012002FFB00B10ADED0110007000000A 232 | :107E70008000666C617368000000D23DFC3D10001C 233 | :107E80000400000100656570726F6D0000EB3DE35A 234 | :107E90003D0A0B0C0D0E0F111213141516010204DE 235 | :0E7EA00008102072662D6F75746C65740000FA 236 | :040000030000700089 237 | :00000001FF 238 | -------------------------------------------------------------------------------- /prebuilt/rf24boot-strip-wisp.hex: -------------------------------------------------------------------------------- 1 | :107000000C9434380C9461380C9461380C946138C9 2 | :107010000C9461380C9461380C9461380C9461388C 3 | :107020000C9461380C9461380C9461380C9461387C 4 | :107030000C9461380C9461380C9461380C9461386C 5 | :107040000C9461380C9461380C9461380C9461385C 6 | :107050000C9461380C9461380C9461380C9461384C 7 | :107060000C9461380C94613811241FBECFEFD8E026 8 | :10707000DEBFCDBF11E0A0E0B1E0E0E4FEE702C07A 9 | :1070800005900D92AE36B107D9F711E0AEE6B1E04A 10 | :1070900001C01D92AB3FB107E1F7F8940E9494380C 11 | :1070A0000E94643E0E94693E0E946E3E78940E9457 12 | :1070B000D53C0E94F93C0E947A3E0E946C380C94A8 13 | :1070C0001C3F0C940038FA01DC0102C005900D92BF 14 | :1070D00021503040D8F7089580E090E00895089559 15 | :1070E00007C0FC012191CF012EBD0DB407FEFDCFDD 16 | :1070F0006150B8F708952FEF08C02EBD0DB407FEFC 17 | :10710000FDCF3EB5FC013193CF016150B0F708953A 18 | :10711000892B11F0449A089544980895892B11F011 19 | :10712000459A0895459808953C9A3D9A249884B1CB 20 | :107130008C6284B985B18C6385B980E58CBD81E0B2 21 | :107140008DBD0895E0910001F09101010190F08161 22 | :10715000E02D90E009950895E0910001F091010182 23 | :107160000280F381E02D90E009950895E0910001FF 24 | :10717000F09101010680F781E02D09950895E091D5 25 | :107180000001F09101010084F185E02D0995089539 26 | :10719000A2E0B0E0EEECF8E30C94B53E89838B01FD 27 | :1071A00080E04A830E94A23861E0CE0101960E94ED 28 | :1071B000B6384A81442321F0642FC8010E94BF38A9 29 | :1071C00081E00E94A2382296E4E00C94D13EA2E035 30 | :1071D000B0E0EDEEF8E30C94B53E89838B0180E0DE 31 | :1071E0004A830E94A23861E0CE0101960E94B6381F 32 | :1071F0004A81442321F0642FC8010E94B63881E0FF 33 | :107200000E94A2382296E4E00C94D13E862FBA0167 34 | :107210008F71422F80620E94E7380895A1E0B0E0AC 35 | :10722000E4E1F9E30C94B73E862F49838F7141E086 36 | :10723000BE016F5F7F4F80620E94E7382196E2E0D7 37 | :107240000C94D33EA1E0B0E0E8E2F9E30C94B73E41 38 | :10725000862F41E0BE016F5F7F4F8F710E94C8385B 39 | :1072600089812196E2E00C94D33EA1E2B0E0EBE309 40 | :10727000F9E30C94B33EFC018B0180EA89A3E3841B 41 | :10728000F42EE41608F4FE2C828583FD02C0EF186C 42 | :1072900001C0E12C4E2D50E060E070E0CE0101967F 43 | :1072A0000E94DE3E80E00E94A23861E0CE0181961D 44 | :1072B0000E94B6386F2DC8010E94B6386E2DCE01DF 45 | :1072C00001960E94B63881E00E94A238A196E6E0BD 46 | :1072D0000C94CF3EA1E2B0E0E0E7F9E30C94B33EBA 47 | :1072E000FC018B0181E689A36385F42E641708F401 48 | :1072F000F62E828583FD03C0E62EEF1801C0E12C37 49 | :1073000080E00E94A23861E0CE0181960E94B638EA 50 | :107310006F2DC8010E94BF386E2DCE0101960E94CC 51 | :10732000BF3881E00E94A238A196E6E00C94CF3EDF 52 | :1073300040E060E070E082EE0E94C838089540E0CE 53 | :1073400060E070E081EE0E94C8380895A1E0B0E0EE 54 | :10735000ECEAF9E30C94B73E80E00E94A23861E0C9 55 | :10736000CE0101960E94BF3881E00E94A238898137 56 | :107370002196E2E00C94D33EAAE0B0E0E2ECF9E31F 57 | :107380000C94B13E8C017B0180E00E94AC38F70187 58 | :107390008081803808F08FE78A8741E0BE01665F10 59 | :1073A0007F4F85E20E94E738F7018481F0E18F9FEB 60 | :1073B000C0011124F70193819F70982B998741E0B8 61 | :1073C000BE01675F7F4F84E20E94E7386DE1C8012C 62 | :1073D0000E942239C82E6CE1C8010E942239F701AF 63 | :1073E0002781213208F020E2F8012387F7019681F6 64 | :1073F000F8012285992341F09C2D94602860228712 65 | :107400004FE3D42ED82A08C09C2D9B7F277FF801FC 66 | :10741000228730ECD32ED822F7012581F80182850E 67 | :10742000222341F08061828726E0C22EC92AF3E040 68 | :10743000DF2A06C08F7EF80182878DEFC82EC92211 69 | :10744000C88641E0BE01685F7F4F8DE30E94E73848 70 | :10745000CC20F1F06DE1C8010E942239811175C084 71 | :1074600080E5898383E78A8380E00E94A23862E016 72 | :10747000CE0101960E94B63881E00E94A238CF82E8 73 | :1074800041E0BE01695F7F4F8DE30E94E7385DC038 74 | :10749000DE8241E0BE016A5F7F4F8CE30E94E738E5 75 | :1074A00066E0C8010E942239F8019285292F2160E7 76 | :1074B0002287877DF7012281223029F49E7FF801FF 77 | :1074C0009287806203C0213009F48860897FF701C8 78 | :1074D0009181933009F40AC0923011F4846007C09E 79 | :1074E000913011F4826003C0943009F486608D837A 80 | :1074F00041E0BE016B5F7F4F86E20E94E73860E0AB 81 | :10750000C8010E942239837FF7019085913011F4E0 82 | :10751000886001C08C608C8341E0BE016C5F7F4F4E 83 | :1075200080E20E94E738F70181858F738B8341E009 84 | :10753000BE016D5F7F4F81E20E94E738C8010E9463 85 | :107540009839C8010E949F3905C06DE1C8010E94A9 86 | :1075500022399ECF2A96E8E00C94CD3EFC0181E0D2 87 | :10756000828780E28387158616861786108A118A9D 88 | :10757000148680E00E94AC3881E00E94A23880E14D 89 | :1075800097E20197F1F70895A2E0B0E0EAECFAE3A0 90 | :107590000C94B53E8C0160E00E94223983608A839E 91 | :1075A00041E0BE016E5F7F4F80E20E94E73880E7D6 92 | :1075B000898341E0BE016F5F7F4F87E20E94E73819 93 | :1075C000B801635F7F4F45E08AE20E94E73881E0BF 94 | :1075D0000E94AC3884E091E00197F1F72296E4E054 95 | :1075E0000C94D13EA1E0B0E0E8EFFAE30C94B53E94 96 | :1075F0008C0180E00E94AC3860E0C8010E94223912 97 | :107600008E7F898341E0BE016F5F7F4F80E20E94E1 98 | :10761000E7380E5E1F4F45E0B8018AE20E94E73866 99 | :1076200045E0B80180E30E94E7382196E4E00C943D 100 | :10763000D13EA2E0B0E0EFE1FBE30C94B53E8B015C 101 | :107640000E94A639282F26952770273081F0011532 102 | :10765000110511F0F801208380E4898341E0BE0127 103 | :107660006F5F7F4F87E22A830E94E7382A8181E09B 104 | :1076700090E0273011F480E090E02296E4E00C9452 105 | :10768000D13ECF93DF93EC010E946A3967E1CE01CE 106 | :107690000E942239817090E0DF91CF910895A1E09E 107 | :1076A000B0E0E5E5FBE30C94B33E7C018B0145E0E3 108 | :1076B0008AE20E94E73845E0B80180E30E94E7389B 109 | :1076C000F80120E030E08191D701A20FB31F52965C 110 | :1076D0008C932F5F3F4F25303105A9F7F701838544 111 | :1076E000813208F080E2898341E0BE016F5F7F4F05 112 | :1076F00081E30E94E7382196E6E00C94CF3EA3E1B7 113 | :10770000B0E0E5E8FBE30C94B33E8C01E62E86E0A6 114 | :10771000E1E5F1E0DE011D9601900D928A95E1F719 115 | :1077200086E0E7E5F1E0DE01179601900D928A957B 116 | :10773000E1F786E0EDE5F1E0DE01119601900D92B2 117 | :107740008A95E1F7611112C0FA0180E090E0219181 118 | :10775000D801A80FB91F1D962C930196853091056D 119 | :10776000B1F7FE01EE0DF11D25E00AC086E0861797 120 | :1077700038F1A1E06A17A9F3FE01E60FF11D21E03F 121 | :107780006585C8010E940639F12CFE01EE0DFF1D32 122 | :10779000D8011B964C916781C8010E940E3962E0A6 123 | :1077A000C8010E942239FE01EE0DFF1D9181982B28 124 | :1077B0009B8B41E0BE016D5E7F4F82E20E94E73805 125 | :1077C0006396E6E00C94CF3EA1E0B0E0EAEEFBE386 126 | :1077D0000C94B53E8C01198241E0BE016F5F7F4F72 127 | :1077E00080E60E94C8388981813220F0C8010E9459 128 | :1077F000983980E02196E4E00C94D13EA2E0B0E01C 129 | :10780000E4E0FCE30C94B13E8B017A0169010E9433 130 | :10781000A639982F80E7898341E0BE016F5F7F4FD3 131 | :1078200087E29A830E94E7389A81892F8072F80153 132 | :107830008083892F8071F70180839074F601908393 133 | :107840002296E8E00C94CD3E67E10E9422398071D7 134 | :107850000895A2E0B0E0EFE2FCE30C94B33E8C01AB 135 | :107860007B0167E14A830E9422394A8185FF0CC06F 136 | :1078700080E1898341E0BE016F5F7F4F87E20E9414 137 | :10788000E73885EF9FEF09C0B701C8010E9435397D 138 | :1078900081E00E94AC3880E090E02296E6E00C9413 139 | :1078A000CF3EA1E0B0E0E7E5FCE30C94B13E7C0103 140 | :1078B0008B0181E00E94AC3860E2C62E6EE4D62EC9 141 | :1078C0000BC09E012F5F3F4FA901B901C7010E9464 142 | :1078D000FE3BC6010197F1F7C7010E94243C8111CC 143 | :1078E00003C00150110969F79E012F5F3F4FA901A5 144 | :1078F000B901C7010E94FE3B80E00E94AC38C8017C 145 | :107900002196E8E00C94CD3E089590912A019923A8 146 | :1079100059F0811120C080910001909101010E94D5 147 | :10792000F23A10922A0108958823A9F06AEF70E0D4 148 | :1079300080910001909101010E94513C892B11F42A 149 | :107940000E949B3E80910001909101010E94C43AE7 150 | :1079500081E080932A0108951F93CF93DF93EC0178 151 | :10796000162F80E00E94853C1F5F412FBE01809151 152 | :107970000001909101010E94293C892BB1F7DF9110 153 | :10798000CF911F91089520916F0130917001F901FD 154 | :10799000EE0FFF1FEB50FE4F918380832F5F3F4F11 155 | :1079A0003093700120936F010895809100019091B0 156 | :1079B00001010E94AE3A6BE171E08091000190916B 157 | :1079C00001010E94BC3980910001909101010E9447 158 | :1079D000843C45E251E060E080910001909101011A 159 | :1079E0000E947F3B80910001909101010E94C43A66 160 | :1079F0000895A1E2B0E0EFEFFCE30C94AF3EBE01CE 161 | :107A00006F5D7F4F80910001909101010E94193BB1 162 | :107A1000892B09F4C3C080910001909101010E945B 163 | :107A2000E43B482F8E010F5F1F4FB801809100018A 164 | :107A3000909101010E94413B29812F7009F048C0BB 165 | :107A40007E0182E0E80EF11CB70180910001909167 166 | :107A500001010E944F3B80916F018A831B824CE1A0 167 | :107A600050E063E671E0CE0104960E94E53E18A264 168 | :107A700080910001909101010E9498396FE1C80145 169 | :107A80000E94AC3C81E080936E01D12C8FE0C82E27 170 | :107A900012C0EE0FFF1FEB50FE4F0190F081E02D62 171 | :107AA000D7018C2D01900D928A95E1F76FE0C80106 172 | :107AB0000E94AC3CD394ED2DF0E080916F01909149 173 | :107AC0007001E817F9072CF381E00E94853C66C03D 174 | :107AD000EA81F0E080916F0190917001E817F90759 175 | :107AE0000CF05CC02330D1F5CB80DC80ED80FE80D3 176 | :107AF0001B821C821D821E82EA81F0E0EE0FFF1FB6 177 | :107B0000EB50FE4F808191814B815C816D817E8144 178 | :107B1000DC011F96ED91FC9150979E01295F3F4F2C 179 | :107B200009955C01682F6B5FC8010E94AC3CA50100 180 | :107B3000662757FD6095762F8B819C81AD81BE8134 181 | :107B4000480F591F6A1F7B1F4B835C836D837E83A5 182 | :107B50004C155D056E057F0578F2B6CF2430A1F493 183 | :107B6000EE0FFF1FEB50FE4F808191814B815C81B6 184 | :107B70006D817E81DC015196ED91FC9152979E01C1 185 | :107B8000295F3F4F09950AC0223041F4EE0FFF1FD5 186 | :107B9000EB50FE4F808191810E94543EA196EAE015 187 | :107BA0000C94CB3EC901411520E7520761057105D0 188 | :107BB00038F420E130E00E94633880E190E00895DD 189 | :107BC00080E090E00895CB01BA0140E150E0C901A6 190 | :107BD0000E94043F0895CB01BA01611544E0740787 191 | :107BE00040F440E150E0C9010E94F43E80E190E0A1 192 | :107BF000089580E090E00895CF93DB01CA018F776C 193 | :107C00009927AA27BB27DC01AD58BE4FC0E1F90177 194 | :107C100001900D92CA95E1F7DB01CA014096A11DC2 195 | :107C2000B11D8F779927AA27BB27892B8A2B8B2BEE 196 | :107C300009F038C04078CFB7F894F999FECF83E0C7 197 | :107C4000FA0180935700E89507B600FCFDCF6091DC 198 | :107C5000730180E090E071E0DC01AD58BE4FFC01A3 199 | :107C6000E40FF51F11962C91119730E0322F222747 200 | :107C7000260F311D090170935700E89511241296C3 201 | :107C80006C9102968038910539F785E0FA0180936E 202 | :107C90005700E89507B600FCFDCF81E180935700BF 203 | :107CA000E895CFBFCF910895809100019091010197 204 | :107CB0000E94F23AF89481E180935700E895E091B0 205 | :107CC0007101F091720109958EE391E00E94C33C2D 206 | :107CD00008958BE291E00E94C33C089529E288E177 207 | :107CE00090E00FB6F894A895809360000FBE2093A3 208 | :107CF00060000895A89580916E0181111BC084EFEA 209 | :107D000091E028EC30E0F9013197F1F70197D9F7CC 210 | :107D10008091F3019091F4019C012F5F3F4F3093CC 211 | :107D2000F4012093F3018536910524F080E090E082 212 | :107D30000E94543E089529E088E190E00FB6F8943F 213 | :107D4000A895809360000FBE20936000FFCF2F9214 214 | :107D50003F924F925F926F927F928F929F92AF92DB 215 | :107D6000BF92CF92DF92EF92FF920F931F93CF9328 216 | :107D7000DF93CDB7DEB7CA1BDB0B0FB6F894DEBFBF 217 | :107D80000FBECDBF09942A88398848885F846E84E5 218 | :107D90007D848C849B84AA84B984C884DF80EE802F 219 | :107DA000FD800C811B81AA81B981CE0FD11D0FB638 220 | :107DB000F894DEBF0FBECDBFED010895DC0101C018 221 | :107DC0006D9341505040E0F70895FB01DC014150B4 222 | :107DD000504048F001900D920020C9F701C01D925B 223 | :107DE00041505040E0F70895DC01CB01FC01F999C6 224 | :107DF000FECF06C0F2BDE1BDF89A319600B40D92F7 225 | :107E000041505040B8F70895DC01CB0103C02D91DB 226 | :107E10000E940F3F41505040D0F70895262FF99906 227 | :107E2000FECF1FBA92BD81BD20BD0FB6F894FA9A5D 228 | :107E3000F99A0FBE019608950C945938F894FFCF23 229 | :107E4000020188388E386F3870387B3800000000A7 230 | :107E500000000000000000000000000D03010F0FF3 231 | :107E600000012002FFB00B10ADED0110007000000A 232 | :107E70008000666C617368000000D23DFC3D10001C 233 | :107E80000400000100656570726F6D0000EB3DE35A 234 | :107E90003D0A0B0C0D0E0F111213141516010204DE 235 | :0E7EA00008102073747269702D77697370007A 236 | :040000030000700089 237 | :00000001FF 238 | -------------------------------------------------------------------------------- /prebuilt/rf24boot-viko-wisp.hex: -------------------------------------------------------------------------------- 1 | :107000000C9434380C9465380C9465380C946538BD 2 | :107010000C9465380C9465380C9465380C9465387C 3 | :107020000C9465380C9465380C9465380C9465386C 4 | :107030000C9465380C9465380C9465380C9465385C 5 | :107040000C9465380C9465380C9465380C9465384C 6 | :107050000C9465380C9465380C9465380C9465383C 7 | :107060000C9465380C94653811241FBECFEFD8E01E 8 | :10707000DEBFCDBF11E0A0E0B1E0E2E7FEE702C075 9 | :1070800005900D92AE36B107D9F711E0AEE6B1E04A 10 | :1070900001C01D92AB3FB107E1F7F8940E94983808 11 | :1070A0000E94683E0E946D3E0E94723E0E94AB3E6E 12 | :1070B0000E94B33E78940E94D93C0E94FD3C0E94FD 13 | :1070C0007E3E0E9470380C94353F0C940038FA01D3 14 | :1070D000DC0102C005900D9221503040D8F7089590 15 | :1070E00080E090E00895089507C0FC012191CF0150 16 | :1070F0002EBD0DB407FEFDCF6150B8F708952FEFF8 17 | :1071000008C02EBD0DB407FEFDCF3EB5FC01319386 18 | :10711000CF016150B0F70895892B11F0439A08957B 19 | :1071200043980895892B11F0429A08954298089542 20 | :107130003B9A3A9A249884B18C6284B985B18C6365 21 | :1071400085B980E58CBD81E08DBD0895E091000199 22 | :10715000F09101010190F081E02D90E009950895F2 23 | :10716000E0910001F09101010280F381E02D90E0B7 24 | :1071700009950895E0910001F09101010680F781E1 25 | :10718000E02D09950895E0910001F091010100843E 26 | :10719000F185E02D09950895A2E0B0E0E2EDF8E375 27 | :1071A0000C94CE3E89838B0180E04A830E94A638EE 28 | :1071B00061E0CE0101960E94BA384A81442321F051 29 | :1071C000642FC8010E94C33881E00E94A63822962D 30 | :1071D000E4E00C94EA3EA2E0B0E0E1EFF8E30C94C6 31 | :1071E000CE3E89838B0180E04A830E94A63861E00D 32 | :1071F000CE0101960E94BA384A81442321F0642FBF 33 | :10720000C8010E94BA3881E00E94A6382296E4E0C4 34 | :107210000C94EA3E862FBA018F71422F80620E9441 35 | :10722000EB380895A1E0B0E0E8E1F9E30C94D03E3A 36 | :10723000862F49838F7141E0BE016F5F7F4F80626F 37 | :107240000E94EB382196E2E00C94EC3EA1E0B0E025 38 | :10725000ECE2F9E30C94D03E862F41E0BE016F5F73 39 | :107260007F4F8F710E94CC3889812196E2E00C9487 40 | :10727000EC3EA1E2B0E0EFE3F9E30C94CC3EFC017C 41 | :107280008B0180EA89A3E384F42EE41608F4FE2C33 42 | :10729000828583FD02C0EF1801C0E12C4E2D50E025 43 | :1072A00060E070E0CE0101960E94F73E80E00E940F 44 | :1072B000A63861E0CE0181960E94BA386F2DC801D0 45 | :1072C0000E94BA386E2DCE0101960E94BA3881E034 46 | :1072D0000E94A638A196E6E00C94E83EA1E2B0E058 47 | :1072E000E4E7F9E30C94CC3EFC018B0181E689A331 48 | :1072F0006385F42E641708F4F62E828583FD03C09F 49 | :10730000E62EEF1801C0E12C80E00E94A63861E073 50 | :10731000CE0181960E94BA386F2DC8010E94C338F1 51 | :107320006E2DCE0101960E94C33881E00E94A638DE 52 | :10733000A196E6E00C94E83E40E060E070E082EE6A 53 | :107340000E94CC38089540E060E070E081EE0E9439 54 | :10735000CC380895A1E0B0E0E0EBF9E30C94D03E26 55 | :1073600080E00E94A63861E0CE0101960E94C338F9 56 | :1073700081E00E94A63889812196E2E00C94EC3EDF 57 | :10738000AAE0B0E0E6ECF9E30C94CA3E8C017B0184 58 | :1073900080E00E94B038F7018081803808F08FE7E4 59 | :1073A0008A8741E0BE01665F7F4F85E20E94EB382D 60 | :1073B000F7018481F0E18F9FC0011124F7019381CF 61 | :1073C0009F70982B998741E0BE01675F7F4F84E2F1 62 | :1073D0000E94EB386DE1C8010E942639C82E6CE18D 63 | :1073E000C8010E942639F7012781213208F020E2E6 64 | :1073F000F8012387F7019681F8012285992341F04E 65 | :107400009C2D9460286022874FE3D42ED82A08C090 66 | :107410009C2D9B7F277FF801228730ECD32ED8222A 67 | :10742000F7012581F8018285222341F0806182875E 68 | :1074300026E0C22EC92AF3E0DF2A06C08F7EF801BB 69 | :1074400082878DEFC82EC922C88641E0BE01685FE1 70 | :107450007F4F8DE30E94EB38CC20F1F06DE1C80145 71 | :107460000E942639811175C080E5898383E78A836C 72 | :1074700080E00E94A63862E0CE0101960E94BA38F0 73 | :1074800081E00E94A638CF8241E0BE01695F7F4F54 74 | :107490008DE30E94EB385DC0DE8241E0BE016A5F91 75 | :1074A0007F4F8CE30E94EB3866E0C8010E942639CA 76 | :1074B000F8019285292F21602287877DF70122819B 77 | :1074C000223029F49E7FF8019287806203C0213028 78 | :1074D00009F48860897FF7019181933009F40AC02B 79 | :1074E000923011F4846007C0913011F4826003C0BF 80 | :1074F000943009F486608D8341E0BE016B5F7F4F5D 81 | :1075000086E20E94EB3860E0C8010E942639837F42 82 | :10751000F7019085913011F4886001C08C608C83F4 83 | :1075200041E0BE016C5F7F4F80E20E94EB38F701C3 84 | :1075300081858F738B8341E0BE016D5F7F4F81E258 85 | :107540000E94EB38C8010E949C39C8010E94A339EF 86 | :1075500005C06DE1C8010E9426399ECF2A96E8E059 87 | :107560000C94E63EFC0181E0828780E283871586E9 88 | :1075700016861786108A118A148680E00E94B03819 89 | :1075800081E00E94A63880E29EE40197F1F7089519 90 | :10759000A2E0B0E0EEECFAE30C94CE3E8C0160E0A9 91 | :1075A0000E94263983608A8341E0BE016E5F7F4F6F 92 | :1075B00080E20E94EB3880E7898341E0BE016F5F83 93 | :1075C0007F4F87E20E94EB38B801635F7F4F45E051 94 | :1075D0008AE20E94EB3881E00E94B03888E092E0B5 95 | :1075E0000197F1F72296E4E00C94EA3EA1E0B0E0C6 96 | :1075F000ECEFFAE30C94CE3E8C0180E00E94B038B0 97 | :1076000060E0C8010E9426398E7F898341E0BE0177 98 | :107610006F5F7F4F80E20E94EB380E5E1F4F45E0A8 99 | :10762000B8018AE20E94EB3845E0B80180E30E948D 100 | :10763000EB382196E4E00C94EA3EA2E0B0E0E3E20D 101 | :10764000FBE30C94CE3E8B010E94AA39282F26958D 102 | :107650002770273081F00115110511F0F801208302 103 | :1076600080E4898341E0BE016F5F7F4F87E22A8318 104 | :107670000E94EB382A8181E090E0273011F480E00D 105 | :1076800090E02296E4E00C94EA3ECF93DF93EC0185 106 | :107690000E946E3967E1CE010E942639817090E028 107 | :1076A000DF91CF910895A1E0B0E0E9E5FBE30C9410 108 | :1076B000CC3E7C018B0145E08AE20E94EB3845E03C 109 | :1076C000B80180E30E94EB38F80120E030E08191BE 110 | :1076D000D701A20FB31F52968C932F5F3F4F2530D7 111 | :1076E0003105A9F7F7018385813208F080E28983AB 112 | :1076F00041E0BE016F5F7F4F81E30E94EB3821962E 113 | :10770000E6E00C94E83EA3E1B0E0E9E8FBE30C948A 114 | :10771000CC3E8C01E62E86E0E1E5F1E0DE011D962F 115 | :1077200001900D928A95E1F786E0E7E5F1E0DE0150 116 | :10773000179601900D928A95E1F786E0EDE5F1E06C 117 | :10774000DE01119601900D928A95E1F7611112C048 118 | :10775000FA0180E090E02191D801A80FB91F1D9691 119 | :107760002C93019685309105B1F7FE01EE0DF11DC8 120 | :1077700025E00AC086E0861738F1A1E06A17A9F370 121 | :10778000FE01E60FF11D21E06585C8010E940A395E 122 | :10779000F12CFE01EE0DFF1DD8011B964C91678167 123 | :1077A000C8010E94123962E0C8010E942639FE0118 124 | :1077B000EE0DFF1D9181982B9B8B41E0BE016D5E0C 125 | :1077C0007F4F82E20E94EB386396E6E00C94E83E3D 126 | :1077D000A1E0B0E0EEEEFBE30C94CE3E8C0119820A 127 | :1077E00041E0BE016F5F7F4F80E60E94CC38898107 128 | :1077F000813220F0C8010E949C3980E02196E4E0AB 129 | :107800000C94EA3EA2E0B0E0E8E0FCE30C94CA3E4F 130 | :107810008B017A0169010E94AA39982F80E7898338 131 | :1078200041E0BE016F5F7F4F87E29A830E94EB3891 132 | :107830009A81892F8072F8018083892F8071F701E6 133 | :1078400080839074F60190832296E8E00C94E63EE3 134 | :1078500067E10E94263980710895A2E0B0E0E3E379 135 | :10786000FCE30C94CC3E8C017B0167E14A830E94CF 136 | :1078700026394A8185FF0CC080E1898341E0BE0141 137 | :107880006F5F7F4F87E20E94EB3885EF9FEF09C063 138 | :10789000B701C8010E94393981E00E94B03880E008 139 | :1078A00090E02296E6E00C94E83EA1E0B0E0EBE543 140 | :1078B000FCE30C94CA3E7C018B0181E00E94B0384D 141 | :1078C00060E4C62E6CE9D62E0BC09E012F5F3F4FA1 142 | :1078D000A901B901C7010E94023CC6010197F1F755 143 | :1078E000C7010E94283C811103C00150110969F7AA 144 | :1078F0009E012F5F3F4FA901B901C7010E94023CC1 145 | :1079000080E00E94B038C8012196E8E00C94E63E81 146 | :10791000089590912A01992359F0811120C08091F6 147 | :107920000001909101010E94F63A10922A010895F7 148 | :107930008823A9F06AEF70E0809100019091010125 149 | :107940000E94553C892B11F40E949F3E80910001BA 150 | :10795000909101010E94C83A81E080932A01089524 151 | :107960001F93CF93DF93EC01162F80E00E94893C98 152 | :107970001F5F412FBE0180910001909101010E9483 153 | :107980002D3C892BB1F7DF91CF911F910895209164 154 | :107990006F0130917001F901EE0FFF1FEB50FE4FA8 155 | :1079A000918380832F5F3F4F3093700120936F014D 156 | :1079B000089580910001909101010E94B23A6BE11B 157 | :1079C00071E080910001909101010E94C039809185 158 | :1079D0000001909101010E94883C45E251E060E085 159 | :1079E00080910001909101010E94833B80910001F0 160 | :1079F000909101010E94C83A0895A1E2B0E0E3E04D 161 | :107A0000FDE30C94C83EBE016F5D7F4F8091000185 162 | :107A1000909101010E941D3B892B09F4C3C0809104 163 | :107A20000001909101010E94E83B482F8E010F5FF9 164 | :107A30001F4FB80180910001909101010E94453BC8 165 | :107A400029812F7009F048C07E0182E0E80EF11C08 166 | :107A5000B70180910001909101010E94533B8091F8 167 | :107A60006F018A831B824CE150E063E671E0CE0136 168 | :107A700004960E94FE3E18A280910001909101019F 169 | :107A80000E949C396FE1C8010E94B03C81E0809364 170 | :107A90006E01D12C8FE0C82E12C0EE0FFF1FEB50ED 171 | :107AA000FE4F0190F081E02DD7018C2D01900D92B9 172 | :107AB0008A95E1F76FE0C8010E94B03CD394ED2DA8 173 | :107AC000F0E080916F0190917001E817F9072CF3B5 174 | :107AD00081E00E94893C66C0EA81F0E080916F01FC 175 | :107AE00090917001E817F9070CF05CC02330D1F5D4 176 | :107AF000CB80DC80ED80FE801B821C821D821E827A 177 | :107B0000EA81F0E0EE0FFF1FEB50FE4F8081918184 178 | :107B10004B815C816D817E81DC011F96ED91FC9132 179 | :107B200050979E01295F3F4F09955C01682F6B5F5D 180 | :107B3000C8010E94B03CA501662757FD6095762FCD 181 | :107B40008B819C81AD81BE81480F591F6A1F7B1FAD 182 | :107B50004B835C836D837E834C155D056E057F05CD 183 | :107B600078F2B6CF2430A1F4EE0FFF1FEB50FE4F9A 184 | :107B7000808191814B815C816D817E81DC01519698 185 | :107B8000ED91FC9152979E01295F3F4F09950AC0E4 186 | :107B9000223041F4EE0FFF1FEB50FE4F80819181A8 187 | :107BA0000E94583EA196EAE00C94E43EC9014115BA 188 | :107BB00020E752076105710538F420E130E00E94AA 189 | :107BC000673880E190E0089580E090E00895CB016F 190 | :107BD000BA0140E150E0C9010E941D3F0895CB0168 191 | :107BE000BA01611544E0740740F440E150E0C90176 192 | :107BF0000E940D3F80E190E0089580E090E00895BC 193 | :107C0000CF93DB01CA018F779927AA27BB27DC0115 194 | :107C1000AD58BE4FC0E1F90101900D92CA95E1F750 195 | :107C2000DB01CA014096A11DB11D8F779927AA27B4 196 | :107C3000BB27892B8A2B8B2B09F038C04078CFB714 197 | :107C4000F894F999FECF83E0FA0180935700E89504 198 | :107C500007B600FCFDCF6091730180E090E071E019 199 | :107C6000DC01AD58BE4FFC01E40FF51F11962C91BD 200 | :107C7000119730E0322F2227260F311D0901709312 201 | :107C80005700E895112412966C9102968038910560 202 | :107C900039F785E0FA0180935700E89507B600FCB4 203 | :107CA000FDCF81E180935700E895CFBFCF91089534 204 | :107CB00080910001909101010E94F63AF89481E1CF 205 | :107CC00080935700E895E0917101F0917201099558 206 | :107CD0008EE391E00E94C73C08958BE291E00E9400 207 | :107CE000C73C089529E288E190E00FB6F894A89582 208 | :107CF000809360000FBE209360000895A895809146 209 | :107D00006E0181111BC084EF91E020E931E0F9019F 210 | :107D10003197F1F70197D9F78091F3019091F40130 211 | :107D20009C012F5F3F4F3093F4012093F301853680 212 | :107D3000910524F080E090E00E94583E089529E0EB 213 | :107D400088E190E00FB6F894A895809360000FBE8C 214 | :107D500020936000FFCF419A319904C080E090E009 215 | :107D60000E94583E089584B18E6084B985B1817FA8 216 | :107D700085B98AB188668AB98AB187798AB908953E 217 | :107D80002F923F924F925F926F927F928F929F922B 218 | :107D9000AF92BF92CF92DF92EF92FF920F931F9319 219 | :107DA000CF93DF93CDB7DEB7CA1BDB0B0FB6F894CA 220 | :107DB000DEBF0FBECDBF09942A88398848885F840A 221 | :107DC0006E847D848C849B84AA84B984C884DF807B 222 | :107DD000EE80FD800C811B81AA81B981CE0FD11D5F 223 | :107DE0000FB6F894DEBF0FBECDBFED010895DC01E4 224 | :107DF00001C06D9341505040E0F70895FB01DC0154 225 | :107E00004150504048F001900D920020C9F701C048 226 | :107E10001D9241505040E0F70895DC01CB01FC0178 227 | :107E2000F999FECF06C0F2BDE1BDF89A319600B4D3 228 | :107E30000D9241505040B8F70895DC01CB0103C0CA 229 | :107E40002D910E94283F41505040D0F70895262F91 230 | :107E5000F999FECF1FBA92BD81BD20BD0FB6F8942F 231 | :107E6000FA9AF99A0FBE019608950C945D38F89429 232 | :027E7000FFCF42 233 | :107E720002018C389238733874387F380000000061 234 | :107E820000000000000000000000000D03010F0FC1 235 | :107E920000012002FFB00B10ADED011000700000D8 236 | :107EA2008000666C617368000000D63D003E1000E1 237 | :107EB2000400000100656570726F6D0000EF3DE720 238 | :107EC2003D0A0B0C0D0E0F111213141516010204AC 239 | :0E7ED20008102076696B6F2D776973700000C1 240 | :040000030000700089 241 | :00000001FF 242 | -------------------------------------------------------------------------------- /production_configs/nrfdongle-20M: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Antares Firmware Config 4 | # 5 | CONFIG_ARCH_HAS_ANTARES_STARTUP=y 6 | 7 | # 8 | # Target platform settings 9 | # 10 | # CONFIG_ARCH_8051 is not set 11 | # CONFIG_ARCH_ARM is not set 12 | CONFIG_ARCH_AVR=y 13 | # CONFIG_ARCH_ESP8266 is not set 14 | # CONFIG_ARCH_GBZ80 is not set 15 | # CONFIG_ARCH_MIPS is not set 16 | # CONFIG_ARCH_MSP430 is not set 17 | # CONFIG_ARCH_NATIVE is not set 18 | # CONFIG_ARCH_NMC is not set 19 | # CONFIG_ARCH_PIC32 is not set 20 | CONFIG_F_CPU=20000000 21 | # CONFIG_MCU_AVR1 is not set 22 | # CONFIG_MCU_AVR2 is not set 23 | # CONFIG_MCU_AVR25 is not set 24 | # CONFIG_MCU_AVR3 is not set 25 | # CONFIG_MCU_AVR31 is not set 26 | # CONFIG_MCU_AVR35 is not set 27 | # CONFIG_MCU_AVR4 is not set 28 | # CONFIG_MCU_AVR5 is not set 29 | # CONFIG_MCU_AVR51 is not set 30 | # CONFIG_MCU_AVR6 is not set 31 | # CONFIG_MCU_AT90S1200 is not set 32 | # CONFIG_MCU_ATTINY11 is not set 33 | # CONFIG_MCU_ATTINY12 is not set 34 | # CONFIG_MCU_ATTINY15 is not set 35 | # CONFIG_MCU_ATTINY28 is not set 36 | # CONFIG_MCU_AT90S2313 is not set 37 | # CONFIG_MCU_AT90S2323 is not set 38 | # CONFIG_MCU_AT90S2333 is not set 39 | # CONFIG_MCU_AT90S2343 is not set 40 | # CONFIG_MCU_ATTINY22 is not set 41 | # CONFIG_MCU_ATTINY26 is not set 42 | # CONFIG_MCU_AT90S4414 is not set 43 | # CONFIG_MCU_AT90S4433 is not set 44 | # CONFIG_MCU_AT90S4434 is not set 45 | # CONFIG_MCU_AT90S8515 is not set 46 | # CONFIG_MCU_AT90C8534 is not set 47 | # CONFIG_MCU_AT90S8535 is not set 48 | # CONFIG_MCU_ATTINY13 is not set 49 | # CONFIG_MCU_ATTINY13A is not set 50 | # CONFIG_MCU_ATTINY2313 is not set 51 | # CONFIG_MCU_ATTINY2313A is not set 52 | # CONFIG_MCU_ATTINY24 is not set 53 | # CONFIG_MCU_ATTINY24A is not set 54 | # CONFIG_MCU_ATTINY4313 is not set 55 | # CONFIG_MCU_ATTINY44 is not set 56 | # CONFIG_MCU_ATTINY44A is not set 57 | # CONFIG_MCU_ATTINY84 is not set 58 | # CONFIG_MCU_ATTINY25 is not set 59 | # CONFIG_MCU_ATTINY45 is not set 60 | # CONFIG_MCU_ATTINY85 is not set 61 | # CONFIG_MCU_ATTINY261 is not set 62 | # CONFIG_MCU_ATTINY261A is not set 63 | # CONFIG_MCU_ATTINY461 is not set 64 | # CONFIG_MCU_ATTINY861 is not set 65 | # CONFIG_MCU_ATTINY861A is not set 66 | # CONFIG_MCU_ATTINY87 is not set 67 | # CONFIG_MCU_ATTINY43U is not set 68 | # CONFIG_MCU_ATTINY48 is not set 69 | # CONFIG_MCU_ATTINY88 is not set 70 | # CONFIG_MCU_AT86RF401 is not set 71 | # CONFIG_MCU_ATA6289 is not set 72 | # CONFIG_MCU_AT43USB355 is not set 73 | # CONFIG_MCU_AT76C711 is not set 74 | # CONFIG_MCU_ATMEGA103 is not set 75 | # CONFIG_MCU_AT43USB320 is not set 76 | # CONFIG_MCU_ATTINY167 is not set 77 | # CONFIG_MCU_ATTINY327 is not set 78 | # CONFIG_MCU_AT90USB82 is not set 79 | # CONFIG_MCU_AT90USB162 is not set 80 | # CONFIG_MCU_ATMEGA8U2 is not set 81 | # CONFIG_MCU_ATMEGA16U2 is not set 82 | # CONFIG_MCU_ATMEGA32U2 is not set 83 | CONFIG_MCU_ATMEGA8=y 84 | # CONFIG_MCU_ATMEGA48 is not set 85 | # CONFIG_MCU_ATMEGA48P is not set 86 | # CONFIG_MCU_ATMEGA88 is not set 87 | # CONFIG_MCU_ATMEGA88P is not set 88 | # CONFIG_MCU_ATMEGA8515 is not set 89 | # CONFIG_MCU_ATMEGA8535 is not set 90 | # CONFIG_MCU_ATMEGA8HVA is not set 91 | # CONFIG_MCU_ATMEGA4HVD is not set 92 | # CONFIG_MCU_ATMEGA8HVD is not set 93 | # CONFIG_MCU_ATMEGA8C1 is not set 94 | # CONFIG_MCU_ATMEGA8M1 is not set 95 | # CONFIG_MCU_AT90PWM1 is not set 96 | # CONFIG_MCU_AT90PWM2 is not set 97 | # CONFIG_MCU_AT90PWM2B is not set 98 | # CONFIG_MCU_AT90PWM3 is not set 99 | # CONFIG_MCU_AT90PWM3B is not set 100 | # CONFIG_MCU_AT90PWM81 is not set 101 | # CONFIG_MCU_ATMEGA16 is not set 102 | # CONFIG_MCU_ATMEGA161 is not set 103 | # CONFIG_MCU_ATMEGA162 is not set 104 | # CONFIG_MCU_ATMEGA163 is not set 105 | # CONFIG_MCU_ATMEGA164P is not set 106 | # CONFIG_MCU_ATMEGA165 is not set 107 | # CONFIG_MCU_ATMEGA165P is not set 108 | # CONFIG_MCU_ATMEGA168 is not set 109 | # CONFIG_MCU_ATMEGA168P is not set 110 | # CONFIG_MCU_ATMEGA169 is not set 111 | # CONFIG_MCU_ATMEGA169P is not set 112 | # CONFIG_MCU_ATMEGA16C1 is not set 113 | # CONFIG_MCU_ATMEGA32 is not set 114 | # CONFIG_MCU_ATMEGA323 is not set 115 | # CONFIG_MCU_ATMEGA324P is not set 116 | # CONFIG_MCU_ATMEGA325 is not set 117 | # CONFIG_MCU_ATMEGA325P is not set 118 | # CONFIG_MCU_ATMEGA3250 is not set 119 | # CONFIG_MCU_ATMEGA3250P is not set 120 | # CONFIG_MCU_ATMEGA328P is not set 121 | # CONFIG_MCU_ATMEGA329 is not set 122 | # CONFIG_MCU_ATMEGA329P is not set 123 | # CONFIG_MCU_ATMEGA3290 is not set 124 | # CONFIG_MCU_ATMEGA3290P is not set 125 | # CONFIG_MCU_ATMEGA406 is not set 126 | # CONFIG_MCU_ATMEGA64 is not set 127 | # CONFIG_MCU_ATMEGA640 is not set 128 | # CONFIG_MCU_ATMEGA644 is not set 129 | # CONFIG_MCU_ATMEGA644P is not set 130 | # CONFIG_MCU_ATMEGA644PA is not set 131 | # CONFIG_MCU_ATMEGA645 is not set 132 | # CONFIG_MCU_ATMEGA649 is not set 133 | # CONFIG_MCU_ATMEGA6450 is not set 134 | # CONFIG_MCU_ATMEGA6490 is not set 135 | # CONFIG_MCU_ATMEGA16HVA is not set 136 | # CONFIG_MCU_ATMEGA16HVB is not set 137 | # CONFIG_MCU_ATMEGA32HVB is not set 138 | # CONFIG_MCU_AT90CAN32 is not set 139 | # CONFIG_MCU_AT90CAN64 is not set 140 | # CONFIG_MCU_AT90PWM216 is not set 141 | # CONFIG_MCU_AT90PWM316 is not set 142 | # CONFIG_MCU_ATMEGA32C1 is not set 143 | # CONFIG_MCU_ATMEGA64C1 is not set 144 | # CONFIG_MCU_ATMEGA16M1 is not set 145 | # CONFIG_MCU_ATMEGA32M1 is not set 146 | # CONFIG_MCU_ATMEGA64M1 is not set 147 | # CONFIG_MCU_ATMEGA16U4 is not set 148 | # CONFIG_MCU_ATMEGA32U4 is not set 149 | # CONFIG_MCU_ATMEGA32U6 is not set 150 | # CONFIG_MCU_AT90USB646 is not set 151 | # CONFIG_MCU_AT90USB647 is not set 152 | # CONFIG_MCU_AT90SCR100 is not set 153 | # CONFIG_MCU_AT94K is not set 154 | # CONFIG_MCU_ATMEGA128 is not set 155 | # CONFIG_MCU_ATMEGA1280 is not set 156 | # CONFIG_MCU_ATMEGA1281 is not set 157 | # CONFIG_MCU_ATMEGA1284P is not set 158 | # CONFIG_MCU_ATMEGA128RFA1 is not set 159 | # CONFIG_MCU_AT90CAN128 is not set 160 | # CONFIG_MCU_AT90USB1286 is not set 161 | # CONFIG_MCU_AT90USB1287 is not set 162 | # CONFIG_MCU_M3000F is not set 163 | # CONFIG_MCU_M3000S is not set 164 | # CONFIG_MCU_M3001B is not set 165 | # CONFIG_MCU_ATMEGA2560 is not set 166 | # CONFIG_MCU_ATMEGA2561 is not set 167 | # CONFIG_AVR_BLDR is not set 168 | # CONFIG_AVR_OLD_DELAY is not set 169 | # CONFIG_AVR_EXTRA_SIZE_OPT is not set 170 | CONFIG_AVR_VFPRINTF_NONE=y 171 | # CONFIG_AVR_VFPRINTF_MIN is not set 172 | # CONFIG_AVR_VFPRINTF_FULL is not set 173 | CONFIG_AVR_VFSCANF_NONE=y 174 | # CONFIG_AVR_VFSCANF_MIN is not set 175 | # CONFIG_AVR_VFSCANF_FULL is not set 176 | 177 | # 178 | # Toolchain settings 179 | # 180 | # CONFIG_SHOW_ALL_TOOLCHAINS is not set 181 | CONFIG_TOOLCHAIN_GCC=y 182 | CONFIG_TOOLCHAIN_PREFIX="avr-" 183 | # CONFIG_CC_OPT0 is not set 184 | # CONFIG_CC_OPT1 is not set 185 | # CONFIG_CC_OPT2 is not set 186 | # CONFIG_CC_OPT3 is not set 187 | CONFIG_CC_OPTSZ=y 188 | # CONFIG_GCC_NOSTDLIBS is not set 189 | # CONFIG_GCC_G is not set 190 | # CONFIG_GCC_LC is not set 191 | # CONFIG_GCC_LM is not set 192 | # CONFIG_GCC_FPIC is not set 193 | CONFIG_GCC_STRIP=y 194 | # CONFIG_GCC_PARANOID_WRN is not set 195 | 196 | # 197 | # Fine tuning 198 | # 199 | CONFIG_CFLAGS="" 200 | CONFIG_ASFLAGS="" 201 | CONFIG_LDFLAGS="" 202 | CONFIG_ELFFLAGS="" 203 | 204 | # 205 | # Libraries and drivers 206 | # 207 | # CONFIG_SHOW_BROKEN is not set 208 | CONFIG_LIB_ANTARES_CORE=y 209 | CONFIG_ANTARES_STARTUP=y 210 | CONFIG_LIB_INITCALL=y 211 | # CONFIG_LIB_INITCALL_DEBUG is not set 212 | # CONFIG_LIB_TMGR is not set 213 | 214 | # 215 | # Console and IO 216 | # 217 | # CONFIG_LIB_EARLYCON is not set 218 | # CONFIG_LIB_PRINTK is not set 219 | # CONFIG_LIB_PANIC_NONE is not set 220 | CONFIG_LIB_PANIC=y 221 | # CONFIG_LIB_PANIC_TRACE is not set 222 | # CONFIG_LIB_PANIC_HOOK is not set 223 | 224 | # 225 | # Wireless devices 226 | # 227 | CONFIG_LIB_RF24_HAVE_AVRSPI=y 228 | CONFIG_LIB_RF24=y 229 | # CONFIG_LIB_RF24_BINDINGS_NONE is not set 230 | # CONFIG_LIB_RF24_AVR_SOFTSPI is not set 231 | CONFIG_LIB_RF24_AVR_HARDSPI=y 232 | 233 | # 234 | # SPI Pin Settings 235 | # 236 | CONFIG_LIB_RF24_CE_PIN=1 237 | CONFIG_LIB_RF24_CE_PORT="B" 238 | CONFIG_LIB_RF24_CSN_PIN=2 239 | CONFIG_LIB_RF24_CSN_PORT="B" 240 | CONFIG_LIB_RF24_SPI_PORT="B" 241 | CONFIG_LIB_RF24_SPI_MOSI_PIN=3 242 | CONFIG_LIB_RF24_SPI_MISO_PIN=4 243 | CONFIG_LIB_RF24_SPI_SCK_PIN=5 244 | CONFIG_LIB_RF24_SPI_SS_PIN=2 245 | CONFIG_LIB_RF24_DEBUG=0 246 | CONFIG_LIB_RF24_SIZEOPT=y 247 | CONFIG_LIB_RF24_SWEEP=y 248 | # CONFIG_LIB_RF24_SWEEP_CARRIER is not set 249 | CONFIG_LIB_RF24_SWEEP_RPD=y 250 | 251 | # 252 | # Data storage devices 253 | # 254 | # CONFIG_LIB_SPISD is not set 255 | 256 | # 257 | # Input devices 258 | # 259 | # CONFIG_LIB_CAPSENSE is not set 260 | 261 | # 262 | # Misc drivers and libraries 263 | # 264 | # CONFIG_LIB_XSSCU is not set 265 | 266 | # 267 | # Data transfer protocols 268 | # 269 | # CONFIG_LIB_XMODEM is not set 270 | CONFIG_LIB_DELAY_AVR=y 271 | CONFIG_LIB_DELAY=y 272 | 273 | # 274 | # Nothing to tune for AVR, everything should work out of the box 275 | # 276 | 277 | # 278 | # Nothing to tune for ARM, everything should work out of the box 279 | # 280 | # CONFIG_LIB_STLINKY is not set 281 | # CONFIG_LIB_URPC is not set 282 | 283 | # 284 | # 3rd-party libraries 285 | # 286 | CONFIG_CONTRIB_VUSB=y 287 | 288 | # 289 | # Some rarely used options have been omitted. 290 | # 291 | 292 | # 293 | # See usb-config.h for more info 294 | # 295 | 296 | # 297 | # Hardware Config 298 | # 299 | CONFIG_USB_CFG_IOPORTNAME="D" 300 | CONFIG_USB_CFG_DMINUS_BIT=2 301 | CONFIG_USB_CFG_DPLUS_BIT=3 302 | # CONFIG_USB_OPT is not set 303 | 304 | # 305 | # Functional Range 306 | # 307 | CONFIG_USB_CFG_HAVE_INTRIN_ENDPOINT=y 308 | # CONFIG_USB_CFG_HAVE_INTRIN_ENDPOINT3 is not set 309 | # CONFIG_USB_CFG_IMPLEMENT_HALT is not set 310 | # CONFIG_USB_CFG_SUPPRESS_INTR_CODE is not set 311 | CONFIG_USB_CFG_INTR_POLL_INTERVAL=10 312 | # CONFIG_USB_CFG_IS_SELF_POWERED is not set 313 | CONFIG_USB_CFG_MAX_BUS_POWER=100 314 | # CONFIG_USB_CFG_IMPLEMENT_FN_READ is not set 315 | CONFIG_USB_CFG_IMPLEMENT_FN_WRITE=y 316 | # CONFIG_USB_CFG_IMPLEMENT_FN_WRITEOUT is not set 317 | # CONFIG_USB_CFG_HAVE_FLOWCONTROL is not set 318 | # CONFIG_USB_CFG_LONG_TRANSFERS is not set 319 | # CONFIG_USB_COUNT_SOF is not set 320 | # CONFIG_USB_CFG_CHECK_DATA_TOGGLING is not set 321 | # CONFIG_USB_CFG_HAVE_MEASURE_FRAME_LENGTH is not set 322 | 323 | # 324 | # Device Description 325 | # 326 | # CONFIG_USB_TUNEPROPS is not set 327 | CONFIG_USB_CFG_VENDOR_ID=0x1d50 328 | CONFIG_USB_CFG_DEVICE_ID=0x6032 329 | CONFIG_USB_CFG_DEVICE_VERSION=0x0001 330 | CONFIG_USB_HAS_VENDORNAME=y 331 | CONFIG_USB_CFG_VENDOR_NAME="www.ncrmnt.org" 332 | CONFIG_USB_HAS_DEVNAME=y 333 | CONFIG_USB_CFG_DEVICE_NAME="nRF24L01-tool" 334 | CONFIG_USB_HAS_SERIAL=y 335 | # CONFIG_USB_SERIAL_USE_GIT is not set 336 | CONFIG_USB_CFG_SERIAL_NUMBER="etheria" 337 | 338 | # 339 | # See USB specification if you want to conform to an existing device class. 340 | # 341 | 342 | # 343 | # Class 0xff is 'vendor specific' 344 | # 345 | CONFIG_USB_CFG_DEVICE_CLASS=0xff 346 | CONFIG_USB_CFG_DEVICE_SUBCLASS=0x0 347 | 348 | # 349 | # define class here if not at device level 350 | # 351 | CONFIG_USB_CFG_INTERFACE_CLASS=0x3 352 | CONFIG_USB_CFG_INTERFACE_SUBCLASS=0x0 353 | CONFIG_USB_CFG_INTERFACE_PROTOCOL=0x00 354 | CONFIG_USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH=0 355 | # CONFIG_USB_ONLY_INCLUDE is not set 356 | # CONFIG_CONTRIB_WS2812 is not set 357 | 358 | # 359 | # Data compression 360 | # 361 | # CONFIG_LIB_HEATSHRINK is not set 362 | 363 | # 364 | # Cryptography 365 | # 366 | # CONFIG_LIB_CRYPTO_CRC16 is not set 367 | 368 | # 369 | # Project Settings 370 | # 371 | CONFIG_DEBUGGING_VERBOSITY=0 372 | 373 | # 374 | # Userspace app requires ARCH_NATIVE 375 | # 376 | # CONFIG_ROLE_SLAVE is not set 377 | CONFIG_ROLE_UISP=y 378 | # CONFIG_ROLE_SENDER is not set 379 | CONFIG_HW_BUFFER_SIZE=16 380 | 381 | # 382 | # Deployment settings 383 | # 384 | CONFIG_DEPLOY_ROOT=y 385 | 386 | # 387 | # Pick the deployment methods you need below 388 | # 389 | # CONFIG_DEPLOY_AVRDUDE is not set 390 | # CONFIG_DEPLOY_DFU_PROGRAMMER is not set 391 | # CONFIG_DEPLOY_RF24TOOL is not set 392 | CONFIG_DEPLOY_UISPTOOL=y 393 | CONFIG_DEPLOY_UISPTOOL_NAME="antares" 394 | CONFIG_DEPLOY_UISPTOOL_VER="testfw" 395 | CONFIG_DEPLOY_UISPTOOL_SERIAL="USB-NRF24L01-boot" 396 | CONFIG_DEPLOY_UISPTOOL_RUN=y 397 | # CONFIG_DEPLOY_ZMODEM is not set 398 | 399 | # 400 | # Custom deployment methods 401 | # 402 | 403 | # 404 | # Build System Configuration 405 | # 406 | CONFIG_MAKE_DEFTARGET="build" 407 | CONFIG_DEPLOY_DEFTARGET="uisptool" 408 | # CONFIG_NOCOLOR is not set 409 | # CONFIG_THREADED is not set 410 | CONFIG_IMAGE_FILENAME="nrfdongle-$(CONFIG_F_CPU)Hz" 411 | CONFIG_IMAGE_DIR="images" 412 | CONFIG_NEED_GENERATE=y 413 | # CONFIG_BUILD_VERBOSE is not set 414 | 415 | # 416 | # Version Information 417 | # 418 | 419 | # 420 | # +++ For reference only +++ 421 | # 422 | 423 | # 424 | # All values below are to be filled by Make scripts 425 | # 426 | 427 | # 428 | # Use make set_version to change 429 | # 430 | CONFIG_VERSION_MAJOR="0" 431 | CONFIG_VERSION_MINOR="2-rc1" 432 | CONFIG_VERSION_CODENAME="Insane Mushroom" 433 | CONFIG_VERSION_STRING="0.2-rc1, Insane Mushroom" 434 | CONFIG_VERSION_GIT="0400df933188103863940b1ba9d8f21c10163305" 435 | -------------------------------------------------------------------------------- /src/.#device.c: -------------------------------------------------------------------------------- 1 | necromant@ilwyn.home.4558:1387788030 -------------------------------------------------------------------------------- /src/.#test.c: -------------------------------------------------------------------------------- 1 | necromant@sylwer.26729:1387703337 -------------------------------------------------------------------------------- /src/8051/Makefile: -------------------------------------------------------------------------------- 1 | objects-y+=platform-stc.o 2 | -------------------------------------------------------------------------------- /src/8051/platform-stc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define COMPONENT "rf24boot" 7 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | 17 | void rf24boot_boot_partition(struct rf24boot_partition *part) 18 | { 19 | 20 | } 21 | 22 | static void set_csn(int level) 23 | { 24 | } 25 | 26 | static void set_ce(int level) 27 | { 28 | } 29 | 30 | 31 | static void spi_set_speed(int speed) 32 | { 33 | dbg("spi: speed change to %d\n", speed); 34 | } 35 | 36 | static void spi_write(const uint8_t *data, uint8_t len) 37 | { 38 | data; 39 | len; 40 | } 41 | static void spi_read(uint8_t *data, uint8_t len) 42 | { 43 | data; 44 | len; 45 | } 46 | 47 | 48 | static struct rf24 r = { 49 | .csn = set_csn, 50 | .ce = set_ce, 51 | .spi_set_speed = spi_set_speed, 52 | .spi_write = spi_write, 53 | .spi_read = spi_read 54 | }; 55 | 56 | struct rf24 *g_radio = &r; 57 | 58 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | objects-$(CONFIG_ROLE_SLAVE)+=slave.o 2 | objects-$(CONFIG_ROLE_SENDER)+=packet-sender.o 3 | objects-$(CONFIG_ROLE_LISTENER)+=packet-listener.o 4 | objects-$(CONFIG_ROLE_UISP)+=uisp-app.o cb.o 5 | 6 | 7 | subdirs-$(CONFIG_ARCH_AVR)+=avr/ 8 | subdirs-$(CONFIG_ARCH_8051)+=8051/ 9 | 10 | subdirs-y+=hacks/ 11 | 12 | objects-$(CONFIG_BOOTCOND_TIMED)+=bootcond-timed.o 13 | objects-$(CONFIG_PART_DUMMY)+=dummypart.o 14 | 15 | subdirs-$(CONFIG_ROLE_USERSPACE)+= native/ 16 | 17 | -------------------------------------------------------------------------------- /src/avr/Makefile: -------------------------------------------------------------------------------- 1 | objects-$(CONFIG_ROLE_SLAVE)+=avr-boot-common.o 2 | 3 | cflags-y+=-DBOOTLOCK_PORTX=PORT$(call unquote,$(CONFIG_BOOTLOCK_PORT)) 4 | cflags-y+=-DBOOTLOCK_PINX=PIN$(call unquote,$(CONFIG_BOOTLOCK_PORT)) 5 | objects-$(CONFIG_BOOTLOCK_AVR)+=bootlock-avr.o 6 | -------------------------------------------------------------------------------- /src/avr/avr-boot-common.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universal rf24boot bootloader : Common avr code 3 | * Copyright (C) 2014 Andrew 'Necromant' Andrianov 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 25 | #define COMPONENT "avrparts" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #define EEPROM_IOSIZE 16 40 | #define FLASH_IOSIZE 16 41 | 42 | #ifdef CONFIG_AVR_BLDADDR 43 | #define BOOT_RESERVED (FLASHEND - CONFIG_AVR_BLDADDR + 1) 44 | #define FLASH_SIZE (FLASHEND - BOOT_RESERVED) 45 | #else 46 | /* Not in bootloader? Disable flash! */ 47 | #if defined(CONFIG_HAS_FLASH_PART) 48 | #undef CONFIG_HAS_FLASH_PART 49 | #warning "Will not enable flash partition when we're not in bootloader" 50 | #endif 51 | #endif 52 | 53 | static void (*nullVector)(void) __attribute__((__noreturn__)); 54 | static unsigned char pbuf[SPM_PAGESIZE]; 55 | 56 | #ifdef MCUCR 57 | #define CR MCUCR 58 | #endif 59 | 60 | #ifdef GICR 61 | #define CR GICR 62 | #endif 63 | 64 | /* AVR can have only one bootable partition, so we ignore the argument */ 65 | void rf24boot_boot_partition(struct rf24boot_partition *part) 66 | { 67 | /* Stop listening */ 68 | rf24_stop_listening(g_radio); 69 | cli(); 70 | boot_rww_enable(); 71 | 72 | #if 0 73 | CR = (1 << IVCE); /* enable change of interrupt vectors */ 74 | CR = (0 << IVSEL); /* move interrupts to application flash section */ 75 | #endif 76 | 77 | /* We must go through a global function pointer variable instead of writing 78 | * ((void (*)(void))0)(); 79 | * because the compiler optimizes a constant 0 to "rcall 0" which is not 80 | * handled correctly by the assembler. 81 | */ 82 | #ifdef CONFIG_WDT_DISABLE 83 | wdt_disable(); 84 | #endif 85 | nullVector(); 86 | } 87 | 88 | /* Finally, let's register our partitions */ 89 | 90 | #ifdef CONFIG_HAS_EEPROM_PART 91 | 92 | 93 | int do_eeprom_read(struct rf24boot_partition* part, uint32_t addr, unsigned char* buf) 94 | { 95 | uint8_t *eptr = (uint8_t *) (uint16_t) addr; 96 | if (eptr >= ((uint8_t*) (uint16_t) (E2END + 1))) 97 | return 0; 98 | eeprom_read_block(buf, eptr, EEPROM_IOSIZE); 99 | return EEPROM_IOSIZE; 100 | } 101 | 102 | void do_eeprom_write(struct rf24boot_partition* part, uint32_t addr, const unsigned char* buf) 103 | { 104 | uint8_t *eptr = (uint8_t *) (uint16_t) addr; 105 | eeprom_write_block(buf, eptr, EEPROM_IOSIZE); 106 | } 107 | 108 | 109 | struct rf24boot_partition eeprom_part = { 110 | .info = { 111 | .name = "eeprom", 112 | .pad = 1, 113 | .size = E2END + 1, 114 | .iosize = EEPROM_IOSIZE, 115 | }, 116 | .read = do_eeprom_read, 117 | .write = do_eeprom_write 118 | }; 119 | BOOT_PARTITION(eeprom_part); 120 | 121 | #endif 122 | 123 | #ifdef CONFIG_HAS_FLASH_PART 124 | 125 | int do_flash_read(struct rf24boot_partition* part, uint32_t addr, unsigned char* buf) 126 | { 127 | if (addr >= (FLASH_SIZE + 1)) 128 | return 0; 129 | memcpy_PF(buf, addr, FLASH_IOSIZE); 130 | return FLASH_IOSIZE; 131 | } 132 | 133 | /* TODO: 134 | We might spare a few bytes and don't buffer the whole page in RAM. 135 | But I was too lazy. 136 | */ 137 | inline void boot_program_page (uint32_t page, uint8_t *buf) 138 | { 139 | uint16_t i; 140 | uint8_t sreg; 141 | 142 | // Disable interrupts. 143 | 144 | sreg = SREG; 145 | cli(); 146 | 147 | eeprom_busy_wait (); 148 | 149 | boot_page_erase (page); 150 | boot_spm_busy_wait (); // Wait until the memory is erased. 151 | 152 | for (i=0; i TIMEOUT) 232 | { 233 | dbg("It's boot time!\n"); 234 | rf24boot_boot_partition(NULL); /* AVR Doesn't care, save space */ 235 | } 236 | } 237 | #endif 238 | } 239 | #endif 240 | 241 | void rf24boot_platform_reset() 242 | { 243 | wdt_enable(WDTO_30MS); 244 | while(1) ;;; 245 | } 246 | -------------------------------------------------------------------------------- /src/avr/bootlock-avr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universal rf24boot bootloader : bootlock for avr 3 | * Copyright (C) 2014 Andrew 'Necromant' Andrianov 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define BOOTLOCK_PIN (1< 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 26 | #define COMPONENT "rf24boot" 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #define TIMEOUT (CONFIG_BOOTCOND_TIMEOUT / 50) 35 | 36 | static int boot_timer = 0; 37 | 38 | 39 | ANTARES_APP(bootcond_timed) 40 | { 41 | if (!rf24boot_got_hello()) 42 | { 43 | delay_ms(50); 44 | if (boot_timer++ > TIMEOUT) 45 | { 46 | rf24boot_boot_by_name(CONFIG_DEFAULT_BOOTPART); 47 | } 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/cb.c: -------------------------------------------------------------------------------- 1 | /* Circular buffer example, keeps one slot open */ 2 | 3 | #include 4 | #include 5 | #include "cb.h" 6 | 7 | 8 | 9 | int cb_is_full(struct rf_packet_buffer *cb) 10 | { 11 | return cb->count == cb->size; 12 | } 13 | 14 | int cb_is_empty(struct rf_packet_buffer *cb) 15 | { 16 | return cb->count == 0; 17 | } 18 | 19 | 20 | 21 | struct rf_packet *cb_read(struct rf_packet_buffer *b) 22 | { 23 | struct rf_packet *ret = NULL; 24 | if (!cb_is_empty(b)) { 25 | ret = &b->elems[b->start]; 26 | b->start = (b->start + 1) % b->size; 27 | b->count--; 28 | } 29 | return ret; 30 | } 31 | 32 | struct rf_packet *cb_peek(struct rf_packet_buffer *b) 33 | { 34 | struct rf_packet *ret = NULL; 35 | if (!cb_is_empty(b)) { 36 | ret = &b->elems[b->start]; 37 | } 38 | return ret; 39 | } 40 | 41 | 42 | 43 | struct rf_packet *cb_get_slot(struct rf_packet_buffer *b) 44 | { 45 | if (cb_is_full(b)) { 46 | cb_read(b); /* drop a packet */ 47 | return cb_get_slot(b); 48 | } 49 | int end = (b->start + b->count) % b->size; 50 | struct rf_packet *ret = &b->elems[end]; 51 | ++b->count; 52 | return ret; 53 | } 54 | 55 | void cb_flush(struct rf_packet_buffer *cb) 56 | { 57 | cb->count = 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/cb.h: -------------------------------------------------------------------------------- 1 | #ifndef CB_H 2 | #define CB_H 3 | 4 | /* RF packet buffer. */ 5 | struct rf_packet { 6 | uint8_t payload[32]; 7 | uint8_t len; 8 | uint8_t pipe; 9 | }; 10 | 11 | /* Circular buffer object */ 12 | struct rf_packet_buffer { 13 | int size; /* maximum number of elements */ 14 | int start; /* index of oldest element */ 15 | int count; /* index at which to write new element */ 16 | struct rf_packet *elems; /* vector of elements */ 17 | }; 18 | 19 | 20 | void cb_flush(struct rf_packet_buffer *cb); 21 | int cb_is_full(struct rf_packet_buffer *cb); 22 | int cb_is_empty(struct rf_packet_buffer *cb); 23 | struct rf_packet *cb_read(struct rf_packet_buffer *b); 24 | struct rf_packet *cb_peek(struct rf_packet_buffer *b); 25 | struct rf_packet *cb_get_slot(struct rf_packet_buffer *b); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/dummypart.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 7 | #define COMPONENT "dummypart" 8 | 9 | 10 | void do_null_write(struct rf24boot_partition* part, struct rf24boot_data *dat) 11 | { 12 | /* DO F*CKING NOTHING */ 13 | } 14 | 15 | int do_null_read(struct rf24boot_partition* part, struct rf24boot_data *dat) 16 | { 17 | /* Return all 0xff's */ 18 | memset(dat->data, 0x0, part->info.iosize); 19 | return part->info.iosize; 20 | } 21 | 22 | struct rf24boot_partition dummy_part = { 23 | .info = { 24 | .name = "dummy", 25 | .size = CONFIG_DUMMYPART_SIZE, 26 | .iosize = CONFIG_DUMMYPART_IOSIZE, 27 | .pad = CONFIG_DUMMYPART_PAD, 28 | }, 29 | .read = do_null_read, 30 | .write = do_null_write 31 | }; 32 | 33 | 34 | 35 | BOOT_PARTITION(dummy_part) 36 | -------------------------------------------------------------------------------- /src/hacks/Makefile: -------------------------------------------------------------------------------- 1 | objects-$(CONFIG_HACKS_LIGHTCTL)+=hacks-lightctl.o 2 | -------------------------------------------------------------------------------- /src/hacks/hacks-lightctl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 6 | #define COMPONENT "lightctlhacks" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | ANTARES_INIT_LOW(switch_off_lights) 15 | { 16 | DDRB|=(1<<1|1<<2|1<<3); 17 | PORTB&=~(1<<1|1<<2|1<<3); 18 | DDRD|=(1<<3|1<<5|1<<6); 19 | DDRD&=~(1<<3|1<<5|1<<6); 20 | } 21 | -------------------------------------------------------------------------------- /src/hacks/kcnf: -------------------------------------------------------------------------------- 1 | config HACKS_LIGHTCTL 2 | bool "Lightctl hacks" 3 | depends on ARCH_AVR 4 | help 5 | Disables all lights on the board while in bootloader 6 | Prevents eminent death of high-powered LEDs 7 | 8 | -------------------------------------------------------------------------------- /src/master.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universal rf24boot bootloader 3 | * Copyright (C) 2014 Andrew 'Necromant' Andrianov 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #define COMPONENT "rf24master" 26 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 27 | 28 | #include 29 | #include 30 | 31 | 32 | static char hw_addr[5] = { 0xff, 0xff, 0xff, 0xff, 0xfa }; 33 | 34 | static struct rf24boot_cmd cmd; 35 | 36 | 37 | ANTARES_APP(master) 38 | { 39 | int ret; 40 | dbg("Wireless in master mode\n"); 41 | rf24_open_writing_pipe(g_radio, hw_addr); 42 | 43 | printk("Searching target..."); 44 | while (1) { 45 | cmd.op = RF_OP_HELLO; 46 | ret = rf24_write(g_radio, &cmd, sizeof(cmd)); 47 | printk("."); 48 | if (ret == 0) 49 | break; 50 | delay_ms(1000); 51 | } 52 | while(1) ;; 53 | } 54 | -------------------------------------------------------------------------------- /src/native/Makefile: -------------------------------------------------------------------------------- 1 | objects-y+=main.o adaptor-factory.o librf24.o 2 | -------------------------------------------------------------------------------- /src/native/adaptor-factory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "requests.h" 13 | 14 | 15 | static struct rf24_adaptor *adaptors; 16 | void rf24tool_register_adaptor(void *p) 17 | { 18 | struct rf24_adaptor *a = p; 19 | if (!adaptors) 20 | adaptors = a; 21 | 22 | struct rf24_adaptor *ad = adaptors; 23 | while (ad->next) 24 | ad = ad->next; 25 | ad->next = a; 26 | a->next = NULL; 27 | } 28 | 29 | struct rf24_adaptor *rf24_get_adaptor_by_name(char* name) 30 | { 31 | struct rf24_adaptor *a = adaptors; 32 | 33 | while (a) { 34 | if (strcmp(a->name, name)==0) 35 | return a; 36 | a = a->next; 37 | } 38 | return NULL; 39 | } 40 | 41 | void rf24_list_adaptors() 42 | { 43 | struct rf24_adaptor *a = adaptors; 44 | fprintf(stderr, "Available adaptors: \n"); 45 | while (a) { 46 | fprintf(stderr, "* %s\n",a->name); 47 | a = a->next; 48 | } 49 | } 50 | 51 | struct rf24_adaptor *rf24_get_default_adaptor() 52 | { 53 | return adaptors; 54 | } 55 | 56 | 57 | static void __attribute__ ((constructor)) load_dynamic_adaptors() 58 | { 59 | dlopen("libantares.so", RTLD_NOW); 60 | } 61 | -------------------------------------------------------------------------------- /src/native/librf24.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "requests.h" 9 | #include 10 | 11 | #define COMPONENT "librf24" 12 | #include 13 | 14 | 15 | struct rf24_transfer *librf24_allocate_io_transfer(struct rf24_adaptor *a, int npackets) 16 | { 17 | struct rf24_transfer *t = calloc(sizeof(struct rf24_transfer), 1); 18 | if (!t) 19 | return NULL; 20 | t->a = a; 21 | 22 | t->io.data = calloc(npackets, sizeof(struct rf24_packet)); 23 | if (!t->io.data) 24 | goto errfreetransfer; 25 | 26 | t->io.ackdata = calloc(npackets, sizeof(struct rf24_packet)); 27 | if (!t->io.ackdata) 28 | goto errfreedata; 29 | 30 | t->io.num_allocated = npackets; 31 | 32 | t->timeout_ms = 1000; /* 1000 ms, a reasonable default */ 33 | 34 | if ((!a->allocate_transferdata) || (0==a->allocate_transferdata(t))) 35 | return t; 36 | 37 | errfreedata: 38 | free(t->io.data); 39 | 40 | errfreetransfer: 41 | free(t); 42 | return NULL; 43 | } 44 | 45 | struct rf24_transfer *librf24_allocate_sweep_transfer(struct rf24_adaptor *a, int times) 46 | { 47 | struct rf24_transfer *t = calloc(sizeof(struct rf24_transfer), 1); 48 | if (!t) 49 | return NULL; 50 | t->a = a; 51 | t->type = RF24_TRANSFER_SWEEP; 52 | t->sweep.sweeptimes = times; 53 | t->timeout_ms = 400*times; /* Give it ~1ms per channel */ 54 | return t; 55 | } 56 | 57 | struct rf24_transfer *librf24_allocate_config_transfer(struct rf24_adaptor *a, struct rf24_config *conf) 58 | { 59 | struct rf24_transfer *t = calloc(sizeof(struct rf24_transfer), 1); 60 | if (!t) 61 | return NULL; 62 | t->a = a; 63 | t->type = RF24_TRANSFER_CONFIG; 64 | t->conf = *conf; 65 | t->timeout_ms = 1000; 66 | return t; 67 | } 68 | 69 | struct rf24_transfer *librf24_allocate_openpipe_transfer(struct rf24_adaptor *a, enum rf24_pipe pipe, char* addr) 70 | { 71 | struct rf24_transfer *t = calloc(sizeof(struct rf24_transfer), 1); 72 | if (!t) 73 | return NULL; 74 | t->a = a; 75 | t->type = RF24_TRANSFER_OPENPIPE; 76 | t->pipeopen.pipe = pipe; 77 | memcpy(t->pipeopen.addr, addr, 5); /* copy the address */ 78 | t->timeout_ms = 1000; 79 | return t; 80 | } 81 | 82 | void librf24_set_transfer_timeout(struct rf24_transfer *t, int timeout_ms) 83 | { 84 | t->timeout_ms = timeout_ms; 85 | } 86 | 87 | void librf24_set_transfer_callback(struct rf24_transfer *t, rf24_transfer_cb_fn callback) 88 | { 89 | t->callback = callback; 90 | } 91 | 92 | int librf24_submit_transfer(struct rf24_transfer *t) 93 | { 94 | if ((t->status == RF24_TRANSFER_RUNNING) || (t->status == RF24_TRANSFER_CANCELLING)) { 95 | warn("Attempt to submit a running/cancelling transfer\n"); 96 | return -EAGAIN; /* Already running? */ 97 | } 98 | 99 | t->timeout_ms_left = t->timeout_ms; 100 | t->status = RF24_TRANSFER_RUNNING; 101 | 102 | /* TODO: More sanity */ 103 | struct rf24_adaptor *a = t->a; 104 | dbg("Submitting transfer\n"); 105 | return a->submit_transfer(t); 106 | } 107 | 108 | 109 | void librf24_free_transfer(struct rf24_transfer *t) 110 | { 111 | if ((t->type == RF24_TRANSFER_READ) || (t->type == RF24_TRANSFER_WRITE)) { 112 | free(t->io.data); 113 | free(t->io.ackdata); 114 | } 115 | free(t); 116 | } 117 | void librf24_callback(struct rf24_transfer *t) 118 | { 119 | if (t->callback) 120 | t->callback(t); 121 | if (t->flags & RF24_TRANSFER_FLAG_FREE) 122 | rf24_free_transfer(t); 123 | } 124 | 125 | void librf24_cancel_transfer(struct rf24_transfer *t) 126 | { 127 | /* TODO: sanity */ 128 | } 129 | 130 | int librf24_make_write_transfer(struct rf24_transfer *t, int mode) 131 | { 132 | if (mode <= MODE_READ) { 133 | warn("Invalid mode supplied to rf24_make_write_transfer\n"); 134 | return 1; 135 | } 136 | 137 | t->type = RF24_TRANSFER_WRITE; 138 | t->io.transfermode = mode; 139 | t->io.num_data_packets = 0; 140 | t->io.num_ack_packets = 0; 141 | /* TODO: Sanity checking */ 142 | return 0; 143 | } 144 | 145 | /** 146 | * Add a packet to a transfer. Call this function after calling 147 | * rf24_make_read_transfer() or rf24_make_write_transfer() 148 | * When a transfer is WRITE this adds the packets to the outgoing list of packets, 149 | * pipe argument is ignored. 150 | * When the transfer is READ, with ack payloads enabled it adds the packet to the 151 | * ack packets for the specified pipe. 152 | * There's no reason to call this function when ack payloads are disabled. 153 | * 154 | * @param t transfer, must be either a READ or WRITE 155 | * @param data Data to put into the packet, up to 32 bytes 156 | * @param len length 1-32 157 | * @param pipe number of pipe (for ack packets) 158 | * 159 | * @return 0 - ok, else failure code 160 | */ 161 | int librf24_add_packet(struct rf24_transfer *t, char* data, int len, int pipe) 162 | { 163 | struct rf24_packet *p; 164 | if (len>32) 165 | return -EBADF; /* too much data */ 166 | if (t->io.transfermode == RF24_TRANSFER_WRITE) { 167 | if (t->io.num_data_packets >= t->io.num_allocated) 168 | return -ENOMEM; 169 | p = &t->io.data[t->io.num_data_packets++]; 170 | } else if (t->io.transfermode == RF24_TRANSFER_READ) { 171 | if (t->io.num_data_packets >= t->io.num_allocated) 172 | return -ENOMEM; 173 | p = &t->io.ackdata[t->io.num_ack_packets++]; 174 | } else 175 | return -EIO; /* Wrong type of transfer */ 176 | 177 | p->pipe = pipe; 178 | memcpy(p->data, data, len); 179 | return 0; 180 | } 181 | -------------------------------------------------------------------------------- /src/native/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | #define COMPONENT "rtest" 9 | #include "lib/printk.h" 10 | 11 | 12 | static int completed = 0; 13 | void sweep_done_cb(struct rf24_transfer *t) 14 | { 15 | printf("Sweep done with status %d\n", t->status); 16 | completed++; 17 | } 18 | 19 | void config_done_cb(struct rf24_transfer *t) 20 | { 21 | printf("Config done with status %d\n", t->status); 22 | completed++; 23 | } 24 | 25 | void open_done_cb(struct rf24_transfer *t) 26 | { 27 | printf("Open done with status %d\n", t->status); 28 | completed++; 29 | } 30 | 31 | void write_done_cb(struct rf24_transfer *t) 32 | { 33 | printf("Write done with status %d\n", t->status); 34 | completed++; 35 | } 36 | 37 | void wait(struct rf24_adaptor *a) 38 | { 39 | while (!completed) 40 | rf24_handle_events(a); 41 | completed = 0; 42 | } 43 | 44 | int main(int argc, char *argv[]) 45 | { 46 | int ret; 47 | struct rf24_adaptor *a = rf24_get_adaptor_by_name("vusb-async"); 48 | if (!a) 49 | err("adaptor not found"); 50 | ret = rf24_init(a, argc, argv); 51 | if (ret) 52 | exit(1); 53 | 54 | struct rf24_transfer *t = rf24_allocate_sweep_transfer(a, 30); 55 | t->flags = RF24_TRANSFER_FLAG_FREE; 56 | rf24_set_transfer_callback(t, sweep_done_cb); 57 | rf24_submit_transfer(t); 58 | 59 | wait(a); 60 | 61 | struct rf24_config conf; 62 | conf.channel = 13; 63 | conf.rate = RF24_2MBPS; 64 | conf.pa = RF24_PA_MAX; 65 | conf.crclen = RF24_CRC_16; 66 | conf.num_retries = 15; 67 | conf.retry_timeout = 10; 68 | conf.dynamic_payloads = 1; 69 | conf.ack_payloads = 0; 70 | 71 | t = rf24_allocate_config_transfer(a, &conf); 72 | rf24_set_transfer_callback(t, config_done_cb); 73 | rf24_set_transfer_timeout(t, 30000); 74 | t->flags = RF24_TRANSFER_FLAG_FREE; 75 | rf24_submit_transfer(t); 76 | wait(a); 77 | 78 | 79 | char addr[] = { 0xb0, 0x0b, 0x10, 0xad, 0xed }; 80 | t = rf24_allocate_openpipe_transfer(a, PIPE_WRITE, addr); 81 | rf24_set_transfer_callback(t, open_done_cb); 82 | rf24_set_transfer_timeout(t, 30000); 83 | t->flags = RF24_TRANSFER_FLAG_FREE; 84 | rf24_submit_transfer(t); 85 | wait(a); 86 | 87 | t = rf24_allocate_openpipe_transfer(a, PIPE_READ_0, addr); 88 | rf24_set_transfer_callback(t, open_done_cb); 89 | rf24_set_transfer_timeout(t, 30000); 90 | t->flags = RF24_TRANSFER_FLAG_FREE; 91 | rf24_submit_transfer(t); 92 | wait(a); 93 | 94 | 95 | char data[] = "hello world"; 96 | t = rf24_allocate_io_transfer(a, 1); 97 | rf24_make_write_transfer(t, MODE_WRITE_STREAM); 98 | rf24_add_packet(t, data, strlen(data), 0); 99 | 100 | rf24_set_transfer_callback(t, write_done_cb); 101 | rf24_set_transfer_timeout(t, 30000); 102 | t->flags = RF24_TRANSFER_FLAG_FREE; 103 | rf24_submit_transfer(t); 104 | wait(a); 105 | return 0; 106 | } 107 | -------------------------------------------------------------------------------- /src/packet-listener.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 6 | #define COMPONENT "rf24boot" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | 16 | static uint8_t local_addr[5] = { 17 | CONFIG_RF_ADDR_0, 18 | CONFIG_RF_ADDR_1, 19 | CONFIG_RF_ADDR_2, 20 | CONFIG_RF_ADDR_3, 21 | CONFIG_RF_ADDR_4 22 | }; 23 | 24 | 25 | /* Place on stack - save RAM */ 26 | struct rf24_config conf = { 27 | .channel = CONFIG_RF_CHANNEL, 28 | .pa = RF24_PA_MAX, 29 | .rate = RF24_2MBPS, 30 | .crclen = RF24_CRC_16, 31 | .dynamic_payloads = 0, 32 | .num_retries = 15, 33 | .retry_timeout = 15, 34 | .pipe_auto_ack = 0xff, 35 | .payload_size = 32 36 | }; 37 | 38 | ANTARES_INIT_HIGH(slave_init) 39 | { 40 | wdt_enable(WDTO_4S); 41 | rf24_init(g_radio); 42 | rf24_flush_rx(g_radio); 43 | rf24_flush_tx(g_radio); 44 | rf24_config(g_radio, &conf); 45 | rf24_power_up(g_radio); 46 | rf24_stop_listening(g_radio); 47 | 48 | delay_ms(1000); 49 | info("addr %x:%x:%x:%x:%x channel %d\n", 50 | local_addr[0], 51 | local_addr[1], 52 | local_addr[2], 53 | local_addr[3], 54 | local_addr[4], 55 | CONFIG_RF_CHANNEL); 56 | 57 | info("RF: init done\n"); 58 | info("RF: module is %s P variant\n", rf24_is_p_variant(g_radio) ? "" : "NOT"); 59 | dbg("Wireless in slave mode\n\n"); 60 | rf24_open_reading_pipe(g_radio, 0, local_addr); 61 | rf24_print_details(g_radio); 62 | rf24_start_listening(g_radio); 63 | } 64 | 65 | ANTARES_APP(slave) 66 | { 67 | static int i; 68 | unsigned char hello[32];; 69 | uint8_t pipe; 70 | wdt_reset(); 71 | if (rf24_available(g_radio, &pipe)) { 72 | uint8_t len = rf24_get_dynamic_payload_size(g_radio); 73 | rf24_read(g_radio, &hello, len); 74 | printk("\n> got packet, len %d\n", len); 75 | for (i=0; i<32; i++) 76 | printk(" %hhx ", hello[i]); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/packet-sender.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 6 | #define COMPONENT "rf24boot" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | 14 | 15 | static uint8_t local_addr[5] = { 16 | CONFIG_RF_ADDR_0, 17 | CONFIG_RF_ADDR_1, 18 | CONFIG_RF_ADDR_2, 19 | CONFIG_RF_ADDR_3, 20 | CONFIG_RF_ADDR_4 21 | }; 22 | 23 | 24 | /* Place on stack - save RAM */ 25 | struct rf24_config conf = { 26 | .channel = CONFIG_RF_CHANNEL, 27 | .pa = RF24_PA_MAX, 28 | .rate = RF24_2MBPS, 29 | .crclen = RF24_CRC_16, 30 | .dynamic_payloads = 1, 31 | .num_retries = 15, 32 | .retry_timeout = 15, 33 | .pipe_auto_ack = 0xff, 34 | .payload_size = 32 35 | }; 36 | 37 | ANTARES_INIT_HIGH(slave_init) 38 | { 39 | 40 | rf24_init(g_radio); 41 | rf24_flush_rx(g_radio); 42 | rf24_flush_tx(g_radio); 43 | rf24_config(g_radio, &conf); 44 | rf24_power_up(g_radio); 45 | rf24_stop_listening(g_radio); 46 | 47 | info("addr %x:%x:%x:%x:%x channel %d\n", 48 | local_addr[0], 49 | local_addr[1], 50 | local_addr[2], 51 | local_addr[3], 52 | local_addr[4], 53 | CONFIG_RF_CHANNEL); 54 | 55 | info("RF: init done\n"); 56 | info("RF: module is %s P variant\n", rf24_is_p_variant(g_radio) ? "" : "NOT"); 57 | dbg("Wireless in slave mode\n\n"); 58 | rf24_open_writing_pipe(g_radio, local_addr); 59 | rf24_print_details(g_radio); 60 | } 61 | 62 | ANTARES_APP(slave) 63 | { 64 | static int i; 65 | char hello[32];; 66 | sprintf(hello, "===> %d", i++); 67 | rf24_flush_tx(g_radio); 68 | 69 | int ret = rf24_write(g_radio, hello, strlen(hello)); 70 | printk("SEND: %d\n", ret); 71 | delay_s(1); 72 | } 73 | -------------------------------------------------------------------------------- /src/slave.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universal rf24boot bootloader : Bootloader core 3 | * Copyright (C) 2014 Andrew 'Necromant' Andrianov 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #define DEBUG_LEVEL CONFIG_DEBUGGING_VERBOSITY 25 | #define COMPONENT "rf24boot" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | #define CONFIG_BOOT_MAX_PARTS 3 34 | static int partcount; 35 | struct rf24boot_partition *parts[CONFIG_BOOT_MAX_PARTS]; 36 | 37 | void rf24boot_add_part(struct rf24boot_partition *part) 38 | { 39 | dbg("Registering partition %d: %s\n", partcount, part->info.name); 40 | BUG_ON(partcount >= CONFIG_BOOT_MAX_PARTS); /* Increase max parts */ 41 | parts[partcount++] = part; 42 | } 43 | 44 | void rf24boot_boot_by_name(char* name) 45 | { 46 | uint8_t i; 47 | for (i=0; iinfo.name)==0) 50 | rf24boot_boot_partition(parts[i]); 51 | } 52 | 53 | } 54 | 55 | uint8_t g_rf24boot_got_hello = 0; 56 | 57 | static uint8_t local_addr[5] = { 58 | CONFIG_RF_ADDR_0, 59 | CONFIG_RF_ADDR_1, 60 | CONFIG_RF_ADDR_2, 61 | CONFIG_RF_ADDR_3, 62 | CONFIG_RF_ADDR_4 63 | }; 64 | 65 | 66 | static struct rf24_config conf = { 67 | .channel = CONFIG_RF_CHANNEL, 68 | .pa = RF24_PA_MAX, 69 | .rate = RF24_2MBPS, 70 | .crclen = RF24_CRC_16, 71 | .dynamic_payloads = 1, 72 | .num_retries = 15, 73 | .retry_timeout = 15, 74 | .pipe_auto_ack = 0xff, 75 | .payload_size = 32 76 | }; 77 | 78 | ANTARES_INIT_HIGH(slave_init) 79 | { 80 | 81 | rf24_init(g_radio); 82 | rf24_config(g_radio, &conf); 83 | info("RF: init done\n"); 84 | info("RF: module is %s P variant\n", rf24_is_p_variant(g_radio) ? "" : "NOT"); 85 | dbg("Wireless in slave mode\n\n"); 86 | rf24_print_details(g_radio); 87 | rf24_open_reading_pipe(g_radio, 0, local_addr); 88 | rf24_start_listening(g_radio); 89 | } 90 | 91 | 92 | #define DEADTIME (CONFIG_DEADTIME_TIMEOUT * 1000) 93 | static uint8_t listening = 1; 94 | 95 | static void listen(uint8_t state) { 96 | if (listening && (!state)) { 97 | rf24_stop_listening(g_radio); 98 | listening = 0; 99 | } else if (!listening && state) { 100 | if (0==rf24_queue_sync(g_radio, 250)) 101 | rf24boot_platform_reset(); 102 | rf24_start_listening(g_radio); 103 | listening=1; 104 | } 105 | } 106 | 107 | 108 | static void respond(uint8_t op, struct rf24boot_cmd *cmd, uint8_t len) 109 | { 110 | listen(0); 111 | int ret; 112 | #if CONFIG_HAVE_DEADTIME 113 | uint8_t retry = 0xff; 114 | do { 115 | ret = rf24_queue_push(g_radio, cmd, len + 1); 116 | if (ret == 0) 117 | break; 118 | delay_ms((DEADTIME / 0xff)); /* If stuck for >5 sec - reboot */ 119 | } while (--retry); 120 | 121 | if (!retry) { 122 | rf24boot_platform_reset(); 123 | } 124 | 125 | printk("resp op %d retry %d len %d\n", op, retry, len + 1); 126 | #else 127 | do { 128 | ret = rf24_queue_push(g_radio, cmd, len + 1); 129 | } 130 | while (ret != 0); 131 | #endif 132 | 133 | } 134 | 135 | 136 | 137 | static inline void handle_cmd(struct rf24boot_cmd *cmd) { 138 | uint8_t cmdcode = cmd->op & 0x0f; 139 | uint8_t i; 140 | struct rf24boot_data *dat; 141 | if (cmdcode == RF_OP_HELLO) 142 | { 143 | struct rf24boot_hello_resp *resp; 144 | dbg("hello from 0x%02x:0x%02x:0x%02x:0x%02x:0x%02x !\n", 145 | cmd->data[0], 146 | cmd->data[1], 147 | cmd->data[2], 148 | cmd->data[3], 149 | cmd->data[4] 150 | ); 151 | rf24_open_writing_pipe(g_radio, cmd->data); 152 | resp = (struct rf24boot_hello_resp *) cmd->data; 153 | resp->numparts = partcount; 154 | resp->is_big_endian = 0; /* FixMe: ... */ 155 | strncpy(resp->id, CONFIG_SLAVE_ID, 28); 156 | resp->id[28]=0x0; 157 | rf24_flush_rx(g_radio); 158 | respond(RF_OP_HELLO, cmd, 159 | sizeof(struct rf24boot_hello_resp)); 160 | g_rf24boot_got_hello=1; 161 | 162 | /* Shit out partition table */ 163 | for (i=0; i< partcount; i++) { 164 | memcpy(cmd->data, (uint8_t *) &parts[i]->info, 165 | sizeof(struct rf24boot_partition_header)); 166 | respond(RF_OP_PARTINFO, cmd, sizeof(struct rf24boot_partition_header)); 167 | } 168 | listen(1); 169 | 170 | return; 171 | } 172 | 173 | 174 | dat = (struct rf24boot_data *) cmd->data; 175 | 176 | if (dat->part >= partcount) 177 | return; 178 | 179 | if ((cmdcode == RF_OP_READ)) 180 | { 181 | int ret; 182 | uint32_t toread = dat->addr; 183 | dat->addr = 0; 184 | do { 185 | ret = parts[dat->part]->read(parts[dat->part], dat->addr, dat->data); 186 | respond(RF_OP_READ, cmd, 187 | ret + 5); 188 | dat->addr += (uint32_t) ret; 189 | } while (dat->addr < toread); 190 | listen(1); 191 | } else if (cmdcode == RF_OP_WRITE) 192 | { 193 | dbg("write addr: %lu\n", dat->addr); 194 | parts[dat->part]->write(parts[dat->part], dat->addr, dat->data); 195 | } else if ((cmdcode == RF_OP_BOOT)) 196 | { 197 | rf24boot_boot_partition(parts[dat->part]); 198 | } 199 | } 200 | 201 | 202 | ANTARES_APP(slave) 203 | { 204 | struct rf24boot_cmd cmd; /* The hw fifo is 3 levels deep */ 205 | uint8_t pipe; 206 | if (rf24_available(g_radio, &pipe)) { 207 | uint8_t len = rf24_get_dynamic_payload_size(g_radio); 208 | rf24_read(g_radio, &cmd, len); 209 | printk("> got packet, len %d\n", len); 210 | dbg("\ngot cmd: %x \n", cmd.op); 211 | handle_cmd(&cmd); 212 | } 213 | } 214 | 215 | #ifdef CONFIG_TOOLCHAIN_SDCC 216 | int main() { 217 | do_antares_startup(); 218 | } 219 | #endif 220 | -------------------------------------------------------------------------------- /src/uisp-app.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Universal rf24boot bootloader : uISP App code 3 | * Copyright (C) 2014 Andrew 'Necromant' Andrianov 4 | * 5 | * This program is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation; either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License along 16 | * with this program; if not, write to the Free Software Foundation, Inc., 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "requests.h" 33 | #include "cb.h" 34 | 35 | char msg[128]; /* usb response buffer */ 36 | 37 | #define dbg(fmt, ...) sprintf(msg, fmt, ##__VA_ARGS__) 38 | 39 | extern struct rf24 *g_radio; 40 | static uchar last_rq; 41 | static int rq_len; 42 | static uint16_t pos; /* Position in the buffer */ 43 | 44 | 45 | 46 | /* Streaming mode flag */ 47 | static uint8_t system_state = MODE_IDLE; 48 | static uint8_t writing; /* Is there currently a write started ? */ 49 | 50 | 51 | static struct rf_packet pcks[CONFIG_HW_BUFFER_SIZE]; /* Our packet buffer pool */ 52 | static struct rf_packet_buffer cb = { 53 | .size = 0, 54 | .elems = pcks, 55 | }; 56 | 57 | /* cb that stores ack packets */ 58 | static struct rf_packet_buffer acb = { 59 | .size = 0, 60 | .elems = pcks, 61 | }; 62 | 63 | #include 64 | 65 | static struct rf24_dongle_status status; 66 | 67 | 68 | void flush_everything() 69 | { 70 | rf24_stop_listening(g_radio); 71 | rf24_queue_sync(g_radio, 0); 72 | rf24_flush_tx(g_radio); 73 | rf24_flush_rx(g_radio); 74 | cb_flush(&cb); 75 | cb_flush(&acb); 76 | writing = 0; 77 | } 78 | 79 | void post_interrupt_message() 80 | { 81 | status.cb_count = cb.count; 82 | status.cb_size = cb.size; 83 | status.acb_count = acb.count; 84 | status.acb_size = acb.size; 85 | status.fifo_is_empty = rf24_tx_empty(g_radio); 86 | usbSetInterrupt((unsigned char *)&status, sizeof(struct rf24_dongle_status)); 87 | } 88 | 89 | int rf24_write_done(struct rf24 *r) 90 | { 91 | uint8_t s; 92 | s = rf24_get_status(r); 93 | return (s & ((1<> 1; 106 | for (i=0; i<4; i++) 107 | if ( cnt > i) 108 | PORTC|=1<len = rf24_get_dynamic_payload_size(g_radio); 117 | p->pipe = pipe; 118 | rf24_read(g_radio, p->payload, p->len); 119 | } 120 | } else if (system_state == MODE_WRITE_STREAM) { 121 | if ((writing) && rf24_write_done(g_radio)) { 122 | uint8_t ok, rdy, failed; 123 | writing = 0; 124 | PORTC=0x2; 125 | rf24_what_happened(g_radio, &ok, &failed, &rdy); 126 | status.last_tx_failed = failed; 127 | post_interrupt_message(); 128 | 129 | if (failed) 130 | rf24_flush_tx(g_radio); 131 | 132 | if (rdy) { 133 | /* Read the ack payload?? */ 134 | } 135 | cb_read(&cb); 136 | } 137 | 138 | if (!writing) { 139 | struct rf_packet *p = cb_peek(&cb); 140 | if (p) { 141 | rf24_start_write(g_radio, p->payload, p->len); 142 | writing = 1; 143 | } 144 | } 145 | } else if (system_state == MODE_WRITE_BULK) { 146 | int ret=0; 147 | uint8_t tmp; 148 | while (ret != -EAGAIN) { 149 | struct rf_packet *p = cb_peek(&cb); 150 | if (!p) 151 | break; 152 | ret = rf24_queue_push(g_radio, p->payload, p->len); 153 | if (ret==0) 154 | cb_read(&cb); 155 | } 156 | 157 | /* Retry any transfers */ 158 | rf24_what_happened(g_radio, &tmp, &tmp, &tmp); 159 | } 160 | } 161 | 162 | uchar usbFunctionSetup(uchar data[8]) 163 | { 164 | usbRequest_t *rq = (void *)data; 165 | switch (rq->bRequest) 166 | { 167 | case RQ_MODE: 168 | system_state = rq->wValue.bytes[0]; 169 | flush_everything(); 170 | 171 | if (rq->wValue.bytes[0] == MODE_IDLE) 172 | rf24_power_down(g_radio); 173 | else 174 | rf24_power_up(g_radio); 175 | 176 | if (rq->wValue.bytes[0] == MODE_READ) { 177 | rf24_start_listening(g_radio); 178 | } 179 | 180 | return 0; 181 | break; 182 | case RQ_READ: 183 | { 184 | struct rf_packet *p; 185 | struct rf_packet_buffer *buf; 186 | 187 | if (system_state == MODE_READ) 188 | buf = &cb; 189 | else 190 | buf = &acb; 191 | 192 | p = cb_read(buf); 193 | if (!p) 194 | return 0; 195 | 196 | msg[0] = p->pipe; 197 | if (!cb_is_empty(buf)) 198 | msg[0]|=1<<7; /* Tell we can read more */ 199 | 200 | memcpy(&msg[1], p->payload, p->len); 201 | usbMsgPtr = (uint8_t *)msg; 202 | post_interrupt_message(); 203 | 204 | return p->len + 1; 205 | } 206 | case RQ_SWEEP: 207 | { 208 | struct rf24_sweeper s; 209 | rf24_sweeper_init(&s, g_radio); 210 | rf24_sweep(&s, rq->wValue.bytes[0]); 211 | memcpy(msg, s.values, 128); 212 | usbMsgPtr = (uint8_t *)msg; 213 | return 128; 214 | break; 215 | } 216 | case RQ_FLUSH: 217 | { 218 | rf24_stop_listening(g_radio); 219 | flush_everything(); 220 | return 0; 221 | } 222 | case RQ_SYNC: 223 | { 224 | while (--rq->wValue.word && cb.count) { 225 | process_radio_transfers(); 226 | delay_ms(10); 227 | } 228 | 229 | rq->wValue.word = 230 | rf24_queue_sync(g_radio, rq->wValue.word); 231 | 232 | uint16_t *ret = (uint16_t *) msg; 233 | *ret = rq->wValue.word; 234 | usbMsgPtr = (uint8_t *)msg; 235 | return sizeof(uint16_t); 236 | } 237 | case RQ_NOP: 238 | /* Shit out dbg buffer */ 239 | usbMsgPtr = (uint8_t *)msg; 240 | return strlen(msg)+1; 241 | break; 242 | } 243 | last_rq = rq->bRequest; 244 | rq_len = rq->wLength.word; 245 | /* Hack: Always call usbFunctionWrite (retransfers) */ 246 | pos = 0; 247 | 248 | 249 | return USB_NO_MSG; 250 | } 251 | 252 | 253 | const char l_addr[] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa }; 254 | uchar usbFunctionWrite(uchar *data, uchar len) 255 | { 256 | /* TODO: We can copy data to the actual cb-buffer on write here. 257 | This way we can write packets to cb in bulk. 258 | */ 259 | 260 | /* Useful to catch userspace breakage 261 | if (last_rq == RQ_WRITE && cb_is_full(&cb)) 262 | { 263 | while (1) { 264 | PORTC^=0xff; 265 | delay_ms(100); 266 | } 267 | } 268 | */ 269 | 270 | memcpy(&msg[pos], data, len); 271 | pos+=len; 272 | 273 | if (pos != rq_len) 274 | return 0; /* Need moar data */ 275 | uint8_t ret = 0; 276 | switch (last_rq) { 277 | case RQ_OPEN_PIPE: 278 | rf24_stop_listening(g_radio); 279 | if (msg[0] < 6) 280 | rf24_open_reading_pipe(g_radio, msg[0], (uchar *) &msg[1]); 281 | else { 282 | rf24_open_writing_pipe(g_radio, (uchar *) &msg[1]); 283 | } 284 | 285 | status.last_tx_failed = 0x0; 286 | post_interrupt_message(); 287 | break; 288 | case RQ_CONFIG: 289 | { 290 | struct rf24_usb_config *c = (struct rf24_usb_config *) msg; 291 | flush_everything(); 292 | rf24_config(g_radio, (struct rf24_config *) c); 293 | status.last_tx_failed = 0x0; 294 | post_interrupt_message(); 295 | if (c->ack_payloads) { 296 | cb.size = CONFIG_HW_BUFFER_SIZE / 2; 297 | acb.size = CONFIG_HW_BUFFER_SIZE / 2; 298 | cb.elems = pcks; 299 | acb.elems = &pcks[CONFIG_HW_BUFFER_SIZE / 2]; 300 | } else { 301 | cb.size = CONFIG_HW_BUFFER_SIZE; 302 | cb.elems = pcks; 303 | acb.size = 0; 304 | } 305 | break; 306 | } 307 | case RQ_WRITE: 308 | { 309 | struct rf_packet *p; 310 | p = ( system_state == MODE_READ ) ? 311 | cb_get_slot(&acb) : 312 | cb_get_slot(&cb); 313 | memcpy(p->payload, &msg[1], pos-1); 314 | p->pipe = msg[0]; 315 | p->len = pos-1; 316 | status.last_tx_failed = 0xff; /* In progress */ 317 | post_interrupt_message(); 318 | break; 319 | } 320 | } 321 | fmt_result(ret); 322 | return 1; 323 | } 324 | 325 | void usbReconnect() 326 | { 327 | DDRD |= ((1<