-
Notifications
You must be signed in to change notification settings - Fork 13.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Driver: Refactor MCP23009 GPIO expander into uORB driver #21466
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,8 +250,8 @@ | |
#define GPIO_VDD_3V3_SD_CARD_EN /* PC13 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTC|GPIO_PIN13) | ||
|
||
/* MCP23009 GPIO expander */ | ||
#define BOARD_GPIO_VDD_5V_COMP_VALID "/dev/gpin4" | ||
#define BOARD_GPIO_VDD_5V_CAN1_GPS1_VALID "/dev/gpin5" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, well, well… I was wondering why my driver worked in firmware_private, but not in upstream. Turns out, the pins are actually registered at This was working when the driver was added (e2337a3), but since then NuttX changed the format string to generic So since then, apparently nobody ever noticed this stopped working… 🫠 We should be careful when we upgrade NuttX in firmware_private. |
||
#define BOARD_GPIO_VDD_5V_COMP_VALID "/dev/gpio4" | ||
#define BOARD_GPIO_VDD_5V_CAN1_GPS1_VALID "/dev/gpio5" | ||
|
||
/* Spare GPIO */ | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# GPIO configuration | ||
|
||
uint64 timestamp # time since system start (microseconds) | ||
uint32 device_id # Device id | ||
|
||
uint32 mask # Pin mask | ||
uint32 state # Initial pin output state | ||
|
||
# Configuration Mask | ||
# Bit 0-3: Direction: 0=Input, 1=Output | ||
# Bit 4-7: Input Config: 0=Floating, 1=PullUp, 2=PullDown | ||
# Bit 8-12: Output Config: 0=PushPull, 1=OpenDrain | ||
# Bit 13-31: Reserved | ||
uint32 INPUT = 0 # 0x0000 | ||
uint32 OUTPUT = 1 # 0x0001 | ||
uint32 PULLUP = 16 # 0x0010 | ||
uint32 PULLDOWN = 32 # 0x0020 | ||
uint32 OPENDRAIN = 256 # 0x0100 | ||
|
||
uint32 INPUT_FLOATING = 0 # 0x0000 | ||
uint32 INPUT_PULLUP = 16 # 0x0010 | ||
uint32 INPUT_PULLDOWN = 32 # 0x0020 | ||
|
||
uint32 OUTPUT_PUSHPULL = 0 # 0x0000 | ||
uint32 OUTPUT_OPENDRAIN = 256 # 0x0100 | ||
uint32 OUTPUT_OPENDRAIN_PULLUP = 272 # 0x0110 | ||
|
||
uint32 config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# GPIO mask and state | ||
|
||
uint64 timestamp # time since system start (microseconds) | ||
uint32 device_id # Device id | ||
|
||
uint32 state # pin state mask |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# GPIO mask and state | ||
|
||
uint64 timestamp # time since system start (microseconds) | ||
uint32 device_id # Device id | ||
|
||
uint32 mask # pin mask | ||
uint32 state # pin state mask |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Request GPIO mask to be read | ||
|
||
uint64 timestamp # time since system start (microseconds) | ||
uint32 device_id # Device id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is reading the pin every 10ms too much? The ADC tasks queries this data every 10ms, but since it's async now, the data may be 20ms delayed in the worst case (probably even more with prioritized scheduling).