5. API

5.1. DesignSpark.Pmod.AD1

Interface for PmodAD1 module (AD7476A).

Note

Only a single channel (A1) is supported at present due to the way that SPI is configured.

class DesignSpark.Pmod.AD1.PmodAD1(DSPMod6)[source]
cleanup()[source]
readA1()[source]
readA1Volts()[source]

5.2. DesignSpark.Pmod.Error

exception DesignSpark.Pmod.Error.Error[source]

Bases: exceptions.Exception

Base class for exceptions in this library.

exception DesignSpark.Pmod.Error.incorrectModuleName[source]

Bases: DesignSpark.Pmod.Error.Error

Exception raised when the module name given does not exist in the module map.

exception DesignSpark.Pmod.Error.incorrectPortName[source]

Bases: DesignSpark.Pmod.Error.Error

Exception raised when the port name given does not exist in the port map.

exception DesignSpark.Pmod.Error.portCapabilityConflict[source]

Bases: DesignSpark.Pmod.Error.Error

Exception raised when the port is already using shared GPIO pins.

exception DesignSpark.Pmod.Error.portCapabilitySupport[source]

Bases: DesignSpark.Pmod.Error.Error

Exception raised when a port does not support the module type.

exception DesignSpark.Pmod.Error.portInUse[source]

Bases: DesignSpark.Pmod.Error.Error

Exception raised when the port is already assigned.

5.3. DesignSpark.Pmod.HAT

Manages Pmod HAT port resources, enforcing correct usage and avoiding conflicts.

class DesignSpark.Pmod.HAT.DSPMod12(_portName)[source]
inUse()[source]
setUseModule(moduleName)[source]
class DesignSpark.Pmod.HAT.DSPMod6(_portName)[source]
inUse()[source]
setUseModule(moduleName)[source]
DesignSpark.Pmod.HAT.createPmod(moduleName, portName)[source]

5.4. DesignSpark.Pmod.HB3

Interface for PmodHB3 module.

class DesignSpark.Pmod.HB3.PmodHB3(DSPMod6)[source]
changeFrequency(freq)[source]
cleanup()[source]
forward(duty)[source]
reverse(duty)[source]
stop()[source]

5.5. DesignSpark.Pmod.ISNS20

Interface for PmodISNS20 module (ADC7476 + Allegro ACS722).

class DesignSpark.Pmod.ISNS20.PmodISNS20(DSPMod6)[source]
cleanup()[source]
readAmps()[source]
readMilliAmps()[source]

5.6. DesignSpark.Pmod.MIC3

Interface for PmodMIC3 (ADCS7476 + Knowles Acoustics SPA2410LR5H-B).

class DesignSpark.Pmod.MIC3.PmodMIC3(DSPMod6)[source]
MIC3_NO_BITS = 12
cleanup()[source]
dReference = 3.3
readIntegerValue()[source]
readPhysicalValue()[source]

5.7. DesignSpark.Pmod.OLEDrgb

Interface for PmodOLEDrgb module (ssd1331).

Note

Depends on luma.oled and luma.core.

class DesignSpark.Pmod.OLEDrgb.PmodOLEDrgb(DSPMod12)[source]
cleanup()[source]
getDevice()[source]
powerOff()[source]
powerOn()[source]

5.8. DesignSpark.Pmod.TC1

Interface for PmodTC1 module (MAX31855).

class DesignSpark.Pmod.TC1.PmodTC1(DSPMod6)[source]
cleanup()[source]
readCelcius()[source]
readError()[source]
readFarenheit()[source]
readInternal()[source]

5.9. DesignSpark.Pmod.ACL2

Interface for Pmod ACL2 module.

class DesignSpark.Pmod.ACL2.PmodACL2(DSPMod12)[source]
cleanup()[source]
getDeviceID()[source]
getPowerMode()[source]
getRawXYZT()[source]
getSensorStatus()[source]
getTemperature()[source]
getX()[source]
getXYZT()[source]
getY()[source]
getZ()[source]
setOutputRate(outRate)[source]
setPowerMode(PowerMode)[source]
setRange(newRange)[source]
softwareReset()[source]

5.10. DesignSpark.Pmod.GPS

Interface for PmodGPS

class DesignSpark.Pmod.GPS.MicropyGPS(local_offset=0, location_formatting='ddm')[source]

GPS NMEA Sentence Parser. Creates object that stores all relevant GPS data and statistics. Parses sentences one character at a time using update().

SENTENCE_LIMIT = 90
compass_direction()[source]

Determine a cardinal or inter-cardinal direction based on current course. :return: string

date_string(formatting='s_mdy', century='20')[source]

Creates a readable string of the current date. Can select between long format: Januray 1st, 2014 or two short formats: 11/01/2014 (MM/DD/YYYY) 01/11/2014 (DD/MM/YYYY) :param formatting: string ‘s_mdy’, ‘s_dmy’, or ‘long’ :param century: int delineating the century the GPS data is from (19 for 19XX, 20 for 20XX) :return: date_string string with long or short format date

