Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: right_to_left and left_to_eight #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

bobnil
Copy link

@bobnil bobnil commented Feb 8, 2019

  • pifacecad_lcd_right_to_left and pifacecad_lcd_autoscroll_off modified
    cur_display_control instead of cur_entry_mode.

  • The descriptions of function in pifacecad.h had been copy and
    pasted, but the function names was not updated in the examples.

pifacecad.c

void pifacecad_lcd_right_to_left(void)
// This will 'right justify' text from the cursor
void pifacecad_lcd_autoscroll_on(void)
{

  • cur_display_control |= LCD_ENTRYSHIFTINCREMENT;
  • pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_display_control);
  • cur_entry_mode |= LCD_ENTRYSHIFTINCREMENT;
  • pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_entry_mode);
    }

// This will 'left justify' text from the cursor
void pifacecad_lcd_autoscroll_off(void)
{

  • cur_display_control &= 0xff ^ LCD_ENTRYSHIFTINCREMENT;
  • pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_display_control);
  • cur_entry_mode &= 0xff ^ LCD_ENTRYSHIFTINCREMENT;
  • pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_entry_mode);
    }

pifacecad.h

    • pifacecad_lcd_display_on();
      
    • pifacecad_lcd_blink_on();
      
    • pifacecad_lcd_display_off();
      
    • pifacecad_lcd_blink_off();
      
    • pifacecad_lcd_display_on();
      
    • pifacecad_lcd_cursor_on();
      
    • pifacecad_lcd_display_off();
      
    • pifacecad_lcd_cursor_off();
      
    • pifacecad_lcd_display_on();
      
    • pifacecad_lcd_backlight_on();
      
    • pifacecad_lcd_display_off();
      
    • pifacecad_lcd_backlight_off();
      

* pifacecad_lcd_right_to_left and pifacecad_lcd_autoscroll_off modified
  cur_display_control instead of cur_entry_mode.

* The descriptions of function in pifacecad.h had been copy and
  pasted, but the function names was not updated in the examples.

pifacecad.c

void pifacecad_lcd_right_to_left(void)
 // This will 'right justify' text from the cursor
 void pifacecad_lcd_autoscroll_on(void)
 {
-    cur_display_control |= LCD_ENTRYSHIFTINCREMENT;
-    pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_display_control);
+    cur_entry_mode |= LCD_ENTRYSHIFTINCREMENT;
+    pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_entry_mode);
 }

 // This will 'left justify' text from the cursor
 void pifacecad_lcd_autoscroll_off(void)
 {
-    cur_display_control &= 0xff ^ LCD_ENTRYSHIFTINCREMENT;
-    pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_display_control);
+    cur_entry_mode &= 0xff ^ LCD_ENTRYSHIFTINCREMENT;
+    pifacecad_lcd_send_command(LCD_ENTRYMODESET | cur_entry_mode);
 }

pifacecad.h

- *     pifacecad_lcd_display_on();
+ *     pifacecad_lcd_blink_on();

- *     pifacecad_lcd_display_off();
+ *     pifacecad_lcd_blink_off();

- *     pifacecad_lcd_display_on();
+ *     pifacecad_lcd_cursor_on();

- *     pifacecad_lcd_display_off();
+ *     pifacecad_lcd_cursor_off();

- *     pifacecad_lcd_display_on();
+ *     pifacecad_lcd_backlight_on();

- *     pifacecad_lcd_display_off();
+ *     pifacecad_lcd_backlight_off();
Added utility funcitons:

  void pifacecad_lcd_display_control(uint8_t attr, uint8_t state);
  void pifacecad_lcd_entry_mode(uint8_t attr, uint8_t state);

Added functions that take a parameter instead of having to call
two diffrerent functions for turning a thing on or off.

  void pifacecad_lcd_display(uint8_t state)
  void pifacecad_lcd_blink(uint8_t state)
  void pifacecad_lcd_cursor(uint8_t state)
  void pifacecad_lcd_autoscroll(uint8_t state)
-static const uint8_t ROW_OFFSETS[] = {0, 0x40};
+static const uint8_t ROW_OFFSETS[] = {0, 40};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant