Demo for MAXREFDES99

Dependencies:   MAX7219 mbed

Committer:
j3
Date:
Tue Jan 26 02:39:36 2016 +0000
Revision:
1:06c0a61ca171
Parent:
0:6b0161c3e440
Child:
3:41bdbc9b3cec
updated header file comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j3 0:6b0161c3e440 1 /******************************************************************//**
j3 0:6b0161c3e440 2 * @file maxrefdes99.h
j3 0:6b0161c3e440 3 *
j3 0:6b0161c3e440 4 * @author Justin Jordan
j3 0:6b0161c3e440 5 *
j3 0:6b0161c3e440 6 * @version 0.0
j3 0:6b0161c3e440 7 *
j3 0:6b0161c3e440 8 * Started: 08JAN16
j3 0:6b0161c3e440 9 *
j3 0:6b0161c3e440 10 * Updated:
j3 0:6b0161c3e440 11 *
j3 0:6b0161c3e440 12 * @brief Header file for maxrefdes99 demo
j3 0:6b0161c3e440 13 ***********************************************************************
j3 0:6b0161c3e440 14 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
j3 0:6b0161c3e440 15 *
j3 0:6b0161c3e440 16 * Permission is hereby granted, free of charge, to any person obtaining a
j3 0:6b0161c3e440 17 * copy of this software and associated documentation files (the "Software"),
j3 0:6b0161c3e440 18 * to deal in the Software without restriction, including without limitation
j3 0:6b0161c3e440 19 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
j3 0:6b0161c3e440 20 * and/or sell copies of the Software, and to permit persons to whom the
j3 0:6b0161c3e440 21 * Software is furnished to do so, subject to the following conditions:
j3 0:6b0161c3e440 22 *
j3 0:6b0161c3e440 23 * The above copyright notice and this permission notice shall be included
j3 0:6b0161c3e440 24 * in all copies or substantial portions of the Software.
j3 0:6b0161c3e440 25 *
j3 0:6b0161c3e440 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
j3 0:6b0161c3e440 27 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
j3 0:6b0161c3e440 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
j3 0:6b0161c3e440 29 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
j3 0:6b0161c3e440 30 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
j3 0:6b0161c3e440 31 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
j3 0:6b0161c3e440 32 * OTHER DEALINGS IN THE SOFTWARE.
j3 0:6b0161c3e440 33 *
j3 0:6b0161c3e440 34 * Except as contained in this notice, the name of Maxim Integrated
j3 0:6b0161c3e440 35 * Products, Inc. shall not be used except as stated in the Maxim Integrated
j3 0:6b0161c3e440 36 * Products, Inc. Branding Policy.
j3 0:6b0161c3e440 37 *
j3 0:6b0161c3e440 38 * The mere transfer of this software does not imply any licenses
j3 0:6b0161c3e440 39 * of trade secrets, proprietary technology, copyrights, patents,
j3 0:6b0161c3e440 40 * trademarks, maskwork rights, or any other form of intellectual
j3 0:6b0161c3e440 41 * property whatsoever. Maxim Integrated Products, Inc. retains all
j3 0:6b0161c3e440 42 * ownership rights.
j3 0:6b0161c3e440 43 **********************************************************************/
j3 0:6b0161c3e440 44
j3 0:6b0161c3e440 45
j3 0:6b0161c3e440 46 #ifndef MAXREFDES99_H
j3 0:6b0161c3e440 47 #define MAXREFDES99_H
j3 0:6b0161c3e440 48
j3 0:6b0161c3e440 49
j3 0:6b0161c3e440 50 #include "mbed.h"
j3 0:6b0161c3e440 51 #include "max7219.h"
j3 0:6b0161c3e440 52
j3 0:6b0161c3e440 53
j3 1:06c0a61ca171 54 /**********************************************************//**
j3 1:06c0a61ca171 55 * @brief gets character bitmap fom memory
j3 1:06c0a61ca171 56 *
j3 1:06c0a61ca171 57 * @details
j3 1:06c0a61ca171 58 *
j3 1:06c0a61ca171 59 * On Entry:
j3 1:06c0a61ca171 60 * @param[in] c - character to get bitmap for
j3 1:06c0a61ca171 61 * @param[in] char_buff - pointer to buffer to store bitmap in
j3 1:06c0a61ca171 62 * must be at least 6 bytes
j3 1:06c0a61ca171 63 *
j3 1:06c0a61ca171 64 * On Exit:
j3 1:06c0a61ca171 65 * @return none
j3 1:06c0a61ca171 66 **************************************************************/
j3 0:6b0161c3e440 67 void get_5x7_character(char c, uint8_t *char_buff);
j3 0:6b0161c3e440 68
j3 0:6b0161c3e440 69
j3 1:06c0a61ca171 70 /**********************************************************//**
j3 1:06c0a61ca171 71 * @brief prints character to MAXREFDES99 at given position
j3 1:06c0a61ca171 72 *
j3 1:06c0a61ca171 73 * @details
j3 1:06c0a61ca171 74 *
j3 1:06c0a61ca171 75 * On Entry:
j3 1:06c0a61ca171 76 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 77 * @param[in] position - position to print char to
j3 1:06c0a61ca171 78 * posiion 1 is top left column, position 32
j3 1:06c0a61ca171 79 * is bottom right column
j3 1:06c0a61ca171 80 * @param[in] c - char to print
j3 1:06c0a61ca171 81 *
j3 1:06c0a61ca171 82 * On Exit:
j3 1:06c0a61ca171 83 * @return none
j3 1:06c0a61ca171 84 **************************************************************/
j3 0:6b0161c3e440 85 void print_char(Max7219 *p_display, uint8_t position, char c);
j3 0:6b0161c3e440 86
j3 0:6b0161c3e440 87
j3 1:06c0a61ca171 88 /**********************************************************//**
j3 1:06c0a61ca171 89 * @brief prints given string to MAXREFDES99 at given position
j3 1:06c0a61ca171 90 *
j3 1:06c0a61ca171 91 * @details
j3 1:06c0a61ca171 92 *
j3 1:06c0a61ca171 93 * On Entry:
j3 1:06c0a61ca171 94 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 95 * @param[in] position - position to print char to
j3 1:06c0a61ca171 96 * posiion 1 is top left column, position 32
j3 1:06c0a61ca171 97 * is bottom right column
j3 1:06c0a61ca171 98 * @param[in] s - pointer to string to print
j3 1:06c0a61ca171 99 *
j3 1:06c0a61ca171 100 * On Exit:
j3 1:06c0a61ca171 101 * @return none
j3 1:06c0a61ca171 102 **************************************************************/
j3 0:6b0161c3e440 103 void print_string(Max7219 *p_display, uint8_t position, const char *s);
j3 0:6b0161c3e440 104
j3 0:6b0161c3e440 105
j3 1:06c0a61ca171 106 /**********************************************************//**
j3 1:06c0a61ca171 107 * @brief shifts display right 'count' positions with given
j3 1:06c0a61ca171 108 * delay between shifts
j3 1:06c0a61ca171 109 *
j3 1:06c0a61ca171 110 * @details
j3 1:06c0a61ca171 111 *
j3 1:06c0a61ca171 112 * On Entry:
j3 1:06c0a61ca171 113 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 114 * @param[in] count - number of positions to shift
j3 1:06c0a61ca171 115 * @param[in] delay - delay between shifts
j3 1:06c0a61ca171 116 *
j3 1:06c0a61ca171 117 * On Exit:
j3 1:06c0a61ca171 118 * @return none
j3 1:06c0a61ca171 119 **************************************************************/
j3 0:6b0161c3e440 120 void shift_display_right(Max7219 *p_display, uint8_t count, uint8_t delay);
j3 0:6b0161c3e440 121
j3 0:6b0161c3e440 122
j3 1:06c0a61ca171 123 /**********************************************************//**
j3 1:06c0a61ca171 124 * @brief shifts display left 'count' positions with given
j3 1:06c0a61ca171 125 * delay between shifts
j3 1:06c0a61ca171 126 *
j3 1:06c0a61ca171 127 * @details
j3 1:06c0a61ca171 128 *
j3 1:06c0a61ca171 129 * On Entry:
j3 1:06c0a61ca171 130 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 131 * @param[in] count - number of positions to shift
j3 1:06c0a61ca171 132 * @param[in] delay - delay between shifts
j3 1:06c0a61ca171 133 *
j3 1:06c0a61ca171 134 * On Exit:
j3 1:06c0a61ca171 135 * @return none
j3 1:06c0a61ca171 136 **************************************************************/
j3 0:6b0161c3e440 137 void shift_display_left(Max7219 *p_display, uint8_t count, uint8_t delay);
j3 0:6b0161c3e440 138
j3 0:6b0161c3e440 139
j3 1:06c0a61ca171 140 /**********************************************************//**
j3 1:06c0a61ca171 141 * @brief turns on all leds for given quadrant, with quad 1 being
j3 1:06c0a61ca171 142 * top left and quad 4 being bottom right
j3 1:06c0a61ca171 143 *
j3 1:06c0a61ca171 144 * @details
j3 1:06c0a61ca171 145 *
j3 1:06c0a61ca171 146 * On Entry:
j3 1:06c0a61ca171 147 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 148 * @param[in] quad - see brief
j3 1:06c0a61ca171 149 *
j3 1:06c0a61ca171 150 * On Exit:
j3 1:06c0a61ca171 151 * @return none
j3 1:06c0a61ca171 152 **************************************************************/
j3 0:6b0161c3e440 153 void quad_all_on(Max7219 *p_display, uint8_t quad);
j3 0:6b0161c3e440 154
j3 0:6b0161c3e440 155
j3 1:06c0a61ca171 156 /**********************************************************//**
j3 1:06c0a61ca171 157 * @brief turns off all leds for given quadrant, with quad 1 being
j3 1:06c0a61ca171 158 * top left and quad 4 being bottom right
j3 1:06c0a61ca171 159 *
j3 1:06c0a61ca171 160 * @details
j3 1:06c0a61ca171 161 *
j3 1:06c0a61ca171 162 * On Entry:
j3 1:06c0a61ca171 163 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 164 * @param[in] quad - see brief
j3 1:06c0a61ca171 165 *
j3 1:06c0a61ca171 166 * On Exit:
j3 1:06c0a61ca171 167 * @return none
j3 1:06c0a61ca171 168 **************************************************************/
j3 0:6b0161c3e440 169 void quad_all_off(Max7219 *p_display, uint8_t quad);
j3 0:6b0161c3e440 170
j3 0:6b0161c3e440 171
j3 1:06c0a61ca171 172 /**********************************************************//**
j3 1:06c0a61ca171 173 * @brief turns all leds for whole display on
j3 1:06c0a61ca171 174 *
j3 1:06c0a61ca171 175 * @details
j3 1:06c0a61ca171 176 *
j3 1:06c0a61ca171 177 * On Entry:
j3 1:06c0a61ca171 178 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 179 *
j3 1:06c0a61ca171 180 * On Exit:
j3 1:06c0a61ca171 181 * @return none
j3 1:06c0a61ca171 182 **************************************************************/
j3 0:6b0161c3e440 183 void all_on(Max7219 *p_display);
j3 0:6b0161c3e440 184
j3 0:6b0161c3e440 185
j3 1:06c0a61ca171 186 /**********************************************************//**
j3 1:06c0a61ca171 187 * @brief turns all leds for whole display off
j3 1:06c0a61ca171 188 *
j3 1:06c0a61ca171 189 * @details
j3 1:06c0a61ca171 190 *
j3 1:06c0a61ca171 191 * On Entry:
j3 1:06c0a61ca171 192 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 193 *
j3 1:06c0a61ca171 194 * On Exit:
j3 1:06c0a61ca171 195 * @return none
j3 1:06c0a61ca171 196 **************************************************************/
j3 0:6b0161c3e440 197 void all_off(Max7219 *p_display);
j3 0:6b0161c3e440 198
j3 0:6b0161c3e440 199
j3 1:06c0a61ca171 200 /**********************************************************//**
j3 1:06c0a61ca171 201 * @brief demo loop for MAXREFDES99
j3 1:06c0a61ca171 202 *
j3 1:06c0a61ca171 203 * @details
j3 1:06c0a61ca171 204 *
j3 1:06c0a61ca171 205 * On Entry:
j3 1:06c0a61ca171 206 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 207 * @param[in] display_config - structure holding configuration data
j3 1:06c0a61ca171 208 * @param[in] endless_loop - if true run demo in endless loop
j3 1:06c0a61ca171 209 *
j3 1:06c0a61ca171 210 * On Exit:
j3 1:06c0a61ca171 211 * @return none
j3 1:06c0a61ca171 212 **************************************************************/
j3 0:6b0161c3e440 213 void demo(Max7219 *display, max7219_configuration_t display_config, bool endless_loop);
j3 0:6b0161c3e440 214
j3 0:6b0161c3e440 215
j3 1:06c0a61ca171 216 /**********************************************************//**
j3 1:06c0a61ca171 217 * @brief shift display in given direction forever
j3 1:06c0a61ca171 218 *
j3 1:06c0a61ca171 219 * @details
j3 1:06c0a61ca171 220 *
j3 1:06c0a61ca171 221 * On Entry:
j3 1:06c0a61ca171 222 * @param[in] p_display - pointer to Max7219 object
j3 1:06c0a61ca171 223 * @param[in] scroll_right - if true shift right, else shift left
j3 1:06c0a61ca171 224 *
j3 1:06c0a61ca171 225 * On Exit:
j3 1:06c0a61ca171 226 * @return none
j3 1:06c0a61ca171 227 **************************************************************/
j3 0:6b0161c3e440 228 void endless_scroll_display(Max7219 *display, uint32_t scroll_right);
j3 0:6b0161c3e440 229
j3 0:6b0161c3e440 230
j3 1:06c0a61ca171 231 /**********************************************************//**
j3 1:06c0a61ca171 232 * @brief print demo menu
j3 1:06c0a61ca171 233 *
j3 1:06c0a61ca171 234 * @details
j3 1:06c0a61ca171 235 *
j3 1:06c0a61ca171 236 * On Entry:
j3 1:06c0a61ca171 237 *
j3 1:06c0a61ca171 238 * On Exit:
j3 1:06c0a61ca171 239 * @return user entry
j3 1:06c0a61ca171 240 **************************************************************/
j3 0:6b0161c3e440 241 uint32_t print_menu(void);
j3 0:6b0161c3e440 242
j3 0:6b0161c3e440 243
j3 1:06c0a61ca171 244 /**********************************************************//**
j3 1:06c0a61ca171 245 * @brief get integer value from user
j3 1:06c0a61ca171 246 *
j3 1:06c0a61ca171 247 * @details
j3 1:06c0a61ca171 248 *
j3 1:06c0a61ca171 249 * On Entry:
j3 1:06c0a61ca171 250 * @param[in] msg - prompt for user
j3 1:06c0a61ca171 251 * @param[in] max_val - maximum allowable input
j3 1:06c0a61ca171 252 *
j3 1:06c0a61ca171 253 * On Exit:
j3 1:06c0a61ca171 254 * @return user entry
j3 1:06c0a61ca171 255 **************************************************************/
j3 0:6b0161c3e440 256 uint32_t get_user_input(char *msg, uint32_t max_val);
j3 0:6b0161c3e440 257
j3 0:6b0161c3e440 258
j3 1:06c0a61ca171 259 /**********************************************************//**
j3 1:06c0a61ca171 260 * @brief get char from user
j3 1:06c0a61ca171 261 *
j3 1:06c0a61ca171 262 * @details
j3 1:06c0a61ca171 263 *
j3 1:06c0a61ca171 264 * On Entry:
j3 1:06c0a61ca171 265 * @param[in] msg - prompt for user
j3 1:06c0a61ca171 266 *
j3 1:06c0a61ca171 267 * On Exit:
j3 1:06c0a61ca171 268 * @return user entry
j3 1:06c0a61ca171 269 **************************************************************/
j3 0:6b0161c3e440 270 char get_user_char(char *msg);
j3 0:6b0161c3e440 271
j3 0:6b0161c3e440 272
j3 1:06c0a61ca171 273 /**********************************************************//**
j3 1:06c0a61ca171 274 * @brief get string from user
j3 1:06c0a61ca171 275 *
j3 1:06c0a61ca171 276 * @details
j3 1:06c0a61ca171 277 *
j3 1:06c0a61ca171 278 * On Entry:
j3 1:06c0a61ca171 279 * @param[in] msg - prompt for user
j3 1:06c0a61ca171 280 *
j3 1:06c0a61ca171 281 * On Exit:
j3 1:06c0a61ca171 282 * @return user entry
j3 1:06c0a61ca171 283 **************************************************************/
j3 0:6b0161c3e440 284 char * get_user_string(char *msg);
j3 0:6b0161c3e440 285
j3 0:6b0161c3e440 286
j3 0:6b0161c3e440 287 #endif /*MAXREFDES99_H*/
j3 0:6b0161c3e440 288