Moin,
ich benutze das AVR Studio (4.18 ) und möchte nun in meinem Projekt mit
I2C arbeiten. Dankenswerterweise gibt es dazu ja die I2C Bibliothek von
Peter Fleury:
Diese habe ich mir nun heruntergeladen und in das WinAVR
Includeverzeichnis kopiert.
In meiner C-Datei steht nun unter anderem im Kopf:
#include <nibobee/usart.h>
#include <nibobee/motpwm.h>
#include <nibobee/analog.h>
#include <nibobee/odometry.h>
#include <nibobee/i2cmaster.h>
#include <nibobee/lcdi2c.h>
#include <avr/io.h>
#include <avr/interrupt.h>
Nur bringt mir AVR-Studio beim builden die folgende Fehlermeldung:
\..\..\..\Programme\NIBObeeLib\include/nibobee/i2cmaster.h:58: error: 'I2C_BUF_SIZE' undeclared here (not in a function)
Nachfolgend die i2cmaster.h:
Code:
/* BSD-License:
Copyright (c) 2007 by Nils Springob, nicai-systems, Germany
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name nicai-systems nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*! @file i2cmaster.h
* @brief Routinen zur Kommunikation ueber den I2C Bus
* @author Nils Springob (nils@nicai-systems.de)
* @date 2007-07-13
*/
#ifndef NIBOBEE_I2CMASTER_H_
#define NIBOBEE_I2CMASTER_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
* Anzahl der zu sendenden / zu empfangenden Zeichen
*/
extern volatile uint8_t i2c_size;
/*!
* Puffer zur Datenübertragung
*/
extern uint8_t i2c_buf[I2C_BUF_SIZE];
/*!
* I2C Status
*/
enum {
I2C_BUSY,
I2C_IDLE,
I2C_SUCCESS,
I2C_ERROR=0x10
};
/*!
* Initialisierung der I2C Schnittstelle
*/
void i2c_init(void);
/*!
* Start der Datenübertragung. Die Daten sind im @ref i2c_buf gespeichert
*/
uint8_t i2c_start_transmission(void);
/*!
* Hole den aktuellen I2C-Status
*/
uint8_t i2c_status(void);
extern volatile uint8_t i2c_last_TWSR;
extern volatile uint8_t i2c_pos;
/*!
* Warte bis Ãœbertragung beendet wurde
*/
uint8_t i2c_wait_transmission(void);
#define I2C_TX(ADDR) ((ADDR)<<1)
#define I2C_RX(ADDR) (((ADDR)<<1)+1)
#ifdef __cplusplus
} // extern "C"
#endif
#endif // NIBOBEE_I2CMASTER_H_
Kann mir jemand einen Tipp geben?
Gruß
Lesezeichen