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 
10 #pragma once
11 
52 #include <stdint.h>
53 #include <limits.h>
54 
55 #include "periph_cpu.h"
56 #include "periph_conf.h"
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
65 #ifndef HAVE_DAC_T
66 typedef uint_fast8_t dac_t;
67 #endif
68 
72 enum {
73  DAC_OK = 0,
74  DAC_NOLINE = -1
75 };
76 
80 #ifndef DAC_UNDEF
81 #define DAC_UNDEF (UINT_FAST8_MAX)
82 #endif
83 
87 #ifndef DAC_LINE
88 #define DAC_LINE(x) (x)
89 #endif
90 
102 int8_t dac_init(dac_t line);
103 
115 void dac_set(dac_t line, uint16_t value);
116 
122 void dac_poweron(dac_t line);
123 
129 void dac_poweroff(dac_t line);
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
uint_fast8_t dac_t
Define default DAC type identifier.
Definition: dac.h:66
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.