dac.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Simon Brummer
3  * 2015-2016 Freie Universit├Ąt Berlin
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
38 #ifndef PERIPH_DAC_H
39 #define PERIPH_DAC_H
40 
41 #include <stdint.h>
42 #include <limits.h>
43 
44 #include "periph_cpu.h"
45 #include "periph_conf.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
54 #ifndef HAVE_DAC_T
55 typedef unsigned int dac_t;
56 #endif
57 
61 enum {
62  DAC_OK = 0,
63  DAC_NOLINE = -1
64 };
65 
69 #ifndef DAC_UNDEF
70 #define DAC_UNDEF (UINT_MAX)
71 #endif
72 
76 #ifndef DAC_LINE
77 #define DAC_LINE(x) (x)
78 #endif
79 
91 int8_t dac_init(dac_t line);
92 
104 void dac_set(dac_t line, uint16_t value);
105 
111 void dac_poweron(dac_t line);
112 
118 void dac_poweroff(dac_t line);
119 
120 
121 #ifdef __cplusplus
122 }
123 #endif
124 
125 #endif /* PERIPH_DAC_H */
126 
void dac_set(dac_t line, uint16_t value)
Write a value onto DAC Device on a given Channel.
int8_t dac_init(dac_t line)
Initialize the given DAC line.
void dac_poweron(dac_t line)
Enable the given DAC line.
void dac_poweroff(dac_t line)
Disable the given DAC line.
unsigned int dac_t
Define default DAC type identifier.
Definition: dac.h:55