// Get the string match pattern
uint32_t ReverseChordFinderMode::HandleGettingStringsMatchPatternState(uint32_t irKey)
{
    // Cache some useful data.
    Display *pDisplay = Display::Instance();
    uint8_t *pPattern = m_Chord.GetPatternPtr();
        
    // Assume that we're going to use the specified IR key.
    uint32_t returnKey = 0;
    
    switch (irKey)
    {
    case PATTERN_RIGHT: // Remove upper strings
        if (m_MatchPattern > 1)
        {
            m_MatchPattern >>= 1;
        }
        pPattern[0] = m_MatchPattern;
        
        // Display the match pattern on the fingerboard.
        pDisplay->DisplayLeds(&m_Chord);
        break;
        
    case PATTERN_LEFT: // Add upper strings.
        if (m_MatchPattern < ((1 << LedDriver::NUM_STRINGS) - 1))
        {
            m_MatchPattern = (m_MatchPattern <<= 1) + 1;
        }
        pPattern[0] = m_MatchPattern;

        // Display the match pattern on the fingerboard.
        pDisplay->DisplayLeds(&m_Chord);
        break;
        
    case SELECT: // Select the current pattern.  Advance to the next state.
        m_CurrentState = GETTING_FRET_STATE;

        // Reset the match pattern on the fingerboard.
        pPattern[0] = 0;
        pDisplay->DisplayLeds(&m_Chord);

        // Display our headline.
        m_Chord.SetFret(0);
        pDisplay->DispLcdProgmem(F("Base Fret: ANY"), true, 0, 0);
        break;
        
    default:
        // We didn't handle the passed in key, so return it unmodified.
        returnKey = irKey;
        break;
    }
// Get the Reverse Chord Finer mode ready to run.
void ReverseChordFinderMode::Startup()
{
    // Cache a pointer to the display instance.
    Display *pDisplay = Display::Instance();
    
    // Setup for the first state and initialize our instance daata.
    m_CurrentState  = GETTING_STRING_MATCH_PATTERN_STATE;
    m_CurrentString = 0;
    m_CurrentFret   = 0;
    m_CurrentValue  = 0;
    m_MatchPattern = (1 << LedDriver::NUM_STRINGS) - 1;
    memset(&m_Chord, 0, sizeof(Chord));
    
    // Reset our chord data to the first chord.
    m_ChordData.GetChord(0, 0, 0);
    
    // Clear all LEDs.
    pDisplay->SetAllLeds(false);
    
    // Display the initial match pattern on the fingerboard.
    uint8_t *pPattern = m_Chord.GetPatternPtr();
    pPattern[0] = m_MatchPattern;
    pDisplay->DisplayLeds(&m_Chord);
    
    pDisplay->DispLcdProgmem(F("Strings to Match"), true, 0, 0);
}