4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2010 Develer S.r.l. (http://www.develer.com/)
32 * \brief led 7 segment display low-level
34 * This file has the functions that must be
35 * implemented to drive the 7 segments display by your
38 * \author Fabio Bizzi <fbizzi@bizzi.org>
40 * Example implementation for AtMEGA 1280
41 * (Arduino MEGA) with a 4 digit display.
42 * We use PORTA to connect the 8 pins of
43 * the 7 segments display and 4 bit of
44 * PORTC to select which digit of the
45 * display we have to write on.
58 * 7 Seg Display Selection
69 * The implementation of the sseg_on procedure that set the PROPER PIN of PORT C
70 * to enable the requested digit of the display, after write the encoded character
75 * INLINE void sseg_on(uint8_t dgt, uint8_t n_dgt)
80 * #ifdef CONFIG_LED_7SEG_CCAT
83 * PORTC &= ~(BV(PORTC1) | BV(PORTC2) | BV(PORTC3));
84 * PORTC |= BV(PORTC0);
87 * PORTC &= ~(BV(PORTC0) | BV(PORTC2) | BV(PORTC3));
88 * PORTC |= BV(PORTC1);
91 * PORTC &= ~(BV(PORTC0) | BV(PORTC1) | BV(PORTC3));
92 * PORTC |= BV(PORTC2);
95 * PORTC &= ~(BV(PORTC0) | BV(PORTC1) | BV(PORTC2));
96 * PORTC |= BV(PORTC3);
103 * PORTC |= (BV(PORTC1) | BV(PORTC2) | BV(PORTC3));
104 * PORTC &= ~(BV(PORTC0));
107 * PORTC |= (BV(PORTC0) | BV(PORTC2) | BV(PORTC3));
108 * PORTC &= ~(BV(PORTC1));
111 * PORTC |= (BV(PORTC0) | BV(PORTC1) | BV(PORTC3));
112 * PORTC &= ~(BV(PORTC2));
115 * PORTC |= (BV(PORTC0) | BV(PORTC1) | BV(PORTC2));
116 * PORTC &= ~(BV(PORTC3));
122 * //Write the charater
128 * The implementation of the sseg_init procedure that set the DIRECTION of PORT C
129 * and PORT A to output
133 * INLINE void sseg_init(void)
135 * //Initialize PIN Direction to OUTPUT
137 * DDRC |= (BV(DDC0) | BV(DDC1) | BV(DDC2) | BV(DDC3));
138 * //Set the display OFF
144 * The implementation of the sseg_off procedure that set the reset PORT A
145 * to clean the display and turn off all the pin of PORT C that drive the
150 * INLINE void sseg_off(void)
152 * //Set the display OFF
154 * #ifdef CONFIG_LED_7SEG_CCAT
156 * PORTC &= ~(BV(PORTC0) | BV(PORTC1) | BV(PORTC2) | BV(PORTC3));
160 * PORTC |= (BV(PORTC0) | BV(PORTC1) | BV(PORTC2) | BV(PORTC3));
169 #ifndef HW_LED_7SEG_H
170 #define HW_LED_7SEG_H
172 #include "cfg/cfg_led_7seg.h"
175 * INLINE HW Functions
179 * \brief Clean the display
181 * This is the procedure that clean the display in HW mode.
182 * you have to write it according with your hardware and micro.
184 INLINE void sseg_off(void)
186 /* Set the display OFF */
187 #ifdef CONFIG_LED_7SEG_CCAT
188 /* You have to implment it */
191 /* You have to implment it */
197 * \brief writes the character to the single digit of the display
199 * This is the procedure that writes the character to the single digit
200 * of the display, you have to write it according with your hardware and micro.
202 * \param dgt the character that has to be displayed
203 * \param n_dgt the digit where to disply the character of the display's digits.
205 INLINE void sseg_on(uint8_t dgt, uint8_t n_dgt)
209 #ifdef CONFIG_LED_7SEG_CCAT
211 /* You have to implment it */
214 /* You have to implment it */
219 * \brief initalize the HW regsiters
221 * This is the procedure that initalize the HW regsiters.
222 * you have to write it according with your hardware and micro.
224 INLINE void sseg_init(void)
226 /* Initialize PIN Direction to OUTPUT*/
227 /* You have to implment it */
228 /* Set the display OFF */
232 #endif /* HW_LED_7SEG_H */