Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
u8g_dev_flipdisc_2x7.c
00001 /* 00002 00003 u8g_dev_flipdisc.c 00004 00005 1-Bit (BW) Driver for flip disc matrix 00006 2x 7 pixel height 00007 00008 Universal 8bit Graphics Library 00009 00010 Copyright (c) 2011, olikraus@gmail.com 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without modification, 00014 are permitted provided that the following conditions are met: 00015 00016 * Redistributions of source code must retain the above copyright notice, this list 00017 of conditions and the following disclaimer. 00018 00019 * Redistributions in binary form must reproduce the above copyright notice, this 00020 list of conditions and the following disclaimer in the documentation and/or other 00021 materials provided with the distribution. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 00024 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 00025 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00026 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00028 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00029 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00030 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00033 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00034 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 00035 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 00037 */ 00038 00039 #include "u8g.h" 00040 00041 #define WIDTH 28 00042 #define HEIGHT 14 00043 #define PAGE_HEIGHT 14 00044 00045 /* 00046 Write data to the flip disc matrix. 00047 This procedure must be implemented by the user. 00048 Arguments: 00049 id: Id for the matrix. Currently always 0. 00050 page: A page has a height of 14 pixel. For a matrix with HEIGHT == 14 this will be always 0 00051 width: The width of the flip disc matrix. Always equal to WIDTH 00052 row1: first data line (7 pixel per byte) 00053 row2: first data line (7 pixel per byte) 00054 */ 00055 void writeFlipDiscMatrix(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2); 00056 00057 00058 00059 void (*u8g_write_flip_disc_matrix)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2); 00060 00061 void u8g_SetFlipDiscCallback(u8g_t *u8g, void (*cb)(uint8_t id, uint8_t page, uint8_t width, uint8_t *row1, uint8_t *row2)) 00062 { 00063 u8g_write_flip_disc_matrix = cb; 00064 } 00065 00066 uint8_t u8g_dev_flipdisc_2x7_bw_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) 00067 { 00068 switch(msg) 00069 { 00070 case U8G_DEV_MSG_INIT: 00071 break; 00072 case U8G_DEV_MSG_STOP: 00073 break; 00074 case U8G_DEV_MSG_PAGE_NEXT: 00075 { 00076 u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem); 00077 00078 /* current page: pb->p.page */ 00079 /* ptr to the buffer: pb->buf */ 00080 00081 (*u8g_write_flip_disc_matrix)(0, pb->p.page, WIDTH, pb->buf, (uint8_t *)(pb->buf)+WIDTH); 00082 } 00083 break; 00084 case U8G_DEV_MSG_CONTRAST: 00085 return 1; 00086 } 00087 return u8g_dev_pb14v1_base_fn(u8g, dev, msg, arg); 00088 } 00089 00090 uint8_t u8g_dev_flipdisc_2x7_bw_buf[WIDTH*2] U8G_NOCOMMON ; 00091 u8g_pb_t u8g_dev_flipdisc_2x7_bw_pb = { {16, HEIGHT, 0, 0, 0}, WIDTH, u8g_dev_flipdisc_2x7_bw_buf}; 00092 u8g_dev_t u8g_dev_flipdisc_2x7 = { u8g_dev_flipdisc_2x7_bw_fn, &u8g_dev_flipdisc_2x7_bw_pb, u8g_com_null_fn }; 00093
Generated on Tue Jul 12 2022 17:30:57 by
1.7.2