wabbitFB
|
index /media/pi/PI4_TT/TT3/wabbitFB.py
|
This module provides the interface between Wabbit optic-isolators
providing status of the TrainThing turnouts, the IOPi HAT and the
Raspberry Pi which reports status of the turnouts to the Laptop
Classes
|
|
|
class WabbitFB
|
|
This class defines and handles the interrupts generated by the IOPi HAT in response to turnout status changes reported by the 6 Wabbit decoder boards part of TrainThing. Defines a method to report the status of all defined IOPi pins. Each of 6 Wabbit controls 2 turnouts reporting the CLEAR and THROWN status to (4) input pins on the IOPi. In response the IOPi generates one of three hardware interrupt connected to GPIO pins (4, 0, 1) on the Raspberry Pi. The Pi generates interrupts in response to the GPIO pin changes calling a method within this class. The method reports the change in sensor status to the laptop.
|
|
Methods defined here:
- __init__(self)
- This method:
1. Initializes the IOPi bus1, port 0 & 1 and bus2 port 0 as inputs from the Wabbits. (bus2 port 1 is used in the traffic module.) 2. Initializes output interrupts for the 3 ports connected to GPIO pins 3. Initializes 3 GPIO pins as input interrupts
- bits(self, n)
- Change n to binary string (Testing)
- delayed(self, T, CT, delay)
- Thread to delay reporting sensor going high
- interrupt(self, interrupt_pin)
- Function called when GPIO 0,1,4 goes low.
Identifies sensors that changed Calls method to report changes
- output(self, port, changed, value, delay=True)
- Report changed
- tell_all(self)
- Report status of all sensors
|
|
Functions
|
|
|
- sleep(...)
- sleep(seconds)
Delay execution for a given number of seconds. The argument may be a floating point number for subsecond precision.
|