updated the logger for static use without a static interface
added the RGB sensor isl29125 added WIFI
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file isl29125.h
|
||||
/// \brief File description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef MAIN_PLATFORM_INC_ISL29125_H_
|
||||
#define MAIN_PLATFORM_INC_ISL29125_H_
|
||||
|
||||
/**
|
||||
* isl29125 implementation
|
||||
* \defgroup isl29125
|
||||
* \brief {group_description}
|
||||
* \addtogroup {Layer}
|
||||
*
|
||||
* Detailed description
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Include files
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CompilerIncludes
|
||||
// All include files that are provided by the compiler directly
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
// ProjectIncludes
|
||||
// All include files that are provided by the project
|
||||
#include "ISerialBus.h"
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class isl29125
|
||||
{
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Public Section
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
public:
|
||||
|
||||
struct rgb_t
|
||||
{
|
||||
uint16_t red;
|
||||
uint16_t green;
|
||||
uint16_t blue;
|
||||
} RGB_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POWER_DOWN = 0,
|
||||
GREEN = 1,
|
||||
RED = 2,
|
||||
BLUE = 3,
|
||||
STANDBY = 4,
|
||||
RGB = 5,
|
||||
GREEN_RED = 6,
|
||||
GREEN_BLUE = 7
|
||||
} Mode_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOW = 0,
|
||||
HIGH = 1
|
||||
} Range_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RES_12BIT = 0,
|
||||
RES_16BIT = 1
|
||||
} Resolution_t;
|
||||
|
||||
const uint8_t deviceID = 0x7D;
|
||||
|
||||
// Class Constructor
|
||||
isl29125(uint8_t slaveAddress, ISerialBus<uint8_t>& serialPort);
|
||||
FunctionStatus initialize(void);
|
||||
|
||||
FunctionStatus setMode(Mode_t mode);
|
||||
FunctionStatus setRange(Range_t range);
|
||||
FunctionStatus setResolution(Resolution_t resolutionß);
|
||||
|
||||
FunctionStatus getRGB(struct rgb_t* rgb);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Protected Section
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
protected:
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Private Section
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
private:
|
||||
|
||||
struct __attribute__ ((packed)) memorymap
|
||||
{
|
||||
uint8_t device_id;
|
||||
struct
|
||||
{
|
||||
uint8_t mode :3;
|
||||
uint8_t range :1;
|
||||
uint8_t bits :1;
|
||||
uint8_t sync :1;
|
||||
uint8_t RESERVERED :2;
|
||||
} configuration1;
|
||||
struct
|
||||
{
|
||||
uint8_t alscc :6;
|
||||
uint8_t RESERVED :1;
|
||||
uint8_t ircom :1;
|
||||
} configuration2;
|
||||
struct
|
||||
{
|
||||
uint8_t intsel :2;
|
||||
uint8_t prst :2;
|
||||
uint8_t conven :1;
|
||||
uint8_t RESERVED :3;
|
||||
} configuration3;
|
||||
struct
|
||||
{
|
||||
uint8_t lowByte;
|
||||
uint8_t highByte;
|
||||
} lowThreshold;
|
||||
struct
|
||||
{
|
||||
uint8_t lowByte;
|
||||
uint8_t highByte;
|
||||
} highThreshold;
|
||||
struct
|
||||
{
|
||||
uint8_t RESERVED1 :2;
|
||||
uint8_t grbcf :2;
|
||||
uint8_t RESERVED2 :1;
|
||||
uint8_t boutf :1;
|
||||
uint8_t convenf :1;
|
||||
uint8_t rgbthf :1;
|
||||
} statusFlags;
|
||||
union
|
||||
{
|
||||
uint16_t word;
|
||||
struct
|
||||
{
|
||||
uint8_t lowByte;
|
||||
uint8_t highByte;
|
||||
};
|
||||
} greenData;
|
||||
union
|
||||
{
|
||||
uint16_t word;
|
||||
struct
|
||||
{
|
||||
uint8_t lowByte;
|
||||
uint8_t highByte;
|
||||
};
|
||||
} redData;
|
||||
union
|
||||
{
|
||||
uint16_t word;
|
||||
struct
|
||||
{
|
||||
uint8_t lowByte;
|
||||
uint8_t highByte;
|
||||
};
|
||||
} blueData;
|
||||
};
|
||||
|
||||
struct memorymap memorymap;
|
||||
|
||||
uint8_t slaveAddress;
|
||||
ISerialBus<uint8_t>& bus;
|
||||
bool initialized;
|
||||
|
||||
// Reads the device ID directly into the memory map
|
||||
FunctionStatus getDeviceID(void);
|
||||
// Reads all configuration registers into the memory map
|
||||
FunctionStatus getConfiguration(void);
|
||||
// Reads all Threshold registers into the memory map
|
||||
FunctionStatus getTheshold(void);
|
||||
// Reads the status register into the memory map
|
||||
FunctionStatus getStatusFlags(void);
|
||||
// Reads the RGB data registers into the memory map
|
||||
FunctionStatus getRGBRegisters(void);
|
||||
// Read the full memory map from device into the local memory map, which creates a perfect memory copy
|
||||
FunctionStatus getCompleteRegisterMap(void);
|
||||
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
#endif /* MAIN_PLATFORM_INC_ISL29125_H_ */
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
#if defined(ENABLE_SERIAL_LOGGING)
|
||||
#define LOGGER_LOG(severity,...) \
|
||||
debugLogger.log(__FILE__, __func__, __LINE__, severity, ##__VA_ARGS__)
|
||||
logger::log(__FILE__, __func__, __LINE__, severity, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOGGER_LOG(severity, message)
|
||||
#endif
|
||||
@@ -98,9 +98,8 @@
|
||||
// Type definitions.
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class logger;
|
||||
extern logger debugLogger;
|
||||
//class logger;
|
||||
//extern logger debugLogger;
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
@@ -126,7 +125,7 @@ class logger
|
||||
// Class Constructor
|
||||
logger(uint32_t queuesize, ISerialBus<uint8_t>& serialPort);
|
||||
|
||||
FunctionStatus log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...);
|
||||
static FunctionStatus log(const char* fileName, const char* functionName, int lineNumber, LogType logType, const char* format, ...);
|
||||
|
||||
// The Logger task - should be called by the system scheduler regularly
|
||||
void task();
|
||||
@@ -160,18 +159,20 @@ class logger
|
||||
|
||||
void composeTypeParameterList(void);
|
||||
|
||||
void composeLogQueueItem(struct LogQueueItem* logQueueItem, std::string fileName, std::string functionName,
|
||||
int lineNumber, LogType logType, std::string context);
|
||||
static void composeLogQueueItem(struct LogQueueItem* logQueueItem, const std::string& fileName, const std::string& functionName,
|
||||
int lineNumber, LogType logType, const std::string& context);
|
||||
|
||||
std::list<struct typeParameters> typeParameterList;
|
||||
|
||||
std::list<struct LogQueueItem> queue;
|
||||
static std::list<struct LogQueueItem> queue;
|
||||
ISerialBus<uint8_t>& port;
|
||||
uint32_t queuesize;
|
||||
uint32_t numberOfLostMessages;
|
||||
static uint32_t queuesize;
|
||||
static uint32_t numberOfLostMessages;
|
||||
static bool overflowRecovery;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// \file wifi.h
|
||||
/// \brief File description
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// vbchaos software design
|
||||
//
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
/// $Revision: $
|
||||
/// $Author: $
|
||||
/// $Date: $
|
||||
// (c) 2023 vbchaos
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef MAIN_INC_WIFI_H_
|
||||
#define MAIN_INC_WIFI_H_
|
||||
|
||||
/**
|
||||
* wifi implementation
|
||||
* \defgroup wifi
|
||||
* \brief {group_description}
|
||||
* \addtogroup {Layer}
|
||||
*
|
||||
* Detailed description
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Include files
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
// CompilerIncludes
|
||||
// All include files that are provided by the compiler directly
|
||||
//#include "esp_system.h"
|
||||
#include "esp_event.h"
|
||||
//#include "esp_log.h"
|
||||
//
|
||||
#include "freertos/FreeRTOS.h"
|
||||
//#include "freertos/task.h"
|
||||
#include "freertos/event_groups.h"
|
||||
|
||||
|
||||
// ProjectIncludes
|
||||
// All include files that are provided by the project
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Type definitions.
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
class Wifi
|
||||
{
|
||||
public:
|
||||
|
||||
Wifi(void);
|
||||
|
||||
void start_client(void);
|
||||
|
||||
private:
|
||||
|
||||
static EventGroupHandle_t s_wifi_event_group;
|
||||
static int s_retry_num;
|
||||
static const char *TAG;
|
||||
|
||||
static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data);
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* MAIN_INC_WIFI_H_ */
|
||||
Reference in New Issue
Block a user