digital.py

The digital functionality currently supported by the RPiSoC Python API

Digital Input and Output

class digital.digitalPin(PORT, PIN, CONFIG=None)
Class:

Provides functionality for use of the GPIO on the RPiSoC as a digital input or output, with a number of different drive mode configurations.

Example:

Define a digitalPin object in the following way:

My_input = digitalPin(Port,Pin,'IN')
My_output = digitalPin(Port,Pin,'OUT')
'''or more generally'''
My_pin = digitalPin(Port,Pin,DRIVE_MODE)
Note:

Modification of which pins are available should be easy. Just add new pins to you RPiSoC schematic, give them an input and an output, and then name them as GPIO_PORT_PIN. After you do this, confirm that it was done correctly by using the DEBUG feature of the RPiSoC class.

Method __init__
Description Constructs and initializes a digitalPin object
Parameters
  • int PORT
  • int PIN
  • string CONFIG
PORT
Port on the RPiSoC
  • GPIO Ports are chosen by default as Ports 2, 5 and 12 for V1.2, but they are easily changed
  • Port 4 does not contain Pin 7 (it is reserved)
  • Port 5 uses 3.3V logic instead of 5V, as do pins 12[6] and 12[7].
PIN
Pin relative to the chosen Port
  • Valid arguments are between 0 and 7, unless noted to have a Port specific exception, or if that pin is removed from your RPiSoC schematic
CONFIG
Drive mode of the pin. Valid choices are:
  • ‘IN’ - sets pin as input
  • ‘OUT’ - sets pin as output
  • ‘PULL_UP’ - sets pin as resisitive pullup
  • ‘PULL_DWN’ - sets pin as resistive pulldown
  • ‘OPEN_DRAIN_LO’ - sets pin as open-drain (drives low)
  • ‘OPEN_DRAIN_HI’ - sets pin as open-drain (drives high)
  • ‘PULL_UP_DWN’ - sets pin as resistive pull-up/down
  • ‘HIGH_Z_DIG’ - sets pin as high impedence (digital)
  • ‘STRONG_DRIVE’ - sets pin as strong drive
Returns No return
Configure(CONFIG)
Method Configure
Description Sets the drive mode of the pin as input (high impedence digital), resistive pullup, resistive pull down, open drain (drives low), open drain (drives high), output (strong drive), or resistive pull-up/down
Parameters
  • string CONFIG
CONFIG
Drive mode of the pin. Valid choices are:
  • ‘IN’ - sets pin as input
  • ‘OUT’ - sets pin as output
  • ‘PULL_UP’ - sets pin as resisitive pullup
  • ‘PULL_DWN’ - sets pin as resistive pulldown
  • ‘OPEN_DRAIN_LO’ - sets pin as open-drain (drives low)
  • ‘OPEN_DRAIN_HI’ - sets pin as open-drain (drives high)
  • ‘PULL_UP_DWN’ - sets pin as resistive pull-up/down
  • ‘HIGH_Z_DIG’ - sets pin as high impedence (digital)
  • ‘STRONG_DRIVE’ - sets pin as strong drive
Returns No return
Read()
Method Read
Description Determines the state of the digital pin on the RPiSoC
Parameters None
Returns bool state
state A True or False value when the output is determined to be HIGH or LOW, respectively
Toggle()
Method Toggle
Description Toggles the state of the specified output and commits that value to the RPiSoC
Parameters None
Returns No return
Write(val)
Method Write
Description
  • Writes a new value to the output port, without affecting the other pins attached to that port
  • Before committing the write operation, this function will confirm that the new value is different than the previous value, and only operate on the RPiSoC’s I/O if it is
Parameters
  • int val
val
  • Value to be written to the initialized digitalPin object
  • Accepts only 1 or 0 for writing the output HIGH or LOW, respectively
Returns No return

PWM

class digital.PWM(portNumber)
Class:

This class provides functionality for use of the PWM components available on the RPiSoC.

Example:

Define PWM objects in the following way:

My_PWM       = PWM(0)
My_other_PWM = PWM(1)
'''etc etc...    '''
My_last_PWM  = PWM(7)
Method __init__
Description Constructs and initializes PWM object
Parameters int portNumber
portNumber
Corresponds to one of the physical PWM pins on your RPiSoC
  • By default, there are 8 PWM channels available, so valid inputs are 0-7
  • Valid inputs are 0-(N-1), assuming that there are N PWM channels in your RPiSoC schematic
  • For the default version of V1.2.4, this number corresponds to the respective pin on Port 6 for channels 1-7, and P0[2] for PWM(0)
