Skip to content

Commit

Permalink
Fix TWIlib compilation on avr-gcc 10 (qmk#9273)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Sep 17, 2020
1 parent 31e58a7 commit d83b77e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 22 deletions.
13 changes: 13 additions & 0 deletions keyboards/lfkeyboards/TWIlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
#include "util/delay.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()
{
TWIInfo.mode = Ready;
Expand Down
12 changes: 1 addition & 11 deletions keyboards/lfkeyboards/TWIlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
#define TXMAXBUFLEN 20
// Receive buffer length
#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 {
Ready,
Expand All @@ -42,8 +32,8 @@ typedef enum {
uint8_t errorCode;
uint8_t repStart;
}TWIInfoStruct;
TWIInfoStruct TWIInfo;

extern TWIInfoStruct TWIInfo;

// TWI Status Codes
#define TWI_START_SENT 0x08 // Start sent
Expand Down
13 changes: 13 additions & 0 deletions keyboards/meira/TWIlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
#include "util/delay.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()
{
TWIInfo.mode = Ready;
Expand Down
12 changes: 1 addition & 11 deletions keyboards/meira/TWIlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
#define TXMAXBUFLEN 20
// Receive buffer length
#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 {
Ready,
Expand All @@ -42,8 +32,8 @@ typedef enum {
uint8_t errorCode;
uint8_t repStart;
}TWIInfoStruct;
TWIInfoStruct TWIInfo;

extern TWIInfoStruct TWIInfo;

// TWI Status Codes
#define TWI_START_SENT 0x08 // Start sent
Expand Down

0 comments on commit d83b77e

Please sign in to comment.