Skip to content

Commit 0e5cef3

Browse files
authored
Boards header updates (#1724)
* Add script to automatically validate board header files * Fix small automatically-found inconsistencies in various board header files * Tweak and add board header file from abandoned PR #1174
1 parent 333974f commit 0e5cef3

13 files changed

+370
-22
lines changed
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3+
*
4+
* SPDX-License-Identifier: BSD-3-Clause
5+
*/
6+
7+
// -----------------------------------------------------
8+
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
9+
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
10+
// -----------------------------------------------------
11+
//
12+
//------------------------------------------------------------------------------------------
13+
// Board definition for the 0xCB Helios
14+
15+
#ifndef _BOARDS_0XCB_HELIOS_H
16+
#define _BOARDS_0XCB_HELIOS_H
17+
18+
// For board detection
19+
#define _0XCB_HELIOS
20+
21+
#ifndef PICO_DEFAULT_UART
22+
#define PICO_DEFAULT_UART 0
23+
#endif
24+
#ifndef PICO_DEFAULT_UART_TX_PIN
25+
#define PICO_DEFAULT_UART_TX_PIN 0
26+
#endif
27+
#ifndef PICO_DEFAULT_UART_RX_PIN
28+
#define PICO_DEFAULT_UART_RX_PIN 1
29+
#endif
30+
31+
// User LED and level shifted PIN
32+
#ifndef PICO_DEFAULT_LED_PIN
33+
#define PICO_DEFAULT_LED_PIN 17
34+
#endif
35+
#ifndef PICO_DEFAULT_WS2812_PIN
36+
#define PICO_DEFAULT_WS2812_PIN 25
37+
#endif
38+
39+
// --- I2C ---
40+
#ifndef PICO_DEFAULT_I2C
41+
#define PICO_DEFAULT_I2C 1
42+
#endif
43+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
44+
#define PICO_DEFAULT_I2C_SDA_PIN 2
45+
#endif
46+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
47+
#define PICO_DEFAULT_I2C_SCL_PIN 3
48+
#endif
49+
50+
// --- SPI ---
51+
#ifndef PICO_DEFAULT_SPI
52+
#define PICO_DEFAULT_SPI 0
53+
#endif
54+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
55+
#define PICO_DEFAULT_SPI_SCK_PIN 22
56+
#endif
57+
#ifndef PICO_DEFAULT_SPI_TX_PIN
58+
#define PICO_DEFAULT_SPI_TX_PIN 23
59+
#endif
60+
#ifndef PICO_DEFAULT_SPI_RX_PIN
61+
#define PICO_DEFAULT_SPI_RX_PIN 20
62+
#endif
63+
#ifndef PICO_DEFAULT_SPI_CSN_PIN
64+
#define PICO_DEFAULT_SPI_CSN_PIN 21
65+
#endif
66+
67+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
68+
69+
#ifndef PICO_FLASH_SPI_CLKDIV
70+
#define PICO_FLASH_SPI_CLKDIV 2
71+
#endif
72+
73+
// board has 16M onboard flash
74+
#ifndef PICO_FLASH_SIZE_BYTES
75+
#define PICO_FLASH_SIZE_BYTES (16 * 1024 * 1024)
76+
#endif
77+
78+
// All boards have B1 RP2040
79+
80+
#ifndef PICO_RP2040_B0_SUPPORTED
81+
#define PICO_RP2040_B0_SUPPORTED 0
82+
#endif
83+
84+
#endif

src/boards/include/boards/cytron_maker_pi_rp2040.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define MAKER_PI_RP2040_M1B_PIN 9
2727
#endif
2828

29-
#ifndef MAKER_PI_RP2040_M2B_PIN
30-
#define MAKER_PI_RP2040_M2B_PIN 10
29+
#ifndef MAKER_PI_RP2040_M2A_PIN
30+
#define MAKER_PI_RP2040_M2A_PIN 10
3131
#endif
3232

3333
#ifndef MAKER_PI_RP2040_M2B_PIN
@@ -186,4 +186,4 @@
186186
#define PICO_RP2040_B0_SUPPORTED 0
187187
#endif
188188

189-
#endif
189+
#endif

src/boards/include/boards/nullbits_bit_c_pro.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
//------------- I2C -------------//
5858
#ifndef PICO_DEFAULT_I2C
59-
#define PICO_DEFAULT_I2C 0
59+
#define PICO_DEFAULT_I2C 1
6060
#endif
6161

6262
#ifndef PICO_DEFAULT_I2C_SDA_PIN

src/boards/include/boards/pico_w.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
// This header may be included by other board headers as "boards/pico.h"
12+
// This header may be included by other board headers as "boards/pico_w.h"
1313

1414
#ifndef _BOARDS_PICO_W_H
1515
#define _BOARDS_PICO_W_H

src/boards/include/boards/pimoroni_tiny2040_2mb.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#define _BOARDS_PIMORONI_TINY2040_2MB_H
1414

1515
// For board detection
16-
#define PIMORONI_TINY2040
1716
#define PIMORONI_TINY2040_2MB
17+
#define PIMORONI_TINY2040
1818

1919
// --- BOARD SPECIFIC ---
2020
#define TINY2040_LED_R_PIN 18

src/boards/include/boards/pololu_3pi_2040_robot.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
#ifndef _POLOLU_3PI_2040_ROBOT_H
13-
#define _POLOLU_3PI_2040_ROBOT_H
12+
#ifndef _BOARDS_POLOLU_3PI_2040_ROBOT_H
13+
#define _BOARDS_POLOLU_3PI_2040_ROBOT_H
1414

1515
// For board detection
1616
#define POLOLU_3PI_2040_ROBOT

src/boards/include/boards/pololu_zumo_2040_robot.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
#ifndef _POLOLU_ZUMO_2040_ROBOT_H
13-
#define _POLOLU_ZUMO_2040_ROBOT_H
12+
#ifndef _BOARDS_POLOLU_ZUMO_2040_ROBOT_H
13+
#define _BOARDS_POLOLU_ZUMO_2040_ROBOT_H
1414

1515
// For board detection
1616
#define POLOLU_ZUMO_2040_ROBOT

src/boards/include/boards/weact_studio_rp2040_2mb.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
// This header may be included by other board headers as "boards/weact_studio_rp2040_16mb.h"
12+
// This header may be included by other board headers as "boards/weact_studio_rp2040_2mb.h"
1313

14-
#ifndef _BOARDS_WEACT_STUDIO_RP2040_16MB_H
15-
#define _BOARDS_WEACT_STUDIO_RP2040_16MB_H
14+
#ifndef _BOARDS_WEACT_STUDIO_RP2040_2MB_H
15+
#define _BOARDS_WEACT_STUDIO_RP2040_2MB_H
1616

1717
// For board detection
18-
#define WEACT_STUDIO_RP2040_16MB
18+
#define WEACT_STUDIO_RP2040_2MB
1919

2020
// --- UART ---
2121
#ifndef PICO_DEFAULT_UART

src/boards/include/boards/weact_studio_rp2040_4mb.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
// This header may be included by other board headers as "boards/weact_studio_rp2040_16mb.h"
12+
// This header may be included by other board headers as "boards/weact_studio_rp2040_4mb.h"
1313

14-
#ifndef _BOARDS_WEACT_STUDIO_RP2040_16MB_H
15-
#define _BOARDS_WEACT_STUDIO_RP2040_16MB_H
14+
#ifndef _BOARDS_WEACT_STUDIO_RP2040_4MB_H
15+
#define _BOARDS_WEACT_STUDIO_RP2040_4MB_H
1616

1717
// For board detection
18-
#define WEACT_STUDIO_RP2040_16MB
18+
#define WEACT_STUDIO_RP2040_4MB
1919

2020
// --- UART ---
2121
#ifndef PICO_DEFAULT_UART

src/boards/include/boards/weact_studio_rp2040_8mb.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
1010
// -----------------------------------------------------
1111

12-
// This header may be included by other board headers as "boards/weact_studio_rp2040_16mb.h"
12+
// This header may be included by other board headers as "boards/weact_studio_rp2040_8mb.h"
1313

14-
#ifndef _BOARDS_WEACT_STUDIO_RP2040_16MB_H
15-
#define _BOARDS_WEACT_STUDIO_RP2040_16MB_H
14+
#ifndef _BOARDS_WEACT_STUDIO_RP2040_8MB_H
15+
#define _BOARDS_WEACT_STUDIO_RP2040_8MB_H
1616

1717
// For board detection
18-
#define WEACT_STUDIO_RP2040_16MB
18+
#define WEACT_STUDIO_RP2040_8MB
1919

2020
// --- UART ---
2121
#ifndef PICO_DEFAULT_UART

src/rp2040/rp2040_interface_pins.json

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"UART": {
3+
"0": {
4+
"TX": [0, 12, 16, 28],
5+
"RX": [1, 13, 17, 29],
6+
"CTS": [2, 14, 18],
7+
"RTS": [3, 15, 19]
8+
},
9+
"1": {
10+
"TX": [4, 8, 20, 24],
11+
"RX": [5, 9, 21, 25],
12+
"CTS": [6, 10, 22, 26],
13+
"RTS": [7, 11, 23, 27]
14+
}
15+
},
16+
"I2C": {
17+
"0": {
18+
"SDA": [0, 4, 8, 12, 16, 20, 24, 28],
19+
"SCL": [1, 5, 9, 13, 17, 21, 25, 29]
20+
},
21+
"1": {
22+
"SDA": [2, 6, 10, 14, 18, 22, 26],
23+
"SCL": [3, 7, 11, 15, 19, 23, 27]
24+
}
25+
},
26+
"SPI": {
27+
"0": {
28+
"RX": [0, 4, 16, 20],
29+
"CSN": [1, 5, 17, 21],
30+
"SCK": [2, 6, 18, 22],
31+
"TX": [3, 7, 19, 23]
32+
},
33+
"1": {
34+
"RX": [8, 12, 24, 28],
35+
"CSN": [9, 13, 25, 29],
36+
"SCK": [10, 14, 26],
37+
"TX": [11, 15, 27]
38+
}
39+
},
40+
"PWM": {
41+
"0": {
42+
"A": [0, 16],
43+
"B": [1, 17]
44+
},
45+
"1": {
46+
"A": [2, 18],
47+
"B": [3, 19]
48+
},
49+
"2": {
50+
"A": [4, 20],
51+
"B": [5, 21]
52+
},
53+
"3": {
54+
"A": [6, 22],
55+
"B": [7, 23]
56+
},
57+
"4": {
58+
"A": [8, 24],
59+
"B": [9, 25]
60+
},
61+
"5": {
62+
"A": [10, 26],
63+
"B": [11, 27]
64+
},
65+
"6": {
66+
"A": [12, 28],
67+
"B": [13, 29]
68+
},
69+
"7": {
70+
"A": [14],
71+
"B": [15]
72+
}
73+
}
74+
}

tools/check_all_board_headers.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
for HEADER in src/boards/include/boards/*.h; do
3+
tools/check_board_header.py $HEADER
4+
if [[ $? -ne 0 ]]; then
5+
break
6+
fi
7+
done

0 commit comments

Comments
 (0)