gpgga()[source]

Parse Global Positioning System Fix Data (GGA) Sentence. Updates UTC timestamp, latitude, longitude, fix status, satellites in use, Horizontal Dilution of Precision (HDOP), altitude, geoid height and fix status

gpgll()[source]

Parse Geographic Latitude and Longitude (GLL)Sentence. Updates UTC timestamp, latitude, longitude, and fix status

gpgsa()[source]

Parse GNSS DOP and Active Satellites (GSA) sentence. Updates GPS fix type, list of satellites used in fix calculation, Position Dilution of Precision (PDOP), Horizontal Dilution of Precision (HDOP), Vertical Dilution of Precision, and fix status

gpgsv()[source]

Parse Satellites in View (GSV) sentence. Updates number of SV Sentences,the number of the last SV sentence parsed, and data on each satellite present in the sentence

gprmc()[source]

Parse Recommended Minimum Specific GPS/Transit data (RMC)Sentence. Updates UTC timestamp, latitude, longitude, Course, Speed, Date, and fix status

gpvtg()[source]

Parse Track Made Good and Ground Speed (VTG) Sentence. Updates speed and course

latitude

Format Latitude Data Correctly

latitude_string()[source]

Create a readable string of the current latitude data :return: string

longitude

Format Longitude Data Correctly

longitude_string()[source]

Create a readable string of the current longitude data :return: string

new_fix_time()[source]

Updates a high resolution counter with current time when fix is updated. Currently only triggered from GGA, GSA and RMC sentences

new_sentence()[source]

Adjust Object Flags in Preparation for a New Sentence

satellite_data_updated()[source]

Checks if the all the GSV sentences in a group have been read, making satellite data complete :return: boolean

satellites_visible()[source]

Returns a list of of the satellite PRNs currently visible to the receiver :return: list

speed_string(unit='kph')[source]

Creates a readable string of the current speed data in one of three units :param unit: string of ‘kph’,’mph, or ‘knot’ :return:

start_logging(target_file, mode='append')[source]

Create GPS data log object

stop_logging()[source]

Closes the log file handler and disables further logging

supported_sentences = {'GLGGA': <function gpgga>, 'GLGLL': <function gpgll>, 'GLGSA': <function gpgsa>, 'GLGSV': <function gpgsv>, 'GLRMC': <function gprmc>, 'GLVTG': <function gpvtg>, 'GNGGA': <function gpgga>, 'GNGLL': <function gpgll>, 'GNGSA': <function gpgsa>, 'GNRMC': <function gprmc>, 'GNVTG': <function gpvtg>, 'GPGGA': <function gpgga>, 'GPGLL': <function gpgll>, 'GPGSA': <function gpgsa>, 'GPGSV': <function gpgsv>, 'GPRMC': <function gprmc>, 'GPVTG': <function gpvtg>}
time_since_fix()[source]

Returns number of millisecond since the last sentence with a valid fix was parsed. Returns 0 if no fix has been found

update(new_char)[source]

Process a new input char and updates GPS object if necessary based on special characters (‘$’, ‘,’, ‘*’) Function builds a list of received string that are validate by CRC prior to parsing by the appropriate sentence function. Returns sentence type on successful parse, None otherwise

write_log(log_string)[source]

Attempts to write the last valid NMEA sentence character to the active file handler

class DesignSpark.Pmod.GPS.PmodGPS(DSPMod6)[source]
cleanup()[source]
getAltitude()[source]
getDate()[source]
getGPSLine()[source]
getGPSPosData()[source]
getHeading()[source]
getLatitude()[source]
getLongitude()[source]
getNumSats()[source]
getPDOP()[source]
getSatelliteData()[source]
getSatelliteInfo()[source]
getSpeedKM()[source]
getTime()[source]
getVisibleSatellite()[source]
gpsUpdate()[source]
isFixed()[source]

5.11. DesignSpark.Pmod.SWT

Interface for Pmod_SWT

class DesignSpark.Pmod.SWT.PmodSWT(DSPmod6)[source]
AllOff()[source]
AllOn()[source]
GetStatus(SW)[source]
GetSwitchPin(SW)[source]
cleanup()[source]

5.12. DesignSpark.Pmod.LS1

Interface for Pmod_LS1

class DesignSpark.Pmod.LS1.PmodLS1(DSPmod6)[source]
GetAllStatus()[source]
GetSensorPin(Sensor)[source]
GetStatus(SNS)[source]
cleanup()[source]

5.13. DesignSpark.Pmod.KYPD

Interface for Pmod_KYPD

class DesignSpark.Pmod.KYPD.PmodKYPD(DSPmod12)[source]
cleanup()[source]
getColRow()[source]
getKey()[source]
getKeyMap()[source]
setKeyMap(UsrKeyMap)[source]
setKeyMapDefault()[source]