Princeton PT6964 LED controller supports 4 Digits @ 13 Segments, 5 Digits @ 12 Segments, 6 Digits @ 11 Segments or 7 Digits @ 10 Segments. Also supports a scanned keyboard of upto 20 keys. SPI bus interface.
Princeton PT6964 LED controller supports 4 Digits @ 13 Segments, 5 Digits @ 12 Segments, 6 Digits @ 11 Segments or 7 Digits @ 10 Segments. Also supports a scanned keyboard of upto 20 keys. SPI bus interface.
See Component page here.
Revision 2:eaf2f5d1af34, committed 2016-01-14
- Comitter:
- wim
- Date:
- Thu Jan 14 20:09:52 2016 +0000
- Parent:
- 1:1adf993a3e34
- Commit message:
- Refactored display and keyboard defines
Changed in this revision
PT6964.cpp | Show annotated file Show diff for this revision Revisions of this file |
PT6964.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1adf993a3e34 -r eaf2f5d1af34 PT6964.cpp --- a/PT6964.cpp Sat Jan 09 13:40:06 2016 +0000 +++ b/PT6964.cpp Thu Jan 14 20:09:52 2016 +0000 @@ -2,6 +2,7 @@ * Copyright (c) 2015, v01: WH, Initial version * 2015, v02: WH, rename Digit/Grid * 2016, v03: WH, updated Icon handling, UDCs and _putc() + * 2016, v04: WH, Refactored display and keyboard defines * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -166,8 +167,9 @@ for (int idx=0; idx < PT6964_KEY_MEM; idx++) { data = _flip(_spi.write(0xFF)); // read keys and correct bitorder + data = data & PT6964_KEY_MSK; // Mask valid bits if (data != 0) { // Check for any pressed key - for (int bit=0; bit < PT6964_KEY_BITS; bit++) { + for (int bit=0; bit < 8; bit++) { if (data & (1 << bit)) {keypress++;} // Test all significant bits } } @@ -287,7 +289,7 @@ if (clrAll) { //clear local buffer (including Icons) - for (int idx=0; idx < (DVD538A_NR_GRIDS << 1); idx++) { + for (int idx=0; idx < (DVD538A_NR_GRIDS << 1); idx++) { // * PT6964_BYTES_PER_GRID _displaybuffer[idx] = 0x00; } } @@ -299,7 +301,7 @@ } } - writeData(_displaybuffer, (DVD538A_NR_GRIDS*2)); + writeData(_displaybuffer, (DVD538A_NR_GRIDS * PT6964_BYTES_PER_GRID)); _column = 0; } @@ -315,12 +317,12 @@ icn = icon & 0xFFFF; addr = (icon >> 24) & 0xFF; - addr = (addr - 1) << 1; + addr = (addr - 1) << 1; // * PT6964_BYTES_PER_GRID //Save char...and set bits for icon to write _displaybuffer[addr] = _displaybuffer[addr] | LO(icn); _displaybuffer[addr+1] = _displaybuffer[addr+1] | HI(icn); - writeData(_displaybuffer, (DVD538A_NR_GRIDS*2)); + writeData(_displaybuffer, (DVD538A_NR_GRIDS * PT6964_BYTES_PER_GRID)); } /** Clr Icon @@ -333,12 +335,12 @@ icn = icon & 0xFFFF; addr = (icon >> 24) & 0xFF; - addr = (addr - 1) << 1; + addr = (addr - 1) << 1; // * PT6964_BYTES_PER_GRID //Save char...and clr bits for icon to write _displaybuffer[addr] = _displaybuffer[addr] & ~LO(icn); _displaybuffer[addr+1] = _displaybuffer[addr+1] & ~HI(icn); - writeData(_displaybuffer, (DVD538A_NR_GRIDS*2)); + writeData(_displaybuffer, (DVD538A_NR_GRIDS * PT6964_BYTES_PER_GRID)); } @@ -407,13 +409,13 @@ //_column == 1 => Grid4 => addr = 6 //_column == 2 => Grid3 => addr = 4 //_column == 3 => Grid4 => addr = 2 - addr = (4 - _column) << 1; + addr = (4 - _column) << 1; // * PT6964_BYTES_PER_GRID //Save icons...and set bits for character to write _displaybuffer[addr] = (_displaybuffer[addr] & MASK_ICON_GRID[4 - _column][0]) | LO(pattern); _displaybuffer[addr+1] = (_displaybuffer[addr+1] & MASK_ICON_GRID[4 - _column][1]) | HI(pattern); - writeData(_displaybuffer, (DVD538A_NR_GRIDS*2)); + writeData(_displaybuffer, (DVD538A_NR_GRIDS * PT6964_BYTES_PER_GRID)); //Update Cursor _column++;
diff -r 1adf993a3e34 -r eaf2f5d1af34 PT6964.h --- a/PT6964.h Sat Jan 09 13:40:06 2016 +0000 +++ b/PT6964.h Thu Jan 14 20:09:52 2016 +0000 @@ -2,6 +2,7 @@ * Copyright (c) 2015, v01: WH, Initial version * 2015, v02: WH, rename Digit/Grid * 2016, v03: WH, updated Icon handling, UDCs and _putc() + * 2016, v04: WH, Refactored display and keyboard defines * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -69,11 +70,15 @@ * @endcode */ +//PT6964 Display and Keymatrix data +#define PT6964_MAX_NR_GRIDS 7 +#define PT6964_BYTES_PER_GRID 2 +//Significant bits Keymatrix data +#define PT6964_KEY_MSK 0x1B + //Memory size in bytes for Display and Keymatrix -#define PT6964_DISPLAY_MEM 14 +#define PT6964_DISPLAY_MEM (PT6964_MAX_NR_GRIDS * PT6964_BYTES_PER_GRID) #define PT6964_KEY_MEM 5 -//Significant bits Keymatrix data -#define PT6964_KEY_BITS 5 //Reserved bits for commands #define PT6964_CMD_MSK 0xC0 @@ -224,7 +229,6 @@ #define DVD538A_NR_GRIDS 5 #define DVD538A_NR_DIGITS 4 -//#define DVD538A_DIG1_IDX 1 #define DVD538A_NR_UDC 8 /** Constructor for class for driving Princeton PT6964 controller as used in DVD538A