-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaeb7c9
commit 3ce9382
Showing
9 changed files
with
127 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
// | ||
// Created by tanneberger on 1/3/25. | ||
// | ||
#ifndef REACTOR_UC_UART_CHANNEL_H | ||
#define REACTOR_UC_UART_CHANNEL_H | ||
|
||
#ifndef UART_CHANNEL_H | ||
#define UART_CHANNEL_H | ||
#define MODULE_PERIPH_UART_RXSTART_IRQ | ||
|
||
#endif //UART_CHANNEL_H | ||
#include "reactor-uc/network_channel.h" | ||
#include "reactor-uc/environment.h" | ||
|
||
#include "periph/uart.h" | ||
#include "cond.h" | ||
|
||
typedef struct UARTChannel UARTChannel; | ||
typedef struct FederatedConnectionBundle FederatedConnectionBundle; | ||
|
||
#define UART_CHANNEL_BUFFERSIZE 1024 | ||
#define UART_CHANNEL_EXPECTED_CONNECT_DURATION MSEC(10) //TODO: | ||
|
||
struct UARTChannel { | ||
NetworkChannel super; | ||
NetworkChannelState state; | ||
|
||
FederateMessage output; | ||
unsigned char write_buffer[UART_CHANNEL_BUFFERSIZE]; | ||
unsigned char read_buffer[UART_CHANNEL_BUFFERSIZE]; | ||
unsigned char connection_thread_stack[THREAD_STACKSIZE_MAIN]; | ||
int connection_thread_pid; | ||
|
||
unsigned int read_index; | ||
uart_t uart_dev; | ||
mutex_t receive_lock; | ||
cond_t receive_cv; | ||
|
||
FederatedConnectionBundle *federated_connection; | ||
void (*receive_callback)(FederatedConnectionBundle *conn, const FederateMessage *message); | ||
}; | ||
|
||
void UARTChannel_ctor(UARTChannel *self, Environment *env, uint32_t baud); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters