本文整理汇总了Python中RPIO.PWM.is_channel_initialized方法的典型用法代码示例。如果您正苦于以下问题:Python PWM.is_channel_initialized方法的具体用法?Python PWM.is_channel_initialized怎么用?Python PWM.is_channel_initialized使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RPIO.PWM
的用法示例。
在下文中一共展示了PWM.is_channel_initialized方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: find_DMA_available
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import is_channel_initialized [as 别名]
def find_DMA_available():
import RPIO.PWM as PWM
result = None
for i in range(0,15):
if not PWM.is_channel_initialized(i):
result = i
break
if result == None:
raise ValueError('No DMA channel available, error')
return result
示例2: __init__
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import is_channel_initialized [as 别名]
def __init__(self, redPin, greenPin, bluePin):
if not PWM.is_setup():
PWM.setup(10,1)
self.pins = [redPin, greenPin, bluePin]
a=2
while PWM.is_channel_initialized(a):
a=a+1
self.channels = [a, a+1, a+2]
for channel_num in self.channels:
PWM.init_channel(channel_num, subcycle_time_us=10000)
示例3: __init__
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import is_channel_initialized [as 别名]
def __init__(self, channel=PWM_CHANNEL, pin=PWM_PIN, subcycle=PWM_SUBCYCLE, unit=PWM_UNIT):
self._channel = channel
self._pin = pin
self._subcycle = subcycle
self._range = int(subcycle / unit)
if not PWM.is_setup():
PWM.set_loglevel(PWM.LOG_LEVEL_ERRORS)
PWM.setup()
# work around bug in RPIO.PWM, https://www.raspberrypi.org/forums/viewtopic.php?p=509549
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
if not PWM.is_channel_initialized(self._channel):
PWM.init_channel(self._channel, self._subcycle)
示例4: getFreePwmChannel
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import is_channel_initialized [as 别名]
def getFreePwmChannel(self):
availableDmaChannels = {9, 10, 11}
try:
for channel in availableDmaChannels:
if PWM.is_channel_initialized(channel) == 0:
return channel
raise Exception("No uninitialized DMA channel available.")
except Exception, exception:
print exception
exit(0)
示例5: granularity
# 需要导入模块: from RPIO import PWM [as 别名]
# 或者: from RPIO.PWM import is_channel_initialized [as 别名]
#set della granularity (è il default durante l'inizializzazione tic di incremento in microsecondi)
PWM.setup(granularity, 0) #default: pulse_incr_us=10, delay_hw=0
for i in canale_dma:
PWM.init_channel(i, subcycle_time[i]) #canale DMA con tempo subcycle
# PWM.setup(granularity, 0) #default: pulse_incr_us=10, delay_hw=0
#aggiungo un impulso nel canale DMA all'interno di ogni subcycle per ogni GPIO
#POSSO ANCHE NON AGGIUNGERE NIENTE :-), VOLENDO.
PWM.add_channel_pulse(i, gpio_port[i], pulse_start[i], pulse_width[i])
#setup per output su GPIO
for i in gpio_port:
RPIO.setup(i, RPIO.OUT)
for i in canale_dma:
PWM.print_channel(i)
if PWM.is_channel_initialized(i):
print ("canale ", i, " inizializzato")
else:
print ("canale ", i, " NON inizializzato")
if PWM.is_setup():
print ("setup canale ", i, "chiamato")
else:
print ("setup canale ", i, " NON chiamato")
try:
while True:
# LED per vedere se tutto funziona
for t in led_time:
for i in gpio_port:
RPIO.output(i, RPIO.HIGH)
sleep(t)