]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/include/drv/dac.h
Merge port and gpio definitions into one file in the DRV layer
[pes-rpp/rpp-lib.git] / rpp / include / drv / dac.h
index aad4b75aa435d78432e7a2297b8486d303fc98d6..1bbdfdf91a6901253767cb8eadab935d469e4920 100644 (file)
@@ -1,33 +1,33 @@
-/*
- * dac_spi.h
+/**
+ * RPP driver implementation for ADC header file.
  *
- *  Created on: 12.2.2013
- *      Author: Michal Horn
+ * @file adc.h
+ *
+ * @copyright Copyright (C) 2012-2013 Czech Technical University in Prague
+ *
+ * @author Michal Horn
+ * @author Carlos Jenkins <carlos@jenkins.co.cr>
  */
 
-#ifndef DAC_SPI_H_
-#define DAC_SPI_H_
 
-//#include "hal_port_def.h"
-#include "drv/drv.h"
+#ifndef __DRV_DAC_H
+#define __DRV_DAC_H
 
-#define DAC_PIN_NUM     4
-#define DAC1_INIT_VAL   0x2000
-#define DAC2_INIT_VAL   0xA000
-#define DAC3_INIT_VAL   0x2000
-#define DAC4_INIT_VAL   0xA000
+#include "drv/digital_io.h"
 
-#define DAC_PIN_ON      1
-#define DAC_PIN_OFF     0
 
-#define DAC_OA_MULT     5.6
-#define DAC_VREF        2.5
+/**
+ * Send SPI command to DAC.
+ *
+ * This function translates parameters into a command and sends it through SPI.
+ *
+ * @param[in] pin       The DAC pin number [0-3].
+ *
+ * @return SPI response if successful.
+ *          -1 if pin out of range.
+ *          -2 if value out of range.
+ */
+int drv_dac_spi_transfer(uint8_t pin, boolean_t enabled, uint16_t value);
 
-int dac_set_pin_voltage(uint8_t pin, uint32_t value);
-int dac_set_pin_on(uint8_t pin);
-int dac_set_pin_off(uint8_t pin);
-int dac_pin_is_on(uint8_t pin);
-int dac_get_pin_voltage(uint8_t pin);
-int dac_spi_transfer(uint8_t pin);
 
-#endif /* DAC_SPI_H_ */
+#endif /* __DRV_DAC_H */