• Main Page
  • Modules
  • Index
  • File List
  • Globals

lib/crypt/lib_crypt_lu1.c

Go to the documentation of this file.
00001 /* Copyright (c) 2009 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is confidential property of Nordic 
00004  * Semiconductor ASA.Terms and conditions of usage are described in detail 
00005  * in NORDIC SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  *              
00011  * $LastChangedRevision: 133 $
00012  */
00013 
00018 #include <stdint.h>
00019 #include <stdbool.h>
00020 #include "nrf24lu1p.h"
00021 
00022 void lib_crypt_generate_ls5b(uint8_t * dest_buf)
00023 {
00024   uint8_t i;
00025   bool wrap = true;
00026   static xdata uint8_t ls5b[5] = {0, 0, 0, 0, 0};
00027   
00028   //Increment LS5B, and write back the new LS5B.
00029   for(i=0;i<5;i++)
00030     {       
00031         if(wrap)  //Check if we need to increment position i.
00032         {
00033           ls5b[i]++;
00034       if(ls5b[i] != 0x00) wrap = false; 
00035         }
00036 
00037     //Write out LS5B
00038     dest_buf[i] = ls5b[i]; 
00039     } 
00040 }

Generated on Fri Apr 20 2012 14:11:45 for nRFGo SDK by  doxygen 1.7.2