Browse Source

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
FindWaySociety-ykla 4 years ago
committed by GitHub
parent
commit
7d8188d0bf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      wiringPi/wiringPi.c

+ 2
- 2
wiringPi/wiringPi.c View File

@@ -288,8 +288,8 @@ const int piMemorySize [8] =
256, // 0
512, // 1
1024, // 2
0, // 3
0, // 4
2048, // 3
4096, // 4
0, // 5
0, // 6
0, // 7


Loading…
Cancel
Save