Replies: 6 comments 23 replies
-
Tbh, I don't really care for the removal of the libgpiod dependency which (together with the c++ adapter) is about 60K bytes. It'd be nice to save them, but it means we have to deal with API changes, as it just so happens with V1 and V2 of the gpio character device APIs. If most chips have only a single gpio chip, I don't know, ours doesn't and just for debugging purpose I try to name all of them :-)
Anyhow, is the list above missing anything else for now? |
Beta Was this translation helpful? Give feedback.
-
easy:
three constants GPIOEVENT_REQUEST_* are defined there
|
Beta Was this translation helpful? Give feedback.
-
See, that's how priorities differ. I think event detection is nice, but we're just polling since we basically have modules either being plugged in (and booted) or not. No quick changes. The issue with event detection is not how to make it happen in the Linux gpio api itself, but those events need to be enqueued into the actual nodejs event loop. And there's nothing like "immediate reaction" to the event since nodejs has pretty hard rules in what order certain types of events are executed. |
Beta Was this translation helpful? Give feedback.
-
I would be happy to help with testing on a physical platform. I mentioned here that I am working on a RockChip board. I'd like to chime in and say I would prefer an interface where I can: const pin3 = new Pin(3); // Internally this would map to `new Line(new Chip(), n)`
pin3.requestOutputMode();
// which for me in the instance It was unclear to me at first how the chip number and line were retrieved, but then found this tool's use: That was how I found out how to get: const chip = new Chip(1);
const line = new Line(chip, 31); When I landed on Radxa's doc's for their GPIO I didn't see at first how to get that info, when they were giving the GPIO numbers |
Beta Was this translation helpful? Give feedback.
-
I think the issue is, that GPIO numbers aren't just assigned in a linear fashion to pin numbers. Many SOCs have specific GPIO numbers assigned to specific pads and specific chips. The most obvious example is a Raspberry Pi, where the pin numbers (on the header) have absolutely nothing to do with the GPIO numbers (see https://pi4j.com/assets/getting-started/pins/headerpins_in_header.png). But this is true for almost all ARM SOCs. On an i.MX6, as another example, the GPIO number is calculated as 32 + 4 = 36 (meaning port 2/chip1, pin 4/line4). That said, they always assume 32 lines per chip (https://www.digi.com/resources/documentation/digidocs/90001546/reference/bsp/cc6/r_general_purpose_input_output.htm#:~:text=LinuxGPIO_num%20%3D%20(%3Cimx6_gpio_port%3E%20%2D%201)%20*%2032%20%2B%20%3Cimx6_gpio_pin%3E). I'm not sure this would hold true for every chip though. With the two above examples, the more complicated issue though, what would PIN mean to the user? Is it the header pin? Is it the GPIO number? Is it just a linearly increasing number? If so, how many lines to assume per chip? |
Beta Was this translation helpful? Give feedback.
-
Hi!
|
Beta Was this translation helpful? Give feedback.
-
@dmitrydvorkin, @sombriks let's move the discussion over here and start a collection of ideas :-)
Beta Was this translation helpful? Give feedback.
All reactions