Orignal AVR Tiny USI Based I2C slave Charlieplexing 7SEG LED Driver.

Dependents:   My7SEG_test

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers My7SEG.h Source File

My7SEG.h

00001 /**
00002  *****************************************************************************
00003  * File Name    : My7SEG.h
00004  *
00005  * Title        : ORGINAL I2C LCD Display Claass Header File
00006  * Revision     : 0.1
00007  * Notes        :
00008  * Target Board : mbed NXP LPC1768, mbed LPC1114FN28  etc
00009  * Tool Chain   : ????
00010  *
00011  * Revision History:
00012  * When         Who         Description of change
00013  * -----------  ----------- -----------------------
00014  * 2013/12/06   Hiroshi M   init
00015  *****************************************************************************
00016  *
00017  * Copyright (C) 2013 Hiroshi M, MIT License
00018  *
00019  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00020  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00021  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00022  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00023  * furnished to do so, subject to the following conditions:
00024  *
00025  * The above copyright notice and this permission notice shall be included in all copies or
00026  * substantial portions of the Software.
00027  *
00028  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00029  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00030  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00031  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00032  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00033  *
00034  **/
00035 
00036 #ifndef __My7SEG_H_
00037 #define __My7SEG_H_
00038 
00039 /* Includes ----------------------------------------------------------------- */
00040 #include "mbed.h"
00041 /* typedef ------------------------------------------------------------------ */
00042 
00043 /* define ------------------------------------------------------------------- */
00044 #define ESC             0x1B
00045 #define I2C_ADDR_MY7SEG  0x33
00046 #define _i2cSUCCESS     0
00047 #define _i2cFAILURE     1
00048 
00049 /* macro -------------------------------------------------------------------- */
00050 /* variables ---------------------------------------------------------------- */
00051 /* class -------------------------------------------------------------------- */
00052 class My7SEG
00053 {
00054 private:
00055     static const int i2c_addr = I2C_ADDR_MY7SEG << 1;
00056     static const int i2c_bit_wait_us = 20;
00057     static const int i2c_command_wait_ms = 4;
00058 
00059     I2C *_i2c;
00060     int writeBytes(const char *data, int length, bool repeated=false);
00061 
00062 protected:
00063 
00064 
00065 public:
00066     My7SEG(I2C *i2c);
00067 
00068     int clear(void);
00069     int shift_left(void);
00070     int shift_right(void);
00071     int rotato_left(void);
00072     int rotato_right(void);
00073     int printChar(char c);
00074     int printPosChar(int pos, char chr);
00075     int printStr(const char *s);
00076 
00077 };
00078 
00079 #endif /* __My7SEG_H_ */