F Malpartida avatar F Malpartida committed 83bc88d

Added backlight control on constructor.
Added support for backlight control using POSITIVE and NEGATIVE logic.

Comments (0)

Files changed (12)

    // 50
    // ---------------------------------------------------------------------------
    delay (100); // 100ms delay
-      
+   
    //put the LCD into 4 bit or 8 bit mode
    // -------------------------------------
    if (! (_displayfunction & LCD_8BITMODE)) 
    {
       command(LCD_SETDDRAMADDR | (col + row_offsetsDef[row]));
    }
-
+   
 }
 
 // Turn the display on/off
    }
 }
 
+//
+// Switch on the backlight
 void LCD::backlight ( void )
 {
    setBacklight(255);
 }
 
+//
+// Switch off the backlight
 void LCD::noBacklight ( void )
 {
    setBacklight(0);
  */
 #define HOME_CLEAR_EXEC      2000
 
+/*!
+ @typedef 
+ @abstract   Define backlight control polarity
+ @discussion Backlight control polarity. @see setBacklightPin.
+ */
+typedef enum { POSITIVE, NEGATIVE } t_backlighPol;
+
 class LCD : public Print 
 {
 public:
     @param      none
     */   
    void moveCursorLeft();
-
+   
    
    /*!
     @function
     @param      row[in] LCD row - line.
     */
    void setCursor(uint8_t col, uint8_t row);
-
+   
    
    /*!
     @function
     This method is device dependent and can be programmed on each subclass. An 
     empty function call is provided that does nothing.
     
-    @param      mode: backlight mode (HIGH|LOW)
+    @param      value: pin associated to backlight control.
+    @param      pol: backlight polarity control (POSITIVE, NEGATIVE)
     */
-   virtual void setBacklightPin ( uint8_t value ) { };
+   virtual void setBacklightPin ( uint8_t value, t_backlighPol pol ) { };
    
    /*!
     @function
     "noBacklight".
     
     @param      0..255 - the value is very dependent on the LCD, however, 0
-    will be interpreted as off.
+    will be interpreted as off. If backlight polarity set to negative, the
+    values will be inverted.
     */
    virtual void setBacklight ( uint8_t value ) { };
    
     @discussion Switch-on the LCD backlight.
     The setBacklightPin has to be called before setting the backlight for
     this method to work. @see setBacklightPin. 
-   */
+    */
    void backlight ( void );
-
+   
    /*!
     @function
     @abstract   Switch-off the LCD backlight.
    // Internal LCD variables to control the LCD shared between all derived
    // classes.
    uint8_t _displayfunction;  // LCD_5x10DOTS or LCD_5x8DOTS, LCD_4BITMODE or 
-                              // LCD_8BITMODE, LCD_1LINE or LCD_2LINE
+   // LCD_8BITMODE, LCD_1LINE or LCD_2LINE
    uint8_t _displaycontrol;   // LCD base control command LCD on/off, blink, cursor
-                              // all commands are "ored" to its contents.
+   // all commands are "ored" to its contents.
    uint8_t _displaymode;      // Text entry mode to the LCD
    uint8_t _numlines;         // Number of lines of the LCD, initialized with begin()
    uint8_t _cols;             // Number of columns in the LCD
+   t_backlighPol _polarity;   // Backlight polarity
    
 private:
    

LiquidCrystal.cpp

 
 // CONSTRUCTORS
 // ---------------------------------------------------------------------------
-LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
-                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
-                             uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
-{
-   init(LCD_8BIT, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
-}
 
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t enable,
                              uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
 }
 
 LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
+                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                             uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7)
+{
+   init(LCD_8BIT, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
+}
+
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
                              uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3)
 {
    init(LCD_4BIT, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0);
    init(LCD_4BIT, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0);
 }
 
+// Contructors with backlight control
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t enable,
+                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                             uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
+                             uint8_t backlightPin, t_backlighPol pol)
+{
+   init(LCD_8BIT, rs, 255, enable, d0, d1, d2, d3, d4, d5, d6, d7);
+   setBacklightPin ( backlightPin, pol );
+}
 
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
+                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                             uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
+                             uint8_t backlightPin, t_backlighPol pol)
+{
+   init(LCD_8BIT, rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7);
+   setBacklightPin ( backlightPin, pol );
+}
+
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
+                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                             uint8_t backlightPin, t_backlighPol pol)
+{
+   init(LCD_4BIT, rs, rw, enable, d0, d1, d2, d3, 0, 0, 0, 0);
+   setBacklightPin ( backlightPin, pol );
+}
+
+LiquidCrystal::LiquidCrystal(uint8_t rs, uint8_t enable,
+                             uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                             uint8_t backlightPin, t_backlighPol pol)
+{
+   init(LCD_4BIT, rs, 255, enable, d0, d1, d2, d3, 0, 0, 0, 0);
+   setBacklightPin ( backlightPin, pol );
+}
 
 // PUBLIC METHODS
 // ---------------------------------------------------------------------------
 
 //
 // setBacklightPin
-void LiquidCrystal::setBacklightPin ( uint8_t pin )
+void LiquidCrystal::setBacklightPin ( uint8_t pin, t_backlighPol pol )
 {
    pinMode ( pin, OUTPUT ); // Difine the backlight pin as output
    _backlightPin = pin;
+   _polarity = pol;
 }
 
 //
 // setBackligh
 void LiquidCrystal::setBacklight ( uint8_t value )
 {
+   // Check if there is a pin assigned to the backlight
+   // ---------------------------------------------------
    if ( _backlightPin != LCD_NOBACKLIGHT )
    {
+      // Check if the pin is associated to a timer, i.e. PWM
+      // ---------------------------------------------------
       if(digitalPinToTimer(_backlightPin) != NOT_ON_TIMER)
       {
-         analogWrite ( _backlightPin, value );
+         // Check for control polarity inversion
+         // ---------------------------------------------------
+         if ( _polarity == POSITIVE )
+         {
+            analogWrite ( _backlightPin, value );
+         }
+         else 
+         {
+            analogWrite ( _backlightPin, 255 - value );
+         }
       }
-      else if(value)
+      // Not a PWM pin, set the backlight pin for POSI or NEG
+      // polarity
+      // --------------------------------------------------------
+      else if (((value > 0) && (_polarity == POSITIVE)) ||
+               ((value == 0) && (_polarity == NEGATIVE)))
       {
          digitalWrite( _backlightPin, HIGH);
       }
    
    // Initialise the backlight pin no nothing
    _backlightPin = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
 }
 
 //
 
 
 /*!
-    @defined 
-    @abstract   Command execution time on the LCD.
-    @discussion This defines how long a command takes to execute by the LCD.
-      The time is expressed in micro-seconds.
-*/
+ @defined 
+ @abstract   Command execution time on the LCD.
+ @discussion This defines how long a command takes to execute by the LCD.
+ The time is expressed in micro-seconds.
+ */
 #define EXEC_TIME 37
 
 class LiquidCrystal : public LCD
                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
                  uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7);
    
+   // Constructors with backlight control
+   LiquidCrystal(uint8_t rs, uint8_t enable,
+                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
+                 uint8_t backlightPin, t_backlighPol pol);
+   LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
+                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                 uint8_t d4, uint8_t d5, uint8_t d6, uint8_t d7,
+                 uint8_t backlightPin, t_backlighPol pol);   
    /*!
     @method     
     @abstract   4 bit LCD constructors.
    LiquidCrystal(uint8_t rs, uint8_t enable,
                  uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3);
    
+   // Constructors with backlight control
+   LiquidCrystal(uint8_t rs, uint8_t rw, uint8_t enable,
+                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                 uint8_t backlightPin, t_backlighPol pol);
+   LiquidCrystal(uint8_t rs, uint8_t enable,
+                 uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                 uint8_t backlightPin, t_backlighPol pol);
    /*!
     @function
     @abstract   Send a particular value to the LCD.
     @discussion Sets the pin in the device to control the backlight.
     
     @param      pin: pin assigned to the backlight
+    @param      pol: backlight pin control polarity (POSITIVE, NEGATIVE).
     */
