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 uint_fast8_t 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_FAST8_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 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* PERIPH_DAC_H */
uint_fast8_t dac_t
Define default DAC type identifier.
Definition: dac.h:67
void dac_set(dac_t line, uint16_t value)
Write a value onto DAC Device on a given Channel.
void dac_poweroff(dac_t line)
Disable the given DAC line.
int8_t dac_init(dac_t line)
Initialize the given DAC line.
void dac_poweron(dac_t line)
Enable the given DAC line.