Returns No return
ClearFIFO()
Method ClearFIFO
Description Clears the capture FIFO of any previously captured data. Here PWM_ReadCapture() is called until the FIFO is empty
Parameters None
Returns No return
GetClockDivider()
Method GetClockDivider
Description Gets the most recently confirmed clock divider value, which is used to determine the clocking frequency of the PWM
Parameters None
Returns int div
div 16-bit clock divider value
GetClocks()
Method GetClocks
Description Calculates the actual clock rate of the PWM’s based on the most recently confirmed clock divider value
Parameters None
Returns float clk
clk The actual frequency of the PWM clock
GetDutyCycle(PRECISION=2)
Method GetDutyCycle
Description Calculates the current duty cycle based on the current period and comparison values
Optional Parameters int PRECISION
PRECISION
The number of decimal places which the result should be calculated to
  • Defaults to 2
Returns float duty_cycle
duty_cycle A value which is representative of the percentage of time, between 0 and 100%, that the PWM signal is on, relative to the total length of its period
GetFrequency(PRECISION=2)
Method GetFrequency
Description Calculates the current PWM wave frequency based on the current clock rate and period value
Optional Parameters int PRECISION
PRECISION
The number of decimal places which the result should be calculated to
  • Defaults to 2
Returns float freq
freq A frequency in Hz, which is representative of the current PWM signal frequency
GetMIDI()
Method GetMIDI
Description Calculates what MIDI note corresponds to the current PWM frequency
Parameters None
Returns int MIDI
MIDI The MIDI note, as defined by the MIDI standard to correspond with a specific musical note, which most closely resembles the PWM frequency
ReadCompare()
Method ReadCompare
Description Determines the compare value, in counts, currently used by the PWM component
Parameters None
Returns int cmp
cmp The compare value, in counts, currently used by the PWM component
ReadPeriod()
Method ReadPeriod
Description Determines the period value, in counts, currently used by the PWM component
Parameters None
Returns int period
period The period value, in counts, currently used by the PWM component
SetClockDivider(divider)
Method SetClockDivider
Description Sets a divider to the desired PWM’s clock source
Parameters int divider
div
An integer between 0 and 65535 which the PWM clock will be divided by
  • Changing the clock’s divider, and consequently its frequency, will affect any other PWMs which share that clock
Returns No return
SetClocks(frequency, safety=False)
Method SetClocks
Description
  • Attempts to set the PWM Clock rate to a desired frequency using an appropriate clock divider
  • It will wait for a response from the RPiSoC which represents the actual clock divider which was set
  • This value is then saved in the RPiSoC class so that it can be referenced to calculate the actual clock frequency at request
Parameters float frequency
frequency
A frequency in Hz which represents the desired clock rate
  • This is NOT the frequency of the PWM, it is the frequency of the clock which drives it
  • Changing the clock frequency for any single PWM that shares it’s clock source will affect all PWMs that share this clock
  • For the suggested clock source of 24 MHz, this value cannot be less than 367 Hz and cannot be more than 24 MHz (24000000 Hz)
  • Generally, the frequency cannot be less than your clock source divided by 65535, and cannot be greater than your clock source itself
Returns No return
Warning
Because frequencies are achieved with dividers, high frequencies are difficult to accurately achieve, and they might have more error.
  • For a 24 MHz source, frequencies higher than 2.526 MHz (2526318 Hz) accuracy cannot be guaranteed to be within a tolerance of 5%
  • For a 24 MHz source, frequencies higher than 5.333 MHz (5333345 Hz) accuracy cannot be guaranteed to be within a tolerance of 10%
  • The frequency might still be accurate at high frequencies; tolerances are worst case scenarios
  • Use GetClocks() to get the actually achieved frequency
SetDutyCycle(duty_cycle, safety=False)
Method SetDutyCycle
Description Simplifies the process of setting a meaningful comparison value by calculating the correct cmp value based on a desired duty cycle
Parameters float duty_cycle
duty_cycle
A a number between 0 and 100 which indicates the percentage of time that the PWM should be HIGH during one period
  • A duty_cycle of 100 indicates that the PWM is always on
  • A duty_cycle of 50 indicates that the PWM is on half of the time
  • A duty_cycle of 0 indicates that the PWM is always off
