Pages: [1]   Go Down
Author Topic: error compiling library (basic.h)  (Read 367 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can't get this library to compile can someone have alook?
Code:
#ifndef basic

#include "pins_arduino.h"
#include "wiring_private.h"
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/signal.h>
#include <avr/delay.h>
#include <stdio.h>
#include <stdarg.h>

byte masterTemp_A;

void initPins(boolean pinDirection, boolean pinState)
{
  /*for(byte i; i < 14; i++)
         {
               pinMode(i, OUTPUT);
               digitalWrite(i, LOW);
         }*/

  if(pinState)
  {
    //PORTA = 255;
    PORTB = 255;
    PORTC = 255;
    PORTD = 255;
  }
  else {
    //PORTA = 0;
    PORTB = 0;
    PORTC = 0;
    PORTD = 0;
  }

  if(pinDirection)
  {
    //DDRA = 255;
    DDRB = 255;
    //DDRC = 255;
    DDRD = 255;
  }
  else {
    //DDRA = 0;
    DDRB = 0;
    //DDRC = 0;
    DDRD = 0;
  }
}

void serialEnd()
{
  masterTemp_A = UCSR0B;
  UCSR0B = UCSR0B & B00111111;
}

void serialRestart()
{
  UCSR0B = masterTemp_A;
}

byte flipByte(byte toFlip)
{
  byte flipRes = 0;
  for(byte i = 0; i < 8; i++)
  {
    if((toFlip & (1 << i)))
    {
      flipRes = flipRes + (B10000000 >> i);
    }            
  }
  return flipRes;
}

byte int2bytes(unsigned int data, boolean mostSignificantBit)
{
  byte output;
  if(mostSignificantBit)
  {
    data = data & 0xFF00; // masks LSB
    data = data >> 8;
  }
  else {
    data = data & 0xFF; // masks MSB
  }
  output = data;
  return output;
}

unsigned int bytes2int(byte data1, byte data2)
{
  unsigned int output;
  output = data1;
  output = (output << 8) + data2;
  return output;
}

byte analogReadByte(uint8_t pin)
{
  uint8_t ch = analogInPinToBit(pin);

  // the low 4 bits of ADMUX select the ADC channel
  ADMUX = (ADMUX & (unsigned int) 0xF0) | (ch & (unsigned int) 0x0F);

  // start the conversion
  //sbi(ADCSRA, ADSC);
  ADCSRA |= B01000000;

  // ADSC is cleared when the conversion finishes
  while (bit_is_set(ADCSRA, ADSC));

  //byte temp = ADCL;
  return ADCH;
}

void analogOff()
{
  ADCSRA = ADCSRA & B01111111;
  DDRC = 0xFF;
  PORTC = 0;
}

byte serialWaitRead()
{
  while(Serial.available() == 0);
  return Serial.read();
}

byte trueRange(byte data, byte _min, byte _max)
{
  data = constrain(data, _min, _max);
  float _minF = _min;
  float _maxF = _max;
  float dataF = data - _min;
  dataF = 255 * ((dataF) / (_maxF - _minF));
  if(dataF < 0)
  {
    dataF = 0;
  }
  else if(dataF > 255)
  {
    dataF = 255;
  }
  data = dataF;
  return data;
}
#define basic
#endif

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

bump sorry guys but please any help
Logged

Cape Town, South Africa
Offline Offline
Full Member
***
Karma: 0
Posts: 177
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cross post....
Logged

Pages: [1]   Go Up
Jump to: