Clean up and comment lcdLib.c
Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
This commit is contained in:
parent
4f9462e983
commit
f7893b7f88
14
lcdLib.c
14
lcdLib.c
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File: lcdLib.c
|
* File: lcdLib.c
|
||||||
|
@ -141,7 +141,7 @@ void writeLCDByte_(uint8_t b) {
|
||||||
and EIGHT_BIT_ARBITRARY_PIN_MODE, the given data is written in one cycle using the
|
and EIGHT_BIT_ARBITRARY_PIN_MODE, the given data is written in one cycle using the
|
||||||
writeLCDByte_ function. In FOUR_BIT_MODE however, the given data is written in two cycles
|
writeLCDByte_ function. In FOUR_BIT_MODE however, the given data is written in two cycles
|
||||||
using two successive calls to the writeLCDNibble_ function.
|
using two successive calls to the writeLCDNibble_ function.
|
||||||
*/
|
*/
|
||||||
void writeLCDInstr_(uint8_t instr) {
|
void writeLCDInstr_(uint8_t instr) {
|
||||||
LCD_RS_PORT &= ~(1 << LCD_RS); // RS=0
|
LCD_RS_PORT &= ~(1 << LCD_RS); // RS=0
|
||||||
LCD_RW_PORT &= ~(1 << LCD_RW); // RW=0
|
LCD_RW_PORT &= ~(1 << LCD_RW); // RW=0
|
||||||
|
@ -164,7 +164,7 @@ void writeLCDInstr(uint8_t instr) {
|
||||||
the LCD. In the default 8-bit mode and EIGHT_BIT_ARBITRARY_PIN_MODE, the given data is
|
the LCD. In the default 8-bit mode and EIGHT_BIT_ARBITRARY_PIN_MODE, the given data is
|
||||||
written in one cycle using the writeLCDByte_ function. In FOUR_BIT_MODE however, the given
|
written in one cycle using the writeLCDByte_ function. In FOUR_BIT_MODE however, the given
|
||||||
data is written in two cycles using two successive calls to the writeLCDNibble_ function.
|
data is written in two cycles using two successive calls to the writeLCDNibble_ function.
|
||||||
*/
|
*/
|
||||||
void writeCharToLCD_(char c) {
|
void writeCharToLCD_(char c) {
|
||||||
LCD_RS_PORT |= (1 << LCD_RS); // RS=1
|
LCD_RS_PORT |= (1 << LCD_RS); // RS=1
|
||||||
LCD_RW_PORT &= ~(1 << LCD_RW); // RW=0
|
LCD_RW_PORT &= ~(1 << LCD_RW); // RW=0
|
||||||
|
@ -192,7 +192,7 @@ void writeCharToLCD_(char c) {
|
||||||
- Alarm '\a': ignored
|
- Alarm '\a': ignored
|
||||||
|
|
||||||
Any other character is sent to the LCD display using writeCharToLCD_.
|
Any other character is sent to the LCD display using writeCharToLCD_.
|
||||||
*/
|
*/
|
||||||
void writeCharToLCD(char c) {
|
void writeCharToLCD(char c) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\n': // Line feed
|
case '\n': // Line feed
|
||||||
|
@ -259,7 +259,7 @@ void writeStringToLCD(const char* str) {
|
||||||
/*
|
/*
|
||||||
Writes the CMD_CLEAR_DISPLAY command to the LCD using writeLCDINSTR, and clears the local
|
Writes the CMD_CLEAR_DISPLAY command to the LCD using writeLCDINSTR, and clears the local
|
||||||
char and line counters.
|
char and line counters.
|
||||||
*/
|
*/
|
||||||
void clearDisplay(void) {
|
void clearDisplay(void) {
|
||||||
writeLCDInstr(CMD_CLEAR_DISPLAY);
|
writeLCDInstr(CMD_CLEAR_DISPLAY);
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ void clearDisplay(void) {
|
||||||
/*
|
/*
|
||||||
Writes the CMD_RETURN_HOME command to the LCD using writeLCDInstr, and clears the local char
|
Writes the CMD_RETURN_HOME command to the LCD using writeLCDInstr, and clears the local char
|
||||||
and line counters.
|
and line counters.
|
||||||
*/
|
*/
|
||||||
void returnHome(void) {
|
void returnHome(void) {
|
||||||
writeLCDInstr(CMD_RETURN_HOME);
|
writeLCDInstr(CMD_RETURN_HOME);
|
||||||
|
|
||||||
|
@ -292,6 +292,8 @@ void returnHome(void) {
|
||||||
/* return c; */
|
/* return c; */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set all pins of LCD_DBUS, as well as pins LCD_RS, and LCD_RW as outputs
|
Set all pins of LCD_DBUS, as well as pins LCD_RS, and LCD_RW as outputs
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue