Skip to content

Commit

Permalink
Extended use of List.of instead of Collections
Browse files Browse the repository at this point in the history
  • Loading branch information
FDelporte committed Nov 22, 2024
1 parent 0013c8a commit b213ecc
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 54 deletions.
101 changes: 50 additions & 51 deletions pi4j-core/src/main/java/com/pi4j/boardinfo/definition/BoardModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

Expand All @@ -31,82 +30,82 @@ public enum BoardModel {
LocalDate.of(2013, 2, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(700),
Collections.singletonList(256 * 1024)),
List.of(700),
List.of(256 * 1024)),
MODEL_1_A_PLUS("Raspberry Pi 1 Model A+", SINGLE_BOARD_COMPUTER,
List.of("0012", "0015", "900021"),
PiModel.MODEL_A,
HeaderVersion.TYPE_1,
LocalDate.of(2014, 11, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(700),
List.of(700),
List.of(256 * 1024, 512 * 1024),
Collections.singletonList("Amount of memory changed to 512Mb on 20160810")),
List.of("Amount of memory changed to 512Mb on 20160810")),
MODEL_3_A_PLUS("Raspberry Pi 3 Model A+", SINGLE_BOARD_COMPUTER,
List.of("9020e0", "9020e1"),
PiModel.MODEL_A,
HeaderVersion.TYPE_3,
LocalDate.of(2018, 11, 1),
Soc.BCM2837B0,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1400),
Collections.singletonList(512 * 1024)),
List.of(1400),
List.of(512 * 1024)),
MODEL_1_B("Raspberry Pi 1 Model B", SINGLE_BOARD_COMPUTER,
List.of("0002", "0003", "0004", "0005", "0006", "000d", "000e", "000f"),
PiModel.MODEL_B,
HeaderVersion.TYPE_1,
LocalDate.of(2012, 4, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(700),
List.of(700),
List.of(256 * 1024, 512 * 1024),
Collections.singletonList("Amount of memory changed to 512Mb on 20121015")),
List.of("Amount of memory changed to 512Mb on 20121015")),
MODEL_1_B_PLUS("Raspberry Pi 1 Model B+", SINGLE_BOARD_COMPUTER,
List.of("0010", "0013", "900032"),
PiModel.MODEL_B,
HeaderVersion.TYPE_1,
LocalDate.of(2014, 7, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(700),
Collections.singletonList(512 * 1024)),
List.of(700),
List.of(512 * 1024)),
MODEL_2_B("Raspberry Pi 2 Model B", SINGLE_BOARD_COMPUTER,
List.of("a01040", "a01041", "a21041"),
PiModel.MODEL_B,
HeaderVersion.TYPE_2,
LocalDate.of(2015, 2, 1),
Soc.BCM2836,
Cpu.CORTEX_A7, 4,
Collections.singletonList(900),
Collections.singletonList(1024 * 1024)),
List.of(900),
List.of(1024 * 1024)),
MODEL_2_B_V1_2("Raspberry Pi 2 Model B V1.2", SINGLE_BOARD_COMPUTER,
List.of("a02042", "a22042"),
PiModel.MODEL_B,
HeaderVersion.TYPE_2,
LocalDate.of(2016, 10, 1),
Soc.BCM2837,
Cpu.CORTEX_A53, 4,
Collections.singletonList(900),
Collections.singletonList(1024 * 1024)),
List.of(900),
List.of(1024 * 1024)),
MODEL_3_B("Raspberry Pi 3 Model B", SINGLE_BOARD_COMPUTER,
List.of("a02082", "a22082", "a32082", "a52082", "a22083"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2016, 2, 1),
Soc.BCM2837,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1200),
Collections.singletonList(1024 * 1024)),
List.of(1200),
List.of(1024 * 1024)),
MODEL_3_B_PLUS("Raspberry Pi 3 Model B+", SINGLE_BOARD_COMPUTER,
List.of("a020d3", "a020d4"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2018, 3, 14),
Soc.BCM2837B0,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1400),
Collections.singletonList(1024 * 1024)),
List.of(1400),
List.of(1024 * 1024)),
MODEL_4_B("Raspberry Pi 4 Model B", SINGLE_BOARD_COMPUTER,
List.of("a03111", "b03111", "b03112", "b03114", "b03115", "c03111", "c03112", "c03114", "c03115", "d03114", "d03115"),
PiModel.MODEL_B,
Expand All @@ -117,22 +116,22 @@ public enum BoardModel {
List.of(1500, 1800),
List.of(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
MODEL_400("Raspberry Pi 400", ALL_IN_ONE_COMPUTER,
Collections.singletonList("c03130"),
List.of("c03130"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2020, 11, 2),
Soc.BCM2711C0,
Cpu.CORTEX_A72, 4,
Collections.singletonList(1800),
Collections.singletonList(4096 * 1024)),
List.of(1800),
List.of(4096 * 1024)),
MODEL_5_B("Raspberry Pi 5 Model B", SINGLE_BOARD_COMPUTER,
List.of("b04170", "c04170", "d04170"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2023, 9, 28),
Soc.BCM2712,
Cpu.CORTEX_A76, 4,
Collections.singletonList(2400),
List.of(2400),
List.of(2048 * 1024, 4096 * 1024, 8192 * 1024)),
COMPUTE_1("Compute Module 1", STACK_ON_COMPUTER,
List.of("0011", "0014", "900061"),
Expand All @@ -141,34 +140,34 @@ public enum BoardModel {
LocalDate.of(2014, 4, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(700),
Collections.singletonList(512 * 1024)),
List.of(700),
List.of(512 * 1024)),
COMPUTE_3("Compute Module 3", STACK_ON_COMPUTER,
List.of("a020a0", "a220a0"),
PiModel.COMPUTE,
HeaderVersion.COMPUTE,
LocalDate.of(2017, 1, 1),
Soc.BCM2837,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1200),
Collections.singletonList(1024 * 1024)),
List.of(1200),
List.of(1024 * 1024)),
COMPUTE_3_PLUS("Compute Module 3+", STACK_ON_COMPUTER,
Collections.singletonList("a02100"),
List.of("a02100"),
PiModel.COMPUTE,
HeaderVersion.COMPUTE,
LocalDate.of(2019, 1, 1),
Soc.BCM2837B0,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1200),
Collections.singletonList(1024 * 1024)),
List.of(1200),
List.of(1024 * 1024)),
COMPUTE_4("Compute Module 4", STACK_ON_COMPUTER,
List.of("a03140", "b03140", "c03140", "d03140", "a03141", "b03141", "c03141", "d03141"),
PiModel.COMPUTE,
HeaderVersion.COMPUTE,
LocalDate.of(2020, 10, 1),
Soc.BCM2711,
Cpu.CORTEX_A72, 4,
Collections.singletonList(1500),
List.of(1500),
List.of(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
// https://datasheets.raspberrypi.com/cm4s/cm4s-datasheet.pdf
COMPUTE_4_SODIMM("Compute Module 4 SODIMM", STACK_ON_COMPUTER,
Expand All @@ -178,7 +177,7 @@ public enum BoardModel {
LocalDate.of(2020, 10, 1),
Soc.BCM2711,
Cpu.CORTEX_A72, 4,
Collections.singletonList(1500),
List.of(1500),
List.of(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
ZERO_PCB_1_2("Raspberry Pi Zero PCB V1.2", SINGLE_BOARD_COMPUTER,
List.of("900092", "920092"),
Expand All @@ -187,72 +186,72 @@ public enum BoardModel {
LocalDate.of(2015, 11, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(1000),
Collections.singletonList(512 * 1024)),
List.of(1000),
List.of(512 * 1024)),
ZERO_PCB_1_3("Raspberry Pi Zero PCB V1.3", SINGLE_BOARD_COMPUTER,
List.of("900093", "920093"),
PiModel.ZERO,
HeaderVersion.TYPE_3,
LocalDate.of(2016, 5, 1),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(1000),
Collections.singletonList(512 * 1024)),
List.of(1000),
List.of(512 * 1024)),
ZERO_W("Raspberry Pi Zero W", SINGLE_BOARD_COMPUTER,
Collections.singletonList("9000c1"),
List.of("9000c1"),
PiModel.ZERO,
HeaderVersion.TYPE_3,
LocalDate.of(2017, 2, 28),
Soc.BCM2835,
Cpu.ARM1176JZF_S, 1,
Collections.singletonList(1000),
Collections.singletonList(512 * 1024)),
List.of(1000),
List.of(512 * 1024)),
ZERO_V2("Raspberry Pi Zero V2", SINGLE_BOARD_COMPUTER,
Collections.singletonList("902120"),
List.of("902120"),
PiModel.ZERO,
HeaderVersion.TYPE_3,
LocalDate.of(2021, 10, 28),
Soc.BCM2710A1,
Cpu.CORTEX_A53, 4,
Collections.singletonList(1000),
Collections.singletonList(512 * 1024)),
List.of(1000),
List.of(512 * 1024)),
PICO("Raspberry Pi Pico", MICROCONTROLLER,
new ArrayList<>(),
PiModel.PICO,
HeaderVersion.PICO,
LocalDate.of(2021, 1, 1),
Soc.RP2040,
Cpu.CORTEX_MO_PLUS, 1,
Collections.singletonList(133),
Collections.singletonList(264 + 2048)),
List.of(133),
List.of(264 + 2048)),
PICO_W("Raspberry Pi Pico W", MICROCONTROLLER,
new ArrayList<>(),
PiModel.PICO,
HeaderVersion.PICO,
LocalDate.of(2022, 6, 1),
Soc.RP2040,
Cpu.CORTEX_MO_PLUS, 1,
Collections.singletonList(133),
Collections.singletonList(264 + 2048),
Collections.singletonList("Same form factor as PICO but with Wi-Fi")),
List.of(133),
List.of(264 + 2048),
List.of("Same form factor as PICO but with Wi-Fi")),
PICO_2("Raspberry Pi Pico 2", MICROCONTROLLER,
new ArrayList<>(),
PiModel.PICO,
HeaderVersion.PICO,
LocalDate.of(2024, 8, 8),
Soc.RP2350,
Cpu.CORTEX_M33, 1,
Collections.singletonList(150),
Collections.singletonList(520 + 4096)),
List.of(150),
List.of(520 + 4096)),
PICO_2_W("Raspberry Pi Pico 2 W", MICROCONTROLLER,
new ArrayList<>(),
PiModel.PICO,
HeaderVersion.PICO,
LocalDate.of(2024, 8, 8),
Soc.RP2350,
Cpu.CORTEX_M33, 1,
Collections.singletonList(150),
Collections.singletonList(520 + 4096)),
List.of(150),
List.of(520 + 4096)),
UNKNOWN("Unknown", BoardType.UNKNOWN,
new ArrayList<>(),
PiModel.UNKNOWN,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.pi4j.boardinfo.definition;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public enum HeaderVersion {
PICO("Pico", "Used on the Pico microcontroller", new ArrayList<>()),
TYPE_1("Type 1", "Used on original Model B", Collections.singletonList(HeaderPins.HEADER_26_TYPE_1)),
TYPE_1("Type 1", "Used on original Model B", List.of(HeaderPins.HEADER_26_TYPE_1)),
TYPE_2("Type 2", "Used on Model A and Model B (revision 2)", List.of(HeaderPins.HEADER_26_TYPE_2, HeaderPins.HEADER_8)),
TYPE_3("Type 3", "Used on Model A+, B+, Pi Zero, Pi Zero W, Pi2B, Pi3B, Pi4B, Pi5B", Collections.singletonList(HeaderPins.HEADER_40)),
TYPE_3("Type 3", "Used on Model A+, B+, Pi Zero, Pi Zero W, Pi2B, Pi3B, Pi4B, Pi5B", List.of(HeaderPins.HEADER_40)),
COMPUTE("Compute Module", "54 GPIO", List.of(HeaderPins.COMPUTE_J5, HeaderPins.COMPUTE_J6)),
UNKNOWN("Unknown", "", new ArrayList<>());

Expand Down

0 comments on commit b213ecc

Please sign in to comment.