80 lines
1.4 KiB
Python
80 lines
1.4 KiB
Python
# Pin mappings for GPIOs and other components specifically for the pi-interface-board_v1.0
|
|
|
|
|
|
|
|
# === Digital Inputs ===
|
|
# Pin mappings for digital inputs (labeled on housing as 1-8)
|
|
GPIO_DIGITAL_INPUTS = {
|
|
1: 25, # Dig-IN_1 is connected to GPIO_25
|
|
2: 16, # Dig-IN_2 is connected to GPIO_16
|
|
3: 26, # Dig-IN_3 is connected to GPIO_26
|
|
4: 13, # Dig-IN_4 is connected to GPIO_13
|
|
5: 6, # Dig-IN_5 is connected to GPIO_6
|
|
6: 5, # Dig-IN_6 is connected to GPIO_5
|
|
7: 22, # Dig-IN_7 is connected to GPIO_22
|
|
8: 24, # Dig-IN_8 is connected to GPIO_24
|
|
}
|
|
|
|
|
|
|
|
|
|
# === Shift Register ===
|
|
GPIO_SHIFT_REG_DATA = 27
|
|
GPIO_SHIFT_REG_LATCH = 17
|
|
GPIO_SHIFT_REG_CLOCK = 4
|
|
|
|
|
|
|
|
|
|
# === ADC ===
|
|
# ADC IC is connected to RPI SPI interface 0 (pins below)
|
|
ADC_SPI_BUS_NUM = 0
|
|
ADC_SPI_DEVICE_NUM = 0
|
|
ADC_SPI_CS_PIN = 8 # SPI Chip Select for MCP3208
|
|
# MISO_0: GPIO_9
|
|
# MOSI_0: GPIO_10
|
|
# SCLK_0: GPIO_11
|
|
# CE_0: GPIO# MCP3208 (ADC)
|
|
|
|
ADC_CHANNELS = {
|
|
1: 0, # Channel 1 = ADC channel 0
|
|
2: 1, # Channel 2 = ADC channel 1
|
|
3: 2, # ...
|
|
4: 3,
|
|
5: 4,
|
|
6: 5,
|
|
7: 6,
|
|
8: 7
|
|
}
|
|
|
|
|
|
|
|
|
|
# === SPI Terminal ===
|
|
SPI_BUS_NUM = 1
|
|
# MISO_1: GPIO_19
|
|
# MOSI_1: GPIO_20
|
|
# SCLK_1: GPIO_21
|
|
# CE_1: GPIO_7
|
|
|
|
|
|
|
|
|
|
# === I2C Terminal ===
|
|
GPIO_I2C_SDA = 2
|
|
GPIO_I2C_SCL = 3
|
|
|
|
|
|
|
|
|
|
# === PWM outputs ===
|
|
GPIO_PWM1 = 12 # RPI_PWM0
|
|
GPIO_PWM2 = 18 # RPI_PWM0 too
|
|
|
|
|
|
|
|
|
|
# === UART / RS485 ===
|
|
GPIO_UART_TX = 14 # RPI TXD
|
|
GPIO_UART_RX = 15 # RPI RXD
|
|
GPIO_UART_DIR = 23 |