Python wrapper for the candle (gs_usb) windows driver.
Project description
candle_driver
Python wrapper for the candle (gs_usb) windows driver which is published here.
Used to communicate with candleLight, CANable (with candleLight firmware) CAN-USB adapters.
Example usage
import candle_driver
# lists all available candle devices
devices = candle_driver.list_devices()
if not len(devices):
print('No candle devices found.')
exit()
print('Found {} candle devices.'.format(len(devices)))
# use first availabel device
device = devices[0]
print('Device path: {}'.format(device.path()))
print('Device name: {}'.format(device.name()))
print('Device channels: {}'.format(device.channel_count()))
# open device (blocks other processes from using it)
device.open()
print('Device timestamp: %d' % device.timestamp()) # in usec
# open first channel
ch = device.channel(0)
ch.set_bitrate(1000000)
# or
# ch.set_timings(prop_seg=1, phase_seg1=12, phase_seg2=2, sjw=1, brp=3)
# start receiving data
ch.start()
# normal frame
ch.write(10, b'abcdefgh')
# extended frame
ch.write(10235 | candle_driver.CANDLE_ID_EXTENDED, b'abcdefgh')
# wait 1000ms for data
try:
frame_type, can_id, can_data, extended, ts = ch.read(1000)
print('Received {} from ID {} at {}'.format(can_data, can_id, ts))
except TimeoutError:
print('CAN read timeout')
# close everything
ch.stop()
device.close()
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Windows C driver is licensed under the GPLv3 License - see the LICENSE file for details.
Acknowledgments
- Hubert Denkmair for the Windows C driver.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
candle_driver-0.1.2.tar.gz
(12.4 kB
view hashes)
Built Distributions
Close
Hashes for candle_driver-0.1.2-py3.7-win-amd64.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19a07cfde622dfddfb907ba86b735cb4666bafb4e445fd2ca15daa174c0dbbcb |
|
MD5 | 37384a4e4fe13d4a6939a0ca934378b9 |
|
BLAKE2b-256 | 6e649e89d040232b9219475e17af9c1fa3cb9af36228cff7a3bbf96edfcdf2f0 |
Close
Hashes for candle_driver-0.1.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25bab5d6db6f952d327dceae561e04bd472c408a368988cb7bf925f797efcc09 |
|
MD5 | 4425497bd97feae6e386de9d30b37f29 |
|
BLAKE2b-256 | 359febfdfd1468a2fb1fa13bbb8a0d307b578d7e1933e9535f5fb567b4ad9527 |