2 * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
3 * Copyright (c) 2014 Intel Corporation.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #define SEG_A 0b00000001
31 #define SEG_B 0b00000010
32 #define SEG_C 0b00000100
33 #define SEG_D 0b00001000
34 #define SEG_E 0b00010000
35 #define SEG_F 0b00100000
36 #define SEG_G 0b01000000
38 #define TM1637_I2C_COMM1 0x40
39 #define TM1637_I2C_COMM2 0xC0
40 #define TM1637_I2C_COMM3 0x80
42 #define PULSE_LENGTH 50
50 * @brief C++ API for Seven segments screen
52 * This file defines the TM1637 C++ interface for lib4digitdisplay
54 * @snippet 4digitdisplay.cxx Interesting
68 * Instanciates a TM1637 object
71 * @param dcki clock pin
73 TM1637 (uint8_t di, uint8_t dcki);
75 * TM1637 object destructor, this will close all used Gpio
81 * Set the brightness of the seven segment display
83 * @param level The brightness level of leds
85 maa_result_t setBrightness (uint8_t level);
88 * Set the the segment screen data and number of segments
90 * @param segments[] data to write on the segments, each elemnt
92 * @param length number of elements in segments array
93 * @param pos data writing offset
95 maa_result_t setSegments (const uint8_t segments[], uint8_t length = 4, uint8_t pos = 0);
98 * Write message on the screen.
100 * @param msg The message to be written on the sreen
102 maa_result_t write (std::string msg);
105 * Return name of the component
113 maa_result_t start();
115 maa_result_t writeByte (uint8_t value);
116 maa_result_t pinMode (maa_gpio_context ctx, gpio_dir_t mode);
118 maa_gpio_context m_clkPinCtx;
119 maa_gpio_context m_dataPinCtx;
122 uint8_t m_brightness;