Returns No return
SetFrequency(freq, MAX_ERROR=5, MIN_PERIOD=10, safety=False)
Method SetFrequency
Description
  • Attempts to set the PWM wave frequency to a desired rate by calculating an appropriate period value and/or clock rate
  • It will try to maintain the clock rate, unless it is impossible without compromising the duty cycle too severely
Parameters
  • float freq
Optional Parameters
  • float MAX_ERROR
  • int MIN_PERIOD
freq
A frequency in Hz which represents the desired wave rate
  • This is NOT the frequency of the clock which drive the PWM, it is the actual output frequency
  • If the frequency cannot be reached without changing the clock rate, any PWM’s sharing that clock will be affected
  • For the suggested source clock rate of 24MHz, freq cannot be less than .006 Hz and cannot be more than 2.4 MHz (2400000 Hz)
  • Generally, freq cannot be less than \(\frac{clock freq}{65535*(2^n - 1)}\), where n is the PWM resolution in bits, and it cannot be more than \(\frac{clock freq}{MIN PERIOD}\)
MAX_ERROR
The largest percentage of error that can be tolerated between the desired frequency and the achieved frequency
MIN_PERIOD
The lowest possible period that can be tolerated when the wave parameters are being calculated
  • Valid between 0 and 65535 for a 16-bit PWM
  • Valid between 0 and 255 for an 8-bit PWM
  • Default behavior is a MIN_PERIOD of 10 on 16-bit PWM
  • Lower values allow for easier wave parameter calculation, without having to modify the clock source
  • Higher values allow finer Duty Cycle maintenence
Returns No return
SetMIDI(MIDI, MAX_ERROR=5, MIN_PERIOD=10)
Method SetMIDI
Description Generates a PWM wave frequency the corresponds to the specified MIDI note
Parameters
  • int MIDI
Optional Parameters
  • float MAX_ERROR
  • int MIN_PERIOD
MIDI A MIDI note, as defined by the MIDI standard to correspond with a specific musical note
MAX_ERROR
The largest percentage of error that can be tolerated between the desired frequency and the achieved frequency
  • This defaults to 5
  • This error rate is in reference to the wave frquency, in Hz, not the MIDI note number which is scaled differently than the frequency
MIN_PERIOD
The lowest possible period that can be tolerated when the wave parameters are being calculated
  • Valid between 0 and 65535 for a 16-bit PWM
  • Valid between 0 and 255 for an 8-bit PWM
  • Default behavior is a MIN_PERIOD of 10 on 16-bit PWM
  • Lower values allow for easier wave parameter calculation, without having to modify the clock source
  • Higher values allow finer Duty Cycle maintenence
Returns No return
Sleep()
Method Sleep
Description Stops the PWM operation, puts the PWM component into it’s lowest power state, and saves the current configuration
Parameters None
Returns No return
Start()
Method Start
Description Starts component operation. Sets the initVar variable, calls the PWM_Init function, and then calls the PWM_Enable function
Parameters None
Returns No return
Stop()
Method Stop
Description Disables the PWM operation
Parameters None
Returns No return
Wakeup()
Method Wakeup
Description Restores and enables the most recently saved configuration
Parameters None
Returns No return
WriteCompare(cmp, safety=False)
Method WriteCompare
Description Writes the period value used by the PWM hardware
Parameters int cmp
cmp
An integer value, in counts, which determines how long during a PWM cycle that the output is HIGH
  • The value must not be greater than 65535 (for 16-bit mode, which is the default)
  • for 8-bit mode it must not be greater than 255
  • The comparison value must also be less than or equal to the period
Returns No return
WritePeriod(period, safety=False)
Method WritePeriod
Description Writes the period value used by the PWM hardware
Parameters int period
period
The length, in counts, which defines how long a PWM Cycle will be
  • The value must not be greater than 65535 (for 16-bit mode, which is the default)
  • for 8-bit mode it must not be greater than 255
  • The period must be greater than the comparison value
Returns No return
isRunning()
Method isRunning
Description Checks to see if the PWM component is currently operational
Parameters None
Returns bool __running
__running A private boolean variable which evaluates to True if the PWM component is operational, or False if it is not

Servo Motors

class digital.Servo(servo_id, min_pulse=1.0, max_pulse=2.0, min_angle=0, max_angle=180)
Class:

This class provides allows for easy manipulation of standard Servo Motors using PWM.

