--- /dev/null
+/**
+ * HPL interface to the M16c62p D/A converers.
+ *
+ * @author Henrik Makitaavola <henrik.makitaavola@gmail.com>
+ */
+
+interface HplM16c62pDac {
+ /**
+ * Sets the D/A value.
+ * @param value The new D/A value
+ */
+ async command void setValue(uint8_t value);
+
+ /**
+ * Reads the current D/A value.
+ * @return D/A value
+ */
+ async command uint8_t getValue();
+
+ /**
+ * Enables the D/A converter.
+ */
+ async command void enable();
+
+ /**
+ * Disables the D/A converter.
+ */
+ async command void disable();
+
+ /**
+ * Checks the state of the D/A converter.
+ * @return TRUE if the D/A converter is enabled.
+ */
+ async command bool isEnabled();
+}
--- /dev/null
+/**
+ * HPL for the M16c62p D/A conversion susbsystem.
+ *
+ * @author Henrik Makitaavola <henrik.makitaavola@gmail.com>
+ */
+
+configuration HplM16c62pDacC {
+ provides interface HplM16c62pDac as Dac0;
+ provides interface HplM16c62pDac as Dac1;
+}
+implementation {
+ components new HplM16c62pDacP(&DA0, 0) as Dac0_,
+ new HplM16c62pDacP(&DA1, 1) as Dac1_;
+
+ Dac0 = Dac0_;
+ Dac1 = Dac1_;
+}
--- /dev/null
+/**
+ * HPL for the M16c62p A/D conversion susbsystem.
+ *
+ * @author Fan Zhang <fanzha@ltu.se>
+ *
+ */
+
+generic module HplM16c62pDacP(uint16_t da_addr,
+ uint8_t da_num)
+{
+ provides interface HplM16c62pDac;
+}
+implementation
+{
+#define da (*TCAST(volatile uint8_t* ONE, da_addr))
+
+ async command void HplM16c62pDac.setValue(uint8_t value)
+ {
+ da = value;
+ }
+
+ async command uint8_t HplM16c62pDac.getValue()
+ {
+ return da;
+ }
+
+ async command void HplM16c62pDac.enable()
+ {
+ SET_BIT(DACON.BYTE, da_num);
+ }
+
+ async command void HplM16c62pDac.disable()
+ {
+ CLR_BIT(DACON.BYTE, da_num);
+ }
+
+ async command bool HplM16c62pDac.isEnabled()
+ {
+ return (READ_BIT(DACON.BYTE, da_num) ? true : false);
+ }
+}
%T/chips/m16c62p
%T/chips/m16c62p/control
%T/chips/m16c62p/adc
+ %T/chips/m16c62p/dac
%T/chips/m16c62p/pins
%T/chips/m16c62p/timer
%T/chips/m16c62p/uart