Added usb_detect() for Clip, Fuze, E200v2 and C200v2.
[kugel-rb.git] / firmware / target / arm / as3525 / usb-as3525.c
blobab2f51e72fbe60685149990e573d8995eb4cdc9e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright © 2008 Rafaël Carré
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 ****************************************************************************/
22 #include "usb.h"
23 #include "power.h"
24 #include "as3525.h"
25 #include <stdbool.h>
27 void usb_enable(bool on)
29 (void)on;
32 void usb_init_device(void)
34 /* TODO */
37 int usb_detect(void)
39 #if defined(SANSA_CLIP)
40 return !GPIOA_PIN(6);
41 #elif defined(SANSA_FUZE) || defined(SANSA_E200V2)
42 return !GPIOA_PIN(3);
43 #elif defined(SANSA_C200V2)
44 return !GPIOA_PIN(1);
45 #else
46 /* TODO: Implement USB detection */
47 return USB_EXTRACTED;
48 #endif