|
|
@ -34,6 +34,34 @@ Includes |
|
|
#include "r_cg_serial.h" |
|
|
#include "r_cg_serial.h" |
|
|
#include "r_cg_wdt.h" |
|
|
#include "r_cg_wdt.h" |
|
|
/* Start user code for include. Do not edit comment generated here */ |
|
|
/* Start user code for include. Do not edit comment generated here */ |
|
|
|
|
|
#include "common.h" |
|
|
|
|
|
#include "r_cg_macrodriver.h" |
|
|
|
|
|
#include <string.h> |
|
|
|
|
|
#include <ctype.h> |
|
|
|
|
|
#include <stddef.h> |
|
|
|
|
|
#include <r_cg_port.h> |
|
|
|
|
|
#define UART_RX_BUF_SIZE 96 |
|
|
|
|
|
#define CMD_MAX 529 |
|
|
|
|
|
|
|
|
|
|
|
// pin10~13 ↔ P1.0~P1.3 가정
|
|
|
|
|
|
#define X0C_PORT P1 |
|
|
|
|
|
#define X0C_PORTMODE PM1 |
|
|
|
|
|
|
|
|
|
|
|
#define X0C_CH0_MASK _01_Pn0_OUTPUT_1 // P1.0 = 1
|
|
|
|
|
|
#define X0C_CH1_MASK _02_Pn1_OUTPUT_1 // P1.1 = 1
|
|
|
|
|
|
#define X0C_CH2_MASK _04_Pn2_OUTPUT_1 // P1.2 = 1
|
|
|
|
|
|
#define X0C_CH3_MASK _08_Pn3_OUTPUT_1 // P1.3 = 1
|
|
|
|
|
|
#define X0C_MASK (X0C_CH0_MASK|X0C_CH1_MASK|X0C_CH2_MASK|X0C_CH3_MASK) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
static uint8_t uart0_rx_buffer[11]; |
|
|
|
|
|
const unsigned char *d; |
|
|
|
|
|
unsigned int len; |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
#include "r_cg_userdefine.h" |
|
|
#include "r_cg_userdefine.h" |
|
|
|
|
|
|
|
|
@ -41,12 +69,332 @@ Includes |
|
|
Pragma directive |
|
|
Pragma directive |
|
|
***********************************************************************************************************************/ |
|
|
***********************************************************************************************************************/ |
|
|
/* Start user code for pragma. Do not edit comment generated here */ |
|
|
/* Start user code for pragma. Do not edit comment generated here */ |
|
|
|
|
|
static unsigned char hex2byte(char h, char l) |
|
|
|
|
|
{ |
|
|
|
|
|
unsigned char hi, lo; |
|
|
|
|
|
if (h >= 'a' && h <= 'f') h -= 32; |
|
|
|
|
|
if (l >= 'a' && l <= 'f') l -= 32; |
|
|
|
|
|
hi = (h >= 'A') ? h - 'A' + 10 : h - '0'; |
|
|
|
|
|
lo = (l >= 'A') ? l - 'A' + 10 : l - '0'; |
|
|
|
|
|
return (hi << 4) | lo; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// === X0C GPIO: P1.0~P1.3 을 pin10~13으로 사용한다고 가정 ===
|
|
|
|
|
|
static void x0c_init(void){ |
|
|
|
|
|
// 출력으로 설정
|
|
|
|
|
|
X0C_PORTMODE &= (uint8_t)~(uint8_t)X0C_MASK; |
|
|
|
|
|
// 모두 LOW
|
|
|
|
|
|
X0C_PORT &= (uint8_t)~(uint8_t)X0C_MASK; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void x0c_all_low(void){ |
|
|
|
|
|
X0C_PORT &= (uint8_t)~(uint8_t)X0C_MASK; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void x0c_select(uint8_t ch){ |
|
|
|
|
|
// break-before-make
|
|
|
|
|
|
X0C_PORT &= (uint8_t)~(uint8_t)X0C_MASK; |
|
|
|
|
|
__nop(); __nop(); __nop(); __nop(); |
|
|
|
|
|
|
|
|
|
|
|
switch(ch){ |
|
|
|
|
|
case 0: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH0_MASK); break; |
|
|
|
|
|
case 1: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH1_MASK); break; |
|
|
|
|
|
case 2: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH2_MASK); break; |
|
|
|
|
|
case 3: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH3_MASK); break; |
|
|
|
|
|
default: /* 255=all low 등 */ break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef void (*CmdHandler)(const unsigned char *data, unsigned int len); |
|
|
|
|
|
|
|
|
|
|
|
void cmd_unknown(const unsigned char *d, unsigned int len) |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
uart_send_string("Unknownaaaaa cmd\r\n"); |
|
|
|
|
|
delay(100000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef enum { |
|
|
|
|
|
PROTOCOL_I2CT, |
|
|
|
|
|
PROTOCOL_OWIT, |
|
|
|
|
|
PROTOCOL_I2CW, |
|
|
|
|
|
PROTOCOL_I2CR, |
|
|
|
|
|
PROTOCOL_OWIW, |
|
|
|
|
|
PROTOCOL_OWIR, |
|
|
|
|
|
PROTOCOL_I2CA, |
|
|
|
|
|
PROTOCOL_OWIA, |
|
|
|
|
|
PROTOCOL_OWID, |
|
|
|
|
|
PROTOCOL_OWIC, |
|
|
|
|
|
PROTOCOL_I2CC, |
|
|
|
|
|
PROTOCOL_UNKNOWN |
|
|
|
|
|
} ProtocolType; |
|
|
|
|
|
|
|
|
|
|
|
ProtocolType detect_protocol(char header1,char header2) |
|
|
|
|
|
{ |
|
|
|
|
|
if (header1 == 'I' && header2 == 'W' ) return PROTOCOL_I2CW; |
|
|
|
|
|
if (header1 == 'I' && header2 == 'R') return PROTOCOL_I2CR; |
|
|
|
|
|
if (header1 == 'O' && header2 == 'W' ) return PROTOCOL_OWIW; |
|
|
|
|
|
if (header1 == 'O' && header2 == 'R' ) return PROTOCOL_OWIR; |
|
|
|
|
|
return PROTOCOL_UNKNOWN; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
|
unsigned char code; |
|
|
|
|
|
CmdHandler fn; |
|
|
|
|
|
} CmdMap; |
|
|
|
|
|
|
|
|
|
|
|
void process_cmd(ProtocolType protocol, uint8_t id/*unsigned char code*/, |
|
|
|
|
|
const unsigned char *data, unsigned int len) |
|
|
|
|
|
{ |
|
|
|
|
|
const CmdMap *map = NULL; |
|
|
|
|
|
int map_size = 0; |
|
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
switch (protocol) { |
|
|
|
|
|
case PROTOCOL_I2CT: |
|
|
|
|
|
I2C_T_Command_Mode_receiveData(data,(uint8_t)len, id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWIT: |
|
|
|
|
|
OWI_T_CommandMode(data,(uint8_t)len, id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_I2CW: |
|
|
|
|
|
I2C_Command_Mode_receiveData(data,(uint8_t)len,id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_I2CR: |
|
|
|
|
|
I2C_Command_Mode_Send((uint8_t)len, id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWIW: |
|
|
|
|
|
OWI_CommandMode(data,(uint8_t)len,id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWIR: |
|
|
|
|
|
OWI_ReadBytesAndPrint(len,id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_I2CA: |
|
|
|
|
|
I2C_A_Command_Mode_receiveData(data,(uint8_t)len,id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWIA: |
|
|
|
|
|
OWI_A_CommandMode(data,(uint8_t)len,id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWID: |
|
|
|
|
|
OWI_disable(); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_OWIC: |
|
|
|
|
|
OWI_Diagnostic(id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PROTOCOL_I2CC: |
|
|
|
|
|
I2C_Diagnostic(id); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
cmd_unknown(data, len); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/* End user code. Do not edit comment generated here */ |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
|
|
|
|
|
|
/***********************************************************************************************************************
|
|
|
/***********************************************************************************************************************
|
|
|
Global variables and functions |
|
|
Global variables and functions |
|
|
***********************************************************************************************************************/ |
|
|
***********************************************************************************************************************/ |
|
|
/* Start user code for global. Do not edit comment generated here */ |
|
|
/* Start user code for global. Do not edit comment generated here */ |
|
|
|
|
|
void handle_uart_command_line(void) |
|
|
|
|
|
{ |
|
|
|
|
|
char line[UART_RX_BUF_SIZE]; |
|
|
|
|
|
|
|
|
|
|
|
while (1) |
|
|
|
|
|
{ |
|
|
|
|
|
if (uart_rx_done) |
|
|
|
|
|
{ |
|
|
|
|
|
int i; |
|
|
|
|
|
int idx = 0; |
|
|
|
|
|
int pos = 2; |
|
|
|
|
|
int rx_len; |
|
|
|
|
|
ProtocolType proto; |
|
|
|
|
|
uint8_t id; |
|
|
|
|
|
unsigned int byte_len; |
|
|
|
|
|
uint8_t cmd[CMD_MAX]; |
|
|
|
|
|
unsigned int k = 0; |
|
|
|
|
|
|
|
|
|
|
|
uart_rx_done = 0; |
|
|
|
|
|
|
|
|
|
|
|
rx_len = (int)uart_rx_length; |
|
|
|
|
|
if (rx_len < 0) rx_len = 0; |
|
|
|
|
|
if (rx_len > (int)UART_RX_BUF_SIZE - 1) rx_len = (int)UART_RX_BUF_SIZE - 1; |
|
|
|
|
|
uart_rx_buffer[rx_len] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
// 한 줄 만들기 (CR 무시, LF에서 끊음)
|
|
|
|
|
|
for (i = 0; i < rx_len && i < (int)sizeof(line) - 1; i++) { |
|
|
|
|
|
char c = (char)uart_rx_buffer[i]; |
|
|
|
|
|
if (c == '\r') continue; |
|
|
|
|
|
if (c == '\n') break; |
|
|
|
|
|
line[idx++] = c; |
|
|
|
|
|
} |
|
|
|
|
|
line[idx] = '\0'; |
|
|
|
|
|
|
|
|
|
|
|
/* ============================
|
|
|
|
|
|
* X0C_ 프리픽스 전처리 |
|
|
|
|
|
* 형식: X0C_011:..., X0C_021:..., X0C_031:..., X0C_041:... |
|
|
|
|
|
* (옵션) X0C_000: -> 모두 LOW |
|
|
|
|
|
* ============================ */ |
|
|
|
|
|
if (idx >= 8 && |
|
|
|
|
|
(line[0]=='X' || line[0]=='x') && |
|
|
|
|
|
(line[1]=='0' || line[1]=='0') && |
|
|
|
|
|
(line[2]=='0' || line[1]=='0') && |
|
|
|
|
|
(line[3]=='C' || line[2]=='c') && |
|
|
|
|
|
line[4]=='_') |
|
|
|
|
|
{ |
|
|
|
|
|
int ch = -1; |
|
|
|
|
|
|
|
|
|
|
|
// 엄격한 포맷 검사: 'X0C_' '0' [1~4|0] '1' ':' (또는 000:)
|
|
|
|
|
|
if (line[5]=='0' && line[8]==':') { |
|
|
|
|
|
if (line[5]=='0' && line[6]=='0' && line[7]=='0') ch = 0; |
|
|
|
|
|
else if (line[5]=='0' && line[6]=='0' && line[7]=='1') ch = 1; |
|
|
|
|
|
else if (line[5]=='2' && line[6]=='1') ch = 1; |
|
|
|
|
|
else if (line[5]=='3' && line[6]=='1') ch = 2; // pin12
|
|
|
|
|
|
else if (line[5]=='4' && line[6]=='1') ch = 3; // pin13
|
|
|
|
|
|
else if (line[5]=='0' && line[6]=='0') ch = 255; // 000: -> 모두 LOW
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (ch == -1) { |
|
|
|
|
|
uart_send_string("Err:X0C_code\r\n"); |
|
|
|
|
|
goto clear; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 모두 LOW
|
|
|
|
|
|
X0C_PORT &= (uint8_t)~(uint8_t)X0C_MASK; |
|
|
|
|
|
__nop(); __nop(); __nop(); __nop(); |
|
|
|
|
|
|
|
|
|
|
|
// 선택된 채널만 HIGH
|
|
|
|
|
|
if (ch != 255) { |
|
|
|
|
|
switch(ch){ |
|
|
|
|
|
case 0: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH0_MASK); break; |
|
|
|
|
|
case 1: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH1_MASK); break; |
|
|
|
|
|
case 2: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH2_MASK); break; |
|
|
|
|
|
case 3: X0C_PORT = (uint8_t)((X0C_PORT & (uint8_t)~(uint8_t)X0C_MASK) | X0C_CH3_MASK); break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delay_us(7000); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 콜론 뒤 명령만 남기도록 버퍼를 앞으로 당김
|
|
|
|
|
|
{ |
|
|
|
|
|
int start = 8; // "X0C_0x1:" 이후 시작 인덱스
|
|
|
|
|
|
int rem = idx - start; // 남은 길이
|
|
|
|
|
|
if (rem <= 0) { |
|
|
|
|
|
// X0C_만 있는 경우: 단순 ACK 후 종료
|
|
|
|
|
|
uart_send_string("<ACK>X0C\r\n"); |
|
|
|
|
|
goto clear; |
|
|
|
|
|
} |
|
|
|
|
|
for (i = 0; i < rem; i++) line[i] = line[start + i]; |
|
|
|
|
|
line[rem] = '\0'; |
|
|
|
|
|
idx = rem; |
|
|
|
|
|
pos = 2; // 프로토콜 재해석 위해 초기화 (OW/IR/IW/OR의 2글자 이후 위치)
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// (X0C 처리 후) 최소 길이 재검사
|
|
|
|
|
|
if (idx < 7) { uart_send_string("Err:short\r\n"); goto clear; } |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
char h0 = (char)toupper((unsigned char)line[0]); |
|
|
|
|
|
char h1 = (char)toupper((unsigned char)line[1]); |
|
|
|
|
|
proto = detect_protocol(h0, h1); |
|
|
|
|
|
} |
|
|
|
|
|
if (proto == PROTOCOL_UNKNOWN) { uart_send_string("Err:ID\r\n"); goto clear; } |
|
|
|
|
|
|
|
|
|
|
|
if (line[pos] == 't' || line[pos] == 'T') { |
|
|
|
|
|
if (proto == PROTOCOL_OWIW) proto = PROTOCOL_OWIT; |
|
|
|
|
|
else if (proto == PROTOCOL_I2CW) proto = PROTOCOL_I2CT; |
|
|
|
|
|
pos++; // 't'
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (line[pos] == 'a' || line[pos] == 'A') { |
|
|
|
|
|
if (proto == PROTOCOL_OWIW) proto = PROTOCOL_OWIA; |
|
|
|
|
|
else if (proto == PROTOCOL_I2CW) proto = PROTOCOL_I2CA; |
|
|
|
|
|
pos++; // 'a'
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (line[pos] == 'd' || line[pos] == 'D') { |
|
|
|
|
|
if (proto == PROTOCOL_OWIW) proto = PROTOCOL_OWID; |
|
|
|
|
|
pos++; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (line[pos] == 'c' || line[pos] == 'C') { |
|
|
|
|
|
if (proto == PROTOCOL_OWIW) proto = PROTOCOL_OWIC; |
|
|
|
|
|
else if (proto == PROTOCOL_I2CW) proto = PROTOCOL_I2CC; |
|
|
|
|
|
pos++; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (line[pos] == '_' || line[pos] == ':') pos++; |
|
|
|
|
|
|
|
|
|
|
|
if (pos + 1 >= idx) { uart_send_string("Err:id_short\r\n"); goto clear; } |
|
|
|
|
|
id = hex2byte(line[pos], line[pos+1]); |
|
|
|
|
|
pos += 2; |
|
|
|
|
|
|
|
|
|
|
|
if (pos + 2 >= idx || |
|
|
|
|
|
!(line[pos] >= '0' && line[pos] <= '9') || |
|
|
|
|
|
!(line[pos+1] >= '0' && line[pos+1] <= '9') || |
|
|
|
|
|
!(line[pos+2] >= '0' && line[pos+2] <= '9')) { |
|
|
|
|
|
uart_send_string("Err:len_dec\r\n"); goto clear; |
|
|
|
|
|
} |
|
|
|
|
|
byte_len = (unsigned int)(100*(line[pos]-'0') + 10*(line[pos+1]-'0') + (line[pos+2]-'0')); |
|
|
|
|
|
pos += 3; |
|
|
|
|
|
if (byte_len > CMD_MAX) { uart_send_string("Err:len_range\r\n"); goto clear; } |
|
|
|
|
|
|
|
|
|
|
|
if (proto == PROTOCOL_I2CA || proto == PROTOCOL_OWIA) { |
|
|
|
|
|
if (byte_len != 0 && byte_len != 3) { |
|
|
|
|
|
uart_send_string("Err:len_a_mode\r\n"); goto clear; |
|
|
|
|
|
} |
|
|
|
|
|
if (byte_len == 0) { |
|
|
|
|
|
if (pos != idx) { uart_send_string("Err:read_no_payload\r\n"); goto clear; } |
|
|
|
|
|
} else { |
|
|
|
|
|
if ((int)(pos + (int)byte_len*2) > idx) { uart_send_string("Err:len_mismatch\r\n"); goto clear; } |
|
|
|
|
|
for (k = 0; k < byte_len; k++) { |
|
|
|
|
|
cmd[k] = hex2byte(line[pos + 2*k], line[pos + 2*k + 1]); |
|
|
|
|
|
} |
|
|
|
|
|
pos += byte_len*2; |
|
|
|
|
|
if (pos != idx) { uart_send_string("Err:len_trail\r\n"); goto clear; } |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else if (proto == PROTOCOL_OWIT || proto == PROTOCOL_I2CT || |
|
|
|
|
|
proto == PROTOCOL_OWIW || proto == PROTOCOL_I2CW) |
|
|
|
|
|
{ |
|
|
|
|
|
if (byte_len == 0) { uart_send_string("Err:payload0\r\n"); goto clear; } |
|
|
|
|
|
if ((int)(pos + (int)byte_len*2) > idx) { uart_send_string("Err:len_mismatch\r\n"); goto clear; } |
|
|
|
|
|
for (k = 0; k < byte_len; k++) { |
|
|
|
|
|
cmd[k] = hex2byte(line[pos + 2*k], line[pos + 2*k + 1]); |
|
|
|
|
|
} |
|
|
|
|
|
pos += byte_len*2; |
|
|
|
|
|
if (pos != idx) { uart_send_string("Err:len_trail\r\n"); goto clear; } |
|
|
|
|
|
} |
|
|
|
|
|
else if (proto == PROTOCOL_OWIR || proto == PROTOCOL_I2CR) |
|
|
|
|
|
{ |
|
|
|
|
|
if (byte_len == 0) { uart_send_string("Err:read_len_nonzero\r\n"); goto clear; } |
|
|
|
|
|
if (pos != idx) { uart_send_string("Err:read_no_payload\r\n"); goto clear; } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
process_cmd(proto, id, cmd, byte_len); |
|
|
|
|
|
|
|
|
|
|
|
clear: |
|
|
|
|
|
idx = 0; |
|
|
|
|
|
uart_rx_index = 0; |
|
|
|
|
|
uart_rx_length = 0; |
|
|
|
|
|
R_UART0_Receive((uint8_t *)&uart_rx_buffer[uart_rx_index], 1); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
void R_MAIN_UserInit(void); |
|
|
void R_MAIN_UserInit(void); |
|
|
|
|
|
|
|
|
@ -60,6 +408,12 @@ void main(void) |
|
|
{ |
|
|
{ |
|
|
R_MAIN_UserInit(); |
|
|
R_MAIN_UserInit(); |
|
|
/* Start user code. Do not edit comment generated here */ |
|
|
/* Start user code. Do not edit comment generated here */ |
|
|
|
|
|
R_UART0_Create(); |
|
|
|
|
|
R_IICA0_Create(); |
|
|
|
|
|
R_UART0_Start(); |
|
|
|
|
|
R_UART0_Receive(&uart_rx_buffer[uart_rx_index], 1); |
|
|
|
|
|
handle_uart_command_line(); |
|
|
|
|
|
delay(100000); |
|
|
while (1U) |
|
|
while (1U) |
|
|
{ |
|
|
{ |
|
|
; |
|
|
; |
|
|
@ -77,6 +431,9 @@ void R_MAIN_UserInit(void) |
|
|
{ |
|
|
{ |
|
|
/* Start user code. Do not edit comment generated here */ |
|
|
/* Start user code. Do not edit comment generated here */ |
|
|
EI(); |
|
|
EI(); |
|
|
|
|
|
R_ADC_Create(); |
|
|
|
|
|
R_ADC_Set_OperationOn(); |
|
|
|
|
|
x0c_init(); |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
/* End user code. Do not edit comment generated here */ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|