/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id: $
 *
 * Copyright (C) 2002 Philipp Pertermann
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied. 
 *
 ****************************************************************************/

#include "menu.h"
#include "lcd.h"
#include "button.h"
#include "mas.h"
#include "system.h"
#include "oszillosgraph.h"

Menu oszillosgraph(void){
    int left, right, y = LCD_WIDTH - 1;

    while (button_get_w_tmo(1) != BUTTON_OFF){
        for (y = 0; y < LCD_HEIGHT; y++) {
            lcd_v_roll(y);
            left = mas_codec_readreg(0xC) / 0x200;
            right = mas_codec_readreg(0xD) / 0x200;

            lcd_clearrect(0, y, LCD_WIDTH, 1);
            lcd_fillrect(LCD_WIDTH / 2, y, left, 1);
            lcd_fillrect(0            , y, right, 1);
            lcd_update_rect(0, y, LCD_WIDTH, 1);
        }
        lcd_v_roll(0);
        lcd_update();
    }
    return MENU_OK;
}

