6 constexpr uint32_t CameraInterfaceGPIO::_gpios[ngpios];
8 CameraInterfaceGPIO::CameraInterfaceGPIO():
10 _trigger_invert(false),
18 _trigger_invert = (polarity == 0);
24 void CameraInterfaceGPIO::setup()
31 uint32_t gpio = _gpios[
_pins[i]];
32 _triggers[t++] = gpio;
33 px4_arch_configgpio(gpio);
34 px4_arch_gpiowrite(gpio,
false ^ _trigger_invert);
39 void CameraInterfaceGPIO::trigger(
bool trigger_on_true)
41 bool trigger_state = trigger_on_true ^ _trigger_invert;
43 for (
unsigned i = 0; i <
arraySize(_triggers); i++) {
45 if (_triggers[i] == 0) {
break; }
47 px4_arch_gpiowrite(_triggers[i], trigger_state);
54 PX4_INFO(
"GPIO trigger mode, pins enabled : [%d][%d][%d][%d][%d][%d], polarity : %s",
56 _trigger_invert ?
"ACTIVE_LOW" :
"ACTIVE_HIGH");
60 PX4_INFO(
"GPIO trigger mode, pins enabled : [%d][%d][%d][%d][%d], polarity : %s",
62 _trigger_invert ?
"ACTIVE_LOW" :
"ACTIVE_HIGH");
__EXPORT int param_get(param_t param, void *val)
Copy the value of a parameter.
int info()
Print a little info about the driver.
void get_pins()
get the hardware configuration
__EXPORT param_t param_find(const char *name)
Look up a parameter by name.
virtual void setup()
setup the interface