#include "arp.h"
#include "cyc_cnt.h"
#include "eth.h"
#include "ip.h"
#include "lcd.h"
#include "leds.h"
#include "switches.h"
#include "uart.h"
#include "udp.h"
unsigned char leds_val = 0x88;
void uint2digits(unsigned int uint, unsigned int cnt, char digits[])
{
while (cnt > 0) {
--cnt;
digits[cnt] = '0' + uint % 10;
uint /= 10;
}
}
void switches(void)
{
char cnt_digits[4];
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' : ' ');
uint2digits(switches_get_rot_cnt(), 4, cnt_digits);
lcd_chr(1, 12, cnt_digits[0]);
lcd_chr(1, 13, cnt_digits[1]);
lcd_chr(1, 14, cnt_digits[2]);
lcd_chr(1, 15, cnt_digits[3]);
}
void uart(void)
{
unsigned short chr;
while (uart_can_rx()) {
chr = uart_rx();
if (!uart_is_err(chr))