80 lines
2.7 KiB
C
80 lines
2.7 KiB
C
/* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
/* Copyright (c) 2016 King Kévin <kingkevin@cuvoodoo.info> */
|
|
/* this library is used to drive the vacuum fluorescent display extracted from a Samsung SER-6500 cashier machine
|
|
* it used three chained supertex HV518P shift register VFD drivers */
|
|
|
|
/* supertex HV518 VFD driver pins */
|
|
/* port on which the pins to control the supertex HV518 VFD driver are
|
|
* we use port A because of the SPI interface */
|
|
#define VFD_PORT GPIOA
|
|
#define VFD_PORT_RCC RCC_GPIOA
|
|
/* SPI port to use */
|
|
#define VFD_SPI SPI1
|
|
#if (VFD_SPI==SPI1)
|
|
#define VFD_SPI_RCC RCC_SPI1
|
|
#define VFD_SPI_IRQ NVIC_SPI1_IRQ
|
|
#elif (VFD_SPI==SPI2)
|
|
#define VFD_SPI_RCC RCC_SPI2
|
|
#define VFD_SPI_IRQ NVIC_SPI2_IRQ
|
|
#endif
|
|
/* strobe pin to enable high voltage output
|
|
* high voltage is output on low
|
|
* drive using a GPIO PA6 (normally MISO) */
|
|
#define VFD_STR GPIO6
|
|
/* latch enable pin
|
|
* store the shifted data on low
|
|
* output the parallel data on high
|
|
* use the SPI NSS (PA4) */
|
|
#define VFD_NLE GPIO_SPI1_NSS
|
|
/* clock signal
|
|
* drive using SPI SCK (PA5) */
|
|
#define VFD_CLK GPIO_SPI1_SCK
|
|
/* data input, where the data is shifted to
|
|
* drive using SPI MOSI (PA7) */
|
|
#define VFD_DIN GPIO_SPI1_MOSI
|
|
|
|
/* the number of blocks available on the VFD */
|
|
#define VFD_DRIVERS 3
|
|
#define VFD_DIGITS 10
|
|
#define VFD_MATRIX 12
|
|
|
|
/* all digits and matrix values */
|
|
extern char vfd_digits[VFD_DIGITS];
|
|
extern char vfd_matrixs[VFD_MATRIX];
|
|
|
|
/* set digit <nb> to ASCII character <c>
|
|
* use the MSB of <c> to enable the dot */
|
|
void vfd_digit(uint8_t nb, char c);
|
|
/* set dot matrix <nb> to ASCII character <c>
|
|
* non ASCII characters are used for pictures */
|
|
void vfd_matrix(uint8_t nb, char c);
|
|
/* shift out the VFD data */
|
|
void vfd_shift(void);
|
|
/* clear VFD display
|
|
* the data has to be transmitted separately */
|
|
void vfd_clear(void);
|
|
/* test VFD display (light up all anodes)
|
|
* the data has to be transmitted separately */
|
|
void vfd_test(void);
|
|
/* transmit every digit and matrix */
|
|
void vfd_transmit(void);
|
|
/* switch VFD display on */
|
|
void vfd_on(void);
|
|
/* switch VFD display off */
|
|
void vfd_off(void);
|
|
/* setup VFD */
|
|
void vfd_setup(void);
|