Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /** 00002 * Copyright (c) 2011 Ibrahim Abd Elkader 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy 00004 * of this software and associated documentation files (the "Software"), to deal 00005 * in the Software without restriction, including without limitation the rights 00006 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00007 * copies of the Software, and to permit persons to whom the Software is 00008 * furnished to do so, subject to the following conditions: 00009 * 00010 * The above copyright notice and this permission notice shall be included in 00011 * all copies or substantial portions of the Software. 00012 * 00013 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00014 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00015 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00016 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00017 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00018 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00019 * THE SOFTWARE. 00020 * 00021 * Program Nordic nRF24LU1+ chips using SPI. 00022 * Instructions: 00023 * 1)convert the ihx to binary using objcopy like this: 00024 * objcopy --gap-fill 255 -Iihex -O binary nrf.ihx nrf.bin 00025 * 2)copy nrf.bin to MBED flash 00026 * 3)copy nrflash to MBED flash 00027 * 4)reset the MBED 00028 **/ 00029 #include <nrflash.h> 00030 NRFlash nrflash(p11, p12, p13, p14, p15, p16); //mosi, miso, sck, ssel, prog, reset 00031 LocalFileSystem local("local"); 00032 00033 int main() 00034 { 00035 nrflash.enable_programming(); 00036 00037 printf("FSR: %d\n", nrflash.read_fsr()); 00038 printf("erasing flash...\n"); 00039 nrflash.erase_flash(); 00040 00041 printf("flashing...\n"); 00042 nrflash.write_flash("/local/nrf.bin"); 00043 00044 printf("saving flash...\n"); 00045 nrflash.read_flash("/local/flash.bin"); 00046 printf("all done...\n"); 00047 00048 nrflash.disable_programming(); 00049 nrflash.reset(); 00050 00051 return 0; 00052 }
Generated on Fri Jul 15 2022 01:39:19 by
1.7.2