heptagon-arduino/parallel_led/arduinolib.c

33 lines
738 B
C
Raw Normal View History

2020-12-27 12:40:42 +01:00
//#include <math.h>
#include <avr/io.h>
#include <util/delay.h>
#include "arduinolib.h"
//#include "HardwareSerial.h"
void Arduinolib__dwrite_step(int p, int v, Arduinolib__dwrite_out *out){
/* set pin 5 of PORTB for output. i.e port 13 */
if (p == 13){
DDRC |= _BV(DDD7);
if (v == 0)
{
PORTD &= ~(1<<PORTD7);
//PORTB &= ~_BV(PORTB5); //put it to low
return;
}
PORTD |= (1<<PORTD7);
//PORTB |= _BV(PORTB5);
return;
}
DDRD |= _BV(DDD5);
if (v == 0)
{
PORTD &= ~(1<<PORTD5);
//PORTB &= ~_BV(PORTB4); //put it to low
return;
}
PORTD |= (1<<PORTD5);
//PORTB |= _BV(PORTB4);
return;
}