I have managed to do this with the Python RPIO library. I set the PWM up with a 1 uSec pulse, and loaded the entire IR code into memory, doing the 36khz modulation in software. Since this is using DMA, the waveform is pretty good. The one issue I am having is that it does take about 4 seconds to get 2 seconds of DMA buffer loaded into memory.
So, it is possible without too many issues. The code is not pretty, but does work :-)
out += [header[0]]
out += [header[1]]
for c in send:
if c == "1":
out += [one[0]]
out += [one[1]]
else:
out += [zero[0]]
out += [zero[1]]
out += [ptail]
#out += (chr(0xff) + chr(0xff))
# Pulses => Out
#print out
out2 = [0]
running = 0
for number in out:
running += number
out2 += [running]
# Running Pulses => Out
print out2
#for i in range(len(out2)/2):
# a = out2[i*2]
# b = out2[i*2+1]
pw = 1000000 / (36000 * 2)
print "PW %d" % (pw)
print time.time()
# Setup PWM and DMA channel 0
PWM.setup(pulse_incr_us=1)
PWM.init_channel(0, subcycle_time_us=2000000)
high = True
for a,b in pairwise(out2):
#print "%d %d %d" % (high, a, b)
if high:
#pulse = int (a / pw)
#PWM.add_channel_pulse(0, 17, a, pw)
pointer = a
while True:
pStart = pointer
pStop = pointer + pw
if pStop > b:
pStop = b
#print "End of Packet 1"
PWM.add_channel_pulse(0, 17, pStart, pStop-pStart)
pointer += pw * 2
if pointer > b: # was pStart > b; One too many cycles
#print "End of Packet 2"
break
high = not high
print time.time()
time.sleep (30)
# Stop PWM for specific GPIO on channel 0
PWM.clear_channel_gpio(0, 17)
# Shutdown all PWM and DMA activity
PWM.cleanup()