use of com.jopdesign.io.OutPort in project jop by jop-devel.
the class Sound method main.
public static void main(String[] args) {
int time, off, val, idx;
SysDevice sys = DspioFactory.getDspioFactory().getSysDevice();
OutPort pwm = DspioFactory.getDspioFactory().getOutPort();
int[] samples = new int[16 * 4 * 1024];
val = 0;
for (int i = 0; i < 16 * 4 * 1024; ++i) {
// val += 149;
val += 1490;
if (val > 65535)
val = 0;
samples[i] = val >>> 6;
}
System.out.println("Period: " + PERIOD);
time = sys.cntInt;
val = 300;
time += 1000;
idx = 0;
for (; ; ) {
time += PERIOD;
++idx;
idx &= 0xffff;
val = 100 + samples[idx];
off = time + val;
sys.deadLine = time;
pwm.port = 3;
// some offset is needed - we have now a 1 offset
sys.deadLine = off;
// and a 1 phase offset. Is this ok?
pwm.port = 0;
}
}