Minor formatting updates to the SerialToLCD project.
This commit is contained in:
parent
2e757d8c38
commit
bd3f6794dd
4 changed files with 59 additions and 38 deletions
|
@ -83,11 +83,11 @@ static void HD44780_WriteByte(const uint8_t c)
|
|||
|
||||
static void HD44780_PowerUp4Bit(void)
|
||||
{
|
||||
/* Wait for more than 40 ms after VCC rises to 2.7 V */
|
||||
/* Wait for more than 40 ms after VCC rises to 2.7 V */
|
||||
_delay_ms(40);
|
||||
HD44780_WriteNibble(0x03); // FN_SET 8-bit
|
||||
|
||||
/* Wait for more than 4.1 ms */
|
||||
/* Wait for more than 4.1 ms */
|
||||
_delay_ms(5);
|
||||
HD44780_WriteNibble(0x03); // FN_SET 8-bit
|
||||
|
||||
|
@ -95,12 +95,12 @@ static void HD44780_PowerUp4Bit(void)
|
|||
_delay_us(100);
|
||||
HD44780_WriteNibble(0x03); // FN_SET 8-bit
|
||||
|
||||
/* From now on we must allow 40us for each command */
|
||||
/* From now on we must allow 40us for each command */
|
||||
_delay_us(50);
|
||||
HD44780_WriteNibble(0x02); // FN_SET 4-bit
|
||||
|
||||
/* The LCD is now in 4-bit mode so we can continue
|
||||
using the 4-bit API */
|
||||
/* The LCD is now in 4-bit mode so we can continue
|
||||
using the 4-bit API */
|
||||
_delay_us(50);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,16 +43,16 @@
|
|||
#include <avr/power.h>
|
||||
|
||||
/* Macros: */
|
||||
#define RS (0x10) // PD4
|
||||
#define ENABLE (0x80) // PD7
|
||||
#define RS (1 << 4) /* PD4 */
|
||||
#define ENABLE (1 << 7) /* PD7 */
|
||||
|
||||
#define HI4_MASK (0xF0)
|
||||
#define LO4_MASK (0x0F) // PD0..3
|
||||
#define HI4_MASK 0xF0
|
||||
#define LO4_MASK 0x0F /* PD0-PD3 */
|
||||
|
||||
#define ALL_BITS (RS|ENABLE|LO4_MASK)
|
||||
#define ALL_BITS (RS | ENABLE | LO4_MASK)
|
||||
|
||||
#define HI4( c ) (( c & HI4_MASK ) >> 4 )
|
||||
#define LO4( c ) (( c & LO4_MASK ) >> 0 )
|
||||
#define HI4(c) ((c & HI4_MASK) >> 4)
|
||||
#define LO4(c) ((c & LO4_MASK) >> 0)
|
||||
|
||||
#define CMD_DISPLAY_ON 0x0C
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue