Обновление
This commit is contained in:
parent
7fe69dc846
commit
7f2d395b67
|
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
tSerialPortIO *serialPortIo_IN_VIRT;
|
tSerialPortIO *serialPortIo_VIRT;
|
||||||
tSerialPortIO *serialPortIo_OUT_VIRT;
|
|
||||||
tSerialPortIO *serialPortIo_PHYSIC;
|
tSerialPortIO *serialPortIo_PHYSIC;
|
||||||
tRtcIO *rtc;
|
tRtcIO *rtc;
|
||||||
uint32_t timeout;
|
uint32_t timeout;
|
||||||
|
|
@ -41,8 +40,7 @@ typedef struct {
|
||||||
void LoggerToSerialPort_Init(
|
void LoggerToSerialPort_Init(
|
||||||
tLoggerToSerialPort *env,
|
tLoggerToSerialPort *env,
|
||||||
int32_t greenwichOffset,
|
int32_t greenwichOffset,
|
||||||
tSerialPortIO *serialPortIo_IN_VIRT,
|
tSerialPortIO *serialPortIo_VIRT,
|
||||||
tSerialPortIO *serialPortIo_OUT_VIRT,
|
|
||||||
tSerialPortIO *serialPortIo_PHYSIC,
|
tSerialPortIO *serialPortIo_PHYSIC,
|
||||||
tRtcIO *rtc,
|
tRtcIO *rtc,
|
||||||
uint16_t flags,
|
uint16_t flags,
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ static void LoggerToSerialPort_PrintLegend(
|
||||||
if (env->flags)
|
if (env->flags)
|
||||||
vAsciiStringAdd(str, &strLen, ": ", 2);
|
vAsciiStringAdd(str, &strLen, ": ", 2);
|
||||||
|
|
||||||
SerialPortTransmit(env->serialPortIo_IN_VIRT, (uint8_t *) str, strLen, env->timeout);
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) str, strLen, env->timeout);
|
||||||
|
|
||||||
env->open = true;
|
env->open = true;
|
||||||
}
|
}
|
||||||
|
|
@ -99,11 +99,11 @@ static void LoggerToSerialPort_Logging(
|
||||||
}
|
}
|
||||||
|
|
||||||
//выводим сообщение
|
//выводим сообщение
|
||||||
SerialPortTransmit(env->serialPortIo_IN_VIRT, (uint8_t *) msg, msgLen, env->timeout);
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) msg, msgLen, env->timeout);
|
||||||
|
|
||||||
if (complete) {
|
if (complete) {
|
||||||
//переводим строку
|
//переводим строку
|
||||||
SerialPortTransmit(env->serialPortIo_IN_VIRT, (uint8_t *) "\r\n", 2, env->timeout);
|
SerialPortTransmit(env->serialPortIo_VIRT, (uint8_t *) "\r\n", 2, env->timeout);
|
||||||
env->open = false;
|
env->open = false;
|
||||||
} else {
|
} else {
|
||||||
env->open = true;
|
env->open = true;
|
||||||
|
|
@ -116,15 +116,13 @@ static void LoggerToSerialPort_Logging(
|
||||||
void LoggerToSerialPort_Init(
|
void LoggerToSerialPort_Init(
|
||||||
tLoggerToSerialPort *env,
|
tLoggerToSerialPort *env,
|
||||||
int32_t greenwichOffset,
|
int32_t greenwichOffset,
|
||||||
tSerialPortIO *serialPortIo_IN_VIRT,
|
tSerialPortIO *serialPortIo_VIRT,
|
||||||
tSerialPortIO *serialPortIo_OUT_VIRT,
|
|
||||||
tSerialPortIO *serialPortIo_PHYSIC,
|
tSerialPortIO *serialPortIo_PHYSIC,
|
||||||
tRtcIO *rtc,
|
tRtcIO *rtc,
|
||||||
uint16_t flags,
|
uint16_t flags,
|
||||||
uint32_t timeoutTransmittedLog
|
uint32_t timeoutTransmittedLog
|
||||||
) {
|
) {
|
||||||
env->serialPortIo_IN_VIRT = serialPortIo_IN_VIRT;
|
env->serialPortIo_VIRT = serialPortIo_VIRT;
|
||||||
env->serialPortIo_OUT_VIRT = serialPortIo_OUT_VIRT;
|
|
||||||
env->serialPortIo_PHYSIC = serialPortIo_PHYSIC;
|
env->serialPortIo_PHYSIC = serialPortIo_PHYSIC;
|
||||||
env->open = false;
|
env->open = false;
|
||||||
env->timeout = 0;// не ждем на каждой операции так как если порт исправен то все должно отрабатывать моментально
|
env->timeout = 0;// не ждем на каждой операции так как если порт исправен то все должно отрабатывать моментально
|
||||||
|
|
@ -149,7 +147,7 @@ extern uint8_t buf_USART2_TRANSMITTED[256];
|
||||||
|
|
||||||
static _Noreturn void LogTransmitter_Thread(tLoggerToSerialPort *env) {
|
static _Noreturn void LogTransmitter_Thread(tLoggerToSerialPort *env) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
uint16_t len = env->serialPortIo_OUT_VIRT->receive(env->serialPortIo_OUT_VIRT->env, buf_USART2_TRANSMITTED,
|
uint16_t len = env->serialPortIo_VIRT->receive(env->serialPortIo_VIRT->env, buf_USART2_TRANSMITTED,
|
||||||
sizeof(buf_USART2_TRANSMITTED), env->timeoutTransmittedLog);
|
sizeof(buf_USART2_TRANSMITTED), env->timeoutTransmittedLog);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue