canonical / matter-pi-gpio-commander

Matter Raspberry Pi GPIO Commander - Turn your Pi into a Matter lighting device!
Apache License 2.0
94 stars 2 forks source link

Switch to C++ app #3

Closed farshidtz closed 1 year ago

farshidtz commented 1 year ago

Given the limitations in the Python SDK, such as the lack of ability to control the communication protocol, this PR switches to use the C++ SDK.

The application code is based on https://github.com/MonicaisHer/connectedhomeip/tree/lighting-app-rpi-gpio/examples/lighting-app/linux

Other changes:

To install from store:

sudo snap install matter-pi-gpio-commander --channel=latest/edge/cpp --devmode
farshidtz commented 1 year ago

The test app can't access the GPIO in confinement on UC:

$ sudo matter-pi-gpio-commander.test-blink
WiringPi pin: 8
wiringPiSetup: Unable to open /dev/mem or /dev/gpiomem: Permission denied.
  Aborting your program because if it can not access the GPIO
  hardware then it most certianly won't work
  Try running with sudo?

We may need to use the wiringPiSetupSys setup function instead which uses the /sys/class/gpio interface.

Moreover, I found that the wiringPi library has other setup modes which make use of BCM-GPIO and physical numbering: http://wiringpi.com/reference/setup/

farshidtz commented 1 year ago

@farshidtz Thank you, looks good!

Thank you for your review. It is ready to merge, leaving https://github.com/MonicaisHer/matter-pi-gpio-commander/pull/3#issuecomment-1431093425 for future work.