Skip to content

Commit

Permalink
Improved Linux GPIO Driver Using Chardev (#2943)
Browse files Browse the repository at this point in the history
* Linux GPIO Driver refactor WIP

* Initial new GPIO driver

* Fixing toolchain warning

* Adding GPIO interface

* Adding in more states

* Added interrupts to GPIO driver

* Fixing build errors

* Formatting GPIO driver

* Fix spelling

* Fixing config check

* Quality status

* Review fixes

* Clearing GPIO struct values

* Updating to new RawTime

* Fixing take -> now

* Fixing quality error

* Fixing second review comments

* Tested: read, write, interupt rising/falling/both

* Final review comment
  • Loading branch information
LeStarch authored Oct 14, 2024
1 parent 564cb57 commit b9ea1fd
Show file tree
Hide file tree
Showing 20 changed files with 637 additions and 1,089 deletions.
11 changes: 10 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ changeme
CHANNELID
CHANS
Chieu
CHIPINFO
CHK
CHNG
CIRCULARSTATE
Expand Down Expand Up @@ -284,6 +285,7 @@ EVENTARRAY
EVENTBOOL
EVENTID
eventname
eventflags
EVENTPRIMITIVE
evr
evt
Expand Down Expand Up @@ -366,6 +368,10 @@ Gorang
GPGGA
GPINT
gpio
gpiochip
gpioevent
gpiohandle
gpioline
Graphviz
grayscales
grnd
Expand All @@ -376,6 +382,7 @@ gtest
gtimeout
Guire
handcoded
handleflags
hardtoaccess
hashvalue
hdr
Expand Down Expand Up @@ -491,7 +498,10 @@ libiconv
LIBLOC
lic
lindent
LINEEVENT
LINEHANDLE
linelength
lineoffset
lineroo
listdir
Listst
Expand Down Expand Up @@ -882,7 +892,6 @@ subhist
subhistory
subseconds
subtargets
subtopologies
subtopology
suppr
suseconds
Expand Down
13 changes: 11 additions & 2 deletions Drv/GpioDriverPorts/GpioDriverPorts.fpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
module Drv {
enum GpioStatus {
OP_OK @< Operation succeeded
NOT_OPENED @< Pin was never opened
INVALID_MODE @< Operation not permitted with current configuration
UNKNOWN_ERROR @< An unknown error occurred
}
}

module Drv {

port GpioWrite(
$state: Fw.Logic
)
) -> GpioStatus

}

module Drv {

port GpioRead(
ref $state: Fw.Logic
)
) -> GpioStatus

}
9 changes: 9 additions & 0 deletions Drv/Interfaces/GpioInterface.fppi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

@ Port used to write to a GPIO pin
sync input port gpioWrite: Drv.GpioWrite

@ Port used to read from a GPIO pin
sync input port gpioRead: Drv.GpioRead

@ Port used to indicate transition on the GPIO pin
output port gpioInterrupt: Svc.Cycle
8 changes: 4 additions & 4 deletions Drv/LinuxGpioDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ endif()
if(FPRIME_USE_STUBBED_DRIVERS)
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver.fpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverComponentImplCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverComponentImplStub.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverStub.cpp"
)
register_fprime_module()
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver.fpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverComponentImplCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverComponentImpl.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriverCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver.cpp"
)
register_fprime_module()
endif()
Expand Down
62 changes: 0 additions & 62 deletions Drv/LinuxGpioDriver/Events.fppi

This file was deleted.

Loading

0 comments on commit b9ea1fd

Please sign in to comment.