/*
	DMAPWM3.C

	This program demonstrates how to use the DMA-driven PWM.
*/

#define RUNKERNEL 1
#use vdriver.lib
#use srtk.lib
#use eziopk23.lib

#funcchain _srtk_hightask _eioBrdAORf

#define DELAYCONST 0x1000

main() {
	auto unsigned dim;
	auto unsigned i;

	VdInit();
	_eioSetupAO1st();
	init_srtkernel();
	while (1) {
		for (dim = 2; dim <= 256; dim=dim*3/2) {
			eioBrdAO(0,dim);
			for (i = 0; i < DELAYCONST; ++i);
		}
		for (dim = 256; dim > 0; dim=dim*2/3) {
			eioBrdAO(0,dim);
			for (i = 0; i < DELAYCONST; ++i);
		}
	}
}