Example:

Define Servo objects in any the following ways:

My_simple_servo       = Servo(0)
My_calibrated_servo   = Servo(1, 1.0, 2.5)
My_descriptive_servo  = Servo(7, 1.0, 2.5, 0, 180)
Method __init__
Description Creates a servo object with the given parameter set
Parameters
  • int servo_id
Optional Parameters
  • float min_pulse
  • float max_pulse
  • float min_angle
  • float max_angle
servo_id
Corresponds to the pin which the signal line of the servo will be connected to
  • These pins will be defined exactly the same way that PWM pins are defined
  • By default, servo 0 is on P0[2], and servos 1-7 are on Port 6 Pins 1-7
min_pulse
The pulse width necessary to obtain angular position min_angle.
  • Values must be greater than zero
  • Normal values are between 0.8 and 1.2
  • Find an appropriate value through calibration; it will default to 1.0 if no parameter is given
max_pulse
The pulse width necessary to obtain angular position max_angle.
  • Values must be greater than zero
  • Normal values are between 1.8 and 2.3
  • Find an appropriate value through calibration; it will default to 2.0 if no parameter is given
min_angle
the angle which the servo will return to if applied with a pulse width of min_pulse
  • This defaults to 0
  • Negative angular positions are valid
  • Angles can be any angular unit: degrees, radians, or other arbitrary (linear) scale
max_angle
the angle which the servo will return to if applied with a pulse width of max_pulse
  • This defaults to 180
  • Negative angular positions are valid
  • Angles can be any angular unit: degrees, radians, or other arbitrary (linear) scale
Returns No return
Note A servo with servo_id, n, will make PWM(n) unnavailable, since the servo controller is implemented using that PWM object. For fine control over that PWM, you can expose the object using My_servo.servo_PWM, and then you can use any of the PWM methods using My_servo.servo_PWM.method(). This is advised against though, because servos are very particular about the construction of their data signals. If you change the wrong parameter of the PWM signal, you might damage the servo
ReadAngle()
Method ReadAngle
Description Calculates the current angle of the servomotor, linearized relative to the provided maximum and minimum angles
Parameters None
Returns float angle_cur
angle_cur A value representative of the angle that the servo motor is held, according to the provided scale
ReadPulse()
Method ReadPulse
Description Calculates the current pulse width of the PWM which is driving the servomotor
Parameters None
Returns float pulse
pulse A pulse duration in milliseconds, representative of the PWM signal pulse width being applied ot the servomotor
SetAngle(angle)
Method SetAngle
Description Calculates a pulse width based on the given angular position and the current min/max configuration parameters, then calls SetPulse() to set the position of the servo
Parameters float angle
angle The angle to which the servo should be set, linearized relative to the defined minimum and maximum angles
Returns No return
SetPulse(pulse_ms)
Method SetPulse
Description Sets a servo position based on a pulse width in ms
Parameters float pulse_ms
pulse_ms
A pulse width in milliseconds, which will be applied to the signal wire of the Servo at 50 Hz
  • Normal values are between 0.8 and 2.3, but they must be between the defined min_pulse and max_pulse values
Returns No return
Start()
Method Start
Description Starts component operation.
Parameters None
Returns No return
Stop()
Method Stop
Description Stops the servo object by terminating the PWM channel that drives it
Parameters None
Returns No return
Side Effects This may cause the servo to move slightly out of position
changeAngles(MIN, MAX)
Method changeAngles
Description Changes the angle range that defines the minimum and maximum positions of the motor
Parameters
  • float MIN
  • float MAX
MIN
the new angle which the servo will return to if applied with the minimum pulse width
  • Negative angular positions are valid
  • Angles can be any angular unit: degrees, radians, or other arbitrary (linear) scale
MAX
the new angle which the servo will return to if applied with the maximum pulse width
  • Negative angular positions are valid
  • Angles can be any angular unit: degrees, radians, or other arbitrary (linear) scale
Returns No return
isRunning()
Method isRunning
Description Checks to see if the Servo component is currently operational
Parameters None
Returns bool __running
__running A private boolean variable which evaluates to True if the PWM component is operational, or False if it is not

NeoPixels

class digital.NeoPixelShield
Class:

This class provides functionality for use of an Arduino NeoPixels shield on an RPiSoC through Python.

Example:

Create a NeoPixelShield object in the following way:

