Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SLCD by
Diff: SLCD.cpp
- Revision:
- 12:2470cab680b7
- Parent:
- 10:ef2b3b7f1b01
--- a/SLCD.cpp Mon Sep 29 15:23:49 2014 +0000
+++ b/SLCD.cpp Mon Sep 29 15:54:39 2014 +0000
@@ -1,7 +1,25 @@
+/**
+ * @file SLCD.cpp
+ * @brief Abstract
+ * @copyright (c)
+ */
+// -----------------------------------------------------------------------------
+// note
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// include files
+// -----------------------------------------------------------------------------
#include "SLCD.h"
#include "LCDconfig.h"
+// -----------------------------------------------------------------------------
+// general define
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// struct define
+// -----------------------------------------------------------------------------
const uint8_t WF_ORDERING_TABLE[ ] = {
CHAR1a, // LCD81 --- Pin:5 LCDnAddress=51
CHAR1b, // LCD82 --- Pin:6 LCDnAddress=52
@@ -83,12 +101,41 @@
( SEGD+!SEGE+!SEGF+!SEGG) , (!SEGC+!SEGB+ SEGA) ,//Char = `, offset=192
};
+// -----------------------------------------------------------------------------
+// external function
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// function prototype
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// external variable
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// global variable
+// -----------------------------------------------------------------------------
+
+// -----------------------------------------------------------------------------
+// function
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//! @brief SLCD Main Function
+//! @param [in] nil
+//! @retval nil
+// -----------------------------------------------------------------------------
SLCD::SLCD()
{
init();
CharPosition = 0;
}
+// -----------------------------------------------------------------------------
+//! @brief Initialize Setting
+//! @param [in] nil
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::init()
{
SIM->SCGC5 |= SIM_SCGC5_SLCD_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTD_MASK | SIM_SCGC5_PORTE_MASK;
@@ -145,12 +192,22 @@
LCD->GCR |= LCD_GCR_LCDEN_MASK;
}
+// -----------------------------------------------------------------------------
+//! @brief Put Characters
+//! @param [in] c integer
+//! @retval int
+// -----------------------------------------------------------------------------
int SLCD::_putc(int c)
{
Write_Char(c);
return 0;
}
+// -----------------------------------------------------------------------------
+//! @brief Write Characters
+//! @param [in] lbValue characters
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::Write_Char (char lbValue)
{
if (CharPosition >= _CHARNUM)
@@ -195,22 +252,42 @@
CharPosition++;
}
+// -----------------------------------------------------------------------------
+//! @brief Set Home Position
+//! @param [in] nil
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::Home()
{
CharPosition = 0;
}
+// -----------------------------------------------------------------------------
+//! @brief Set Contrast
+//! @param [in] lbContrast contrast
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::Contrast (uint8_t lbContrast)
{
lbContrast &= 0x0F; //Forced to the only values accepted
LCD->GCR |= LCD_GCR_RVTRIM(lbContrast);
}
+// -----------------------------------------------------------------------------
+//! @brief Clear Segments
+//! @param [in] nil
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::clear()
{
All_Segments(0);
}
+// -----------------------------------------------------------------------------
+//! @brief Set Segments
+//! @param [in] mode mode
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::All_Segments (int mode)
{
uint8_t lbTotalBytes = _CHARNUM * _LCDTYPE;
@@ -227,6 +304,12 @@
}
}
+// -----------------------------------------------------------------------------
+//! @brief Set DP
+//! @param [in] pos position
+//! @param [in] on on
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::DP(int pos, bool on)
{
uint8_t *lbpLCDWF;
@@ -252,21 +335,41 @@
}
}
+// -----------------------------------------------------------------------------
+//! @brief Set DP1
+//! @param [in] mode mode
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::DP1 (int mode)
{
DP(0, mode==1);
}
+// -----------------------------------------------------------------------------
+//! @brief Set DP2
+//! @param [in] mode mode
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::DP2 (int mode)
{
DP(1, mode==1);
}
+// -----------------------------------------------------------------------------
+//! @brief Set DP3
+//! @param [in] mode mode
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::DP3 (int mode)
{
DP(2, mode==1);
}
+// -----------------------------------------------------------------------------
+//! @brief Set Colon
+//! @param [in] on on
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::Colon (bool on)
{
uint8_t *lbpLCDWF;
@@ -278,6 +381,11 @@
}
}
+// -----------------------------------------------------------------------------
+//! @brief Set Blink
+//! @param [in] blink blink
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::blink(int blink)
{
if (( blink > 7) || (blink < 0))
@@ -286,6 +394,11 @@
LCD->AR |= LCD_AR_BLINK_MASK | blink;
}
+// -----------------------------------------------------------------------------
+//! @brief Deep Sleep Enable
+//! @param [in] enable enable
+//! @retval nil
+// -----------------------------------------------------------------------------
void SLCD::deepsleepEnable(bool enable)
{
MCG->C1 &= ~MCG_C1_IREFSTEN_MASK;
