Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/arm/raspberry_pi.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern "C" {
#define MRAA_RASPBERRY_PI_ZERO_PINCOUNT 41
#define MRAA_RASPBERRY_PI3_B_PINCOUNT 41
#define MRAA_RASPBERRY_PI_ZERO_W_PINCOUNT 41
#define MRAA_RASPBERRY_PI_ZERO_2W_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
Expand Down
13 changes: 12 additions & 1 deletion src/arm/raspberry_pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define PLATFORM_NAME_RASPBERRY_PI4_B "Raspberry Pi 4 Model B"
#define PLATFORM_NAME_RASPBERRY_PI_400 "Raspberry Pi 400"
#define PLATFORM_NAME_RASPBERRY_PI5_B "Raspberry Pi 5 Model B"
#define PLATFORM_NAME_RASPBERRY_PI_ZERO_2W "Raspberry Pi Zero 2W"
#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 @@ -46,6 +47,7 @@
#define PLATFORM_RASPBERRY_PI4_B 13
#define PLATFORM_RASPBERRY_PI_400 14
#define PLATFORM_RASPBERRY_PI5_B 15
#define PLATFORM_RASPBERRY_PI_ZERO_2W 16
#define MMAP_PATH "/dev/mem"
#define BCM2835_PERI_BASE 0x20000000
#define BCM2836_PERI_BASE 0x3f000000
Expand Down Expand Up @@ -532,6 +534,10 @@ mraa_raspberry_pi()
b->phy_pin_count = MRAA_RASPBERRY_PI5_B_PINCOUNT;
peripheral_base = BCM2837_PERI_BASE;
block_size = BCM2837_BLOCK_SIZE;
} else if (strstr(line, "902120")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_ZERO_2W;
platform_detected = PLATFORM_RASPBERRY_PI_ZERO_2W;
b->phy_pin_count = MRAA_RASPBERRY_PI_ZERO_2W_PINCOUNT;
} else {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_B_REV_1;
platform_detected = PLATFORM_RASPBERRY_PI_B_REV_1;
Expand Down Expand Up @@ -614,6 +620,10 @@ mraa_raspberry_pi()
b->platform_name = PLATFORM_NAME_RASPBERRY_PI5_B;
platform_detected = PLATFORM_RASPBERRY_PI5_B;
b->phy_pin_count = MRAA_RASPBERRY_PI5_B_PINCOUNT;
} else if (mraa_file_contains(compatible_path, "raspberrypi,model-zero-2w")) {
b->platform_name = PLATFORM_NAME_RASPBERRY_PI_ZERO_2W;
platform_detected = PLATFORM_RASPBERRY_PI_ZERO_2W;
b->phy_pin_count = MRAA_RASPBERRY_PI_ZERO_2W_PINCOUNT;
}
}

Expand Down Expand Up @@ -885,7 +895,8 @@ mraa_raspberry_pi()
(platform_detected == PLATFORM_RASPBERRY_PI3_A_PLUS) ||
(platform_detected == PLATFORM_RASPBERRY_PI4_B) ||
(platform_detected == PLATFORM_RASPBERRY_PI_400) ||
(platform_detected == PLATFORM_RASPBERRY_PI5_B) ) {
(platform_detected == PLATFORM_RASPBERRY_PI5_B) ||
(platform_detected == PLATFORM_RASPBERRY_PI_ZERO_2W) ) {

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