shield = NeoPixelShield()
Method __init__
Description Defines the register address for the striplight controller used by the NeoPixels, and it defines 140 colors as class attributes, named according to their standardized HTML and CSS names
Parameters None
Returns No return
Dim(DIM_LEVEL)
Method Dim
Description Preserves the color to be drawn to the shield, but dims the brightness. Effects take place immediately.
Parameters
  • int DIM_LEVEL
DIM_LEVEL
An integer between 0 and 4
  • 0 indicating full brightness, or minimum dim level
  • 4 indicating minimum brightness, or full dim level
Returns No return
DrawColumn(column, color)
Method DrawColumn
Description Fully draws the chosen column the desired color
Parameters
  • int column
  • int color
column
Column which will be fully drawn
  • valid between 0 and 7
color
A 24-bit number representative of a BRG value
  • BRG components are given equal weight, so 8-bits each
  • There are predefined colors inside of __init__(), which can be called as shield.[color name]; example: shield.Blue
Returns No return
DrawRow(row, color)
Method DrawRow
Description Fully draws the chosen row the desired color
Parameters
  • int row
  • int color
row
Row which will be fully drawn
  • valid between 0 and 4
color
A 24-bit number representative of a BRG value
  • BRG components are given equal weight, so 8-bits each
  • There are predefined colors inside of __init__(), which can be called as shield.[color name]; example: shield.Blue
Returns No return
RGB_toHex(RGB)
Method RGB_toHex
Description Converts RGB content to the needed BRG Hex value taken by the NeoPixelShield device
Parameters list or tuple RGB
RGB
A list or tuple containing three elements, each of which is limited to one byte (0-255)
  • The first element is the Red byte
  • The second element is the Green byte
  • The thirf element is the Blue byte
Returns int hex_val
hex_val A hex value which can be given to a NeoPixelShield object as a valid color
SetPixel(row, column, color)
Method SetPixel
Description Sets the given pixel at location (x,y) = (row, column), to a color defined by a 24 bit Blue-Red-Green (BRG) value (8-bits each)
Parameters
  • int row
  • int column
  • int color
row
Row which contains the desired pixel to be set
  • valid between 0 and 4
column
Column which contains the desired pixel to be set
  • valid between 0 and 7
color
A 24-bit number representative of a BRG value
  • BRG components are given equal weight, so 8-bits each
  • There are predefined colors inside of __init__(), which can be called as shield.[color name]; example: shield.Blue
Returns No return
Start()
Method Start
Description Powers up and enables the needed hardware for the NeoPixels component
Parameters None
Returns No return
Stop()
Method Stop
Description Powers down and disables the needed hardware for the NeoPixels component
Parameters None
Returns No return
Stripe(pixelnum, color, safety=False)
Method Stripe
Description Draws a line of length pixelnum of the stated color, starting from the first pixel, and extending as far as the 40th (last) pixel. It will wrap around rows
Parameters
  • int pixelnum
  • int color
pixelnum
Indicates how many pixels, starting with pixel (0,0), will be filled
  • valid between 1 and 40
color
A 24-bit number representative of a BRG value
  • BRG components are given equal weight, so 8-bits each
  • There are predefined colors inside of __init__(), which can be called as shield.[color name]; example: shield.Blue
Returns No return
isRunning()
Method isRunning
Description Checks to see if the NeoPixels display is currently powered up
Parameters None
Returns bool __running
__running A private boolean variable which evaluates to True if the NeoPixels display is running, or False if it is not

Ultrasonic Range Finding

class digital.rangeFinder(SIG, TRIGGER=None, DELAYus=10, TIMEOUTus=30000)
Class:

This class provides functionality for use of ultrasonic range finder devices that use standard GPIO pulse width measurement protocols

Example:

Define a rangeFinder object in the following way:

my_ranger = rangerFinder([SIG_PORT,SIG_PIN], [TRIG_PORT, TRIG_PIN])
Method __init__
Description Initializes an object by describing which pin the echo will be measured on. Optionally, provide a trigger pin if the ranger is a 4 or 5 pin form factor, also optionally provide a trigger pulse width and timeout value in milliseconds
Parameters
  • list SIG
Optional Parameters
  • list TRIGGER
  • int DELAYus
  • int TIMEOUTus
SIG
A list constructed as [PORT, PIN] which defines which exact pin will be used to communicate with the rangers signal/echo pin
  • PORT is the port on the RPiSoC connected to the rangers signal pin
  • PIN is the pin relative to that port
