Badge-Initialisierung komplett umgeschrieben, um neue pinconfig.h zu benutzen.
[hackover2013-badge-firmware.git] / drivers / displays / segment / as1115 / as1115.h
1 /**************************************************************************/
2 /*!
3 @file as1115.h
4 @author K. Townsend (microBuilder.eu)
5
6 @section LICENSE
7
8 Software License Agreement (BSD License)
9
10 Copyright (c) 2012, microBuilder SARL
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */
35 /**************************************************************************/
36
37 #ifndef _AS1115_H_
38 #define _AS1115_H_
39
40 #include "projectconfig.h"
41 #include "core/i2c/i2c.h"
42
43 #define AS1115_ADDRESS (0x00 << 1)
44 #define AS1115_SUBADDRESS (0x03 << 1)
45 #define AS1115_READBIT (0x01)
46
47 // Individual digit registers
48 #define AS1115_DIGIT0 (0x01)
49 #define AS1115_DIGIT1 (0x02)
50 #define AS1115_DIGIT2 (0x03)
51 #define AS1115_DIGIT3 (0x04)
52 #define AS1115_DIGIT4 (0x05)
53 #define AS1115_DIGIT5 (0x06)
54 #define AS1115_DIGIT6 (0x07)
55 #define AS1115_DIGIT7 (0x08)
56
57 // Command registers
58 #define AS1115_DECODEMODE (0x09)
59 #define AS1115_INTENSITY (0x0A)
60 #define AS1115_SCANLIMIT (0x0B)
61 #define AS1115_SHUTDOWN (0x0C)
62 #define AS1115_SELFADDR (0x2D)
63 #define AS1115_FEATURE (0x0E)
64 #define AS1115_DISPTEST (0x0F)
65
66 // Bit definitions for AS1115_FEATURE
67 #define AS1115_FEATURE_CLOCKENABLE (0x01) // 0 = Internal oscillator, 1 = Use pin CLK for sys clock input
68 #define AS1115_FEATURE_RESETREGISTERS (0x02) // 0 = reset disabled, 1 = reset all ctrl registers to default state except function register
69 #define AS1115_FEATURE_DECODESEL (0x04) // 0 = Enable BCD decoding, 1 = HEX decoding
70 #define AS1115_FEATURE_BLINKENABLE (0x10) // 0 = Disable blinking, 1 = Enable blinking
71 #define AS1115_FEATURE_BLINKFREQSEL (0x20) // 0 = 0.5s+0.5s on/off, 1 = 1s+1s on/off
72 #define AS1115_FEATURE_SYNC (0x40) // Syncs blinking on rising edge of pin LD/CS
73 #define AS1115_FEATURE_BLINKSTART (0x80) // 0 = blinking starts off, 1 = blinking starts on
74
75 typedef enum
76 {
77 AS1115_ERROR_OK = 0, // Everything executed normally
78 AS1115_ERROR_I2CINIT, // Unable to initialise I2C
79 AS1115_ERROR_I2CBUSY, // I2C already in use
80 AS1115_ERROR_UNEXPECTEDRESPONSE, // Didn't get 0x80 after AS1115_DISPTEST
81 AS1115_ERROR_LAST
82 }
83 as1115Error_t;
84
85 as1115Error_t as1115Init(void);
86 as1115Error_t as1115Test(void);
87 as1115Error_t as1115SetDecodeMode(uint8_t x);
88 as1115Error_t as1115SetBrightness(uint8_t x);
89 as1115Error_t as1115SetFeature(uint8_t feature);
90 as1115Error_t as1115WriteBuffer(uint8_t *buffer);
91
92 #endif
93
94
This page took 0.05426 seconds and 5 git commands to generate.