Voxl-IO questions (GPIO & i2c)
-
I have a few questions about the voxl-io library, and I would love if you could help me:
1.1. Missing ability to GPIO interrupt (or missing documentation?) 1.2. Missing ability to control of Pull Up/Down (Is the hardware exist to do so?, or missing documentation?) 1.3. Need clarification in the i2c api, can I write to a device without specifying a designated register? For example in the smbus linux library: (https://www.kernel.org/doc/html/latest/i2c/smbus-protocol.html) i2c_smbus_write_byte(...): Writes a single byte to a device i2c_smbus_write_byte_data(...): Writes a single byte to a designated register on the device -
Hi @amitmol ,
The VOXL is based on the snapdragon 820, built for smart phones, and has a bit less control than a microcontroller with configurability....
- Interrupt- not out of the box as far as I know
- pull up/down - this is a device tree modification likely, not something quick
- on this platform, we use voxl-io to send/receive the I2C commands to the sDSP, so it's what's exposed there presently only unless it's added later
-
We have example Python code in voxl-modem to control the B2B GPIO
## All GPIO pins need to be exported before they can be used # def gpio_export(num): subprocess.call("echo " + num + " > /sys/class/gpio/export", stderr=FNULL, shell=True) ## Each GPIO has to have its direction set prior to use # @param num pin number # @param direction 'in' or 'out' # def gpio_direction_map(num, direction): subprocess.call("echo " + direction + " > /sys/class/gpio/gpio" \ + num + "/direction", stderr=FNULL, shell=True) ## Set a value to an 'out' gpio # def set_gpio(num, value): subprocess.call("echo " + value + " > /sys/class/gpio/gpio" + num + "/value", stderr=FNULL, shell=True) ## Reads a GPIO pin # @apram pin # pin number # @return # integer value [0,1] def gpio_read_int(pin_int): gpio_file = '/sys/class/gpio/gpio' + str(pin_int) + '/value' value = subprocess.check_output(['cat', gpio_file]).strip() return int(value)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login