.\" $NetBSD: mcp48x1dac.4,v 1.2 2015/08/23 20:07:16 wiz Exp $
.\"
.\" Copyright (c) 2015 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Radoslaw Kujawa.
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Frank Wille.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd August 23, 2015
.Dt MCP48X1DAC 4
.Os
.Sh NAME
.Nm mcp48x1dac
.Nd Microchip 48x1 digital to analog converter
.Sh SYNOPSIS
.Cd "mcp48x1dac* at spi? slave ? flags N"
.Sh DESCRIPTION
The
.Nm
driver supports the MCP48x1 family of digital to analog converters.
The digital
values to be converted to analog signal are passed through the
.Xr sysctl 8
node.
.Pp
The driver reports the current voltage output on the chip's DAC channel
through the
.Xr envsys 4
API.
It calculates these values assuming that internal 2.048V reference voltage
.Li ( Vref )
is used.
.Pp
The following table shows the supported chips.
The type of the chip can be selected with the
.Ar flags
argument in the config file.
.Bl -column "Designation" "Resolution" "flags" -offset indent
.It Sy "Designation" Ta Sy "Resolution" Ta Sy "flags"
.It Li "MCP4801" Ta "8 bits" Ta "0"
.It Li "MCP4811" Ta "10 bits" Ta "1"
.It Li "MCP4821" Ta "12 bits" Ta "2"
.El
.Sh SYSCTL VARIABLES
The following
.Xr sysctl 3
variables are provided:
.Bl -tag -width indent
.It machdep.mcp48x1dac0.data
Defines digital data to be converted into analog signal.
This value is interpreted literally and sent to the DAC without any conversion.
Refer to the chip datasheet for more information.
.It machdep.mcp48x1dac0.gain
When set to 1 it enables 2x output gain on the DAC channel.
The default value is 0.
.El
.Sh SEE ALSO
.Xr envsys 4 ,
.Xr spi 4 ,
.Xr sysctl 8
.Rs
.%T MCP4801/4811/4821 8/10/12-Bit Voltage Output Digital-to-Analog Converter \
with Internal VREF and SPI Interface Data Sheet
.Re
.Sh HISTORY
The
.Nm
driver first appeared in
.Nx 7.0 .
.Sh AUTHORS
.An -nosplit
The
.Nm
driver was written by
.An Radoslaw Kujawa .
.Pp
This man page is based on
.Xr mcp3kadc 4
page by
.An Frank Wille .
.Sh BUGS
There are bugs.