Skip to content

Commit 6d15974

Browse files
authored
Add some definition files for waveshare board. (earlephilhower#984)
* src/boards/include: Change the default I2C interface of RP2040_lcd_0.96. * src/boards/include: Add some definition files for waveshare board.
1 parent e50e107 commit 6d15974

File tree

3 files changed

+186
-3
lines changed

3 files changed

+186
-3
lines changed

src/boards/include/boards/waveshare_rp2040_lcd_0.96.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131

3232
// --- I2C ---
3333
#ifndef PICO_DEFAULT_I2C
34-
#define PICO_DEFAULT_I2C 0
34+
#define PICO_DEFAULT_I2C 1
3535
#endif
3636
#ifndef PICO_DEFAULT_I2C_SDA_PIN
37-
#define PICO_DEFAULT_I2C_SDA_PIN 4
37+
#define PICO_DEFAULT_I2C_SDA_PIN 6
3838
#endif
3939
#ifndef PICO_DEFAULT_I2C_SCL_PIN
40-
#define PICO_DEFAULT_I2C_SCL_PIN 5
40+
#define PICO_DEFAULT_I2C_SCL_PIN 7
4141
#endif
4242

4343
// --- SPI ---
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
#ifndef _BOARDS_WAVESHARE_RP2040_LCD_1_28_H
14+
#define _BOARDS_WAVESHARE_RP2040_LCD_1_28_H
15+
16+
// For board detection
17+
#define WAVESHARE_RP2040_LCD_1_28
18+
19+
// --- UART ---
20+
#ifndef PICO_DEFAULT_UART
21+
#define PICO_DEFAULT_UART 0
22+
#endif
23+
#ifndef PICO_DEFAULT_UART_TX_PIN
24+
#define PICO_DEFAULT_UART_TX_PIN 0
25+
#endif
26+
#ifndef PICO_DEFAULT_UART_RX_PIN
27+
#define PICO_DEFAULT_UART_RX_PIN 1
28+
#endif
29+
30+
// no PICO_DEFAULT_WS2812_PIN
31+
32+
// --- I2C ---
33+
#ifndef PICO_DEFAULT_I2C
34+
#define PICO_DEFAULT_I2C 1
35+
#endif
36+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
37+
#define PICO_DEFAULT_I2C_SDA_PIN 6
38+
#endif
39+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
40+
#define PICO_DEFAULT_I2C_SCL_PIN 7
41+
#endif
42+
43+
// --- SPI ---
44+
#ifndef PICO_DEFAULT_SPI
45+
#define PICO_DEFAULT_SPI 0
46+
#endif
47+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
48+
#define PICO_DEFAULT_SPI_SCK_PIN 18
49+
#endif
50+
#ifndef PICO_DEFAULT_SPI_TX_PIN
51+
#define PICO_DEFAULT_SPI_TX_PIN 19
52+
#endif
53+
#ifndef PICO_DEFAULT_SPI_RX_PIN
54+
#define PICO_DEFAULT_SPI_RX_PIN 16
55+
#endif
56+
#ifndef PICO_DEFAULT_SPI_CSN_PIN
57+
#define PICO_DEFAULT_SPI_CSN_PIN 17
58+
#endif
59+
60+
// --- LCD ---
61+
#ifndef WAVESHARE_RP2040_LCD_SPI
62+
#define WAVESHARE_RP2040_LCD_SPI 1
63+
#endif
64+
#ifndef WAVESHARE_RP2040_LCD_DC_PIN
65+
#define WAVESHARE_RP2040_LCD_DC_PIN 8
66+
#endif
67+
#ifndef WAVESHARE_RP2040_LCD_CS_PIN
68+
#define WAVESHARE_RP2040_LCD_CS_PIN 9
69+
#endif
70+
#ifndef WAVESHARE_RP2040_LCD_SCLK_PIN
71+
#define WAVESHARE_RP2040_LCD_SCLK_PIN 10
72+
#endif
73+
#ifndef WAVESHARE_RP2040_LCD_TX_PIN
74+
#define WAVESHARE_RP2040_LCD_TX_PIN 11
75+
#endif
76+
#ifndef WAVESHARE_RP2040_LCD_RST_PIN
77+
#define WAVESHARE_RP2040_LCD_RST_PIN 12
78+
#endif
79+
#ifndef WAVESHARE_RP2040_LCD_BL_PIN
80+
#define WAVESHARE_RP2040_LCD_BL_PIN 25
81+
#endif
82+
// --- ADC ---
83+
#ifndef WAVESHARE_RP2040_BAT_ADC_PIN
84+
#define WAVESHARE_RP2040_BAT_ADC_PIN 29
85+
#endif
86+
// --- FLASH ---
87+
88+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
89+
90+
#ifndef PICO_FLASH_SPI_CLKDIV
91+
#define PICO_FLASH_SPI_CLKDIV 2
92+
#endif
93+
94+
#ifndef PICO_FLASH_SIZE_BYTES
95+
#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
96+
#endif
97+
98+
// All boards have B1 RP2040
99+
#ifndef PICO_RP2040_B0_SUPPORTED
100+
#define PICO_RP2040_B0_SUPPORTED 0
101+
#endif
102+
103+
#endif
104+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
#ifndef _BOARDS_WAVESHARE_RP2040_ONE_H
14+
#define _BOARDS_WAVESHARE_RP2040_ONE_H
15+
16+
// For board detection
17+
#define WAVESHARE_RP2040_ONE
18+
19+
// --- UART ---
20+
#ifndef PICO_DEFAULT_UART
21+
#define PICO_DEFAULT_UART 0
22+
#endif
23+
#ifndef PICO_DEFAULT_UART_TX_PIN
24+
#define PICO_DEFAULT_UART_TX_PIN 0
25+
#endif
26+
#ifndef PICO_DEFAULT_UART_RX_PIN
27+
#define PICO_DEFAULT_UART_RX_PIN 1
28+
#endif
29+
30+
// --- WS2812 ---
31+
#ifndef PICO_DEFAULT_WS2812_PIN
32+
#define PICO_DEFAULT_WS2812_PIN 16
33+
#endif
34+
35+
// --- I2C ---
36+
#ifndef PICO_DEFAULT_I2C
37+
#define PICO_DEFAULT_I2C 1
38+
#endif
39+
#ifndef PICO_DEFAULT_I2C_SDA_PIN
40+
#define PICO_DEFAULT_I2C_SDA_PIN 6
41+
#endif
42+
#ifndef PICO_DEFAULT_I2C_SCL_PIN
43+
#define PICO_DEFAULT_I2C_SCL_PIN 7
44+
#endif
45+
46+
// --- SPI ---
47+
#ifndef PICO_DEFAULT_SPI
48+
#define PICO_DEFAULT_SPI 1
49+
#endif
50+
#ifndef PICO_DEFAULT_SPI_SCK_PIN
51+
#define PICO_DEFAULT_SPI_SCK_PIN 10
52+
#endif
53+
#ifndef PICO_DEFAULT_SPI_TX_PIN
54+
#define PICO_DEFAULT_SPI_TX_PIN 11
55+
#endif
56+
#ifndef PICO_DEFAULT_SPI_RX_PIN
57+
#define PICO_DEFAULT_SPI_RX_PIN 12
58+
#endif
59+
#ifndef PICO_DEFAULT_SPI_CSN_PIN
60+
#define PICO_DEFAULT_SPI_CSN_PIN 13
61+
#endif
62+
63+
// --- FLASH ---
64+
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
65+
66+
#ifndef PICO_FLASH_SPI_CLKDIV
67+
#define PICO_FLASH_SPI_CLKDIV 2
68+
#endif
69+
70+
#ifndef PICO_FLASH_SIZE_BYTES
71+
#define PICO_FLASH_SIZE_BYTES (4 * 1024 * 1024)
72+
#endif
73+
74+
// All boards have B1 RP2040
75+
#ifndef PICO_RP2040_B0_SUPPORTED
76+
#define PICO_RP2040_B0_SUPPORTED 0
77+
#endif
78+
79+
#endif

0 commit comments

Comments
 (0)