refactored code

This commit is contained in:
hhaupt 2024-06-13 00:55:30 +02:00
parent 3c0cbe1941
commit 448e7e3f4b
7 changed files with 16 additions and 31 deletions

View File

@ -1,18 +1,11 @@
//
// Created by Anton Jacker on 24.11.23.
//
#define SDA_PIN 1 #define SDA_PIN 1
#define SCL_PIN 2 #define SCL_PIN 2
#include "Dezibot.h" #include "Dezibot.h"
#include <SPI.h>
#include <Adafruit_NeoPixel.h>
#include <Wire.h> #include <Wire.h>
#define GPIO_LED 48 #define GPIO_LED 48
Dezibot::Dezibot():multiColorLight(){};
void Dezibot::begin(void) { void Dezibot::begin(void) {
Wire.begin(SDA_PIN,SCL_PIN); Wire.begin(SDA_PIN,SCL_PIN);

View File

@ -1,6 +1,6 @@
/** /**
* @file Dezibot.h * @file Dezibot.h
* @author your name (you@domain.com) * @author Hans Haupt, Jens Wagner, Anina Morgner, Anton Jacker, Saskia Dübener
* @brief * @brief
* @version 0.1 * @version 0.1
* @date 2023-11-19 * @date 2023-11-19
@ -32,22 +32,6 @@ public:
InfraredLight infraredLight; InfraredLight infraredLight;
Display display; Display display;
void begin(void); void begin(void);
/*
Display display
IRCommuncation irCommuncation (beinhaltet Kommuniaktion / Annhärung...)
Battery battery
Extension extension
WiFi wifi //wie wird WiFi geschrieben?
//nur lesender Zugriff, in dieser Klasse sind andere Instanzen mit dem Dezibotinterface gekapselt
Friends friends
OperatingSystem operatingSystem
USBCommunication usbCommunication
Button button
//nicht unique, initzial Dezibot
String robotName
*/
}; };
#endif //Dezibot_h #endif //Dezibot_h

View File

@ -1,7 +1,6 @@
#include "ColorDetection.h" #include "ColorDetection.h"
void ColorDetection::begin(void){ void ColorDetection::begin(void){
Wire.begin(I2C_MASTER_SDA_IO,I2C_MASTER_SCL_IO);
ColorDetection::configure(VEML_CONFIG{.mode = AUTO,.enabled = true,.exposureTime=MS40}); ColorDetection::configure(VEML_CONFIG{.mode = AUTO,.enabled = true,.exposureTime=MS40});
}; };
void ColorDetection::configure(VEML_CONFIG config){ void ColorDetection::configure(VEML_CONFIG config){

View File

@ -1,3 +1,14 @@
/**
* @file ColorDetecion.h
* @author Hans Haupt
* @brief Class that controls the colorsensor (VEML6040) of the dezibot.
* @version 0.1
* @date 2024-06-01
*
* @copyright Copyright (c) 2024
*
*/
#ifndef ColorDetection_h #ifndef ColorDetection_h
#define ColorDetection_h #define ColorDetection_h
#include <stdint.h> #include <stdint.h>

View File

@ -1,9 +1,7 @@
#include "InfraredLight.h" #include "InfraredLight.h"
#define pwmSpeedMode LEDC_LOW_SPEED_MODE #define pwmSpeedMode LEDC_LOW_SPEED_MODE
#define fooPin 13
#define footimer LEDC_TIMER_0
#define foochannel LEDC_CHANNEL_0
InfraredLED::InfraredLED(uint8_t pin,ledc_timer_t timer, ledc_channel_t channel){ InfraredLED::InfraredLED(uint8_t pin,ledc_timer_t timer, ledc_channel_t channel){
this->ledPin = pin; this->ledPin = pin;
this->timer = timer; this->timer = timer;
@ -53,7 +51,7 @@ void InfraredLED::setState(bool state){
}; };
void InfraredLED::sendFrequency(uint16_t frequency){ void InfraredLED::sendFrequency(uint16_t frequency){
// ledc_set_freq(pwmSpeedMode,timer,frequency); ledc_set_freq(pwmSpeedMode,timer,frequency);
ledc_set_duty(pwmSpeedMode,channel,512); ledc_set_duty(pwmSpeedMode,channel,512);
ledc_update_duty(pwmSpeedMode,channel); ledc_update_duty(pwmSpeedMode,channel);
}; };

View File

@ -1,6 +1,6 @@
#include "MotionDetection.h" #include "MotionDetection.h"
MotionDetection::MotionDetection(){//:handler(FSPI){ MotionDetection::MotionDetection(){
handler = new SPIClass(FSPI); handler = new SPIClass(FSPI);
}; };

View File

@ -6,7 +6,7 @@ MultiColorLight::MultiColorLight():rgbLeds(ledAmount,ledPin){
void MultiColorLight::begin(void){ void MultiColorLight::begin(void){
rgbLeds.begin(); rgbLeds.begin();
this->turnOffLeds(); this->turnOffLed();
}; };
void MultiColorLight::setLed(uint8_t index , uint32_t color){ void MultiColorLight::setLed(uint8_t index , uint32_t color){