This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NyLPC_cUuid.c Source File

NyLPC_cUuid.c

00001 #include <stdlib.h>
00002 #include "NyLPC_cUuid.h"
00003 
00004 void NyLPC_cUuid_initialize(NyLPC_TcUuid_t* i_inst)
00005 {
00006 }
00007 #define NyLPC_cUuid_finalize(i_inst)
00008 
00009 void NyLPC_cUuid_setTimeBase(NyLPC_TcUuid_t* i_inst,NyLPC_TUInt32 i_time_l,NyLPC_TUInt32 i_time_h,NyLPC_TUInt16 i_seq,struct NyLPC_TEthAddr* eth_mac)
00010 {
00011     i_inst->f1=i_time_l;
00012     i_inst->f2=(NyLPC_TUInt16)(i_time_h & 0x0000ffff);
00013     i_inst->f3=(NyLPC_TUInt16)(((i_time_h & 0x0fff0000)>>16)|0x1000);
00014     i_inst->f4=(NyLPC_TUInt8)((0x3f&(i_seq>>8))|0x80);
00015     i_inst->f5=(NyLPC_TUInt8)(0xff&(i_seq>>0));
00016     memcpy(i_inst->f6,eth_mac->addr,8);
00017 }
00018 
00019 
00020 void NyLPC_cUuid_toString(NyLPC_TcUuid_t* i_inst,NyLPC_TChar* i_buf)
00021 {
00022     NyLPC_TChar* p=i_buf;
00023     NyLPC_TInt16 i;
00024     NyLPC_uitoa2(i_inst->f1,p,16,8);p+=8;
00025     *p='-';p++;
00026     NyLPC_uitoa2(i_inst->f2,p,16,4);p+=4;
00027     *p='-';p++;
00028     NyLPC_uitoa2(i_inst->f3,p,16,4);p+=4;
00029     *p='-';p++;
00030     NyLPC_uitoa2(i_inst->f4,p,16,2);p+=2;
00031     NyLPC_uitoa2(i_inst->f5,p,16,2);p+=2;
00032     *p='-';p++;
00033     for(i=0;i<6;i++){
00034         NyLPC_uitoa2(i_inst->f6[i],p,16,2);p+=2;
00035     }
00036     *p='\0';
00037 }