-   void setBacklightPin ( uint8_t pin );
-      
+   void setBacklightPin ( uint8_t pin, t_backlighPol pol );
+   
    /*!
     @function
     @abstract   Switch-on/off the LCD backlight.

LiquidCrystal_I2C.cpp

 #define LCD_BACKLIGHT   0xFF
 
 
+// Default library configuration parameters used by class constructor with
+// only the I2C address field.
+// ---------------------------------------------------------------------------
+/*!
+ @defined 
+ @abstract   Enable bit of the LCD
+ @discussion Defines the IO of the expander connected to the LCD Enable
+ */
+#define EN B01000000  // Enable bit
+
+/*!
+ @defined 
+ @abstract   Read/Write bit of the LCD
+ @discussion Defines the IO of the expander connected to the LCD Rw pin
+ */
+#define RW B00100000  // Read/Write bit
+
+/*!
+ @defined 
+ @abstract   Register bit of the LCD
+ @discussion Defines the IO of the expander connected to the LCD Register select pin
+ */
+#define RS B00010000  // Register select bit
+
+
 // CONSTRUCTORS
 // ---------------------------------------------------------------------------
 LiquidCrystal_I2C::LiquidCrystal_I2C( uint8_t lcd_Addr )
    
    _backlightPinMask = 0x0;
    _backlightStsMask = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
    
    _En = EN;
    _Rw = RW;
    }
 }
 
