ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Пятница
29 марта
659631 Топик полностью
garry_ (12.03.2016 18:52, просмотров: 179) ответил IBAH на Нашел у STM AN UM0424, там что написано про 12 digits...
там так сделали  /******************************************************************************* * Function Name : Get_SerialNum. * Description : Create the serial number string descriptor. * Input : None. * Output : None. * Return : None. *******************************************************************************/ void Get_SerialNum(void) { uint32_t Device_Serial0, Device_Serial1, Device_Serial2; Device_Serial0 = *(uint32_t*)ID1; Device_Serial1 = *(uint32_t*)ID2; Device_Serial2 = *(uint32_t*)ID3; Device_Serial0 += Device_Serial2; if (Device_Serial0 != 0) { IntToUnicode (Device_Serial0, &CustomHID_StringSerial[2] , 8); IntToUnicode (Device_Serial1, &CustomHID_StringSerial[18], 4); } } /******************************************************************************* * Function Name : HexToChar. * Description : Convert Hex 32Bits value into char. * Input : None. * Output : None. * Return : None. *******************************************************************************/ static void IntToUnicode (uint32_t value , uint8_t *pbuf , uint8_t len) { uint8_t idx = 0; for( idx = 0 ; idx < len ; idx ++) { if( ((value >> 28)) < 0xA ) { pbuf[ 2* idx] = (value >> 28) + '0'; } else { pbuf[2* idx] = (value >> 28) + 'A' - 10; } value = value << 4; pbuf[ 2* idx + 1] = 0; } }