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 
50 #ifndef PERIPH_DAC_H
51 #define PERIPH_DAC_H
52 
53 #include <stdint.h>
54 #include <limits.h>
55 
56 #include "periph_cpu.h"
57 #include "periph_conf.h"
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
66 #ifndef HAVE_DAC_T
67 typedef unsigned int dac_t;
68 #endif
69 
73 enum {
74  DAC_OK = 0,
75  DAC_NOLINE = -1
76 };
77 
81 #ifndef DAC_UNDEF
82 #define DAC_UNDEF (UINT_MAX)
83 #endif
84 
88 #ifndef DAC_LINE
89 #define DAC_LINE(x) (x)
90 #endif
91 
103 int8_t dac_init(dac_t line);
104 
116 void dac_set(dac_t line, uint16_t value);
117 
123 void dac_poweron(dac_t line);
124 
130 void dac_poweroff(dac_t line);
131 
132 
133 #ifdef __cplusplus
134 }
135 #endif
136 
137 #endif /* PERIPH_DAC_H */
138 
dac_set
void dac_set(dac_t line, uint16_t value)
Write a value onto DAC Device on a given Channel.
dac_init
int8_t dac_init(dac_t line)
Initialize the given DAC line.
dac_poweron
void dac_poweron(dac_t line)
Enable the given DAC line.
dac_poweroff
void dac_poweroff(dac_t line)
Disable the given DAC line.
dac_t
unsigned int dac_t
Define default DAC type identifier.
Definition: dac.h:67