-LiquidCrystal_I2C::LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
-                                      uint8_t Rs)
+
+LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t backlighPin, 
+                                     t_backlighPol pol = POSITIVE)
+{
+   _Addr = lcd_Addr;
+   
+   _backlightPinMask = 0x0;
+   _backlightStsMask = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
+   
+   _En = EN;
+   _Rw = RW;
+   _Rs = RS;
+   
+   // Initialise default values data[0] pin 0, data[1] pin 1, ...
+   for ( uint8_t i = 0; i < 4; i++ )
+   {
+      _data_pins[i] = ( 1 << i );
+   }
+   setBacklightPin(backlighPin, pol);
+}
+
+LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
+                                     uint8_t Rs)
 {
    _Addr = lcd_Addr;
    
    _backlightPinMask = 0;
    _backlightStsMask = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
    
    _En = ( 1 << En );
    _Rw = ( 1 << Rw );
    }
 }
 
-LiquidCrystal_I2C::LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
+LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
+                                     uint8_t Rs, uint8_t backlighPin, 
+                                     t_backlighPol pol = POSITIVE)
+{
+   _Addr = lcd_Addr;
+   
+   _backlightPinMask = 0;
+   _backlightStsMask = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
+   
+   _En = ( 1 << En );
+   _Rw = ( 1 << Rw );
+   _Rs = ( 1 << Rs );
+   
+   // Initialise default values data[0] pin 0, data[1] pin 1, ...
+   for ( uint8_t i = 0; i < 4; i++ )
+   {
+      _data_pins[i] = ( 1 << i );
+   }
+   setBacklightPin(backlighPin, pol);
+}
+
+LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
                                      uint8_t Rs, uint8_t d0, uint8_t d1,
                                      uint8_t d2, uint8_t d3 )
 {
    
    _backlightPinMask = 0;
    _backlightStsMask = LCD_NOBACKLIGHT;
-
+   _polarity = POSITIVE;
+   
    _En = ( 1 << En );
    _Rw = ( 1 << Rw );
    _Rs = ( 1 << Rs );
    _data_pins[3] = ( 1 << d3 );
 }
 
+LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw,
+                                     uint8_t Rs, uint8_t d0, uint8_t d1,
+                                     uint8_t d2, uint8_t d3, uint8_t backlighPin, 
+                                     t_backlighPol pol = POSITIVE )
+{
+   _Addr = lcd_Addr;
+   
+   _backlightPinMask = 0;
+   _backlightStsMask = LCD_NOBACKLIGHT;
+   _polarity = POSITIVE;
+   
+   _En = ( 1 << En );
+   _Rw = ( 1 << Rw );
+   _Rs = ( 1 << Rs );
+   
+   // Initialise pin mapping
+   _data_pins[0] = ( 1 << d0 );
+   _data_pins[1] = ( 1 << d1 );
+   _data_pins[2] = ( 1 << d2 );
+   _data_pins[3] = ( 1 << d3 );
+   setBacklightPin(backlighPin, pol);
+}
+
 // PUBLIC METHODS
 // ---------------------------------------------------------------------------
 
 
 //
 // setBacklightPin
