Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Revert "Added i2c functions"
Browse files Browse the repository at this point in the history
This reverts commit 26dcb64.
  • Loading branch information
rmoesbergen committed Mar 4, 2024
1 parent 26dcb64 commit fd7ff79
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
20 changes: 0 additions & 20 deletions src/Leaphyoriginal1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,3 @@ void setLed(int fpRed, int fpGreen, int fpBlue)
analogWrite(LED1_GREEN, fpGreen);
analogWrite(LED1_BLUE, fpBlue);
}

void i2cSelectChannel(uint8_t channel, bool push=TRUE) {
if (push) i2cChannelStack.addLast(channel);
if(channel <= 7) channel = (1 << channel);
Wire.beginTransmission(0x70);
Wire.write(channel);
Wire.endTransmission();
}

void i2cRestoreChannel() {
i2cChannelStack.removeLast();
uint8_t channel = i2cChannelStack.get(i2cChannelStack.size() - 1);
i2cSelectChannel(channel, FALSE);
}

uint8_t i2cGetChannel() {
uint8_t channel = i2cChannelStack.get(i2cChannelStack.size() - 1);
if (channel > 7) channel = 0;
return channel;
}
6 changes: 0 additions & 6 deletions src/Leaphyoriginal1.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <util/delay.h>
#include <stdint.h>
#include <stdlib.h>
#include <List.hpp>

#define MOTOR_LEFT (9) // M1
#define MOTOR_RIGHT (10) // M2
Expand Down Expand Up @@ -43,17 +42,12 @@ struct {
int m2_dir = 13;
} motor_pins;

List<int> i2cChannelStack;

void setMotorPins(int m1_pwm, int m1_dir, int m2_pwm, int m2_dir);
float getDistance();
int getLineFollower(int fpSide);
void setTone( int fpTone, int fpBeat);
void setMotor(int fpMotor, int fpSpeed);
void moveMotors(int fpDirection, int fpSpeed);
void setLed(int fpRed, int fpGreen, int fpBlue);
void i2cSelectChannel(uint8_t channel, bool push=TRUE)
void i2cRestoreChannel();
uint8_t i2cGetChannel();

#endif

0 comments on commit fd7ff79

Please sign in to comment.