WiPy Multi-threading

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
atinypuppy
Posts: 3
Joined: Fri Jun 23, 2017 6:36 pm

WiPy Multi-threading

Post by atinypuppy » Tue Jun 27, 2017 5:57 pm

I'm attempting to multi-thread data collection to get a better bandwidth. I am using the Timer micropython class. This code takes one data point into my array but doesn't loop like I wanted. Am I missing some piece of code? Does the way I setup my timer make sense?

[def _addData_():
global adcPin
global dataArray
global curPos, numPnts, countDown
dataArray[curPos] = adcPin()
curPos += 1
curPos %= numPnts #resets curPos
countDown -= 1

if countDown <1:
timChannel.irq(handler=None, trigger = Timer.TIMEOUT)

global tim
global timChannel
tim = Timer(0, mode = Timer.PERIODIC, width = 32)
timChannel = tim.channel(Timer.A | Timer.B, freq = freq)
timChannel.irq(handler = _addData_(), trigger = Timer.TIMEOUT)
time.sleep_ms(1000)
]

Post Reply