Fix TWIlib compilation on avr-gcc 10 (#9273)
This commit is contained in:
parent
e9b3a12c6e
commit
410d09675a
4 changed files with 28 additions and 22 deletions
|
@ -11,6 +11,19 @@
|
||||||
#include "util/delay.h"
|
#include "util/delay.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
|
||||||
|
// Global transmit buffer
|
||||||
|
volatile uint8_t *TWITransmitBuffer;
|
||||||
|
// Global receive buffer
|
||||||
|
volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN];
|
||||||
|
// Buffer indexes
|
||||||
|
volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time.
|
||||||
|
int RXBuffIndex; // Current index in the receive buffer
|
||||||
|
// Buffer lengths
|
||||||
|
int TXBuffLen; // The total length of the transmit buffer
|
||||||
|
int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN)
|
||||||
|
|
||||||
|
TWIInfoStruct TWIInfo;
|
||||||
|
|
||||||
void TWIInit()
|
void TWIInit()
|
||||||
{
|
{
|
||||||
TWIInfo.mode = Ready;
|
TWIInfo.mode = Ready;
|
||||||
|
|
|
@ -16,16 +16,6 @@
|
||||||
#define TXMAXBUFLEN 20
|
#define TXMAXBUFLEN 20
|
||||||
// Receive buffer length
|
// Receive buffer length
|
||||||
#define RXMAXBUFLEN 20
|
#define RXMAXBUFLEN 20
|
||||||
// Global transmit buffer
|
|
||||||
volatile uint8_t *TWITransmitBuffer;
|
|
||||||
// Global receive buffer
|
|
||||||
volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN];
|
|
||||||
// Buffer indexes
|
|
||||||
volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time.
|
|
||||||
int RXBuffIndex; // Current index in the receive buffer
|
|
||||||
// Buffer lengths
|
|
||||||
int TXBuffLen; // The total length of the transmit buffer
|
|
||||||
int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN)
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Ready,
|
Ready,
|
||||||
|
@ -42,8 +32,8 @@ typedef enum {
|
||||||
uint8_t errorCode;
|
uint8_t errorCode;
|
||||||
uint8_t repStart;
|
uint8_t repStart;
|
||||||
}TWIInfoStruct;
|
}TWIInfoStruct;
|
||||||
TWIInfoStruct TWIInfo;
|
|
||||||
|
|
||||||
|
extern TWIInfoStruct TWIInfo;
|
||||||
|
|
||||||
// TWI Status Codes
|
// TWI Status Codes
|
||||||
#define TWI_START_SENT 0x08 // Start sent
|
#define TWI_START_SENT 0x08 // Start sent
|
||||||
|
|
|
@ -11,6 +11,19 @@
|
||||||
#include "util/delay.h"
|
#include "util/delay.h"
|
||||||
#include "print.h"
|
#include "print.h"
|
||||||
|
|
||||||
|
// Global transmit buffer
|
||||||
|
volatile uint8_t *TWITransmitBuffer;
|
||||||
|
// Global receive buffer
|
||||||
|
volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN];
|
||||||
|
// Buffer indexes
|
||||||
|
volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time.
|
||||||
|
int RXBuffIndex; // Current index in the receive buffer
|
||||||
|
// Buffer lengths
|
||||||
|
int TXBuffLen; // The total length of the transmit buffer
|
||||||
|
int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN)
|
||||||
|
|
||||||
|
TWIInfoStruct TWIInfo;
|
||||||
|
|
||||||
void TWIInit()
|
void TWIInit()
|
||||||
{
|
{
|
||||||
TWIInfo.mode = Ready;
|
TWIInfo.mode = Ready;
|
||||||
|
|
|
@ -16,16 +16,6 @@
|
||||||
#define TXMAXBUFLEN 20
|
#define TXMAXBUFLEN 20
|
||||||
// Receive buffer length
|
// Receive buffer length
|
||||||
#define RXMAXBUFLEN 20
|
#define RXMAXBUFLEN 20
|
||||||
// Global transmit buffer
|
|
||||||
volatile uint8_t *TWITransmitBuffer;
|
|
||||||
// Global receive buffer
|
|
||||||
volatile uint8_t TWIReceiveBuffer[RXMAXBUFLEN];
|
|
||||||
// Buffer indexes
|
|
||||||
volatile int TXBuffIndex; // Index of the transmit buffer. Is volatile, can change at any time.
|
|
||||||
int RXBuffIndex; // Current index in the receive buffer
|
|
||||||
// Buffer lengths
|
|
||||||
int TXBuffLen; // The total length of the transmit buffer
|
|
||||||
int RXBuffLen; // The total number of bytes to read (should be less than RXMAXBUFFLEN)
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
Ready,
|
Ready,
|
||||||
|
@ -42,8 +32,8 @@ typedef enum {
|
||||||
uint8_t errorCode;
|
uint8_t errorCode;
|
||||||
uint8_t repStart;
|
uint8_t repStart;
|
||||||
}TWIInfoStruct;
|
}TWIInfoStruct;
|
||||||
TWIInfoStruct TWIInfo;
|
|
||||||
|
|
||||||
|
extern TWIInfoStruct TWIInfo;
|
||||||
|
|
||||||
// TWI Status Codes
|
// TWI Status Codes
|
||||||
#define TWI_START_SENT 0x08 // Start sent
|
#define TWI_START_SENT 0x08 // Start sent
|
||||||
|
|
Loading…
Reference in a new issue