Skip to content

Commit

Permalink
Update library name to avoid name conflicts with original FutabaUsVfd…
Browse files Browse the repository at this point in the history
… library.
  • Loading branch information
Andy4495 committed Feb 13, 2020
1 parent a86bce3 commit f3a7c0f
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 53 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Andreas Taylor
Copyright (c) 2019 - 2020 Andreas Taylor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FutabaUsVfd Library
FutabaVFD162S Library
=============================================================================

This is an improved version of the [FutabaUsVfd][1] library published on Arduino Playground. It is designed to work with the Futaba 162SD03C Vacuum Fluorescent Display. It may work with other VFDs using the same controller chips.
This is an improved version of the [FutabaUsVfd][1] library published on Arduino Playground. It is designed to work with the Futaba US162SD03 Vacuum Fluorescent Display. It may work with other VFDs using the same controller chips.

Library Usage
-------------
_Be sure to review the example sketches included with the library._

1. Include the library:

`#include <FutabaUsVfd.h>`
`#include <FutabaVFD162S.h>`

2. Instantiate an object, passing in the Arduino pin numbers used to control the display:

`FutabaUsVfd vfd(CLK_pin_number, DATA_pin_number, RESET_pin_number);`
`FutabaVFD162S vfd(CLK_pin_number, DATA_pin_number, RESET_pin_number);`

3. Initialize the vfd object:

Expand Down Expand Up @@ -68,7 +68,7 @@ There is a noticeable difference in brightness when going from level 254 to 255.

I measured supply current of around 320 mA when the device was powered, regardless of whether something was displayed or the screen was blank. The datasheet specs it at 450 mA typical, 600 mA maximum.

While it is a 5V device, the inputs are compatible with 3.3V logic levels.
While it is a 5V device, the CLK, DATA, and RESET inputs are compatible with 3.3V logic levels.

Pin Functions (J1):
1. Vcc
Expand All @@ -80,7 +80,7 @@ Pin Functions (J1):
References
----------
+ Original FutabaUsVfd [library][1] at Arduino Playground
+ Futaba Model 162SD03C Vacuum Fluorescent Display [datasheet][2]
+ Futaba Model US162SD03 Vacuum Fluorescent Display [datasheet][2]


[1]: https://playground.arduino.cc/Main/FutabaUsVfd/
Expand Down
8 changes: 4 additions & 4 deletions examples/CustomCharacter/CustomCharacter.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
FutabaUsVfd Library - customCharacter()
FutabaVFD162S Library - customCharacter()
Demonstrates the use an Futaba VFD. Tested
with model US162SD03CB 2x16 display.
Expand All @@ -20,13 +20,13 @@
http://arduino.cc/playground/Main/FutabaUsVfd
Slight modification Nov 2019 to include in updated library at https://github.com/Andy4495/FutabaUsVfd
Slight modification Nov 2019 to include in updated library at https://github.com/Andy4495/FutabaVFD162S
*/

// Include the library code.
#include <FutabaUsVfd.h>
#include <FutabaVFD162S.h>

FutabaUsVfd vfd(5, 6, 8);
FutabaVFD162S vfd(5, 6, 8);

byte openHeart[8] = {
0b00000,
Expand Down
10 changes: 5 additions & 5 deletions examples/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
FutabaUsVfd Library - Hello World
FutabaVFD162S Library - Hello World
Demonstrates the use an Futaba VFD. Tested
with model US162SD03CB 2x16 display.
Expand All @@ -20,16 +20,16 @@
This example code is in the public domain.
http://arduino.cc/playground/Main/FutabaUsVfd
http://arduino.cc/playground/Main/FutabaVFD162S
Slight modification Nov 2019 to include in updated library at https://github.com/Andy4495/FutabaUsVfd
Slight modification Nov 2019 to include in updated library at https://github.com/Andy4495/FutabaVFD162S
*/

// Include the library code.
#include <FutabaUsVfd.h>
#include <FutabaVFD162S.h>

FutabaUsVfd vfd(5, 6, 8);
FutabaVFD162S vfd(5, 6, 8);

void setup() {
// Set up the VFD's number of columns and rows:
Expand Down
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name=FutabaUsVFD
name=FutabaVFD162S
version=1.0.0
author=unknown
maintainer=Andreas Taylor <Andy4495@outlook.com>
sentence=Library for Futaba US162SD03CB Vacuum Fluorescent Display
paragraph=May work with other Futaba VFDs using same controller. Modified from original code posted at https://playground.arduino.cc/Main/FutabaUsVfd/
category=Display
url=https://github.com/Andy4495/FutabaUsVfd
url=https://github.com/Andy4495/FutabaVFD162S
architectures=*
includes=FutabaUsVfd.h
includes=FutabaVFD162S.h
53 changes: 27 additions & 26 deletions src/FutabaUsVfd.cpp → src/FutabaVFD162S.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/*
FutabaUsVfd Library
FutabaVFD162S Library
- Original file created 17 March 2011 (https://playground.arduino.cc/Main/FutabaUsVfd/), unknown author
Updated by Andreas Taylor Nov 2019
- Modifications to support latest Arduino IDE and library spec
- Added methods for most of the control functions listed in datasheet
- Updated timing definitions
Updated Feb 2020 to change name to avoid conflict with existing library.
https://github.com/Andy4495/FutabaUsVfd
https://github.com/Andy4495/FutabaVFD162S
*/

#include "FutabaUsVfd.h"
#include "FutabaVFD162S.h"
#include "Arduino.h"

FutabaUsVfd::FutabaUsVfd(uint8_t clockPin, uint8_t dataPin, uint8_t resetPin)
FutabaVFD162S::FutabaVFD162S(uint8_t clockPin, uint8_t dataPin, uint8_t resetPin)
{
// Copy pin values.
_clockPin = clockPin;
Expand All @@ -40,7 +41,7 @@ FutabaUsVfd::FutabaUsVfd(uint8_t clockPin, uint8_t dataPin, uint8_t resetPin)
}
}

void FutabaUsVfd::begin(uint8_t numColumns, int numRows)
void FutabaVFD162S::begin(uint8_t numColumns, int numRows)
{
_numDisplayColumns = numColumns;
_numDisplayRows = numRows;
Expand Down Expand Up @@ -70,17 +71,17 @@ void FutabaUsVfd::begin(uint8_t numColumns, int numRows)
}
}

