37 lines
768 B
C
37 lines
768 B
C
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
#include "uart.h"
|
|
|
|
void wait(uint8_t count) {
|
|
uint8_t i;
|
|
if(count == 0) count = 100;
|
|
for(i=0;i<count;i++) {
|
|
_delay_ms(10);
|
|
}
|
|
}
|
|
|
|
void uart_print_voltage(uint16_t x) {
|
|
uart_putc(48 + (x / 10000));
|
|
uart_putc(48 + (x % 10000 /1000));
|
|
uart_putc('.');
|
|
uart_putc(48 + (x % 1000 / 100 ));
|
|
//uart_putc(48 + (x % 100 / 10 ));
|
|
//uart_putc(48 + (x % 10));
|
|
}
|
|
|
|
void uart_print_uint8(uint8_t x) {
|
|
uart_putc(48 + (x / 100 ));
|
|
uart_putc(48 + (x % 100 / 10 ));
|
|
uart_putc(48 + (x % 10));
|
|
}
|
|
|
|
void uart_print_uint16(uint16_t x) {
|
|
uart_putc(48 + (x / 10000));
|
|
uart_putc(48 + (x % 10000 /1000));
|
|
uart_putc(48 + (x % 1000 / 100 ));
|
|
uart_putc(48 + (x % 100 / 10 ));
|
|
uart_putc(48 + (x % 10));
|
|
}
|
|
|
|
|