TRIGGER
A list constructed as [PORT, PIN] which defines which exact pin will be used to communicate with the rangers trigger pin
  • By default, if no argument is provided, it will assume the trigger pin is the same as the echo pin; this is true for 3-pin devices and so no argument is needed
  • PORT is the port on the RPiSoC connected to the rangers trigger pin
  • PIN is the pin relative to that port
DELAYus
The width of the trigger pulse, in microseconds, that will be sent from the TRIGGER pin, to signal the ranger to send a ping
  • This defaults as 10 microseconds, but most rangers are okay with much less
TIMEOUTus
The maximum length of time, in microseconds, that the RPiSoC will wait for a confirmed echo
  • If this time is exceeded, the ranger will immediately terminate its timing process and return the timeout as a response
  • This defaults as 30000 microseconds, which is equivalent to 30 ms, and is much longer than generally needed and so won’t usually need to be altered
  • Refer to your devices documentation for a more specific timeout choice
Returns No return
readCentimeters(sound=343.0, PRECISION=2)
Method readCentimeters
Description Uses readRaw to get a raw time value in microseconds, and then calculates the distance between the ranger and the pinged object in centimeters
Optional Parameters
  • float sound
  • int PRECISION
sound
The speed of sound which is used to calcuate the distance of the object detected by the ranger
  • Defaults to 343 m/s (approximate value based on room temperature of air)
  • Must be m/s
  • Modify this according to your environmental needs (different temperature/medium)
PRECISION
The number of decimal points to be included in the returned result
  • Defaults to 2
Returns float meters
meters The distance, in meters, between the ultrasonic ranger and the pinged object
readInches(sound=343.0, PRECISION=2)
Method readInches
Description Uses readRaw to get a raw time value in microseconds, and then calculates the distance between the ranger and the pinged object in inches
Optional Parameters
  • float sound
  • int PRECISION
sound
The speed of sound which is used to calcuate the distance of the object detected by the ranger
  • Defaults to 343 m/s (approximate value based on room temperature of air)
  • Must be m/s
  • Modify this according to your environmental needs (different temperature/medium)
PRECISION
The number of decimal points to be included in the returned result
  • Defaults to 2
Returns float meters
meters The distance, in meters, between the ultrasonic ranger and the pinged object
readMeters(sound=343.0, PRECISION=2)
Method readMeters
Description Uses readRaw to get a raw time value in microseconds, and then calculates the distance between the ranger and the pinged object in meters
Optional Parameters
  • float sound
  • int PRECISION
sound
The speed of sound which is used to calcuate the distance of the object detected by the ranger
  • Defaults to 343 m/s (approximate value based on room temperature of air)
  • Must be m/s
  • Modify this according to your environmental needs (different temperature/medium)
PRECISION
The number of decimal points to be included in the returned result
  • Defaults to 2
Returns float meters
meters The distance, in meters, between the ultrasonic ranger and the pinged object
readRaw()
Method readRaw
Description
  • Gets a raw value from the RPiSoC, which is representative of how many microseconds the rangers echo pin was held high
  • It will trigger the ranger by sending a short pulse, the length of which was defined upon construction of the object
  • The result will be measured on the desired signal pin, and stop measuring when a timeout is reached
Parameters None
Returns int reading
reading
  • The length of time, in microseconds, that it took for the ping to echo back to the ultrasonic ranger
  • This value can be used to calculate distance to an object using the speed of sound
setDelay(delay_us)
Method setDelay
Description Sets the length of the trigger pulse, in microseconds, which will be used to tell the device to send out a ping
Parameters
  • int delay_us
delay_us
Amount of time, in microseconds, that the RPiSoC will hold its trigger pulse high
  • This is a 6 bit value, and so it must be between 0 and 63
Returns No return
Notes This is handled in __init__(), so it should only be called under unique circumstances
setTimeout(timeout_us)
Method setTimeout
Description Sets the timeout length in microseconds. If the RPiSoC is still waiting for a completed response after this amount of time, it will stop counting and immediately return the result
Parameters
  • int timeout_us
timeout_us
Amount of time, in microseconds, that the RPiSoC will wait for a completed response
  • This is a 16 bit value, and so it must be between 0 and 65535
Returns No return
Notes This is handled in __init__(), so it should only be called under unique circumstances

Table Of Contents

Previous topic

rpisoc.py

Next topic

analog.py

This Page