         var bufferPos: UInt32 = 31
 
         for byte in data {
+            //TODO: Cut at dataLength
+
             // For each bit of the output, convert in signal bits
             for i in (0...7).reversed() {
                 // Obtain the bit set that will be saved in appended to output, one bit at a time


        for idx in 0..<stream.count {
            printBinary(stream[idx])
            pwm_raw[idx] = UInt(stream[idx])
        }

        // Wait for any previous DMA operation to complete.


        guard let mailbox = mailbox else {fatalError("Could allocate mailbox.")}

        dmaCallbackPointer = mailbox.baseVirtualAddress.assumingMemoryBound(to: DMACallback.self)
        pwmRawPointer = (mailbox.baseVirtualAddress + MemoryLayout<DMACallback>.stride).assumingMemoryBound(to: UInt.self)

        // Fill PWM buffer with zeros
        let rows = dataSize / MemoryLayout<UInt>.stride
        for pos in 0..<rows {
            pwmRawPointer.advanced(by: pos).pointee = 0
        }

        // Stop PWM and clock
        pwmBasePointer.pointee = 0
