init
This commit is contained in:
commit
d1ac414c5e
34 changed files with 64721 additions and 0 deletions
38
rom.c
Normal file
38
rom.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
static unsigned short* lcd = (unsigned short*)0xf00100;
|
||||
|
||||
static void lcd_wait(void){
|
||||
while(lcd[1] & (1 << 7));
|
||||
}
|
||||
|
||||
static void lcd_cmd(unsigned char cmd){
|
||||
lcd[0] = cmd;
|
||||
lcd_wait();
|
||||
}
|
||||
|
||||
static void lcd_data(unsigned char c){
|
||||
lcd[1] = c;
|
||||
lcd_wait();
|
||||
}
|
||||
|
||||
static void lcd_print(const char* str){
|
||||
int i;
|
||||
|
||||
for(i = 0; str[i] != 0; i++) lcd_data(str[i]);
|
||||
}
|
||||
|
||||
#define LCD_DISPLAY (1 << 3)
|
||||
#define LCD_DISPLAY_ON (1 << 2)
|
||||
|
||||
#define LCD_FUNCTION (1 << 5)
|
||||
#define LCD_FUNCTION_8_BITS (1 << 4)
|
||||
#define LCD_FUNCTION_2_LINES (1 << 3)
|
||||
|
||||
int main(void){
|
||||
lcd_cmd(LCD_FUNCTION | LCD_FUNCTION_8_BITS | LCD_FUNCTION_2_LINES);
|
||||
lcd_cmd(LCD_DISPLAY | LCD_DISPLAY_ON);
|
||||
|
||||
lcd_print("Hello, world!");
|
||||
}
|
||||
|
||||
void tick(void){
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue