From b64d3ca7571ca65fe43bdfdae58d005f2e99b7a7 Mon Sep 17 00:00:00 2001 From: lahouass Date: Thu, 6 Feb 2020 10:07:31 +0100 Subject: [PATCH] Envoi de la temperature vers la raspberry (fonctionnel) --- Tuno_to_rpi.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+), 0 deletions(-) create mode 100644 Tuno_to_rpi.c diff --git a/Tuno_to_rpi.c b/Tuno_to_rpi.c new file mode 100644 index 0000000..752fe7a --- /dev/null +++ b/Tuno_to_rpi.c @@ -0,0 +1,115 @@ +#include // for the input/output register +#include +#include +#include +#include +#include +#define PRESCALER 1024 +#define TIME_SLOT 20 +#define BAUDRATE 103 + +#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) +#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) + +char Donnee[24]; +float temp; + +void init_serial(void) +{ + /* ACHTUNG : we suppose UBRR value < 0xff */ + /* Not true in all case */ + uint8_t baudrate = BAUDRATE; + /* Set baud rate */ + UBRR0H = 0; + UBRR0L = baudrate; + /* Enable transmitter *///task_led_red(); + //task_send_serial('A'); + UCSR0B = (1<