You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
991 B
38 lines
991 B
|
10 hours ago
|
#include "r_cg_macrodriver.h"
|
||
|
|
#include "r_cg_serial.h"
|
||
|
|
#include "r_cg_adc.h"
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#define ADC_RESOLUTION 1023.0f // 10-bit ADC
|
||
|
|
#define VREF 5.06f // V
|
||
|
|
#define ADC_NUM_CH 4
|
||
|
|
#define RAM_BYTES 13
|
||
|
|
#define UART_RX_BUF_SIZE 96
|
||
|
|
|
||
|
|
extern float g_adc_bytes[ADC_NUM_CH];
|
||
|
|
extern uint8_t g_adc_len;
|
||
|
|
|
||
|
|
extern volatile uint8_t uart_rx_done;
|
||
|
|
extern volatile uint8_t uart_rx_index;
|
||
|
|
extern volatile uint8_t uart_rx_buffer[UART_RX_BUF_SIZE];
|
||
|
|
extern volatile uint16_t uart_rx_length;
|
||
|
|
|
||
|
|
|
||
|
|
void uart_send_string(const char *str); // UART0(RS485)
|
||
|
|
void uart_send_hex(uint8_t val); // UART0(RS485)
|
||
|
|
|
||
|
|
void uart1_send_string(const char *str); // UART1(PC)
|
||
|
|
void uart1_send_hex(uint8_t val); // UART1(PC)
|
||
|
|
|
||
|
|
//void UART0_ReceiveHandler(void);
|
||
|
|
void ADC_ReadAndSend_UART(void);
|
||
|
|
void cmd_enter_command_mode(const unsigned char *d, unsigned int len);
|
||
|
|
void cmd_unknown(const unsigned char *d, unsigned int len);
|
||
|
|
|
||
|
|
// RS485 EN(P45)
|
||
|
|
void rs485_init(void);
|
||
|
|
void rs485_set_tx(uint8_t on);
|
||
|
|
|