Skip to content

Commit

Permalink
Merge pull request #407 from Pi4J/feature/#406
Browse files Browse the repository at this point in the history
#406 Add codes for old board models
  • Loading branch information
FDelporte authored Nov 16, 2024
2 parents 913079c + 6f40bc8 commit 85aeb32
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 62 deletions.
17 changes: 17 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,22 @@
<module name="UnusedImports"/>
<module name="RedundantImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->

<!-- Ignore missing field/variable comments -->
<module name="JavadocVariable">
<property name="severity" value="ignore"/>
</module>

<!-- Ignore missing method comments -->
<module name="JavadocMethod">
<property name="allowMissingParamTags" value="true"/>
<property name="allowMissingReturnTag" value="true"/>
</module>

<!-- Ignore enum constant documentation -->
<module name="JavadocType">
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF, ANNOTATION_DEF"/>
<!-- This excludes ENUM_DEF -->
</module>
</module>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
*
* <ul>
* <li>Board codes: <a href="https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes-in-use">raspberrypi.com/documentation/computers/raspberry-pi.html#new-style-revision-codes-in-use</a></li>
* <li><a href="https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications">en.wikipedia.org/wiki/Raspberry_Pi</a></li>
* <li>Old-style: <a href="https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc">github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/revision-codes.adoc</a></li>
* </li><li><a href="https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications">en.wikipedia.org/wiki/Raspberry_Pi</a></li>
* <li><a href="https://oastic.com/posts/how-to-know-which-raspberry-do-you-have/">oastic.com/posts/how-to-know-which-raspberry-do-you-have</a></li>
* <li><a href="https://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/">raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/</a></li>
* </ul>
*/
public enum BoardModel {
MODEL_1_A("Raspberry Pi 1 Model A", SINGLE_BOARD_COMPUTER,
new ArrayList<>(),
List.of("0007", "0008", "0009"),
PiModel.MODEL_A,
HeaderVersion.TYPE_1,
LocalDate.of(2013, 2, 1),
Expand All @@ -33,17 +34,17 @@ public enum BoardModel {
Collections.singletonList(700),
Collections.singletonList(256 * 1024)),
MODEL_1_A_PLUS("Raspberry Pi 1 Model A+", SINGLE_BOARD_COMPUTER,
Collections.singletonList("900021"),
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),
Arrays.asList(256 * 1024, 512 * 1024),
List.of(256 * 1024, 512 * 1024),
Collections.singletonList("Amount of memory changed to 512Mb on 20160810")),
MODEL_3_A_PLUS("Raspberry Pi 3 Model A+", SINGLE_BOARD_COMPUTER,
Arrays.asList("9020e0", "9020e1"),
List.of("9020e0", "9020e1"),
PiModel.MODEL_A,
HeaderVersion.TYPE_3,
LocalDate.of(2018, 11, 1),
Expand All @@ -52,17 +53,17 @@ public enum BoardModel {
Collections.singletonList(1400),
Collections.singletonList(512 * 1024)),
MODEL_1_B("Raspberry Pi 1 Model B", SINGLE_BOARD_COMPUTER,
new ArrayList<>(),
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),
Arrays.asList(256 * 1024, 512 * 1024),
List.of(256 * 1024, 512 * 1024),
Collections.singletonList("Amount of memory changed to 512Mb on 20121015")),
MODEL_1_B_PLUS("Raspberry Pi 1 Model B+", SINGLE_BOARD_COMPUTER,
Collections.singletonList("900032"),
List.of("0010", "0013", "900032"),
PiModel.MODEL_B,
HeaderVersion.TYPE_1,
LocalDate.of(2014, 7, 1),
Expand All @@ -71,7 +72,7 @@ public enum BoardModel {
Collections.singletonList(700),
Collections.singletonList(512 * 1024)),
MODEL_2_B("Raspberry Pi 2 Model B", SINGLE_BOARD_COMPUTER,
Arrays.asList("a01040", "a01041", "a21041"),
List.of("a01040", "a01041", "a21041"),
PiModel.MODEL_B,
HeaderVersion.TYPE_2,
LocalDate.of(2015, 2, 1),
Expand All @@ -80,7 +81,7 @@ public enum BoardModel {
Collections.singletonList(900),
Collections.singletonList(1024 * 1024)),
MODEL_2_B_V1_2("Raspberry Pi 2 Model B V1.2", SINGLE_BOARD_COMPUTER,
Arrays.asList("a02042", "a22042"),
List.of("a02042", "a22042"),
PiModel.MODEL_B,
HeaderVersion.TYPE_2,
LocalDate.of(2016, 10, 1),
Expand All @@ -89,7 +90,7 @@ public enum BoardModel {
Collections.singletonList(900),
Collections.singletonList(1024 * 1024)),
MODEL_3_B("Raspberry Pi 3 Model B", SINGLE_BOARD_COMPUTER,
Arrays.asList("a02082", "a22082", "a32082", "a52082", "a22083"),
List.of("a02082", "a22082", "a32082", "a52082", "a22083"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2016, 2, 1),
Expand All @@ -98,7 +99,7 @@ public enum BoardModel {
Collections.singletonList(1200),
Collections.singletonList(1024 * 1024)),
MODEL_3_B_PLUS("Raspberry Pi 3 Model B+", SINGLE_BOARD_COMPUTER,
Arrays.asList("a020d3", "a020d4"),
List.of("a020d3", "a020d4"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2018, 3, 14),
Expand All @@ -107,14 +108,14 @@ public enum BoardModel {
Collections.singletonList(1400),
Collections.singletonList(1024 * 1024)),
MODEL_4_B("Raspberry Pi 4 Model B", SINGLE_BOARD_COMPUTER,
Arrays.asList("a03111", "b03111", "b03112", "b03114", "b03115", "c03111", "c03112", "c03114", "c03115", "d03114", "d03115"),
List.of("a03111", "b03111", "b03112", "b03114", "b03115", "c03111", "c03112", "c03114", "c03115", "d03114", "d03115"),
PiModel.MODEL_B,
HeaderVersion.TYPE_3,
LocalDate.of(2019, 6, 24),
Soc.BCM2711,
Cpu.CORTEX_A72, 4,
Arrays.asList(1500, 1800),
Arrays.asList(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
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"),
PiModel.MODEL_B,
Expand All @@ -125,16 +126,16 @@ public enum BoardModel {
Collections.singletonList(1800),
Collections.singletonList(4096 * 1024)),
MODEL_5_B("Raspberry Pi 5 Model B", SINGLE_BOARD_COMPUTER,
Arrays.asList("b04170", "c04170", "d04170"),
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),
Arrays.asList(2048 * 1024, 4096 * 1024, 8192 * 1024)),
List.of(2048 * 1024, 4096 * 1024, 8192 * 1024)),
COMPUTE_1("Compute Module 1", STACK_ON_COMPUTER,
Collections.singletonList("900061"),
List.of("0011", "0014", "900061"),
PiModel.COMPUTE,
HeaderVersion.COMPUTE,
LocalDate.of(2014, 4, 1),
Expand All @@ -143,7 +144,7 @@ public enum BoardModel {
Collections.singletonList(700),
Collections.singletonList(512 * 1024)),
COMPUTE_3("Compute Module 3", STACK_ON_COMPUTER,
Arrays.asList("a020a0", "a220a0"),
List.of("a020a0", "a220a0"),
PiModel.COMPUTE,
HeaderVersion.COMPUTE,
LocalDate.of(2017, 1, 1),
Expand All @@ -161,14 +162,14 @@ public enum BoardModel {
Collections.singletonList(1200),
Collections.singletonList(1024 * 1024)),
COMPUTE_4("Compute Module 4", STACK_ON_COMPUTER,
Arrays.asList("a03140", "b03140", "c03140", "d03140", "a03141", "b03141", "c03141", "d03141"),
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),
Arrays.asList(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
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,
new ArrayList<>(), // Not known yet
Expand All @@ -178,9 +179,9 @@ public enum BoardModel {
Soc.BCM2711,
Cpu.CORTEX_A72, 4,
Collections.singletonList(1500),
Arrays.asList(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
List.of(1024 * 1024, 2048 * 1024, 4096 * 1024, 8192 * 1024)),
ZERO_PCB_1_2("Raspberry Pi Zero PCB V1.2", SINGLE_BOARD_COMPUTER,
Arrays.asList("900092", "920092"),
List.of("900092", "920092"),
PiModel.ZERO,
HeaderVersion.TYPE_3,
LocalDate.of(2015, 11, 1),
Expand All @@ -189,7 +190,7 @@ public enum BoardModel {
Collections.singletonList(1000),
Collections.singletonList(512 * 1024)),
ZERO_PCB_1_3("Raspberry Pi Zero PCB V1.3", SINGLE_BOARD_COMPUTER,
Arrays.asList("900093", "920093"),
List.of("900093", "920093"),
PiModel.ZERO,
HeaderVersion.TYPE_3,
LocalDate.of(2016, 5, 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
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_2("Type 2", "Used on Model A and Model B (revision 2)", Arrays.asList(HeaderPins.HEADER_26_TYPE_2, HeaderPins.HEADER_8)),
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)),
COMPUTE("Compute Module", "54 GPIO", Arrays.asList(HeaderPins.COMPUTE_J5, HeaderPins.COMPUTE_J6)),
COMPUTE("Compute Module", "54 GPIO", List.of(HeaderPins.COMPUTE_J5, HeaderPins.COMPUTE_J6)),
UNKNOWN("Unknown", "", new ArrayList<>());

private final String label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ public static ContextBuilder newInstance(){
@Override
public ContextBuilder add(Platform... platform) {
if(platform != null && platform.length > 0)
this.platforms.addAll(Arrays.asList(platform));
this.platforms.addAll(List.of(platform));
return this;
}

/** {@inheritDoc} */
@Override
public ContextBuilder add(Provider... provider) {
if(provider != null && provider.length > 0)
this.providers.addAll(Arrays.asList(provider));
this.providers.addAll(List.of(provider));
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ public DIGITAL_TYPE removeListener(DigitalStateChangeListener... listener) {
public DIGITAL_TYPE bind(DigitalBinding ... binding) {
return bindings.bind(binding);

//bindings.addAll(Arrays.asList(binding));
//bindings.addAll(List.of(binding));
//return (DIGITAL_TYPE)this;
}

/** {@inheritDoc} */
@Override
public DIGITAL_TYPE unbind(DigitalBinding ... binding) {
return bindings.unbind(binding);
//bindings.removeAll(Arrays.asList(binding));
//bindings.removeAll(List.of(binding));
//return (DIGITAL_TYPE)this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
Expand Down Expand Up @@ -210,7 +207,7 @@ public RuntimePlatforms initialize(Collection<Platform> platforms) throws Initia


private <T extends Platform> Platforms add(T ... platform) throws PlatformAlreadyExistsException, PlatformInitializeException {
return add(Arrays.asList(platform));
return add(List.of(platform));
}

private <T extends Platform > Platforms add(Collection<T> platform) throws PlatformAlreadyExistsException, PlatformInitializeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
Expand Down Expand Up @@ -229,7 +226,7 @@ public Provider get(String providerId) throws ProviderNotFoundException {
}

private <T extends Provider> Providers add(T ... provider) throws ProviderInitializeException, ProviderAlreadyExistsException {
return add(Arrays.asList(provider));
return add(List.of(provider));
}

private <T extends Provider> Providers add(Collection<T> provider) throws ProviderAlreadyExistsException, ProviderInitializeException {
Expand Down
4 changes: 3 additions & 1 deletion pi4j-test/src/main/java/com/pi4j/test/About.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package com.pi4j.test;/*-
package com.pi4j.test;

/*-
* #%L
* **********************************************************************
* ORGANIZATION : Pi4J
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
Expand Down Expand Up @@ -110,7 +111,7 @@ protected String[] getProviders() {
*/
public void setProviders(String ... providerId){
this.supportedProviderIds.clear();
this.supportedProviderIds.addAll(Arrays.asList(providerId));
this.supportedProviderIds.addAll(List.of(providerId));
}

/**
Expand Down
31 changes: 11 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
<maven-gpg-plugin.version>3.2.1</maven-gpg-plugin.version>
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
<maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
<maven-release-plugin.version>3.0.0-M4</maven-release-plugin.version>
<maven-resource-plugin.version>3.2.0</maven-resource-plugin.version>
<maven-scm-plugin.version>1.11.2</maven-scm-plugin.version>
Expand Down Expand Up @@ -501,6 +501,16 @@
</goals>
</execution>
</executions>
<configuration>
<source>${java.version}</source>
<detectJavaApiLink>false</detectJavaApiLink>
<doclint>none</doclint>
<!-- Add module options -->
<additionalJOption>--add-modules</additionalJOption>
<additionalJOption>ALL-MODULE-PATH</additionalJOption>
<!-- Optional: skip errors -->
<failOnError>false</failOnError>
</configuration>
</plugin>

<!-- DOWNLOAD LICENSE, README & NOTICE ARTIFACTS -->
Expand Down Expand Up @@ -759,25 +769,6 @@
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>checkstyle-check</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>config/checkstyle/checkstyle.xml</configLocation>
<excludes>**/module-info.java</excludes>
</configuration>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 85aeb32

Please sign in to comment.