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
1.0 KiB
38 lines
1.0 KiB
|
3 months ago
|
#ifndef UART_H
|
||
|
|
#define UART_H
|
||
|
|
|
||
|
|
#include "r_cg_macrodriver.h"
|
||
|
|
#include "r_cg_serial.h"
|
||
|
|
#include "r_cg_adc.h"
|
||
|
|
#include <stdint.h>
|
||
|
|
|
||
|
|
#define ADC_RESOLUTION 1023.0f
|
||
|
|
#define VREF 5.06f
|
||
|
|
#define RAM_BYTES 13
|
||
|
|
#define UART_RX_BUF_SIZE 1024
|
||
|
|
|
||
|
|
/* PC(UART1) 출력 전용 */
|
||
|
|
#define PC_PRINT(s) uart1_send_string((s))
|
||
|
|
#define PC_PRINT_HEX(v) uart1_send_hex((v))
|
||
|
|
#define HOST_PRINT(s) PC_PRINT(s)
|
||
|
|
|
||
|
|
/* UART1 RX 상태 */
|
||
|
|
extern volatile uint8_t uart_rx_done;
|
||
|
|
extern volatile uint16_t uart_rx_index;
|
||
|
|
extern volatile uint8_t uart_rx_buffer[UART_RX_BUF_SIZE];
|
||
|
|
extern volatile uint16_t uart_rx_length;
|
||
|
|
|
||
|
|
/* UART1 TX 상태 */
|
||
|
|
extern volatile uint8_t g_uart1_tx_done;
|
||
|
|
extern volatile uint16_t g_uart1_tx_count;
|
||
|
|
|
||
|
|
/* UART1(PC) 전용 API */
|
||
|
|
void uart1_send_string(const char *str);
|
||
|
|
void uart1_send_hex(uint8_t val);
|
||
|
|
|
||
|
|
/* 공용 함수 */
|
||
|
|
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);
|
||
|
|
|
||
|
|
#endif /* UART_H */
|