Переглянути джерело
Add piMemorySize for rpi4
#include <stdio.h>
int main()
{
int bRev, bType, bProc, bMfg, bMem, bWarranty ;
int revision = 12595474; //Convert hexadecimal to decimal
bRev = (revision & (0x0F << 0)) >> 0 ;
bType = (revision & (0xFF << 4)) >> 4 ;
bProc = (revision & (0x0F << 12)) >> 12 ; // Not used for now.
bMfg = (revision & (0x0F << 16)) >> 16 ;
bMem = (revision & (0x07 << 20)) >> 20 ;
bWarranty = (revision & (0x03 << 24)) != 0 ;
printf ("piBoardId: rev: %d, type: %d, proc: %d, mfg: %d, mem: %d, warranty: %d\n",
bRev, bType, bProc, bMfg, bMem, bWarranty) ;
return 0;
}
/* revision see https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
*RPI revision is HEX.*\
pull/75/head