Commit Graph

32 Commits

Author SHA1 Message Date
bc48704477 First pass setting up doxygen documentation
There are a few things that still need to be commented, furthermore,
usage of the library needs to be explained in more detail. Also things
are still somewhat unorganized as the lcdLib library is packaged up with
the lcdOutput application for testing. Also a tiny USART library is
included but has nothing to do with the lcdLib except that its used by
the lcdOutput demo program. When the lcdLib library is ready it will be
split into its own repository with accompanying examples (one of which
may be the USART echo example (lcdOutput.c as of this commit).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-15 01:23:11 -04:00
89a10c4802 Add remaining ANSI escapes to ansi_escapes.h
All ANSI escapes sequences except "Select graphic rendition" are
supported.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-15 00:27:19 -04:00
f84eb1ddda Comment and clean-up lcdLib.c and lcdLib.h
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-15 00:26:46 -04:00
c29ef36638 Comment lcdLib.h
At some point perhaps switch to using doxygen to output nice
documentation. This will require using doxygen conventions, which aren't
currently used but easily adapted to.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-09 02:59:21 -04:00
ea7003ce83 Simplify entry of ANSI escape sequences
Use pre-processor macros to allow for simple entry of ANSI escape
sequences.

Many escape sequences don't require all characters in all cases.
Example: Cursor movement (up down, forward and back) all take one
parameter (natural number) that defaults to 1, and can be omitted in
this case. Calling the associated macros with 1 will generate the
correct escape but not the smallest one. Now for these single argument
cases (there are others also) the macro of choice can be used with an
empty argument which will generate the smallest ANSI escape sequence.
Eg, the following are equivalent: CUD() === CUD(1)

Another example is use of CUP (cursor position). It takes two arguments
which both default to 1. Similarly to the CUD example above, CUP(1,1)
generates a valid ANSI escape sequence, just not the smallest one. The
smallest one can be achieved by omitting the arguments to CUP: CUP(,).

For more information on ANSI escapes see wikipedia:
https://en.wikipedia.org/wiki/ANSI_escape_code

This is just an initial proof of concept and is not complete;
namely:

- Not all ANSI escapes are implemented
- Macros don't error check for the user; that is, invalid escapes can be
  generated (Eg. the argument to ED is constrained to 0, 1, or 2 but
  this is not checked by the ED macro)
- Macro's can generate invalid ANSI escapes when the argument that's
  given is not a natural number (specified as ASCII)

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-09 01:35:47 -04:00
4fdb822e50 Fixed renamed transmitBytes and changed parameters
After changing the transmitBytes function and renaming it, missed
changing the function definition in the header file to match the new declaration.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-09 01:31:50 -04:00
854876217a Update the serial console as to mimic the LCD
Working for clear screen, Backspace, and newline. Still needs to be
implemented to match the columns and rows of the LCD (which will require
that lcdLib.c provide access to currentLineChars and currentLineNum via
functions like getCurrentRow and getCurrentColumn.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-08 03:15:25 -04:00
8ab9c5a4b0 Add transmitString function to USART library
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-08 03:15:00 -04:00
3d3b9ab5fb Working backspace and fixed bug with cursor
Before this commit the cursor would be incremented (automatically by
hardware) after printing the last character on the line, which would
leave it the next line in memory, which doesn't necessarily correspond
to the next physical line on the display. This would be corrected when
the next character is received but is incorrect behavior; the cursor
should always be at where the next character is to inserted. This was
due to an off-by-one logical error. This commit solves this bug.

Along with the bug fix, keycodes from the serial terminal are now
deciphered correctly and the corresponding key or keys are sent to the
LCD accordingly.

Further work is required with regards to updating the serial
console (the connected client) so that their serial console looks
exactly like the LCD they are connected to.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-07 22:38:57 -04:00
3a6800a2b0 Remove showPrases from startup
No longer show phrases (was used during testing).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-07 22:38:11 -04:00
172d5e268f Prepare to support various escapes for characters
Move code that checked for escapes from the writeStringToLCD function to
the writeCharToLCD function.

Note: There seems to be an issue connecting to USART when the programmer
is not connected. This is likely a wiring issue related to ISP.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-06 05:49:59 -04:00
208d90f4ef Initial USART echoing to LCD example
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-06 04:23:40 -04:00
85c7948848 Fix BAUD rate in Makefile
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-06 04:23:14 -04:00
435c8eb07b Fixed busy flag check
Inspired by
http://web.alfredstate.edu/weimandn/programming/lcd/ATmega328/LCD_code_index.html.
Forgot about the 'data hold time', 'address hold time' and 'enable cycle
time'. These delays should eventually be implemented as preprocessor constants.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-06 03:34:39 -04:00
abacb2b30a Take screen characteristics into account
The writeStringtoLCD function now wraps text correctly and proceeds to
the next line when '\n' is reached in its argument.

Note: during debugging of this feature it was noticed that the function
loop_until_LCD_BF_clear is broken, as previously suspected. This forces
delays to be placed in the clearDisplay and returnHome functions and
could cause other undefined behavior if timing requirements aren't met.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-06 03:14:24 -04:00
45797f1164 Refactor lcdLib.h
Move mode and settings sanity check to end of file.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-05 05:03:26 -04:00
68d60151dc Initial commit to branch; split done but untested
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-04 22:49:15 -04:00
2a1073f658 Code cleanup of lcdLib.h
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-04 21:20:51 -04:00
a7f83fbe63 Add *.lst to .gitignore
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-04 21:20:23 -04:00
8281b3c28e Forgot to turn off FOUR_BIT_MODE after testing
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 03:46:57 -04:00
e5cc008cc7 Code cleanup/commenting
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 03:46:44 -04:00
c52fa746e0 Removed repeated #defines for data lines
Removed the repeated #defines for LCD_DBUS*[,_PORT,_DDR,_PIN] used for
both FOUR_BIT_MODE and EIGHT_BIT_ARBITRARY_PIN_MODE.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 03:27:57 -04:00
569316a8ae Fixed init issue with EIGHT_BIT_ARBITRARY_PIN_MODE
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 03:27:13 -04:00
9fda49a40a Forgot to change back to default mode after tests
After trying FOUR_BIT_MODE to ensure it worked properly, forgot to
comment it out so that the default mode is enabled as expected and
documented.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 02:48:42 -04:00
04be2b85da Tested operational 4-bit mode
Cleaned up a few comments and tested and verified operation of 4-bit mode.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-02 02:46:23 -04:00
0a36d6cf77 All 8-bit modes functional
Tested mode 1 (default 8-bit mode), and mode 2 (8-bit mode with
arbitrary pins for the data lines).

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-01 04:06:08 -04:00
fc0de88b8e Finished (but untested) modes
1. Default mode (8-bit data bus, control lines on any PINs)
2. 8-bit arbitrary pin mode (8-bit data bus on any PIN, control lines on
   any PINs)
3. 4-bit mode (4-bit data bus, control lines on any PINs)

Default mode is tested and working. The others still require testing.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-01 03:43:07 -04:00
5777e2b831 Prepare for 4 bit mode of operation
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-10-01 03:04:33 -04:00
3ba737fc7b Fixed timing issues, working again
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-09-30 05:02:43 -04:00
047c4b5c31 Broken likely due to timing
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-09-30 04:46:49 -04:00
1acda4a55a Some cleanup
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-09-29 06:06:37 -04:00
bfb78be425 Initial commit
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-09-29 02:48:09 -04:00