File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -892,4 +892,21 @@ bool Arduino_AlvikCarrier::isLifted(){
892892 else {
893893 return false ;
894894 }
895+ }
896+
897+
898+
899+ /* *****************************************************************************************************/
900+ /* Utilities */
901+ /* *****************************************************************************************************/
902+
903+ void Arduino_AlvikCarrier::getSerialNumber (char * sn){
904+ uint32_t id[3 ];
905+ id[0 ] = HAL_GetUIDw0 ();
906+ id[1 ] = HAL_GetUIDw1 ();
907+ id[2 ] = HAL_GetUIDw2 ();
908+ uint32_t top = id[0 ]+id[2 ];
909+ uint16_t bottom = (id[1 ]&0xFFFF0000 )>>16 ;
910+ sprintf (sn," %08lx" , top);
911+ sprintf (sn+8 ," %x" ,bottom);
895912}
Original file line number Diff line number Diff line change @@ -249,6 +249,11 @@ class Arduino_AlvikCarrier{
249249 void updateBehaviours ();
250250 void setBehaviour (const uint8_t behaviour, const bool enable);
251251 bool isLifted ();
252+
253+
254+ // Utilities
255+ void getSerialNumber (char * sn); // get STM32 serial number
256+
252257};
253258
254259#endif
You can’t perform that action at this time.
0 commit comments