MHVLib  20111011
An efficiency oriented runtime library for AVR microcontrollers
A:/eclipse/mhvlib/MHV_Display_Monochrome.h
Go to the documentation of this file.
00001 /* Copyright (c) 2011, Make, Hack, Void Inc
00002  * All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *  * Redistributions of source code must retain the above copyright
00007  *    notice, this list of conditions and the following disclaimer.
00008  *  * Redistributions in binary form must reproduce the above copyright
00009  *    notice, this list of conditions and the following disclaimer in the
00010  *    documentation and/or other materials provided with the distribution.
00011  *  * Neither the name of the Make, Hack, Void nor the
00012  *    names of its contributors may be used to endorse or promote products
00013  *    derived from this software without specific prior written permission.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00016  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00017  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00018  * DISCLAIMED. IN NO EVENT SHALL MAKE, HACK, VOID BE LIABLE FOR ANY
00019  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00020  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00021  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00022  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00023  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00024  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025  */
00026 
00027 #ifndef MHV_DISPLAY_MONOCHROME_H_
00028 #define MHV_DISPLAY_MONOCHROME_H_
00029 
00030 #include <inttypes.h>
00031 #include <avr/pgmspace.h>
00032 #include <MHV_Device_TX.h>
00033 #include <MHV_io.h>
00034 #include <MHV_Font.h>
00035 
00036 class MHV_Display_Monochrome : public MHV_Device_TX {
00037 protected:
00038         uint16_t                _colCount;
00039         uint16_t                _rowCount;
00040         int16_t                 _txOffset;
00041 
00042         bool writeChar(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00043                         uint8_t onValue, uint8_t offValue, char character);
00044         bool writeSeperator(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00045                         uint8_t onValue, uint8_t offValue);
00046         void runTxBuffers();
00047 
00048 public:
00049         MHV_Display_Monochrome(uint16_t colCount, uint16_t rowCount, MHV_RingBuffer *txBuffers);
00050         uint16_t getWidth();
00051         uint16_t getHeight();
00052         void clear(uint8_t value);
00053         bool writeString(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00054                         uint8_t onValue, uint8_t offValue, const char *string);
00055         bool writeString_P(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00056                         uint8_t onValue, uint8_t offValue, PGM_P string);
00057         bool writeBuffer(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00058                         uint8_t onValue, uint8_t offValue, const char *buffer, uint16_t length);
00059         bool writeBuffer_P(const MHV_FONT *font, int16_t *offsetX, int16_t offsetY,
00060                         uint8_t onValue, uint8_t offValue, PGM_P buffer, uint16_t length);
00061         bool txAnimation(const MHV_FONT *font, int16_t offsetY, uint8_t onValue, uint8_t offValue);
00062 
00063         virtual void setPixel(uint16_t row, uint16_t col, uint8_t value)=0;
00064         virtual uint8_t getPixel(uint16_t row, uint16_t col)=0;
00065 };
00066 
00067 #endif /* MHV_DISPLAY_MONOCHROME_H_ */