GHIElectronics.Endpoint.Pins 0.5.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ """GHI Electronics Endpoint board pin constants, bus tables, and board
2
+ support — one wheel for every Endpoint board (EPM815, EPDomino24, EPN256,
3
+ EPN128). On import, reads ChipDetect and registers the matching board's
4
+ BoardSupport with Core, so the chip-neutral controllers (I2cController,
5
+ SpiController, ...) dispatch correctly.
6
+
7
+ Mirrors .NET's GHIElectronics.Endpoint.Pins.
8
+
9
+ Usage:
10
+
11
+ import GHIElectronics.Endpoint.Pins # registers the board
12
+ from GHIElectronics.Endpoint.Core import I2cController
13
+ from GHIElectronics.Endpoint.Pins import EPDomino24
14
+
15
+ I2cController.Initialize(EPDomino24.I2c.I2c1)
16
+
17
+ Raspberry Pi Zero 2 W is NOT in this package - the Pi is not an Endpoint
18
+ board; use GHIElectronics.Endpoint.Drivers.RaspberryPi instead.
19
+ """
20
+
21
+ from GHIElectronics.Endpoint.Core import BoardSupport
22
+ from GHIElectronics.Endpoint.Core._chip_detect import Chip, Current
23
+
24
+ from ._epm815 import EPM815
25
+ from ._epdomino24 import EPDomino24
26
+ from ._epn256 import EPN256
27
+ from ._epn128 import EPN128
28
+
29
+
30
+ class _EPM815BoardSupport:
31
+ """Fills in Core.BoardSupport for the EPM815 module (and the EPDomino24
32
+ carrier that sits on top of it - same chip underneath). Mirrors .NET's
33
+ EPM815BoardSupport : IBoardSupport.
34
+ """
35
+
36
+ Name = "EPM815"
37
+
38
+ def I2cInitialize(self, bus, frequency): EPM815.I2c.Initialize(bus, frequency)
39
+ def I2cUnInitialize(self, bus): EPM815.I2c.UnInitialize(bus)
40
+ def I2cGetFrequency(self, bus): return EPM815.I2c.GetFrequency(bus)
41
+
42
+ def SpiInitialize(self, bus, bufferSize): EPM815.Spi.Initialize(bus, bufferSize)
43
+ def SpiUnInitialize(self, bus): EPM815.Spi.UnInitialize(bus)
44
+
45
+ def PwmInitialize(self, pin): EPM815.Pwm.Initialize(pin)
46
+ def PwmUnInitialize(self, pin): EPM815.Pwm.UnInitialize(pin)
47
+ def PwmGetChipId(self, pin): return EPM815.Pwm.GetChipId(pin)
48
+ def PwmGetChannelId(self, pin): return EPM815.Pwm.GetChannelId(pin)
49
+
50
+ def CanInitialize(self, port, bitrate): EPM815.Can.Initialize(port, bitrate)
51
+ def CanUnInitialize(self, port): EPM815.Can.UnInitialize(port)
52
+
53
+ def SerialPortInitialize(self, portName, enableHardwareFlowControl):
54
+ EPM815.SerialPort.Initialize(portName, enableHardwareFlowControl)
55
+ def SerialPortUnInitialize(self, portName): EPM815.SerialPort.UnInitialize(portName)
56
+
57
+
58
+ class _EPN256BoardSupport:
59
+ """Fills in Core.BoardSupport for the EPN256 board. Mirrors .NET's
60
+ EPN256BoardSupport : IBoardSupport.
61
+ """
62
+
63
+ Name = "EPN256"
64
+
65
+ def I2cInitialize(self, bus, frequency): EPN256.I2c.Initialize(bus, frequency)
66
+ def I2cUnInitialize(self, bus): EPN256.I2c.UnInitialize(bus)
67
+ def I2cGetFrequency(self, bus): return EPN256.I2c.GetFrequency(bus)
68
+
69
+ def SpiInitialize(self, bus, bufferSize): EPN256.Spi.Initialize(bus)
70
+ def SpiUnInitialize(self, bus): EPN256.Spi.UnInitialize(bus)
71
+
72
+ def PwmInitialize(self, pin): EPN256.Pwm.Initialize(pin)
73
+ def PwmUnInitialize(self, pin): EPN256.Pwm.UnInitialize(pin)
74
+ def PwmGetChipId(self, pin): return EPN256.Pwm.GetChipId(pin)
75
+ def PwmGetChannelId(self, pin): return EPN256.Pwm.GetChannelId(pin)
76
+
77
+ def CanInitialize(self, port, bitrate): EPN256.Can.Initialize(port, bitrate)
78
+ def CanUnInitialize(self, port): EPN256.Can.UnInitialize(port)
79
+
80
+ def SerialPortInitialize(self, portName, enableHardwareFlowControl):
81
+ EPN256.SerialPort.Initialize(portName, enableHardwareFlowControl)
82
+ def SerialPortUnInitialize(self, portName): EPN256.SerialPort.UnInitialize(portName)
83
+
84
+
85
+ class _EPN128BoardSupport:
86
+ """Fills in Core.BoardSupport for the EPN128 (Chili Pro) board. EPN128
87
+ does not bond out SPI or EPWM pins, so those entry points raise.
88
+ Mirrors .NET's EPN128BoardSupport : IBoardSupport.
89
+ """
90
+
91
+ Name = "EPN128"
92
+
93
+ def I2cInitialize(self, bus, frequency): EPN128.I2c.Initialize(bus, frequency)
94
+ def I2cUnInitialize(self, bus): EPN128.I2c.UnInitialize(bus)
95
+ def I2cGetFrequency(self, bus): return EPN128.I2c.GetFrequency(bus)
96
+
97
+ def SpiInitialize(self, bus, bufferSize):
98
+ raise NotImplementedError("EPN128 (MA35D0 Chili Pro) does not bond out SPI pins.")
99
+ def SpiUnInitialize(self, bus): pass
100
+
101
+ def PwmInitialize(self, pin):
102
+ raise NotImplementedError("EPN128 (MA35D0 Chili Pro) does not bond out EPWM pins.")
103
+ def PwmUnInitialize(self, pin): pass
104
+ def PwmGetChipId(self, pin):
105
+ raise NotImplementedError("EPN128 (MA35D0 Chili Pro) does not bond out EPWM pins.")
106
+ def PwmGetChannelId(self, pin):
107
+ raise NotImplementedError("EPN128 (MA35D0 Chili Pro) does not bond out EPWM pins.")
108
+
109
+ def CanInitialize(self, port, bitrate): EPN128.Can.Initialize(port, bitrate)
110
+ def CanUnInitialize(self, port): EPN128.Can.UnInitialize(port)
111
+
112
+ def SerialPortInitialize(self, portName, enableHardwareFlowControl):
113
+ EPN128.SerialPort.Initialize(portName, enableHardwareFlowControl)
114
+ def SerialPortUnInitialize(self, portName): EPN128.SerialPort.UnInitialize(portName)
115
+
116
+
117
+ # Pick the matching board's BoardSupport from ChipDetect.Current. Runs once
118
+ # per process, at first `import GHIElectronics.Endpoint.Pins`. Mirrors .NET's
119
+ # [ModuleInitializer] in GHIElectronics.Endpoint.Pins.ModuleInit.
120
+ if Current == Chip.Epm815:
121
+ BoardSupport.Register(_EPM815BoardSupport())
122
+ elif Current == Chip.Epn256:
123
+ BoardSupport.Register(_EPN256BoardSupport())
124
+ elif Current == Chip.Epn128:
125
+ BoardSupport.Register(_EPN128BoardSupport())
126
+ # Chip.Unknown: don't register. BoardSupport.Current() throws on first access
127
+ # with a clear "no board detected" message.
128
+
129
+
130
+ __all__ = ["EPM815", "EPDomino24", "EPN256", "EPN128"]
@@ -0,0 +1,190 @@
1
+ """EP-Domino24 Rev B: a board variant of the EPM815 module with a 40-pin
2
+ header, two mikroBUS sockets and a handful of onboard components. Same chip
3
+ and firmware as EPM815; this class is a thin re-naming layer that lists
4
+ only the peripherals and pins actually bonded on the board, so application
5
+ code reads what a user looking at the EP-Domino24 silkscreen expects.
6
+
7
+ Mirrors .NET's GHIElectronics.Endpoint.Pins.EPDomino24.
8
+ """
9
+
10
+ from ._epm815 import EPM815
11
+
12
+
13
+ class EPDomino24:
14
+ """EP-Domino24 Rev B (EPM815-based) board"""
15
+
16
+ # Non-GPIO aliases live at the board top level; GPIO-pin aliases like Led
17
+ # live inside Gpio, matching every other board's shape.
18
+
19
+ Buzzer = EPM815.Gpio.Pin.PF9
20
+ """Piezo buzzer on PF9 (also PWM-capable via TIM14 CH1)"""
21
+ ButtonF1 = EPM815.Gpio.Pin.PF3
22
+ """Function button F1 on PF3"""
23
+ ButtonF2 = EPM815.Gpio.Pin.PH2
24
+ """Function button F2 on PH2"""
25
+ ButtonF3 = EPM815.Gpio.Pin.PH3
26
+ """Function button F3 on PH3"""
27
+ Backlight = EPM815.Gpio.Pin.PD14
28
+ """Panel backlight on PD14 (also PWM-capable via TIM4 CH3)"""
29
+
30
+ class Gpio:
31
+ """GPIO pins exposed on EP-Domino24."""
32
+
33
+ Led = EPM815.Gpio.Pin.PC0
34
+ """User LED on PC0"""
35
+
36
+ @staticmethod
37
+ def GetChipId(pin):
38
+ """Linux gpiochip number for the pin. Delegates to
39
+ EPM815.Gpio.GetChipId because EP-Domino24 is an EPM815 board."""
40
+ return EPM815.Gpio.GetChipId(pin)
41
+
42
+ @staticmethod
43
+ def GetLineId(pin):
44
+ """Line number within the gpiochip (0 to 15). Pairs with
45
+ GetChipId. Delegates to EPM815.Gpio.GetLineId."""
46
+ return EPM815.Gpio.GetLineId(pin)
47
+
48
+ class Pin:
49
+ """Pins bonded on EP-Domino24. Subset of EPM815.Gpio.Pin."""
50
+ PA0 = EPM815.Gpio.Pin.PA0
51
+ PA3 = EPM815.Gpio.Pin.PA3
52
+ PA4 = EPM815.Gpio.Pin.PA4
53
+ PA5 = EPM815.Gpio.Pin.PA5
54
+ PA6 = EPM815.Gpio.Pin.PA6
55
+ PA10 = EPM815.Gpio.Pin.PA10
56
+ PA12 = EPM815.Gpio.Pin.PA12
57
+ PA13 = EPM815.Gpio.Pin.PA13
58
+ PA14 = EPM815.Gpio.Pin.PA14
59
+ PA15 = EPM815.Gpio.Pin.PA15
60
+ PB6 = EPM815.Gpio.Pin.PB6
61
+ PB9 = EPM815.Gpio.Pin.PB9
62
+ PB11 = EPM815.Gpio.Pin.PB11 # on-board native display FT5xx6 touch IRQ (falling edge)
63
+ PB12 = EPM815.Gpio.Pin.PB12
64
+ PB13 = EPM815.Gpio.Pin.PB13
65
+ PC0 = EPM815.Gpio.Pin.PC0
66
+ PC3 = EPM815.Gpio.Pin.PC3
67
+ PD0 = EPM815.Gpio.Pin.PD0
68
+ PD1 = EPM815.Gpio.Pin.PD1
69
+ PD3 = EPM815.Gpio.Pin.PD3
70
+ PD4 = EPM815.Gpio.Pin.PD4
71
+ PD6 = EPM815.Gpio.Pin.PD6
72
+ PD8 = EPM815.Gpio.Pin.PD8
73
+ PD9 = EPM815.Gpio.Pin.PD9
74
+ PD11 = EPM815.Gpio.Pin.PD11
75
+ PD12 = EPM815.Gpio.Pin.PD12
76
+ PD13 = EPM815.Gpio.Pin.PD13
77
+ PD15 = EPM815.Gpio.Pin.PD15
78
+ PE0 = EPM815.Gpio.Pin.PE0
79
+ PE1 = EPM815.Gpio.Pin.PE1
80
+ PE4 = EPM815.Gpio.Pin.PE4
81
+ PE5 = EPM815.Gpio.Pin.PE5
82
+ PE8 = EPM815.Gpio.Pin.PE8
83
+ PE9 = EPM815.Gpio.Pin.PE9
84
+ PE10 = EPM815.Gpio.Pin.PE10
85
+ PE12 = EPM815.Gpio.Pin.PE12
86
+ PE13 = EPM815.Gpio.Pin.PE13
87
+ PE14 = EPM815.Gpio.Pin.PE14
88
+ PF2 = EPM815.Gpio.Pin.PF2 # on-board native display FT5xx6 touch reset (active-low pulse)
89
+ PF3 = EPM815.Gpio.Pin.PF3
90
+ PF4 = EPM815.Gpio.Pin.PF4
91
+ PF5 = EPM815.Gpio.Pin.PF5
92
+ PF6 = EPM815.Gpio.Pin.PF6
93
+ PF8 = EPM815.Gpio.Pin.PF8
94
+ PF9 = EPM815.Gpio.Pin.PF9
95
+ PF11 = EPM815.Gpio.Pin.PF11
96
+ PF12 = EPM815.Gpio.Pin.PF12
97
+ PF13 = EPM815.Gpio.Pin.PF13
98
+ PF14 = EPM815.Gpio.Pin.PF14
99
+ PF15 = EPM815.Gpio.Pin.PF15
100
+ PG0 = EPM815.Gpio.Pin.PG0
101
+ PG9 = EPM815.Gpio.Pin.PG9
102
+ PG10 = EPM815.Gpio.Pin.PG10
103
+ PH2 = EPM815.Gpio.Pin.PH2
104
+ PH3 = EPM815.Gpio.Pin.PH3
105
+ PH9 = EPM815.Gpio.Pin.PH9
106
+ PH10 = EPM815.Gpio.Pin.PH10
107
+ PH12 = EPM815.Gpio.Pin.PH12
108
+ PI4 = EPM815.Gpio.Pin.PI4
109
+ PZ0 = EPM815.Gpio.Pin.PZ0
110
+ PZ1 = EPM815.Gpio.Pin.PZ1
111
+ PZ2 = EPM815.Gpio.Pin.PZ2
112
+ PZ3 = EPM815.Gpio.Pin.PZ3
113
+ PZ6 = EPM815.Gpio.Pin.PZ6
114
+ PZ7 = EPM815.Gpio.Pin.PZ7
115
+
116
+ class I2c:
117
+ """I2C buses bonded on EP-Domino24."""
118
+ I2c1 = EPM815.I2c.I2c1 # PD12 (SCL), PD13 (SDA); 40-pin header
119
+ I2c4 = EPM815.I2c.I2c4 # PB6 (SCL), PF15 (SDA); mikroBUS #2
120
+ I2c5 = EPM815.I2c.I2c5 # PZ4 (SCL), PZ5 (SDA); on-board native display FT5xx6 touch (not on a header)
121
+ I2c6 = EPM815.I2c.I2c6 # PD1 (SCL), PD0 (SDA); mikroBUS #1
122
+
123
+ class Spi:
124
+ """SPI buses bonded on EP-Domino24."""
125
+ Spi1 = EPM815.Spi.Spi1 # PZ0 (SCK), PZ1 (MISO), PZ2 (MOSI); mikroBUS #2
126
+ Spi4 = EPM815.Spi.Spi4 # PE12 (SCK), PE13 (MISO), PE14 (MOSI); mikroBUS #1
127
+
128
+ class SerialPort:
129
+ """Serial ports bonded on EP-Domino24."""
130
+ Uart1 = EPM815.SerialPort.Uart1 # PZ7 (TX), PZ6 (RX), PA12 (RTS), PZ3 (CTS); mikroBUS #1 CS/INT/RST
131
+ Uart2 = EPM815.SerialPort.Uart2 # PF5 (TX), PD6 (RX), PD4 (RTS), PD3 (CTS); mikroBUS #1
132
+ Uart3 = EPM815.SerialPort.Uart3 # PD8 (TX), PD9 (RX), PD12 (RTS), PD11 (CTS); mikroBUS #2
133
+ Uart4 = EPM815.SerialPort.Uart4 # PD1 (TX), PD0 (RX); 40-pin header (shares pins with I2C6 and CAN1)
134
+ Uart5 = EPM815.SerialPort.Uart5 # PB13 (TX), PB12 (RX); 40-pin header (shares pins with CAN2)
135
+ Uart7 = EPM815.SerialPort.Uart7 # PE8 (TX), PF6 (RX), PE9 (RTS), PE10 (CTS); 40-pin header
136
+ Uart8 = EPM815.SerialPort.Uart8 # PE1 (TX), PE0 (RX); 40-pin header
137
+
138
+ class Can:
139
+ """CAN buses bonded on EP-Domino24."""
140
+ Can1 = EPM815.Can.Can1 # FDCAN1: PD1 (TX), PD0 (RX); 40-pin header (shares pins with I2C6 and UART4)
141
+ Can2 = EPM815.Can.Can2 # FDCAN2: PB13 (TX), PB12 (RX); 40-pin header (shares pins with UART5)
142
+
143
+ class Pwm:
144
+ """PWM-capable pins bonded on EP-Domino24."""
145
+
146
+ class Pin:
147
+ """PWM pins. Subset of EPM815.Pwm.Pin."""
148
+ PA0 = EPM815.Pwm.Pin.PA0 # TIM5 channel 1 - mikroBUS #2 PWM
149
+ PA3 = EPM815.Pwm.Pin.PA3 # TIM2 channel 4 - mikroBUS #1 PWM
150
+ PA6 = EPM815.Pwm.Pin.PA6 # TIM13 channel 1
151
+ PA10 = EPM815.Pwm.Pin.PA10 # TIM1 channel 3
152
+ PA15 = EPM815.Pwm.Pin.PA15 # TIM2 channel 1
153
+ PB9 = EPM815.Pwm.Pin.PB9 # TIM17 channel 1
154
+ PD12 = EPM815.Pwm.Pin.PD12 # TIM4 channel 1
155
+ PD15 = EPM815.Pwm.Pin.PD15 # TIM4 channel 4
156
+ PE5 = EPM815.Pwm.Pin.PE5 # TIM15 channel 1
157
+ PF9 = EPM815.Pwm.Pin.PF9 # TIM14 channel 1 - the onboard buzzer
158
+ PH9 = EPM815.Pwm.Pin.PH9 # TIM12 channel 2
159
+ PH12 = EPM815.Pwm.Pin.PH12 # TIM5 channel 3
160
+
161
+ class Adc:
162
+ """Analog-input pins bonded on EP-Domino24."""
163
+
164
+ class Pin:
165
+ """ADC pins. Subset of EPM815.Adc.Pin."""
166
+ PA0 = EPM815.Adc.Pin.PA0 # ADC1 channel 16
167
+ PA3 = EPM815.Adc.Pin.PA3 # ADC1 channel 15
168
+ PA4 = EPM815.Adc.Pin.PA4 # ADC1 channel 18 (shares pin with DAC channel 1)
169
+ PA5 = EPM815.Adc.Pin.PA5 # ADC1 channel 19 (shares pin with DAC channel 2)
170
+ PA6 = EPM815.Adc.Pin.PA6 # ADC1 channel 3
171
+ PC3 = EPM815.Adc.Pin.PC3 # ADC1 channel 13 - mikroBUS #1 ADC
172
+ PF11 = EPM815.Adc.Pin.PF11 # ADC1 channel 2
173
+ PF12 = EPM815.Adc.Pin.PF12 # ADC1 channel 6
174
+ PF13 = EPM815.Adc.Pin.PF13 # ADC2 channel 2
175
+ PF14 = EPM815.Adc.Pin.PF14 # ADC2 channel 6 - mikroBUS #2 ADC
176
+
177
+ class Dac:
178
+ """DAC: two analog outputs on PA4 and PA5 (shared with ADC on the same pins)."""
179
+ Id = EPM815.Dac.Id
180
+ PA4 = EPM815.Dac.PA4
181
+ PA5 = EPM815.Dac.PA5
182
+
183
+ class Watchdog:
184
+ """Watchdog - same as EPM815.Watchdog."""
185
+ Id = EPM815.Watchdog.Id
186
+
187
+ class StorageController:
188
+ """Storage controllers bonded on EP-Domino24. Same strings as EPM815.StorageController."""
189
+ SdCard = EPM815.StorageController.SdCard
190
+ UsbHostMassStorage = EPM815.StorageController.UsbHostMassStorage