BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
5e29ab5
Branches
Tags
master
mips_sys
fw
main.c
implemented switches
Stefan Schuermans
commited
5e29ab5
at 2012-02-12 20:47:12
main.c
Blame
History
Raw
#include "cyc_cnt.h" #include "lcd.h" #include "leds.h" #include "switches.h" const int myconst = 0x12345678; int myvar = 0x11223344; volatile int data[100]; void switches(void) { lcd_chr(1, 0, switches_get_state(sw_0) ? '0' : ' '); lcd_chr(1, 1, switches_get_state(sw_1) ? '1' : ' '); lcd_chr(1, 2, switches_get_state(sw_2) ? '2' : ' '); lcd_chr(1, 3, switches_get_state(sw_3) ? '3' : ' '); lcd_chr(1, 4, switches_get_state(sw_east) ? 'E' : ' '); lcd_chr(1, 5, switches_get_state(sw_north) ? 'N' : ' '); lcd_chr(1, 6, switches_get_state(sw_south) ? 'S' : ' '); lcd_chr(1, 7, switches_get_state(sw_west) ? 'W' : ' '); lcd_chr(1, 8, switches_get_state(sw_center) ? 'C' : ' '); lcd_chr(1, 9, switches_get_state(sw_rot_a) ? 'a' : ' '); lcd_chr(1, 10, switches_get_state(sw_rot_b) ? 'b' : ' '); } void delay(void) { unsigned int i; for (i = 0; i < 10; ++i) { switches(); cyc_cnt_delay_ms(20); } } int main() { unsigned int i; for (i = 0; i < sizeof(data) / sizeof(data[0]); ++i) data[i] = i; lcd_init(); lcd_str(0, "MIPS I system"); lcd_str(1, ""); while (1) { for (i = 0x1; i < 0x80; i <<= 1) { leds_set_state(i); delay(); } for (i = 0x80; i > 0x1; i >>= 1) { leds_set_state(i); delay(); } } return 0; }