[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4678: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4680: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4681: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4682: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3815)
virt2real.ru • Просмотр темы - Как отключить прерывания?




 

Управляем чем угодно откуда угодно

Как отключить прерывания?

Обсуждение линуксовой части и софта на борту виртурилки

Как отключить прерывания?

Сообщение Serg » 19 июн 2014, 22:04

Установил прерывание на GPIO3 - все работает.
[root@virt2real ~]# cat /proc/gpio-event/pins | grep GPIO
GPIO: 3 Edge: Both Debounce: 100 msec

Теперь надо отключить прерывание, а как это сделать не нашел. Пытаюсь перевести пин в режим "вывод", не помогает
echo "set gpio 3 input 0" > /dev/v2r_gpio
Прерывания все равно приходят:

[root@virt2real ~]# cat /dev/gpio-event
3 R 946694350.651771
3 F 946694350.752826

Я могу в программе анализировать, что пин "отключен", но хотелось бы чтобы прерывания просто не приходили пока я их опять явно не включу.
Serg
 
Сообщения: 121
Зарегистрирован: 07 сен 2013, 23:55

Re: Как отключить прерывания?

Сообщение Gol » 19 июн 2014, 22:11

Аватара пользователя
Gol
 
Сообщения: 507
Зарегистрирован: 17 фев 2012, 01:44
Откуда: Тула-Свободный-Щёкино-Тула-Москва

Re: Как отключить прерывания?

Сообщение Serg » 19 июн 2014, 23:08

Спасибо за ответ! В вики или нет или проглядел...

Не хотел костыли в проге делать и каждый раз анализировать нужно мне это прерывание или нет.

Включение происходит так

echo "set gpio 3 input" > /dev/v2r_gpio
gpio-event 3:b:100

Пробовал минус и туда и туда пихать - ругается
[root@virt2real ~]# gpio-event -3:b:100
gpio-event: invalid option -- '3'

и так
echo "set gpio -3 input 0" > /dev/v2r_gpio
и так
[root@virt2real ~]# gpio-event 3:b:-

Прерывание все равно остается:
[root@virt2real ~]# cat /proc/gpio-event/pins
GPIO: 4 Edge: Both Debounce: 100 msec
GPIO: 5 Edge: Both Debounce: 100 msec
GPIO: 6 Edge: Both Debounce: 100 msec
GPIO: 3 Edge: Both Debounce: 0 msec
Serg
 
Сообщения: 121
Зарегистрирован: 07 сен 2013, 23:55

Re: Как отключить прерывания?

Сообщение Serg » 20 июн 2014, 01:36

UPD:
Исправленная программа, если кому-то понадобится, лежит тут http://www.atis-it.com/gpio-event.gz
Только надо gunzip-ом ее разжать сперва :)


Посмотрел исходники gpio-event
Командную строку с "-3" он воспринимает как опцию, минус все же. Поэтому считает, что "3" это опция и страшно ругается. В итоге заменил условие
gpio = strtol( gpioStr, &endPtr, 0 );
if ( gpio < 0 )
{
monitor.gpio = -gpio;
monitor.onOff = 0;
}
на
gpio = strtol( gpioStr, &endPtr, 0 );
if ( gpio > 999 )
{
monitor.gpio = gpio-1000;
gpio = gpio - 1000;
monitor.onOff = 0;
}
Скомпилировал, все работает. Единственное, что для удаления gpioX надо выполнить команду gpio-event 100X:b, например так:
[root@virt2real tevidi]# ./gpio-event 3:b
[root@virt2real tevidi]# cat /proc/gpio-event/pins
GPIO: 3 Edge: Both Debounce: 0 msec
[root@virt2real tevidi]# ./gpio-event 1003:b
[root@virt2real tevidi]# cat /proc/gpio-event/pins
[root@virt2real tevidi]#
Serg
 
Сообщения: 121
Зарегистрирован: 07 сен 2013, 23:55


Вернуться в Софт на виртурилке - SDK, Linux, Github, программирование (C/C++ и др.)

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 8

cron