1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 François Dinel
11 * Copyright (C) 2008-2009 Rafaël Carré
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
28 void lcd_hw_init(void)
30 CGU_PERI
|= CGU_SSP_CLOCK_ENABLE
;
32 SSP_CPSR
= AS3525_SSP_PRESCALER
; /* OF = 0x10 */
33 SSP_CR0
= (1<<7) | (1<<6) | 7; /* Motorola SPI frame format, 8 bits */
34 SSP_CR1
= (1<<3) | (1<<1); /* SSP Operation enabled */
35 SSP_IMSC
= 0; /* No interrupts */
38 GPIOB_DIR
|= (1<<2) | (1<<7);
40 GPIOA_PIN(5) = (1<<5);
43 void lcd_write_command(int byte
)
45 while(SSP_SR
& (1<<4)) /* BSY flag */
51 while(SSP_SR
& (1<<4)) /* BSY flag */
55 void lcd_write_data(const fb_data
* p_bytes
, int count
)
57 GPIOB_PIN(2) = (1<<2);
61 while(!(SSP_SR
& (1<<1))) /* wait until transmit FIFO is not full */
64 SSP_DATA
= *p_bytes
++;