nrf24l01 support irq recv
This commit is contained in:
@@ -14,7 +14,7 @@ void board_init() {
|
|||||||
gpio_bit_set(LEDG_GPIO_PORT, LEDG_PIN);
|
gpio_bit_set(LEDG_GPIO_PORT, LEDG_PIN);
|
||||||
gpio_bit_set(LEDB_GPIO_PORT, LEDB_PIN);
|
gpio_bit_set(LEDB_GPIO_PORT, LEDB_PIN);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
LCD_Init(); // init LCD
|
LCD_Init(); // init LCD
|
||||||
LCD_Clear(BLACK);
|
LCD_Clear(BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -35,61 +35,61 @@
|
|||||||
|
|
||||||
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug.8330431" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug">
|
<toolChain id="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug.8330431" name="RISC-V Cross GCC" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.toolchain.elf.debug">
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1202731164" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash.1202731164" name="Create flash image" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createflash" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.1939916912" name="Create extended listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting.1939916912" name="Create extended listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.createlisting" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.662073656" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize.662073656" name="Print size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.addtools.printsize" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.1313552818" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.debug" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.1313552818" name="Optimization Level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.level.none" valueType="enumerated"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.1404627735" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength.1404627735" name="Message length (-fmessage-length=0)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.messagelength" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.1267661089" name="'char' is signed (-fsigned-char)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar.1267661089" name="'char' is signed (-fsigned-char)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.signedchar" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.1426360736" name="Function sections (-ffunction-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections.1426360736" name="Function sections (-ffunction-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.functionsections" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.759847876" name="Data sections (-fdata-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections.759847876" name="Data sections (-fdata-sections)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.optimization.datasections" useByScannerDiscovery="true" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.668391469" name="Debug level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.max" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.668391469" name="Debug level" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level" useByScannerDiscovery="true" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.level.max" valueType="enumerated"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.1164967264" name="Debug format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format.1164967264" name="Debug format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.debugging.format" useByScannerDiscovery="true"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.1072740689" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name" value="GNU MCU RISC-V GCC" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name.1072740689" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.name" useByScannerDiscovery="false" value="GNU MCU RISC-V GCC" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.1957750909" name="Prefix" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix" value="riscv-none-embed-" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix.1957750909" name="Prefix" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.prefix" useByScannerDiscovery="false" value="riscv-none-embed-" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.1974277961" name="C compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c" value="gcc" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c.1974277961" name="C compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.c" useByScannerDiscovery="false" value="gcc" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1904763105" name="C++ compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp" value="g++" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp.1904763105" name="C++ compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.cpp" useByScannerDiscovery="false" value="g++" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.1687279771" name="Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar" value="ar" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar.1687279771" name="Archiver" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.ar" useByScannerDiscovery="false" value="ar" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.990721007" name="Hex/Bin converter" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy" value="objcopy" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy.990721007" name="Hex/Bin converter" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objcopy" useByScannerDiscovery="false" value="objcopy" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1007157873" name="Listing generator" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump" value="objdump" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump.1007157873" name="Listing generator" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.objdump" useByScannerDiscovery="false" value="objdump" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.2005273946" name="Size command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size" value="size" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size.2005273946" name="Size command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.size" useByScannerDiscovery="false" value="size" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.817675941" name="Build command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make" value="make" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make.817675941" name="Build command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.make" useByScannerDiscovery="false" value="make" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.1016789776" name="Remove command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm" value="rm" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm.1016789776" name="Remove command" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.command.rm" useByScannerDiscovery="false" value="rm" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.631765752" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id" value="512258282" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.631765752" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id" useByScannerDiscovery="false" value="512258282" valueType="string"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.1350567922" name="Architecture" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.arch.rv32i" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base.1350567922" name="Architecture" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.base" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.arch.rv32i" valueType="enumerated"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.1880868567" name="Multiply extension (RVM)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply.1880868567" name="Multiply extension (RVM)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.multiply" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.456415389" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic.456415389" name="Atomic extension (RVA)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.atomic" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.2087083466" name="Compressed extension (RVC)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed.2087083466" name="Compressed extension (RVC)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.isa.compressed" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.520770065" name="Integer ABI" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.abi.integer.ilp32" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer.520770065" name="Integer ABI" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.abi.integer" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.abi.integer.ilp32" valueType="enumerated"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.1599179399" name="Code model" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.default" valueType="enumerated"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.1599179399" name="Code model" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.default" valueType="enumerated"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.smalldatalimit.1215554700" name="Small data limit" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.smalldatalimit" value="4" valueType="string"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.smalldatalimit.1215554700" name="Small data limit" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.smalldatalimit" useByScannerDiscovery="false" value="4" valueType="string"/>
|
||||||
|
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1085168581" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1085168581" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.933880407" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.933880407" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.525634082" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.525634082" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.334418871" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.334418871" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">
|
||||||
|
|
||||||
@@ -209,21 +209,21 @@
|
|||||||
|
|
||||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.125062338" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
|
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting.125062338" name="GNU RISC-V Cross Create Listing" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.createlisting">
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.1032156266" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source.1032156266" name="Display source (--source|-S)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.source" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.130399435" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders.130399435" name="Display all headers (--all-headers|-x)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.allheaders" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle.1410206102" name="Demangle names (--demangle|-C)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle.1410206102" name="Demangle names (--demangle|-C)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.demangle" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers.80630986" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers.80630986" name="Display line numbers (--line-numbers|-l)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.linenumbers" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide.1257944666" name="Wide lines (--wide|-w)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide" value="true" valueType="boolean"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide.1257944666" name="Wide lines (--wide|-w)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.createlisting.wide" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
|
|
||||||
</tool>
|
</tool>
|
||||||
|
|
||||||
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.855604372" name="GNU RISC-V Cross Print Size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize">
|
<tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize.855604372" name="GNU RISC-V Cross Print Size" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.printsize">
|
||||||
|
|
||||||
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format.545311739" name="Size format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format"/>
|
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format.545311739" name="Size format" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.printsize.format" useByScannerDiscovery="false"/>
|
||||||
|
|
||||||
</tool>
|
</tool>
|
||||||
|
|
||||||
|
@@ -3,19 +3,20 @@
|
|||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "nrf24.h"
|
#include "nrf24.h"
|
||||||
|
|
||||||
|
#if 0
|
||||||
#define TASK_SIZE 1024
|
#define TASK_SIZE 1024
|
||||||
|
|
||||||
|
|
||||||
k_task_t task1_handle;
|
k_task_t task1_handle;
|
||||||
k_task_t task2_handle;
|
k_task_t task2_handle;
|
||||||
k_task_t led_handle;
|
k_task_t led_handle;
|
||||||
|
|
||||||
uint8_t task1_stk[TASK_SIZE];
|
uint8_t task1_stk[TASK_SIZE];
|
||||||
uint8_t task2_stk[TASK_SIZE*8];
|
uint8_t task2_stk[TASK_SIZE*1];
|
||||||
uint8_t led_stk[TASK_SIZE/2];
|
uint8_t led_stk[TASK_SIZE/2];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int share = 0xCBA7F9;
|
|
||||||
k_sem_t sem;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int port;
|
int port;
|
||||||
@@ -43,16 +44,13 @@ void task1(void *arg)
|
|||||||
tos_task_delay(1000);
|
tos_task_delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//extern uint8_t nrf_received_data = 0;
|
|
||||||
extern uint8_t nrf_hal_test_rx();
|
|
||||||
void task2(void *arg)
|
void task2(void *arg)
|
||||||
{
|
{
|
||||||
int task_cnt2 = 0;
|
int task_cnt2 = 0;
|
||||||
|
|
||||||
nrf24l01_init();
|
|
||||||
nrf_hal_test_rx();
|
|
||||||
while (1) {
|
while (1) {
|
||||||
printf("hello world from %s cnt: %08x\n", __func__, task_cnt2--);
|
//printf("hello world from %s cnt: %08x\n", __func__, task_cnt2--);
|
||||||
tos_task_delay(200);
|
tos_task_delay(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,19 +85,16 @@ void task_led(void *arg)
|
|||||||
void main(void) {
|
void main(void) {
|
||||||
board_init();
|
board_init();
|
||||||
|
|
||||||
usart0_init(115200);
|
//usart0_init(115200);
|
||||||
|
|
||||||
tos_knl_init();
|
tos_knl_init();
|
||||||
|
|
||||||
|
|
||||||
//tos_task_create(&task1_handle, "task1", task1, NULL, 2, task1_stk, TASK_SIZE, 0);
|
nrf24l01_init();
|
||||||
tos_task_create(&task2_handle, "task2", task2, NULL, 3, task2_stk, TASK_SIZE*8, 0);
|
|
||||||
//tos_task_create(&led_handle, "led", task_led, NULL, 2, led_stk, TASK_SIZE/2, 0);
|
|
||||||
|
|
||||||
k_err_t err = tos_sem_create(&sem, 1);
|
//tos_task_create(&task1_handle, "task1", task1, NULL, 2, task1_stk, TASK_SIZE, 0);
|
||||||
if (err != K_ERR_NONE) {
|
//tos_task_create(&task2_handle, "task2", task2, NULL, 3, task2_stk, TASK_SIZE*1, 0);
|
||||||
goto die;
|
//tos_task_create(&led_handle, "led", task_led, NULL, 2, led_stk, TASK_SIZE/2, 0);
|
||||||
}
|
|
||||||
|
|
||||||
tos_knl_start();
|
tos_knl_start();
|
||||||
|
|
||||||
|
@@ -1,9 +1,18 @@
|
|||||||
#include "nrf24.h"
|
#include "nrf24.h"
|
||||||
|
#include "tos_k.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int flag = 0;
|
||||||
|
#define TASK_SIZE (8*1024)
|
||||||
|
k_task_t task_nrf24_handle;
|
||||||
|
uint8_t task_nrf24_stk[TASK_SIZE];
|
||||||
|
|
||||||
|
void task_nrf24();
|
||||||
|
|
||||||
void nrf24l01_init() {
|
void nrf24l01_init() {
|
||||||
rcu_periph_clock_enable(RCU_GPIOA);
|
rcu_periph_clock_enable(RCU_GPIOA);
|
||||||
rcu_periph_clock_enable(RCU_GPIOB);
|
rcu_periph_clock_enable(RCU_GPIOB);
|
||||||
//rcu_periph_clock_enable(RCU_AF);
|
rcu_periph_clock_enable(RCU_AF);
|
||||||
rcu_periph_clock_enable(RCU_SPI0);
|
rcu_periph_clock_enable(RCU_SPI0);
|
||||||
#define SPIx SPI0
|
#define SPIx SPI0
|
||||||
|
|
||||||
@@ -19,6 +28,8 @@ void nrf24l01_init() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tos_task_create(&task_nrf24_handle, "task_nrf24", task_nrf24, NULL, 5, task_nrf24_stk, TASK_SIZE, 0);
|
||||||
|
|
||||||
nrf_hal_init_t nhi;
|
nrf_hal_init_t nhi;
|
||||||
nhi.spi = SPIx;
|
nhi.spi = SPIx;
|
||||||
nhi.ce_port = GPIOA;
|
nhi.ce_port = GPIOA;
|
||||||
@@ -49,26 +60,271 @@ void nrf24l01_init() {
|
|||||||
spi_init_struct.endian = SPI_ENDIAN_MSB;
|
spi_init_struct.endian = SPI_ENDIAN_MSB;
|
||||||
spi_init(SPIx, &spi_init_struct);
|
spi_init(SPIx, &spi_init_struct);
|
||||||
|
|
||||||
|
spi_enable(SPIx);
|
||||||
|
|
||||||
|
|
||||||
spi_ti_mode_disable(SPIx); // use motorola mode
|
spi_ti_mode_disable(SPIx); // use motorola mode
|
||||||
spi_crc_off(SPIx);
|
spi_crc_off(SPIx);
|
||||||
spi_crc_polynomial_set(SPIx,7);
|
spi_crc_polynomial_set(SPIx, 7);
|
||||||
|
|
||||||
spi_nssp_mode_enable(SPIx);
|
spi_nssp_mode_enable(SPIx);
|
||||||
//spi_i2s_data_frame_format_config(SPIx, SPI_FRAMESIZE_8BIT);
|
|
||||||
|
|
||||||
|
|
||||||
//spi_i2s_data_frame_format_config(SPIx, SPI_FRAMESIZE_8BIT);
|
|
||||||
//spi_i2s_interrupt_disable(SPIx, SPI_I2S_INT_TBE);
|
|
||||||
//spi_i2s_interrupt_disable(SPIx, SPI_I2S_INT_RBNE);
|
|
||||||
//spi_i2s_interrupt_disable(SPIx, SPI_I2S_INT_ERR);
|
|
||||||
|
|
||||||
|
|
||||||
spi_enable(SPIx);
|
|
||||||
|
|
||||||
|
|
||||||
nrf_init(&nhi);
|
nrf_init(&nhi);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EXTI0_IRQHandler(void)
|
||||||
|
{
|
||||||
|
if (tos_knl_is_running()) {
|
||||||
|
tos_knl_irq_enter();
|
||||||
|
|
||||||
|
if (RESET != exti_interrupt_flag_get(GPIO_PIN_0)){
|
||||||
|
|
||||||
|
exti_interrupt_flag_clear(GPIO_PIN_0);
|
||||||
|
|
||||||
|
uint8_t status = 0;
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
|
||||||
|
if(status & _BV(RX_DR)) {
|
||||||
|
flag = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tos_knl_irq_leave();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ADDRLEN 5
|
||||||
|
void print_rxaddr(uint8_t pipe) {
|
||||||
|
uint8_t addr[ADDRLEN];
|
||||||
|
|
||||||
|
uint8_t addrlen = ADDRLEN;
|
||||||
|
nrf_get_rxaddr(pipe, addr, &addrlen);
|
||||||
|
|
||||||
|
printf("pipe %u addr: ", pipe);
|
||||||
|
for(int i=0; i<ADDRLEN; i++) {
|
||||||
|
printf("%u ", addr[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void task_nrf24() {
|
||||||
|
|
||||||
|
if(1)
|
||||||
|
{
|
||||||
|
// nrf24 irq pin
|
||||||
|
gpio_init(GPIOB, GPIO_MODE_IPU, GPIO_OSPEED_50MHZ, GPIO_PIN_0);
|
||||||
|
gpio_bit_set(GPIOB, GPIO_PIN_0);
|
||||||
|
|
||||||
|
eclic_global_interrupt_enable();
|
||||||
|
eclic_priority_group_set(ECLIC_PRIGROUP_LEVEL3_PRIO1);
|
||||||
|
eclic_irq_enable(EXTI0_IRQn, 1, 1);
|
||||||
|
|
||||||
|
/* connect EXTI line to GPIO pin */
|
||||||
|
gpio_exti_source_select(GPIO_PORT_SOURCE_GPIOB, GPIO_PIN_SOURCE_0);
|
||||||
|
|
||||||
|
exti_init(EXTI_0, EXTI_INTERRUPT, EXTI_TRIG_FALLING);
|
||||||
|
exti_interrupt_flag_clear(EXTI_0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t data = 0;
|
||||||
|
|
||||||
|
nrf_delay(200);
|
||||||
|
|
||||||
|
nrf_hal_csn(1);
|
||||||
|
nrf_hal_ce(0);
|
||||||
|
|
||||||
|
nrf_delay(200);
|
||||||
|
|
||||||
|
nrf_set_standby_mode();
|
||||||
|
|
||||||
|
nrf_set_receive_mode();
|
||||||
|
nrf_enable_rx_irq();
|
||||||
|
|
||||||
|
nrf_set_rf_channel(64);
|
||||||
|
nrf_set_datarate(NRF_2Mbps);
|
||||||
|
uint8_t rxaddr[ADDRLEN] = { 0xAA, 0xCC, 0xEE, 0x00, 0x00 };
|
||||||
|
nrf_set_rxaddr(0, rxaddr, ADDRLEN);
|
||||||
|
|
||||||
|
nrf_enable_dynamic_payload(0);
|
||||||
|
nrf_enable_dynamic_payload(1);
|
||||||
|
|
||||||
|
nrf_enable_rxaddr(0);
|
||||||
|
nrf_enable_rxaddr(1);
|
||||||
|
|
||||||
|
print_rxaddr(0);
|
||||||
|
print_rxaddr(1);
|
||||||
|
print_rxaddr(2);
|
||||||
|
|
||||||
|
|
||||||
|
nrf_flush_rx();
|
||||||
|
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
while(flag == 0) {
|
||||||
|
nrf_delay(1);
|
||||||
|
}
|
||||||
|
flag = 0;
|
||||||
|
|
||||||
|
uint8_t buf[32];
|
||||||
|
uint8_t len = 0;
|
||||||
|
uint8_t status = 0;
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
|
||||||
|
if((status & _BV(RX_DR)) == 0) {
|
||||||
|
printf("nodata %x\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t pipe = ((status>>1) & 0x07);
|
||||||
|
nrf_read_payload(buf, &len);
|
||||||
|
|
||||||
|
nrf_hal_set_reg_bit(REG_STATUS, _BV(RX_DR));
|
||||||
|
|
||||||
|
nrf_flush_rx();
|
||||||
|
|
||||||
|
printf("received %u bytes from pipe %u: ", len, pipe);
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=0; i<len; i++) {
|
||||||
|
printf("%x ", buf[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t nrf_hal_test_rx_old() {
|
||||||
|
|
||||||
|
uint8_t data = 0;
|
||||||
|
|
||||||
|
nrf_delay(200);
|
||||||
|
|
||||||
|
nrf_hal_csn(1);
|
||||||
|
nrf_hal_ce(0);
|
||||||
|
|
||||||
|
nrf_delay(200);
|
||||||
|
|
||||||
|
nrf_set_standby_mode();
|
||||||
|
|
||||||
|
nrf_set_receive_mode();
|
||||||
|
nrf_disable_rx_irq();
|
||||||
|
|
||||||
|
nrf_set_rf_channel(64);
|
||||||
|
nrf_set_datarate(NRF_2Mbps);
|
||||||
|
uint8_t rxaddr[ADDRLEN] = { 0xAA, 0xCC, 0xEE, 0x00, 0x00 };
|
||||||
|
nrf_set_rxaddr(0, rxaddr, ADDRLEN);
|
||||||
|
|
||||||
|
nrf_enable_dynamic_payload(0);
|
||||||
|
nrf_enable_dynamic_payload(1);
|
||||||
|
|
||||||
|
nrf_enable_rxaddr(0);
|
||||||
|
nrf_enable_rxaddr(1);
|
||||||
|
|
||||||
|
print_rxaddr(0);
|
||||||
|
print_rxaddr(1);
|
||||||
|
print_rxaddr(2);
|
||||||
|
|
||||||
|
|
||||||
|
nrf_flush_rx();
|
||||||
|
while(1) {
|
||||||
|
uint8_t buf[32];
|
||||||
|
uint8_t len = 0;
|
||||||
|
uint8_t status = 0;
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
|
||||||
|
if((status & _BV(RX_DR)) == 0) {
|
||||||
|
printf("nodata %x\n", status);
|
||||||
|
nrf_delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t pipe = 0xFF;
|
||||||
|
uint32_t loop_cnt = 0;
|
||||||
|
while(1) {
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
pipe = status;
|
||||||
|
pipe >>= 1;
|
||||||
|
pipe &= 0x07;
|
||||||
|
if(pipe < 6) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
nrf_delay(1);
|
||||||
|
loop_cnt++;
|
||||||
|
}
|
||||||
|
nrf_read_payload(buf, &len);
|
||||||
|
|
||||||
|
if(loop_cnt > 0) {
|
||||||
|
printf("loopcnt %u\n", loop_cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
nrf_hal_set_reg_bit(REG_STATUS, _BV(RX_DR));
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
|
||||||
|
nrf_flush_rx();
|
||||||
|
|
||||||
|
printf("received %u bytes from pipe %u: ", len, pipe);
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=0; i<len; i++) {
|
||||||
|
printf("%x ", buf[i]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t nrf_hal_test_tx() {
|
||||||
|
|
||||||
|
uint8_t data = 0;
|
||||||
|
|
||||||
|
nrf_delay(200);
|
||||||
|
nrf_hal_csn(1);
|
||||||
|
nrf_hal_ce(0);
|
||||||
|
nrf_delay(200);
|
||||||
|
|
||||||
|
nrf_set_standby_mode();
|
||||||
|
nrf_set_send_mode();
|
||||||
|
|
||||||
|
nrf_set_rf_channel(100);
|
||||||
|
nrf_set_datarate(NRF_2Mbps);
|
||||||
|
|
||||||
|
nrf_enable_dynamic_payload(0);
|
||||||
|
uint8_t txaddr[] = { 1, 2, 3, 4, 0 };
|
||||||
|
nrf_set_txaddr(txaddr, 5);
|
||||||
|
|
||||||
|
nrf_flush_rx();
|
||||||
|
nrf_flush_tx();
|
||||||
|
uint32_t cnt = 0;
|
||||||
|
while(1) {
|
||||||
|
nrf_flush_rx();
|
||||||
|
nrf_flush_tx();
|
||||||
|
uint8_t buf[] = {0x0A, 0x0C, 0x0E, cnt++ };
|
||||||
|
nrf_write_payload(buf, sizeof(buf));
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
uint8_t status = 0;
|
||||||
|
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
||||||
|
|
||||||
|
printf("status %x\n", status);
|
||||||
|
if(status & _BV(MAX_RT)) {
|
||||||
|
printf("send error....\n");
|
||||||
|
nrf_hal_set_reg_bit(REG_STATUS, _BV(MAX_RT));
|
||||||
|
nrf_flush_tx();
|
||||||
|
break;
|
||||||
|
}else if(status & _BV(TX_DS)) {
|
||||||
|
printf("sended....\n");
|
||||||
|
nrf_hal_set_reg_bit(REG_STATUS, _BV(TX_DS));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
printf("sending....\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nrf_delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
@@ -72,6 +72,46 @@ int nrf_set_rxaddr(uint8_t pipe, uint8_t *addr, uint8_t addrlen) {
|
|||||||
return nrf_hal_write_reg(reg, addr, addrlen);
|
return nrf_hal_write_reg(reg, addr, addrlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nrf_get_addrlen() {
|
||||||
|
uint8_t v = 0;
|
||||||
|
uint8_t addrlen = 0;
|
||||||
|
if(0 != nrf_hal_read_reg_byte(REG_SETUP_AW, v)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
v &= 0x03;
|
||||||
|
|
||||||
|
switch(v) {
|
||||||
|
case AW_3BYTES:
|
||||||
|
addrlen = 3;
|
||||||
|
break;
|
||||||
|
case AW_4BYTES:
|
||||||
|
addrlen = 4;
|
||||||
|
break;
|
||||||
|
case AW_5BYTES:
|
||||||
|
addrlen = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return addrlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nrf_get_rxaddr(uint8_t pipe, uint8_t *addr, uint8_t *addrlen) {
|
||||||
|
|
||||||
|
*addrlen = nrf_get_addrlen();
|
||||||
|
|
||||||
|
uint8_t reg = REG_RX_ADDR_P0 + pipe;
|
||||||
|
|
||||||
|
return nrf_hal_read_reg(reg, addr, *addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nrf_get_txaddr(uint8_t *addr, uint8_t *addrlen) {
|
||||||
|
*addrlen = nrf_get_addrlen();
|
||||||
|
return nrf_hal_read_reg(REG_TX_ADDR, addr, *addrlen);
|
||||||
|
}
|
||||||
|
|
||||||
int nrf_set_txaddr(uint8_t *addr, uint8_t addrlen) {
|
int nrf_set_txaddr(uint8_t *addr, uint8_t addrlen) {
|
||||||
if(addrlen >= 6) {
|
if(addrlen >= 6) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -224,152 +264,3 @@ int nrf_read_payload(uint8_t *buf, uint8_t *len) {
|
|||||||
int nrf_write_payload(uint8_t *buf, uint8_t len) {
|
int nrf_write_payload(uint8_t *buf, uint8_t len) {
|
||||||
return nrf_hal_cmd_write(CMD_W_TX_PAYLOAD_NOACK, buf, len);
|
return nrf_hal_cmd_write(CMD_W_TX_PAYLOAD_NOACK, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_addr(uint8_t pipe) {
|
|
||||||
uint8_t addr[5];
|
|
||||||
nrf_hal_read_reg(REG_RX_ADDR_P0+pipe, addr, 5);
|
|
||||||
|
|
||||||
printf("pipe %u addr: ", pipe);
|
|
||||||
for(int i=0; i<5; i++) {
|
|
||||||
printf("%u ", addr[i]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nrf_received_data = 0;
|
|
||||||
uint8_t nrf_hal_test_rx() {
|
|
||||||
|
|
||||||
uint8_t data = 0;
|
|
||||||
|
|
||||||
nrf_delay(200);
|
|
||||||
|
|
||||||
nrf_hal_csn(1);
|
|
||||||
nrf_hal_ce(0);
|
|
||||||
|
|
||||||
nrf_delay(200);
|
|
||||||
#if 0
|
|
||||||
while(1) {
|
|
||||||
nrf_hal_write_reg_byte(REG_CONFIG, _BV(EN_CRC) | _BV(CRCO));
|
|
||||||
nrf_hal_read_reg_byte(REG_CONFIG, &data);
|
|
||||||
nrf_delay(100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
nrf_set_standby_mode();
|
|
||||||
|
|
||||||
nrf_set_receive_mode();
|
|
||||||
nrf_disable_rx_irq();
|
|
||||||
|
|
||||||
nrf_set_rf_channel(64);
|
|
||||||
nrf_set_datarate(NRF_2Mbps);
|
|
||||||
uint8_t rxaddr[] = { 1, 2, 3, 4, 1 };
|
|
||||||
uint8_t txaddr[] = { 1, 2, 3, 4, 2 };
|
|
||||||
nrf_set_rxaddr(0, rxaddr, 5);
|
|
||||||
nrf_set_txaddr(txaddr, 5);
|
|
||||||
|
|
||||||
nrf_enable_dynamic_payload(0);
|
|
||||||
nrf_enable_dynamic_payload(1);
|
|
||||||
|
|
||||||
nrf_enable_rxaddr(0);
|
|
||||||
nrf_enable_rxaddr(1);
|
|
||||||
|
|
||||||
print_addr(0);
|
|
||||||
print_addr(1);
|
|
||||||
print_addr(2);
|
|
||||||
|
|
||||||
|
|
||||||
nrf_flush_rx();
|
|
||||||
while(1) {
|
|
||||||
uint8_t buf[32];
|
|
||||||
uint8_t len = 0;
|
|
||||||
uint8_t status = 0;
|
|
||||||
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
|
||||||
nrf_read_payload(buf, &len);
|
|
||||||
|
|
||||||
if(status & _BV(RX_DR)) {
|
|
||||||
nrf_hal_set_reg_bit(REG_STATUS, _BV(RX_DR));
|
|
||||||
nrf_flush_rx();
|
|
||||||
|
|
||||||
if(len > 0) {
|
|
||||||
uint8_t pipe = status;
|
|
||||||
pipe >>= 1;
|
|
||||||
pipe &= 0x07;
|
|
||||||
printf("received %u bytes from pipe %u: ", len, pipe);
|
|
||||||
if(pipe >= 6) {
|
|
||||||
printf("\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for(int i=0; i<len; i++) {
|
|
||||||
printf("%x ", buf[i]);
|
|
||||||
}
|
|
||||||
nrf_received_data = 1;
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
printf("nodata %x\n", status);
|
|
||||||
nrf_delay(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nrf_hal_test_tx() {
|
|
||||||
|
|
||||||
uint8_t data = 0;
|
|
||||||
|
|
||||||
nrf_delay(200);
|
|
||||||
nrf_hal_csn(1);
|
|
||||||
nrf_hal_ce(0);
|
|
||||||
nrf_delay(200);
|
|
||||||
|
|
||||||
nrf_set_standby_mode();
|
|
||||||
nrf_set_send_mode();
|
|
||||||
|
|
||||||
nrf_set_rf_channel(100);
|
|
||||||
nrf_set_datarate(NRF_2Mbps);
|
|
||||||
|
|
||||||
nrf_enable_dynamic_payload(0);
|
|
||||||
uint8_t txaddr[] = { 1, 2, 3, 4, 0 };
|
|
||||||
nrf_set_txaddr(txaddr, 5);
|
|
||||||
|
|
||||||
nrf_flush_rx();
|
|
||||||
nrf_flush_tx();
|
|
||||||
uint32_t cnt = 0;
|
|
||||||
while(1) {
|
|
||||||
nrf_flush_rx();
|
|
||||||
nrf_flush_tx();
|
|
||||||
uint8_t buf[] = {0x0A, 0x0C, 0x0E, cnt++ };
|
|
||||||
nrf_write_payload(buf, sizeof(buf));
|
|
||||||
|
|
||||||
while(1) {
|
|
||||||
uint8_t status = 0;
|
|
||||||
nrf_hal_read_reg_byte(REG_STATUS, &status);
|
|
||||||
|
|
||||||
printf("status %x\n", status);
|
|
||||||
if(status & _BV(MAX_RT)) {
|
|
||||||
printf("send error....\n");
|
|
||||||
nrf_hal_set_reg_bit(REG_STATUS, _BV(MAX_RT));
|
|
||||||
nrf_flush_tx();
|
|
||||||
break;
|
|
||||||
}else if(status & _BV(TX_DS)) {
|
|
||||||
printf("sended....\n");
|
|
||||||
nrf_hal_set_reg_bit(REG_STATUS, _BV(TX_DS));
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
printf("sending....\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
nrf_delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t nrf_hal_test() {
|
|
||||||
//return nrf_hal_test_rx();
|
|
||||||
return nrf_hal_test_tx();
|
|
||||||
}
|
|
||||||
|
@@ -281,11 +281,62 @@ typedef struct {
|
|||||||
#define _BV(n) (1<<(n))
|
#define _BV(n) (1<<(n))
|
||||||
#define _VV(v, n) ((v)<<(n))
|
#define _VV(v, n) ((v)<<(n))
|
||||||
|
|
||||||
int nrf_powerup();
|
|
||||||
|
|
||||||
int nrf_init(void* ni);
|
int nrf_init(void* ni);
|
||||||
|
|
||||||
uint8_t nrf_hal_test();
|
void nrf_flush_rx();
|
||||||
|
|
||||||
|
void nrf_flush_tx();
|
||||||
|
|
||||||
|
void nrf_delay(uint32_t delay);
|
||||||
|
|
||||||
|
int nrf_powerup();
|
||||||
|
|
||||||
|
int nrf_powerdown();
|
||||||
|
|
||||||
|
void nrf_enable_rx_irq();
|
||||||
|
|
||||||
|
void nrf_disable_rx_irq();
|
||||||
|
|
||||||
|
void nrf_enable_tx_irq();
|
||||||
|
|
||||||
|
void nrf_disable_tx_irq();
|
||||||
|
|
||||||
|
void nrf_enable_max_rt_irq();
|
||||||
|
|
||||||
|
void nrf_disable_max_rt_irq();
|
||||||
|
|
||||||
|
void nrf_set_rf_channel(uint8_t channel);
|
||||||
|
|
||||||
|
int nrf_set_rxaddr(uint8_t pipe, uint8_t *addr, uint8_t addrlen);
|
||||||
|
|
||||||
|
int nrf_get_rxaddr(uint8_t pipe, uint8_t *addr, uint8_t *addrlen);
|
||||||
|
|
||||||
|
int nrf_set_txaddr(uint8_t *addr, uint8_t addrlen);
|
||||||
|
|
||||||
|
int nrf_get_txaddr(uint8_t *addr, uint8_t *addrlen);
|
||||||
|
|
||||||
|
int nrf_enable_rxaddr(uint8_t pipe);
|
||||||
|
|
||||||
|
void nrf_reset_registers();
|
||||||
|
|
||||||
|
void nrf_set_standby_mode();
|
||||||
|
|
||||||
|
void nrf_set_receive_mode();
|
||||||
|
|
||||||
|
void nrf_set_send_mode();
|
||||||
|
|
||||||
|
void nrf_enable_autoack(uint8_t pipe);
|
||||||
|
|
||||||
|
void nrf_disable_autoack(uint8_t pipe);
|
||||||
|
|
||||||
|
void nrf_set_datarate(uint8_t dr);
|
||||||
|
|
||||||
|
int nrf_enable_dynamic_payload(uint8_t pipe);
|
||||||
|
|
||||||
|
int nrf_read_payload(uint8_t *buf, uint8_t *len);
|
||||||
|
|
||||||
|
int nrf_write_payload(uint8_t *buf, uint8_t len);
|
||||||
|
|
||||||
|
|
||||||
#endif /* NRF24L01_H_ */
|
#endif /* NRF24L01_H_ */
|
||||||
|
Reference in New Issue
Block a user