git-svn-id: svn+ssh://rtime.felk.cvut.cz/var/svn/eurobot/trunk/soft@135
78ed6b52-5822-0410-8084-
884f26da6e90
--- /dev/null
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ; while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd` ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+ @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
--- /dev/null
+# -*- makefile -*-
+
+bin_PROGRAMS = pwmtest
+
+pwmtest_SOURCES = pwmtest.c
+pwmtest_LIBS = boot_fn
--- /dev/null
+#include <stdio.h>
+#include <h8s2638h.h>
+#include <system_def.h>
+#include <boot_fn.h>
+
+int main()
+{
+ DEB_LED_INIT(); /* Init port with LEDs */
+
+ *SYS_MSTPCRD&=~MSTPCRD_PWMm;
+
+ *PWM_PWOCR2 =
+ PWOCR2_OE2Am | PWOCR2_OE2Bm | PWOCR2_OE2Cm |
+ PWOCR2_OE2Em | PWOCR2_OE2Fm | PWOCR2_OE2Gm; // switch on needed channels
+
+ unsigned cyr = CPU_SYS_HZ/20000; /* PWM freq */
+ if (cyr & PWBFR2A_DTxm) cyr = PWBFR2A_DTxm;
+ *PWM_PWCYR2 = cyr;
+
+ *PWM_PWCR2 = PWCR2_CSTm | PWCR2_CKS_F1; /* Start PWM timer, clock = phi/1 */
+
+ int i;
+ while (1) {
+ for (i=0; i<cyr; i++) {
+ *DIO_PEDR = (i>>3)&0xf;
+ *PWM_PWBFR2A = i;
+ *PWM_PWBFR2B = i;
+ *PWM_PWBFR2C = i;
+ FlWait(1000);
+ }
+ }
+
+ return 0;
+}
--- /dev/null
+../../app/pwmtest
\ No newline at end of file