void FutabaUsVfd::clear()
void FutabaVFD162S::clear()
{
writeCharacterDirect(CLEAR_ENTIRE_DISPLAY_CHARACTER);
}

void FutabaUsVfd::home()
void FutabaVFD162S::home()
{
setCursor(0, 0);
}

void FutabaUsVfd::createChar(uint8_t characterIndex, uint8_t pixels[] /* 8 bytes, 1 for each row */)
void FutabaVFD162S::createChar(uint8_t characterIndex, uint8_t pixels[] /* 8 bytes, 1 for each row */)
{
writeCharacterDirect(LOAD_USER_CHARACTER_CHARACTER);

Expand All @@ -106,7 +107,7 @@ void FutabaUsVfd::createChar(uint8_t characterIndex, uint8_t pixels[] /* 8 bytes
}
}

void FutabaUsVfd::setCursor(uint8_t column, uint8_t row)
void FutabaVFD162S::setCursor(uint8_t column, uint8_t row)
{
uint8_t address = row * _numDisplayColumns + column;
if (address >= _numDisplayCharacters)
Expand All @@ -118,7 +119,7 @@ void FutabaUsVfd::setCursor(uint8_t column, uint8_t row)
writeCharacterDirect(address + 1);
}

/*virtual*/ size_t FutabaUsVfd::write(uint8_t character)
/*virtual*/ size_t FutabaVFD162S::write(uint8_t character)
{
// Remap from LCD custom character locations to VFD characters.
if (character < NUM_CUSTOM_CHARACTERS)
Expand All @@ -136,102 +137,102 @@ void FutabaUsVfd::setCursor(uint8_t column, uint8_t row)
return 1;
}

void FutabaUsVfd::setBrightness(uint8_t level)
void FutabaVFD162S::setBrightness(uint8_t level)
{
writeCharacterDirect(SET_DISPLAY_BRIGHTNESS_CHARACTER);
writeCharacterDirect(level);
}

// Cursor control
// Changes do not take affect immediately; next character will be printed to current cursor postion before new mode takes affect.
void FutabaUsVfd::setCursorModeAutoInc() // Auto-increment cursor each time character is printed (default)
void FutabaVFD162S::setCursorModeAutoInc() // Auto-increment cursor each time character is printed (default)
{
writeCharacterDirect(SET_CURSOR_MODE_CHARACTER);
writeCharacterDirect(0x01);
}

void FutabaUsVfd::setCursorModeAutoDec() // Auto-decrement cursor each time character is printed
void FutabaVFD162S::setCursorModeAutoDec() // Auto-decrement cursor each time character is printed
{
writeCharacterDirect(SET_CURSOR_MODE_CHARACTER);
writeCharacterDirect(0x02);
}

void FutabaUsVfd::setCursorModeNonInc() // Cursor stays at same position when character is printed
void FutabaVFD162S::setCursorModeNonInc() // Cursor stays at same position when character is printed
{
writeCharacterDirect(SET_CURSOR_MODE_CHARACTER);
writeCharacterDirect(0x03);
}

// Character flashing configuration
void FutabaUsVfd::setFlashPositions(uint8_t start, uint8_t stop) // Several ranges can be chosen with multiple calls and may overlap
void FutabaVFD162S::setFlashPositions(uint8_t start, uint8_t stop) // Several ranges can be chosen with multiple calls and may overlap
{
writeCharacterDirect(SET_FLASH_POSITION_CHARACTER);
writeCharacterDirect(start);
writeCharacterDirect(stop);
}

void FutabaUsVfd::setFlashModeEnabled()
void FutabaVFD162S::setFlashModeEnabled()
{
writeCharacterDirect(FLASH_MODE_CHARACTER);
writeCharacterDirect(0x02);
}

void FutabaUsVfd::setFlashModeDisabled() // Default
void FutabaVFD162S::setFlashModeDisabled() // Default
{
writeCharacterDirect(FLASH_MODE_CHARACTER);
writeCharacterDirect(0x01);
}

void FutabaUsVfd::setFlashRate50() // 50 Hz - Effectively makes characters look 1/2 as bright as non-flashing characters
void FutabaVFD162S::setFlashRate50() // 50 Hz - Effectively makes characters look 1/2 as bright as non-flashing characters
{
writeCharacterDirect(SET_FLASH_RATE_CHARACTER);
writeCharacterDirect(0x01);
}

void FutabaUsVfd::setFlashRate1() // 1 Hz - Default rate
void FutabaVFD162S::setFlashRate1() // 1 Hz - Default rate
{
writeCharacterDirect(SET_FLASH_RATE_CHARACTER);
writeCharacterDirect(0x30);
}

void FutabaUsVfd::setFlashRateTenth() // 1/10 Hz
void FutabaVFD162S::setFlashRateTenth() // 1/10 Hz
{
writeCharacterDirect(SET_FLASH_RATE_CHARACTER);
writeCharacterDirect(0xff);
}

// Font selection
void FutabaUsVfd::setFontWestern() // Default
void FutabaVFD162S::setFontWestern() // Default
{
writeCharacterDirect(SELECT_FONT_CHARACTER);
writeCharacterDirect(0x01);
}

void FutabaUsVfd::setFontKatakana()
void FutabaVFD162S::setFontKatakana()
{
writeCharacterDirect(SELECT_FONT_CHARACTER);
writeCharacterDirect(0x02);
}

// Display buffer modes
void FutabaUsVfd::setNonBufferedMode() // Default
void FutabaVFD162S::setNonBufferedMode() // Default
{
writeCharacterDirect(SET_BUFFERED_MODE_CHARACTER);
writeCharacterDirect(0x01);
}

void FutabaUsVfd::setBufferedMode()
void FutabaVFD162S::setBufferedMode()
{
writeCharacterDirect(SET_BUFFERED_MODE_CHARACTER);
writeCharacterDirect(0x02);
}

void FutabaUsVfd::printMessageBuffer()
void FutabaVFD162S::printMessageBuffer()
{
writeCharacterDirect(PRINT_MESSAGE_BUFFER_CHARACTER);
}

void FutabaUsVfd::writeCharacterDirect(uint8_t character)
void FutabaVFD162S::writeCharacterDirect(uint8_t character)
{
for (uint8_t mask=0b10000000; mask; mask>>=1)
{
Expand Down
17 changes: 9 additions & 8 deletions src/FutabaUsVfd.h → src/FutabaVFD162S.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
/*
FutabaUsVfd Library
FutabaVFD162S Library
- Original file created 17 March 2011 (https://playground.arduino.cc/Main/FutabaUsVfd/), unknown author
Updated by Andreas Taylor Nov 2019
- Modifications to support latest Arduino IDE and library spec
- Added methods for most of the control functions listed in datasheet
- Updated timing definitions
Updated Feb 2020 with new name to avoid conflict with existing library.
https://github.com/Andy4495/FutabaUsVfd
https://github.com/Andy4495/FutabaVFD162S
*/

#ifndef FutabaUsVfd_h
#define FutabaUsVfd_h
#ifndef FutabaVFD162S_h
#define FutabaVFD162S_h

#include <inttypes.h>
#include "Print.h"
#include "Arduino.h"

class FutabaUsVfd : public Print {
class FutabaVFD162S : public Print {
public:

// Special control characters supported by display. See datasheet for more information.
Expand All @@ -36,7 +37,7 @@ class FutabaUsVfd : public Print {
static const uint8_t SET_BUFFERED_MODE_CHARACTER = 0x0B; // Second byte is buffering mode.
static const uint8_t PRINT_MESSAGE_BUFFER_CHARACTER = 0x0C; // Flush buffer and home cursor.

FutabaUsVfd(uint8_t clockPin, uint8_t dataPin, uint8_t resetPin);
FutabaVFD162S(uint8_t clockPin, uint8_t dataPin, uint8_t resetPin);

// Sets the character dimensions of the display.
void begin(uint8_t numColumns, int numRows);
Expand Down Expand Up @@ -128,9 +129,9 @@ class FutabaUsVfd : public Print {
inline void timingDelay(uint16_t delayInMicroseconds);
};

inline void FutabaUsVfd::timingDelay(uint16_t delayInMicroseconds)
inline void FutabaVFD162S::timingDelay(uint16_t delayInMicroseconds)
{
delayMicroseconds(delayInMicroseconds);
}

#endif // FutabaUsVfd_h
#endif // FutabaVFD162S_h

0 comments on commit f3a7c0f

Please sign in to comment.