Compare commits
No commits in common. "main" and "temperature" have entirely different histories.
main
...
temperatur
28
read_logs.py
28
read_logs.py
@ -1,28 +0,0 @@
|
|||||||
import serial
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
# Configure serial port settings
|
|
||||||
port = '/dev/cu.usbmodemNRAQBQER2' # Replace with your specific serial port
|
|
||||||
baud_rate = 115200 # Replace with the appropriate baud rate
|
|
||||||
timeout = 1 # Specify the timeout for reading from the serial port
|
|
||||||
|
|
||||||
# Open the serial port
|
|
||||||
ser = serial.Serial(port, baud_rate, timeout=timeout)
|
|
||||||
|
|
||||||
# Generate the filename based on current date and time
|
|
||||||
now = datetime.now()
|
|
||||||
date_time = now.strftime("%Y-%m-%d_%H-%M")
|
|
||||||
filename = f"{date_time}_SHOH.txt"
|
|
||||||
|
|
||||||
# Open a file to write the logs
|
|
||||||
with open(filename, 'w') as file:
|
|
||||||
# Read and write the logs from the serial port
|
|
||||||
while True:
|
|
||||||
line = ser.readline().decode().strip()
|
|
||||||
if line:
|
|
||||||
file.write(line + '\n')
|
|
||||||
print(line) # Optional: Print the logs to the console as well
|
|
||||||
|
|
||||||
# Close the serial port when done
|
|
||||||
ser.close()
|
|
||||||
|
|
||||||
@ -57,12 +57,8 @@ I2C::I2C (const I2C_config &cfg) : device (nullptr)
|
|||||||
*/
|
*/
|
||||||
//Manual: Table 83 & 90
|
//Manual: Table 83 & 90
|
||||||
Chip_SYSCTL_PeriphReset(RESET_I2C0);
|
Chip_SYSCTL_PeriphReset(RESET_I2C0);
|
||||||
Chip_IOCON_PinMuxSet(LPC_IOCON, ThreadCommon::PORT_I2C_SCL,
|
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 4, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode);
|
||||||
ThreadCommon::PIN_I2C_SCL, IOCON_FUNC1 |
|
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 5, IOCON_FUNC1 | IOCON_DIGMODE_EN | cfg.i2c_mode);
|
||||||
IOCON_DIGMODE_EN | cfg.i2c_mode);
|
|
||||||
Chip_IOCON_PinMuxSet(LPC_IOCON, ThreadCommon::PORT_I2C_SDA,
|
|
||||||
ThreadCommon::PIN_I2C_SDA, IOCON_FUNC1 |
|
|
||||||
IOCON_DIGMODE_EN | cfg.i2c_mode);
|
|
||||||
//}
|
//}
|
||||||
// else {
|
// else {
|
||||||
// currently we support only I2C number 0
|
// currently we support only I2C number 0
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
#include "board.h"
|
#include "board.h"
|
||||||
#include "pinportmap.h"
|
|
||||||
|
|
||||||
struct I2C_config {
|
struct I2C_config {
|
||||||
unsigned int device_number;
|
unsigned int device_number;
|
||||||
|
|||||||
@ -13,12 +13,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "queue.h"
|
#include "queue.h"
|
||||||
#include "pinportmap.h"
|
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace ThreadCommon
|
namespace ThreadCommon
|
||||||
{
|
{
|
||||||
|
|
||||||
enum RotaryAction
|
enum RotaryAction
|
||||||
{
|
{
|
||||||
Right,
|
Right,
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* pinportmap.h
|
|
||||||
*
|
|
||||||
* Created on: 17 Jun 2023
|
|
||||||
* Author: dave
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef THREADS_COMMON_PINPORTMAP_H_
|
|
||||||
#define THREADS_COMMON_PINPORTMAP_H_
|
|
||||||
|
|
||||||
namespace ThreadCommon
|
|
||||||
{
|
|
||||||
|
|
||||||
enum PINMAP
|
|
||||||
{
|
|
||||||
PIN_LCD_RS = 24,
|
|
||||||
PIN_LCD_EN = 26,
|
|
||||||
PIN_LCD_D4 = 27,
|
|
||||||
PIN_LCD_D5 = 25,
|
|
||||||
PIN_LCD_D6 = 28,
|
|
||||||
PIN_LCD_D7 = 3,
|
|
||||||
PIN_I2C_SCL = 4,
|
|
||||||
PIN_I2C_SDA = 5,
|
|
||||||
PIN_ROTARY_SIG_A = 18,
|
|
||||||
PIN_ROTARY_SIG_B = 12,
|
|
||||||
PIN_ROTARY_PRESS = 2,
|
|
||||||
PIN_BOARD_SW1 = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
enum PORTMAP
|
|
||||||
{
|
|
||||||
PORT_LCD_RS = 1,
|
|
||||||
PORT_LCD_EN = 1,
|
|
||||||
PORT_LCD_D4 = 1,
|
|
||||||
PORT_LCD_D5 = 1,
|
|
||||||
PORT_LCD_D6 = 1,
|
|
||||||
PORT_LCD_D7 = 2,
|
|
||||||
PORT_I2C_SCL = 0,
|
|
||||||
PORT_I2C_SDA = 0,
|
|
||||||
PORT_ROTARY_SIG_A = 1,
|
|
||||||
PORT_ROTARY_SIG_B = 2,
|
|
||||||
PORT_ROTARY_PRESS = 0,
|
|
||||||
PORT_BOARD_SW1 = 0
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* THREADS_COMMON_PINPORTMAP_H_ */
|
|
||||||
@ -16,7 +16,7 @@ extern QueueHandle_t logging_queue;
|
|||||||
/* ================= Settings ================== */
|
/* ================= Settings ================== */
|
||||||
#define LOG_COLORED_OUTPUT
|
#define LOG_COLORED_OUTPUT
|
||||||
#define HIGH_PRIORITY_DEBUG
|
#define HIGH_PRIORITY_DEBUG
|
||||||
#define LOG_DEBUG_MESSAGES 0
|
#define LOG_DEBUG_MESSAGES 1
|
||||||
/* ================= Settings ================== */
|
/* ================= Settings ================== */
|
||||||
|
|
||||||
// internal debug defines
|
// internal debug defines
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void Master::HandleEventType(Event* e)
|
|||||||
//Comes from rotary, goes to manager
|
//Comes from rotary, goes to manager
|
||||||
send = _qm->send<Event>(ThreadCommon::QueueManager::manager_event_master, e, 0);
|
send = _qm->send<Event>(ThreadCommon::QueueManager::manager_event_master, e, 0);
|
||||||
//LOG_WARNING("Timestamp: %zus, Clock: %zu, Chip freq: %zu", LPC_SCT1->COUNT_U / Chip_Clock_GetMainClockRate(), LPC_SCT1->COUNT_U, Chip_Clock_GetMainClockRate());
|
//LOG_WARNING("Timestamp: %zus, Clock: %zu, Chip freq: %zu", LPC_SCT1->COUNT_U / Chip_Clock_GetMainClockRate(), LPC_SCT1->COUNT_U, Chip_Clock_GetMainClockRate());
|
||||||
if (send) LOG_INFO("Rotary: %s has been forwarded to manager", rotary_direction[rd]);
|
if (send) LOG_DEBUG("Rotary: %s has been forwarded to manager", rotary_direction[rd]);
|
||||||
break;
|
break;
|
||||||
case Event::InternalTemp:
|
case Event::InternalTemp:
|
||||||
// TODO remove (deprecated)
|
// TODO remove (deprecated)
|
||||||
|
|||||||
@ -20,15 +20,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
Event* message;
|
Event* message;
|
||||||
ThreadCommon::QueueManager* _qm;
|
ThreadCommon::QueueManager* _qm;
|
||||||
DigitalIoPin signal[3] = { { ThreadCommon::PORT_ROTARY_SIG_A,
|
DigitalIoPin signal[3] = { { 1, 18, true, true, false, true, PIN_INT0_IRQn}, //sigA
|
||||||
ThreadCommon::PIN_ROTARY_SIG_A,
|
{ 2, 12, true, true, false}, //sigB
|
||||||
true, true, false, true, PIN_INT0_IRQn},
|
{ 0, 2, true, true, false, true, PIN_INT1_IRQn} }; //Press, sw //2 11 (pin without interrupt) //0 1 (board button)
|
||||||
{ ThreadCommon::PORT_ROTARY_SIG_B,
|
|
||||||
ThreadCommon::PIN_ROTARY_SIG_B,
|
|
||||||
true, true, false},
|
|
||||||
{ ThreadCommon::PORT_ROTARY_PRESS,
|
|
||||||
ThreadCommon::PIN_ROTARY_PRESS,
|
|
||||||
true, true, false, true, PIN_INT1_IRQn} };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void thread_rotary(void* pvParams);
|
void thread_rotary(void* pvParams);
|
||||||
|
|||||||
@ -20,7 +20,7 @@ void Temperature::taskFunction()
|
|||||||
SensorTempSHT20 ext_temp_sensor(this->_pi2c);
|
SensorTempSHT20 ext_temp_sensor(this->_pi2c);
|
||||||
Event t (Event::ExternalTemp, -128);
|
Event t (Event::ExternalTemp, -128);
|
||||||
int8_t temp_value = -128;
|
int8_t temp_value = -128;
|
||||||
while(ext_temp_sensor.is_up() != true);
|
_qm->send<Event>(ThreadCommon::QueueManager::master_event_all, &t, 0);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (ext_temp_sensor.is_up())
|
if (ext_temp_sensor.is_up())
|
||||||
|
|||||||
@ -75,18 +75,12 @@ void UserInterface::handleLCD(LiquidCrystal *lcd, const char *str)
|
|||||||
|
|
||||||
void UserInterface::initLCD1()
|
void UserInterface::initLCD1()
|
||||||
{
|
{
|
||||||
this->lcd1_rs = new DigitalIoPin(ThreadCommon::PORT_LCD_RS,
|
this->lcd1_rs = new DigitalIoPin(1, 24, false);//(1, 18, false);
|
||||||
ThreadCommon::PIN_LCD_RS, false);//(1, 18, false);
|
this->lcd1_en = new DigitalIoPin(1, 26, false);//(1, 24, false);
|
||||||
this->lcd1_en = new DigitalIoPin(ThreadCommon::PORT_LCD_EN,
|
this->lcd1_d4 = new DigitalIoPin(1, 27, false);//(1, 19, false);
|
||||||
ThreadCommon::PIN_LCD_EN, false);//(1, 24, false);
|
this->lcd1_d5 = new DigitalIoPin(1, 25, false);//(1, 26, false);
|
||||||
this->lcd1_d4 = new DigitalIoPin(ThreadCommon::PORT_LCD_D4,
|
this->lcd1_d6 = new DigitalIoPin(1, 28, false);//(1, 27, false);
|
||||||
ThreadCommon::PIN_LCD_D4, false);//(1, 19, false);
|
this->lcd1_d7 = new DigitalIoPin(2, 3, false);//(1, 25, false);
|
||||||
this->lcd1_d5 = new DigitalIoPin(ThreadCommon::PORT_LCD_D5,
|
|
||||||
ThreadCommon::PIN_LCD_D5, false);//(1, 26, false);
|
|
||||||
this->lcd1_d6 = new DigitalIoPin(ThreadCommon::PORT_LCD_D6,
|
|
||||||
ThreadCommon::PIN_LCD_D6, false);//(1, 27, false);
|
|
||||||
this->lcd1_d7 = new DigitalIoPin(ThreadCommon::PORT_LCD_D7,
|
|
||||||
ThreadCommon::PIN_LCD_D7, false);//(1, 25, false);
|
|
||||||
|
|
||||||
this->lcd1_rs->write(false);
|
this->lcd1_rs->write(false);
|
||||||
this->lcd1_en->write(false);
|
this->lcd1_en->write(false);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user