{ "info": { "author": "Rosangela Canino-Koning", "author_email": "cypresscapsensei2c@voidptr.net", "bugtrack_url": null, "classifiers": [], "description": "Python Library for Cypress Capsense C8YC201xx over I2C\n======================================================\n\nGitHub: https://github.com/voidptr/CypressCapsense/tree/master/BeagleBone\n\nThis library requires the SMBus Linux i2c libray. It has been tested on the \nBeagleBone, but it should work on any linux system that supports I2C.\n\nFor example::\n\n import CypressCapsense_I2C\n\n ####### INITIAL SETUP - Only Do Once Per Device\n # sensorInit = CypressCapsense_I2C.CypressCapsense_I2C(0x00, debug=True)\n # sensorInit.setupDevice()\n # sensorInit.changeDeviceAddress(0x5D) # or whatever address you want\n ########################################################################\n\n\n ## this device has already been set up to use 0x5D as its address\n sensor = CypressCapsense_I2C.CypressCapsense_I2C(0x5D, debug=False)\n\n while(True):\n print \"0x%02X\" % sensor.fetchTouchStatus()\n\n\nExternal Documentation\n----------------------\n\nCypress Capsense CY8C201xx\n^^^^^^^^^^^^^^^^^^^^^^^^^^\nhttp://www.cypress.com/?id=1377\n\nCY8C201xx Register Reference Guide\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nhttp://www.cypress.com/?rID=14664\nhttp://www.cypress.com/?docID=41921\n\nCY8C201xx Datasheet\n^^^^^^^^^^^^^^^^^^^\nhttp://www.cypress.com/?rID=3912\nhttp://www.cypress.com/?docID=50758\n\nIdiosyncracies\n--------------\n\nI2C Address\n^^^^^^^^^^^\n\nThe CypressCapsense chip should be initialized with an address. Per\nhttp://www.cypress.com/?id=4&rID=29387, the default address is 0x00. If you are \ncommunicating with multiple Cypress Capsense devices, you must reset the \ndefault address using the *changeDeviceAddress* function in this library.\n\nTo confirm the value of your device's address, you may disconnect all other \nunknown devices except for the Capsense, and then run::\n\n $ i2cdetect -y -r 1\n\nSetting the address only needs to be done once.\n\nSetting the address works from Arduino devices, and probably from BeagleBone.\nPIC-based devices such as the ChipKit cannot be used to re-set the address \nhowever, because they reserve address 0x00 for some internal purpose.\n\nSensible Defaults\n^^^^^^^^^^^^^^^^^\n\nThis library includes a function to set sensible defaults on the Capsense\nchip (*setupDevice*). By default, it disables every gpio, turns on every \ntouch sensor, and sets the capacitive sensing thresholds to reasonable values.\n\nAll that said, these settings may no be sensible FOR YOU. The GPIO and \nCapSense settings may be set via SetupDevice, but to set different sensing \nthresholds, you must apply those settings yourself, using the *write* \nprimitive.\n\nTo set these values, you must place the device in SETUP_OPERATION_MODE, apply\nthe setting, then save, and restart::\n\n sensor.write(CSE_COMMAND_REG, SETUP_OPERATION_MODE);\n sensor.write(CypressCapsense_I2C.CSE_CS_OTH_SET, (CypressCapsense_I2C.CSE_OTH_SET_DISABLE_EXT_CAP | CypressCapsense_I2C.CSE_OTH_SET_SENSOR_RESET | CypressCapsense_I2C.CSE_OTH_SET_CLOCK_IMO))\n sensor.write(CypressCapsense_I2C.CSE_COMMAND_REG, CypressCapsense_I2C.STORE_CURRENT_CONFIGURATION_TO_NVM)\n sensor.write(CypressCapsense_I2C.CSE_COMMAND_REG, CypressCapsense_I2C.RECONFIGURE_DEVICE)\n sensor.write(CypressCapsense_I2C.CSE_COMMAND_REG, CypressCapsense_I2C.NORMAL_OPERATION_MODE)\n\n\nDevice setup only needs to be done once. The settings are stored in \nnon-volatile memory across restarts.\n\nSensing Reset\n^^^^^^^^^^^^^\n\nPer the manufacturer, the Capsense chip has mechanisms for adjusting to the \nenvironment over time to maintain the sensitivity and accuracy of the sensor.\n\nIn my board designs, however, I find whatever method they are using to be \nhilariously ineffective. Therefore, it is prudent to reset the board sensors\nperiodically. This may be done via the *reset* function::\n\n sensor.reset()\n\n\nBuffer Reading\n^^^^^^^^^^^^^^\n\nFor some reason, the Capsense device doesn't like responding to the buffer-\nreading capabilities in the SMBus library. The SMBus *read_byte(addr)* \nprimitive should do the trick, but it just hangs. So, that means that we can't \nread i2c buffers for the device configration and version number like we can\nin the Arduino driver.\n\nUltimately, this removes some debugging capability on the device, but for the\nbasic purpose of setting up and reading touch status, this library does the \ntrick. YMMV.\n\nTodo\n----\n\nSliders\n^^^^^^^\n\nSome Capsense chips have the capability to provide hardware-mediated sliders.\nUsers of this library are able to set the appropriate settings to use these\ncapabilities using the *write* primitive, but easy support during SetupDevice\nis not yet available. Stay tuned.\n\nPyDoc Output for CypressCapsense_I2C\n====================================\n\nHelp on module CypressCapsense_I2C::\n\n NAME\n CypressCapsense_I2C\n\n FILE\n /home/rosiec/CypressCapsense/BeagleBone/CypressCapsense_I2C.py\n\n CLASSES\n CypressCapsense_I2C\n \n class CypressCapsense_I2C\n | Methods defined here:\n | \n | __init__(self, address, busnum=-1, debug=False)\n | \n | changeDeviceAddress(self, new_address)\n | Parameters:\n | new_address - 7 Bit new device address to set\n | \n | Return Value:\n | none\n | \n | Errors:\n | none\n | \n | Description:\n | Sends command to device to unlock the address register, change the address\n | value, and re-lock the register.\n | \n | errMsg(self)\n | \n | fetchRawCounts(self, port, sensor)\n | Parameters:\n | port - Which port to query (0 or 1)\n | sensor - Which sensor to query (0-4)\n | \n | Return Value:\n | uint16_t - The raw count of the sensor.\n | \n | Errors:\n | If port > 1, or sensor > 4, return 0\n | \n | Description:\n | Fetches the raw count values from the sensor\n | \n | fetchTouchStatus(self)\n | Parameters:\n | \n | Return Value:\n | uint16_t - The status of the sensors. Each bit being on/off\n | \n | Errors:\n | none\n | \n | Description:\n | Fetches the touch true/false status from the sensors\n | \n | read(self, register_address)\n | Parameters:\n | register_address - 8 Bit register address designating where to read\n | \n | Return Value:\n | byte\n | \n | Errors:\n | none\n | \n | Description:\n | reads from the Capsense device\n | to get the data at that location and returns a byte\n | \n | readString(self, register_address, size)\n | Parameters:\n | register_address - 8 Bit register_address designating where to read\n | size - number of bytes to be read\n | \n | Return Value:\n | results\n | \n | Errors:\n | none\n | \n | Description:\n | reads consecutive bytes starting\n | from the given register_address\n | \n | reboot(self)\n | Reboot the board.\n | \n | reset(self)\n | Reset the touch sensors baseline value.\n | \n | setupDevice(self, gpio, capsense)\n | Parameters:\n | gpio - 16 bits to turn on as GPIO xxxBBBBBxxxBBBBB\n | (LSB 8 bits (LSB 5 bits) for GPIO0, MSB 8 bits (LSB 5 bits) GPIO1)\n | capsense - 16 bits to turn on as Capsense xxxBBBBBxxxBBBBB\n | (LSB 8 bits (LSB 5 bits) for GPIO0, MSB 8 bits (LSB 5 bits) GPIO1)\n | \n | Return Value:\n | none\n | \n | Errors:\n | If the pin settings conflict, return false\n | \n | Description:\n | Sets the pins to be used as capsense or GPIO on ports 0 and 1. A pin may not be\n | both capsense and gpio at the same time.\n | \n | write(self, register_address, data)\n | Parameters:\n | register_address - 8 Bit register_address designating were to write\n | data - Data to be written\n | \n | Return Value:\n | \n | Errors:\n | \n | Description:\n | writes a byte to specified register_address\n | \n | writeString(self, register_address, data)\n | Parameters:\n | register_address - 8 Bit register_address designating were to write\n | data - Data to be written\n | \n | Return Value:\n | none\n | \n | Errors:\n | none\n | \n | Description:\n | Writes a string of bytes to\n | specified register_address. If amount of bytes is above 64 the data\n | will automaticly be truncated.\n | \n | ----------------------------------------------------------------------\n | Data and other attributes defined here:\n | \n | CSE_COMMAND_REG = 160\n | \n | CSE_CS_ENABLE0 = 6\n | \n | CSE_CS_ENABLE1 = 7\n | \n | CSE_CS_FILTERING = 86\n | \n | CSE_CS_FINGER_TH_00 = 97\n | \n | CSE_CS_FINGER_TH_01 = 98\n | \n | CSE_CS_FINGER_TH_02 = 99\n | \n | CSE_CS_FINGER_TH_03 = 100\n | \n | CSE_CS_FINGER_TH_04 = 101\n | \n | CSE_CS_FINGER_TH_10 = 102\n | \n | CSE_CS_FINGER_TH_11 = 103\n | \n | CSE_CS_FINGER_TH_12 = 104\n | \n | CSE_CS_FINGER_TH_13 = 105\n | \n | CSE_CS_FINGER_TH_14 = 106\n | \n | CSE_CS_IDAC_00 = 107\n | \n | CSE_CS_IDAC_01 = 108\n | \n | CSE_CS_IDAC_02 = 109\n | \n | CSE_CS_IDAC_03 = 110\n | \n | CSE_CS_IDAC_04 = 111\n | \n | CSE_CS_IDAC_10 = 112\n | \n | CSE_CS_IDAC_11 = 113\n | \n | CSE_CS_IDAC_12 = 114\n | \n | CSE_CS_IDAC_13 = 115\n | \n | CSE_CS_IDAC_14 = 116\n | \n | CSE_CS_OTH_SET = 81\n | \n | CSE_CS_READ_BUTTON = 129\n | \n | CSE_CS_READ_RAWL = 135\n | \n | CSE_CS_READ_RAWM = 134\n | \n | CSE_CS_READ_STATUS0 = 136\n | \n | CSE_CS_READ_STATUS1 = 137\n | \n | CSE_CS_SCAN_POS_00 = 87\n | \n | CSE_CS_SCAN_POS_01 = 88\n | \n | CSE_CS_SCAN_POS_02 = 89\n | \n | CSE_CS_SCAN_POS_03 = 90\n | \n | CSE_CS_SCAN_POS_04 = 91\n | \n | CSE_CS_SCAN_POS_10 = 92\n | \n | CSE_CS_SCAN_POS_11 = 93\n | \n | CSE_CS_SCAN_POS_12 = 94\n | \n | CSE_CS_SCAN_POS_13 = 95\n | \n | CSE_CS_SCAN_POS_14 = 96\n | \n | CSE_GPIO_ENABLE0 = 8\n | \n | CSE_GPIO_ENABLE1 = 9\n | \n | CSE_I2C_ADDR_DM = 124\n | \n | CSE_I2C_DEV_LOCK = 121\n | \n | CSE_OTH_SET_CLOCK_IMO = 0\n | \n | CSE_OTH_SET_CLOCK_IMO2 = 32\n | \n | CSE_OTH_SET_CLOCK_IMO4 = 64\n | \n | CSE_OTH_SET_CLOCK_IMO8 = 96\n | \n | CSE_OTH_SET_DISABLE_EXT_CAP = 2\n | \n | CSE_OTH_SET_ENABLE_EXT_CAP = 2\n | \n | CSE_OTH_SET_NO_SENSOR_RESET = 0\n | \n | CSE_OTH_SET_SENSOR_RESET = 8\n | \n | CS_FILTERING_TOUCH_BASELINE_RESET = 64\n | \n | GET_FIRMWARE_REVISION = 0\n | \n | NORMAL_OPERATION_MODE = 7\n | \n | READ_DEVICE_CONFIGURATION = 5\n | \n | RECONFIGURE_DEVICE = 6\n | \n | SETUP_OPERATION_MODE = 8\n | \n | STORE_CURRENT_CONFIGURATION_TO_NVM = 1\n | \n | lock = [150, 90, 195]\n | \n | unlock = [60, 165, 105]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/voidptr/CypressCapsense/", "keywords": null, "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "CypressCapsense_I2C", "package_url": "https://pypi.org/project/CypressCapsense_I2C/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/CypressCapsense_I2C/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/voidptr/CypressCapsense/" }, "release_url": "https://pypi.org/project/CypressCapsense_I2C/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Python module for communicating with Cypress Capsense CY8C201xx capacitive touch sensors over I2C", "version": "0.1.0" }, "last_serial": 1364027, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b73c09eb13473b9abdd0f60816d6fdde", "sha256": "11985036d87b24038d895b9f596758a9637cadbe94cf892de3d687d1ea8c84a9" }, "downloads": -1, "filename": "CypressCapsense_I2C-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b73c09eb13473b9abdd0f60816d6fdde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8625, "upload_time": "2014-12-29T18:28:27", "url": "https://files.pythonhosted.org/packages/e2/3f/3759c8174fb86434f1fdd5243756d0d598e8b357101b552a0ad66ce3df18/CypressCapsense_I2C-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b73c09eb13473b9abdd0f60816d6fdde", "sha256": "11985036d87b24038d895b9f596758a9637cadbe94cf892de3d687d1ea8c84a9" }, "downloads": -1, "filename": "CypressCapsense_I2C-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b73c09eb13473b9abdd0f60816d6fdde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8625, "upload_time": "2014-12-29T18:28:27", "url": "https://files.pythonhosted.org/packages/e2/3f/3759c8174fb86434f1fdd5243756d0d598e8b357101b552a0ad66ce3df18/CypressCapsense_I2C-0.1.0.tar.gz" } ] }