diff --git a/Moteur/serial.c b/Moteur/serial.c new file mode 100644 index 0000000..7636c6a --- /dev/null +++ b/Moteur/serial.c @@ -0,0 +1,33 @@ +#include "serial.h" + +void init_serial(unsigned long int speed) //initialisation de la liaison série +{ +/* Set baud rate */ +UBRR0 = CPU_FREQ/(((unsigned long int)speed)<<4)-1; + +/* Enable transmitter & receiver */ +UCSR0B = (1< // for the input/output register +#include + +#define CPU_FREQ 16000000L // Assume a CPU frequency of 16Mhz + +void init_serial(unsigned long int speed); +void send_serial(uint8_t c); +uint8_t get_serial(void); +void send_ack(void); +#endif -- libgit2 0.21.2