Skip to content

Commit

Permalink
Added Raspberry Pi 4 1GB 2GB and 4GB to the list of detected platforms
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Duey <cduey@msn.com>
  • Loading branch information
Chuckduey authored and Propanu committed Jan 10, 2020
1 parent bb736e7 commit f58cdc9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/arm/raspberry_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern "C" {
#define MRAA_RASPBERRY_PI_ZERO_W_PINCOUNT 41
#define MRAA_RASPBERRY_PI3_B_PLUS_PINCOUNT 41
#define MRAA_RASPBERRY_PI3_A_PLUS_PINCOUNT 41
#define MRAA_RASPBERRY_PI4_B_PINCOUNT 41

mraa_board_t *
mraa_raspberry_pi();
Expand Down
16 changes: 15 additions & 1 deletion src/arm/raspberry_pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define PLATFORM_NAME_RASPBERRY_PI_ZERO_W "Raspberry Pi Zero W"
#define PLATFORM_NAME_RASPBERRY_PI3_B_PLUS "Raspberry Pi 3 Model B+"
#define PLATFORM_NAME_RASPBERRY_PI3_A_PLUS "Raspberry Pi 3 Model A+"
#define PLATFORM_NAME_RASPBERRY_PI4_B "Raspberry Pi 4 Model B"
#define PLATFORM_RASPBERRY_PI_B_REV_1 1
#define PLATFORM_RASPBERRY_PI_A_REV_2 2
#define PLATFORM_RASPBERRY_PI_B_REV_2 3
Expand All @@ -40,6 +41,7 @@
#define PLATFORM_RASPBERRY_PI_ZERO_W 10
#define PLATFORM_RASPBERRY_PI3_B_PLUS 11
#define PLATFORM_RASPBERRY_PI3_A_PLUS 12
#define PLATFORM_RASPBERRY_PI4_B 13
#define MMAP_PATH "/dev/mem"
#define BCM2835_PERI_BASE 0x20000000
#define BCM2836_PERI_BASE 0x3f000000
Expand Down Expand Up @@ -502,6 +504,13 @@ mraa_raspberry_pi()
b->phy_pin_count = MRAA_RASPBERRY_PI3_A_PLUS_PINCOUNT;
peripheral_base = BCM2837_PERI_BASE;
block_size = BCM2837_BLOCK_SIZE;
} else if (strstr(line, "a03111") || strstr(line, "b03111") ||
strstr(line, "c03111")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI4_B;
platform_detected = PLATFORM_RASPBERRY_PI4_B;
b->phy_pin_count = MRAA_RASPBERRY_PI4_B_PINCOUNT;
peripheral_base = BCM2837_PERI_BASE;
block_size = BCM2837_BLOCK_SIZE;
} else {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_1;
platform_detected = PLATFORM_RASPBERRY_PI_B_REV_1;
Expand Down Expand Up @@ -572,6 +581,10 @@ mraa_raspberry_pi()
b->platform_name = PLATFORM_NAME_RASPBERRY_PI3_A_PLUS;
platform_detected = PLATFORM_RASPBERRY_PI3_A_PLUS;
b->phy_pin_count = MRAA_RASPBERRY_PI3_A_PLUS_PINCOUNT;
} else if (mraa_file_contains(compatible_path, "raspberrypi,4-model-b")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI4_B;
platform_detected = PLATFORM_RASPBERRY_PI4_B;
b->phy_pin_count = MRAA_RASPBERRY_PI4_B_PINCOUNT;
}
}

Expand Down Expand Up @@ -840,7 +853,8 @@ mraa_raspberry_pi()
(platform_detected == PLATFORM_RASPBERRY_PI_ZERO) ||
(platform_detected == PLATFORM_RASPBERRY_PI_ZERO_W) ||
(platform_detected == PLATFORM_RASPBERRY_PI3_B_PLUS) ||
(platform_detected == PLATFORM_RASPBERRY_PI3_A_PLUS)) {
(platform_detected == PLATFORM_RASPBERRY_PI3_A_PLUS) ||
(platform_detected == PLATFORM_RASPBERRY_PI4_B)) {

strncpy(b->pins[27].name, "ID_SD", MRAA_PIN_NAME_SIZE);
b->pins[27].capabilities = (mraa_pincapabilities_t){ 1, 0, 0, 0, 0, 0, 0, 0 };
Expand Down

0 comments on commit f58cdc9

Please sign in to comment.