-void LiquidCrystal_I2C::setBacklightPin ( uint8_t pin )
+void LiquidCrystal_I2C::setBacklightPin ( uint8_t pin, t_backlighPol pol = POSITIVE )
 {
    _backlightPinMask = ( 1 << pin );
+   _polarity = pol;
 }
 
 //
 // setBacklight
 void LiquidCrystal_I2C::setBacklight( uint8_t value ) 
 {
-   if ( value > 0 )
+   // Check if backlight is available
+   // ----------------------------------------------------
+   if ( _backlightPinMask != 0x0 )
    {
-      _backlightStsMask = _backlightPinMask & LCD_BACKLIGHT;
-      
+      // Check for polarity to configure mask accordingly
+      // ----------------------------------------------------------
+      if  (((_polarity == POSITIVE) && (value > 0)) || 
+           ((_polarity == NEGATIVE ) && ( value == 0 )))
+      {
+         _backlightStsMask = _backlightPinMask & LCD_BACKLIGHT;
+      }
+      else 
+      {
+         _backlightStsMask = _backlightPinMask & LCD_NOBACKLIGHT;
+      }
+      _i2cio.write( _backlightStsMask );
    }
-   else 
-   {
-      _backlightStsMask = _backlightPinMask & LCD_NOBACKLIGHT;
-   }
-   _i2cio.write( _backlightStsMask );
 }
 
 

LiquidCrystal_I2C.h

 #include "I2CIO.h"
 #include "LCD.h"
 
-// Default library configuration parameters used by class constructor with
-// only the I2C address field.
-// ---------------------------------------------------------------------------
-/*!
- @defined 
- @abstract   Enable bit of the LCD
- @discussion Defines the IO of the expander connected to the LCD Enable
- */
-#define EN B01000000  // Enable bit
-
-/*!
- @defined 
- @abstract   Read/Write bit of the LCD
- @discussion Defines the IO of the expander connected to the LCD Rw pin
- */
-#define RW B00100000  // Read/Write bit
-
-/*!
- @defined 
- @abstract   Register bit of the LCD
- @discussion Defines the IO of the expander connected to the LCD Register select pin
- */
-#define RS B00010000  // Register select bit
-
 
 class LiquidCrystal_I2C : public LCD 
 {
     the address can be configured using the on board jumpers.
     */
    LiquidCrystal_I2C (uint8_t lcd_Addr);
+   // Constructor with backlight control
+   LiquidCrystal_I2C (uint8_t lcd_Addr, uint8_t backlighPin, t_backlighPol pol);
    
    /*!
     @method     
     @param      Rs[in] LCD Rs (Reset) pin connected to the IO extender module
     */
    LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs);
-   
+   // Constructor with backlight control
+   LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs,
+                     uint8_t backlighPin, t_backlighPol pol);   
    
    /*!
     @method     
     @param      d2[in] LCD data 2 pin map on IO extender module
     @param      d3[in] LCD data 3 pin map on IO extender module
     */
-   LiquidCrystal_I2C( uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, 
+   LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, 
                      uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3 );
-   
+   // Constructor with backlight control
+   LiquidCrystal_I2C(uint8_t lcd_Addr, uint8_t En, uint8_t Rw, uint8_t Rs, 
+                     uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
+                     uint8_t backlighPin, t_backlighPol pol);
    /*!
     @function
     @abstract   LCD initialization and associated HW.
     
     @param      0: backlight off, 1..255: backlight on.
     */
