updated the logger for static use without a static interface
added the RGB sensor isl29125 added WIFI
This commit is contained in:
+26
-9
@@ -33,7 +33,9 @@
|
||||
#include "uart.h"
|
||||
|
||||
// Platform includes
|
||||
#include "isl29125.h"
|
||||
#include "logger.h"
|
||||
#include "Wifi.h"
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
@@ -48,6 +50,7 @@
|
||||
// File-scope variables
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
static TaskHandle_t loggerTaskHandle;
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
@@ -84,13 +87,14 @@ extern "C" void app_main(void)
|
||||
.rx_flow_ctrl_thresh = 0,
|
||||
.source_clk = UART_SCLK_DEFAULT
|
||||
};
|
||||
static uart_port_t debugUart = UART_NUM_0;
|
||||
uart_port_t debugUart = UART_NUM_0;
|
||||
ESP_ERROR_CHECK(uart_param_config(debugUart, &uartConfig));
|
||||
ESP_ERROR_CHECK(uart_set_pin(debugUart, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE));
|
||||
ESP_ERROR_CHECK(uart_driver_install(debugUart, 1024, 1024, 0, NULL, 0));
|
||||
|
||||
uart uartDebug = uart(&debugUart);
|
||||
uartDebug.open();
|
||||
uartDebug.write(255, 255, (uint8_t*)"START", 5);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// System-wide Debug Logger
|
||||
@@ -114,8 +118,8 @@ extern "C" void app_main(void)
|
||||
|
||||
i2c_config_t i2cConfig = {
|
||||
.mode = I2C_MODE_MASTER,
|
||||
.sda_io_num = (int)4,
|
||||
.scl_io_num = (int)5,
|
||||
.sda_io_num = (int)2,
|
||||
.scl_io_num = (int)3,
|
||||
.sda_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.scl_pullup_en = GPIO_PULLUP_ENABLE,
|
||||
.master = 400000,
|
||||
@@ -127,19 +131,32 @@ extern "C" void app_main(void)
|
||||
|
||||
i2c i2cSensor = i2c(&i2c_master_port);
|
||||
i2cSensor.open();
|
||||
uint8_t i2cData[2] = {0x12, 0x34};
|
||||
i2cSensor.write(0x40, 0x00, i2cData, 2);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// I2C RGB Sensor on I2C MasterBus for sensors
|
||||
//
|
||||
isl29125 rgbSensor = isl29125(0x44, i2cSensor);
|
||||
rgbSensor.initialize();
|
||||
vTaskDelay(100);
|
||||
rgbSensor.setMode(isl29125::RGB);
|
||||
rgbSensor.setRange(isl29125::HIGH);
|
||||
rgbSensor.setResolution(isl29125::RES_16BIT);
|
||||
vTaskDelay(100);
|
||||
struct isl29125::rgb_t rgbValue;
|
||||
rgbSensor.getRGB(&rgbValue);
|
||||
|
||||
gpio debugIO = gpio(19, gpio::Direction_t::GPIO_DIRECTION_OUTPUT, gpio::Value_t::GPIO_VALUE_LOW);
|
||||
|
||||
gpio debugIO = gpio(2, gpio::Direction_t::GPIO_DIRECTION_OUTPUT, gpio::Value_t::GPIO_VALUE_LOW);
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
// Wifi create and connect
|
||||
//
|
||||
Wifi wifi;
|
||||
wifi.start_client();
|
||||
|
||||
|
||||
while(1)
|
||||
{
|
||||
vTaskDelay(100);
|
||||
vTaskDelay(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user