chore: cleanup

This commit is contained in:
2024-11-10 14:59:30 +06:00
parent 3ac9c62241
commit 39f7755477
6 changed files with 24 additions and 31 deletions

View File

@@ -6,6 +6,14 @@
#include "ch32v003fun.h"
#include "w5500.h"
// Options structure for client identification
typedef struct {
char* clientid;
char* username;
char* password;
int qos;
} ch32_mqtt_options_t;
typedef struct {
Network network;
MQTTClient client;

View File

@@ -20,11 +20,11 @@ void spidma_read_buffer(uint8_t *buf, uint16_t len);
// SPI DMA buffer write
void spidma_write_buffer(uint8_t *buf, uint16_t len);
// SPI (non-DMA) byte read
uint8_t spi_read_byte();
// // SPI (non-DMA) byte read
// uint8_t spi_read_byte();
// SPI (non-DMA) byte write
void spi_write_byte(uint8_t byte);
// // SPI (non-DMA) byte write
// void spi_write_byte(uint8_t byte);
// activate CS
void spi_select(void);

View File

@@ -7,13 +7,16 @@
// Macro definitions
#define APB1_CLOCK (FUNCONF_SYSTEM_CORE_CLOCK / 2) // APB1 is divided by 2
#define UART_BRR_APB1 \
(((APB1_CLOCK) + (UART_BAUD_RATE / 2)) / (UART_BAUD_RATE)) // USART2
#define UART_BRR_APB2 \
(((FUNCONF_SYSTEM_CORE_CLOCK) + (UART1_BAUD_RATE / 2)) / \
(UART1_BAUD_RATE)) // USART1
// USART2
#define UART_BRR_APB1 (((APB1_CLOCK) + (UART_BAUD_RATE / 2)) / (UART_BAUD_RATE))
// USART1
#define UART_BRR_APB2 \
(((FUNCONF_SYSTEM_CORE_CLOCK) + (UART1_BAUD_RATE / 2)) / (UART1_BAUD_RATE))
// Function prototypes
void init_uart(int uart_brr);
#endif // UART_H

View File

@@ -9,23 +9,11 @@
#define DNS_SOCKET 1
#define TCP_SOCKET 2
// Options structure for client identification
typedef struct {
char* clientid;
char* username;
char* password;
int qos;
} ch32_mqtt_options_t;
extern volatile int ip_assigned;
// Initializes the W5500 chip
void configure_network(void);
// void configure_dhcp(void);
void dhcp_init(void);
void dhcp_process(void);
// resolves a domain name
// void resolve_domain_name(const char* domain_name);