-   void setBacklightPin ( uint8_t value );
+   void setBacklightPin ( uint8_t value, t_backlighPol pol );
    
    /*!
     @function

LiquidCrystal_SR.cpp

 
 //
 // setBacklightPin
-void LiquidCrystal_SR::setBacklightPin ( uint8_t pin )
+void LiquidCrystal_SR::setBacklightPin ( uint8_t pin, t_backlighPol pol )
 { }
 
 //

LiquidCrystal_SR.h

     @function
     @abstract   Sets the pin to control the backlight.
     @discussion Sets the pin in the device to control the backlight.
+    @warning    Currently not supported
     
     @param      mode: backlight mode (HIGH|LOW)
+    @param      pol: backlight polarity
     */
-   void setBacklightPin ( uint8_t pin );
+   void setBacklightPin ( uint8_t pin, t_backlighPol pol );
    
    /*!
     @function

examples/HelloWorld_4bit/HelloWorld_4bit.pde

 #include <LiquidCrystal.h>
 
 
-LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 #define   CONTRAST_PIN   9
 #define   BACKLIGHT_PIN  7
 #define   CONTRAST       110
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2, BACKLIGH_PIN, POSITIVE );
+
 
 // Creat a set of new characters
 byte smiley[8] = {
   pinMode(CONTRAST_PIN, OUTPUT);
   analogWrite ( CONTRAST_PIN, CONTRAST );
 
-  lcd.setBacklightPin ( BACKLIGHT_PIN );
-  lcd.setBacklight ( HIGH );
+  //lcd.setBacklightPin ( BACKLIGHT_PIN, POSITIVE );
+  //lcd.setBacklight ( HIGH );
+  lcd.backlight();
     
   lcd.begin(16,2);               // initialize the lcd 
 

examples/HelloWorld_i2c/HelloWorld_i2c.pde

 #include <Wire.h> 
 #include <LiquidCrystal_I2C.h>
 
+
+
+#define BACKLIGHT_PIN     13
+
 LiquidCrystal_I2C lcd(0x38);  // Set the LCD I2C address
 
-#define BACKLIGHT_PIN     13
+//LiquidCrystal_I2C lcd(0x38, BACKLIGHT_PIN, POSITIVE);  // Set the LCD I2C address
+
 
 // Creat a set of new characters
 const uint8_t charBitmap[][8] = {

examples/i2cLCDextraIO/i2cLCDextraIO.pde

     @abstract   LCD backlight pin definition.
     @discussion AVR pin used for the backlight illumintation of the LCD.
 */
-#define BACKLIGHT_PIN          12
+#define BACKLIGHT_PIN          7
 
 /*!
     @defined    TEMP_CAL_OFFSET
 #endif
 
 #ifdef _LCD_4BIT_
-LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2, BACKLIGHT_PIN, POSITIVE);
 #endif
 const int    CONTRAST_PIN  = 9;
 const int    CONTRAST      = 65;
    
 #ifdef _LCD_4BIT_
   pinMode(CONTRAST_PIN, OUTPUT);
-  pinMode(BACKLIGHT_PIN, OUTPUT);
-#endif
+  lcd.backlight();
   digitalWrite(BACKLIGHT_PIN, HIGH);
   analogWrite (CONTRAST_PIN, CONTRAST);
+#else
+  pinMode ( BACKLIGHT_PIN, OUTPUT );
+  digitalWrite(BACKLIGHT_PIN, HIGH);
+#endif
 
    myLCD->begin ( 16, 2 );
   

examples/i2cLCDextraIO_tempLeonardo/i2cLCDextraIO_tempLeonardo.ino

 #endif
 
 #ifdef _LCD_4BIT_
-LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
+LiquidCrystal lcd(12, 11, 5, 4, 3, 2, BACKLIGHT_PIN, POSITIVE);
 const int    CONTRAST_PIN  = 9;
 const int    CONTRAST      = 65;
 #endif
   analogWrite (CONTRAST_PIN, CONTRAST);
 #endif
 
+#ifdef _LCD_I2C_
    pinMode ( BACKLIGHT_PIN, OUTPUT );
    digitalWrite (BACKLIGHT_PIN, HIGH);
-   
+#else
+   myLCD->backlight();
+#endif
    pinMode ( STATUS_PIN, OUTPUT );
 
    myLCD->begin ( 20, 4 );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.