Colour targets: Revert an optimisation from almost 18 months ago that actually turned...
[Rockbox.git] / bootloader / meizu_m6sl.c
blob08e01fd33332b3fda5943bf55c2d049acf10d688
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2006 by Greg White
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "config.h"
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include "inttypes.h"
26 #include "string.h"
27 #include "cpu.h"
28 #include "system.h"
29 #include "lcd.h"
30 #include "kernel.h"
31 #include "thread.h"
32 #include "ata.h"
33 #include "fat.h"
34 #include "disk.h"
35 #include "font.h"
36 #include "adc.h"
37 #include "backlight.h"
38 #include "backlight-target.h"
39 #include "button.h"
40 #include "panic.h"
41 #include "power.h"
42 #include "file.h"
43 #include "common.h"
44 #include "rbunicode.h"
45 #include "usb.h"
47 #include <stdarg.h>
49 char version[] = APPSVERSION;
51 void main(void)
53 //Set backlight pin to output and enable
54 int oldval = PCON0;
55 PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
56 PDAT0 |= (1 << 2);
58 //Set PLAY to input
59 oldval = PCON1;
60 PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
62 //Set the piezo pins to output
63 oldval = PCON5;
64 PCON5 = ((oldval & ~((0xf << 4) | (0xf << 8))) | ((1 << 0) | (1 << 4)));
65 PDAT5 &= ~((1 << 1) | (1 << 2)); //should not be needed
67 PDAT5 |= (1 << 1); //Toggle piezo +
69 //toggle backlight on PLAY
70 while(true)
72 // Wait for play to be pressed
73 while(!(PDAT1 & (1 << 4)))
77 PDAT5 ^= (1 << 1); //Toggle piezo +
78 PDAT0 ^= (1 << 2); //Toggle packlight
80 // Wait for play to be released
81 while(PDAT1 & (1 << 4))