Skip to content
Snippets Groups Projects
Commit 974ff1e0 authored by Erik Strand's avatar Erik Strand
Browse files

Disable interrupts for put_char

This fixes the weird symbols that were randomly appearing.
parent 60ba91c9
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <util/delay.h> #include <util/delay.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include "OneWire.h" #include "OneWireMod.h"
#define output(directions,pin) (directions |= pin) // set port direction for output #define output(directions,pin) (directions |= pin) // set port direction for output
#define set(port,pin) (port |= pin) // set port pin #define set(port,pin) (port |= pin) // set port pin
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define max_buffer 25 #define max_buffer 25
void put_char(volatile unsigned char *port, unsigned char pin, char txchar) { void put_char(volatile unsigned char *port, unsigned char pin, char txchar) {
noInterrupts();
// //
// send character in txchar on port pin // send character in txchar on port pin
// assumes line driver (inverts bits) // assumes line driver (inverts bits)
...@@ -101,6 +102,7 @@ void put_char(volatile unsigned char *port, unsigned char pin, char txchar) { ...@@ -101,6 +102,7 @@ void put_char(volatile unsigned char *port, unsigned char pin, char txchar) {
// char delay // char delay
// //
bit_delay(); bit_delay();
interrupts();
} }
void put_string(volatile unsigned char *port, unsigned char pin, char *str) { void put_string(volatile unsigned char *port, unsigned char pin, char *str) {
...@@ -146,6 +148,9 @@ void loop(void) { ...@@ -146,6 +148,9 @@ void loop(void) {
PORTB |= led_pin; PORTB |= led_pin;
//put_char(&serial_port, serial_pin_out, '1'); //put_char(&serial_port, serial_pin_out, '1');
} }
put_string(&serial_port, serial_pin_out, "hello world");
delay(500);
return;
byte i; byte i;
byte present = 0; byte present = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment