/****************************************************************************** * @brief Create the serial number string descriptor. */ void Get_SerialNum(void) { uint32_t Device_Serial0, Device_Serial1; Device_Serial0 = *(uint32_t *)MCU_ID1 + *(uint32_t *)MCU_ID3; Device_Serial1 = *(uint32_t *)MCU_ID2; if (Device_Serial0 != 0) { IntToUnicode (Device_Serial0, &CDC_StringSerial[2] , 8); IntToUnicode (Device_Serial1, &CDC_StringSerial[18], 4); } }
void Device_Init(void) { /* Update iSerial with MCU unique ID */ IntToUnicode(*(__IO uint32_t*)(0x1FFFF7E8), &StringSerial[ 2]); IntToUnicode(*(__IO uint32_t*)(0x1FFFF7EC), &StringSerial[10]); IntToUnicode(*(__IO uint32_t*)(0x1FFFF7F0), &StringSerial[18]); pInformation->Current_Configuration = 0; /* Connect the device */ _SetCNTR(CNTR_FRES); wInterrupt_Mask = 0; _SetCNTR(wInterrupt_Mask); _SetISTR(0); wInterrupt_Mask = CNTR_RESETM | CNTR_SUSPM | CNTR_WKUPM; _SetCNTR(wInterrupt_Mask); /* Perform basic device initialization operations */ _SetISTR(0); wInterrupt_Mask = CNTR_CTRM | CNTR_SOFM | CNTR_RESETM; _SetCNTR(wInterrupt_Mask); /* Device unconnected */ led_off(); }