After Width: | Height: | Size: 3.7 KiB |
@ -0,0 +1,853 @@
|
||||
#include "app_cli.h"
|
||||
#include "sw_timer.h"
|
||||
#include "app_uart.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CLI_KEY_BACK 0x7F
|
||||
#define CLI_KEY_DEL 0x7E
|
||||
#define CLI_KEY_ENTER 0x0D
|
||||
#define CLI_KEY_ESC 0x1B
|
||||
#define CLI_KEY_LEFT 0x44
|
||||
#define CLI_KEY_RIGHT 0x43
|
||||
#define CLI_KEY_UP 0x41
|
||||
#define CLI_KEY_DOWN 0x42
|
||||
#define CLI_KEY_HOME 0x31
|
||||
#define CLI_KEY_END 0x34
|
||||
|
||||
#define CLI_PROMPT_STR "CLI# "
|
||||
|
||||
#define CLI_ARGS_MAX 32
|
||||
#define CLI_PRINT_BUF_MAX 256
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
CLI_RX_IDLE,
|
||||
CLI_RX_SP1,
|
||||
CLI_RX_SP2,
|
||||
CLI_RX_SP3,
|
||||
CLI_RX_SP4,
|
||||
};
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char cmd_str[CLI_CMD_NAME_MAX];
|
||||
void (*cmd_func)(cli_args_t *);
|
||||
} cli_cmd_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t buf[CLI_LINE_BUF_MAX];
|
||||
uint8_t buf_len;
|
||||
uint8_t cursor;
|
||||
uint8_t count;
|
||||
} cli_line_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t ch;
|
||||
uint32_t baud;
|
||||
bool is_open;
|
||||
bool is_log;
|
||||
uint8_t log_ch;
|
||||
uint32_t log_baud;
|
||||
uint8_t state;
|
||||
char print_buffer[CLI_PRINT_BUF_MAX];
|
||||
uint16_t argc;
|
||||
char *argv[CLI_ARGS_MAX];
|
||||
|
||||
|
||||
bool hist_line_new;
|
||||
int8_t hist_line_i;
|
||||
uint8_t hist_line_last;
|
||||
uint8_t hist_line_count;
|
||||
|
||||
cli_line_t line_buf[CLI_LINE_HIS_MAX];
|
||||
cli_line_t line;
|
||||
|
||||
uint16_t cmd_count;
|
||||
cli_cmd_t cmd_list[CLI_CMD_LIST_MAX];
|
||||
cli_args_t cmd_args;
|
||||
} cli_t;
|
||||
|
||||
|
||||
|
||||
cli_t cli_node;
|
||||
|
||||
|
||||
|
||||
static bool cliUpdate(cli_t *p_cli, uint8_t rx_data);
|
||||
static void cliLineClean(cli_t *p_cli);
|
||||
static void cliLineAdd(cli_t *p_cli);
|
||||
static void cliLineChange(cli_t *p_cli, int8_t key_up);
|
||||
static void cliShowPrompt(cli_t *p_cli);
|
||||
static void cliToUpper(char *str);
|
||||
static bool cliRunCmd(cli_t *p_cli);
|
||||
static bool cliParseArgs(cli_t *p_cli);
|
||||
|
||||
static int32_t cliArgsGetData(uint8_t index);
|
||||
static float cliArgsGetFloat(uint8_t index);
|
||||
static char *cliArgsGetStr(uint8_t index);
|
||||
static bool cliArgsIsStr(uint8_t index, char *p_str);
|
||||
static void uartPrintf(uint8_t ch, const char *format, ...);
|
||||
static uint32_t uartWrite(uint8_t ch, uint8_t* pTxData, uint32_t txLen);
|
||||
|
||||
void cliShowList(cli_args_t *args);
|
||||
void cliMemoryDump(cli_args_t *args);
|
||||
|
||||
bool cliInit(void);
|
||||
void cliMain(void);
|
||||
bool cliAdd(const char *cmd_str, void (*p_func)(cli_args_t *));
|
||||
void cliPrintf(const char *fmt, ...);
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
bool cliOpen(uint8_t ch, uint32_t baud);
|
||||
bool cliOpenLog(uint8_t ch, uint32_t baud);
|
||||
|
||||
|
||||
bool cliAdd(const char *cmd_str, void (*p_func)(cli_args_t *));
|
||||
bool cliKeepLoop(void);
|
||||
uint32_t cliAvailable(void);
|
||||
uint8_t cliRead(void);
|
||||
uint32_t cliWrite(uint8_t *p_data, uint32_t length);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void App_CLI_Initialization(void)
|
||||
{
|
||||
cliInit();
|
||||
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 0, cliMain);
|
||||
}
|
||||
|
||||
bool cliInit(void)
|
||||
{
|
||||
cli_node.is_open = true;
|
||||
cli_node.is_log = true;
|
||||
cli_node.state = CLI_RX_IDLE;
|
||||
|
||||
cli_node.hist_line_i = 0;
|
||||
cli_node.hist_line_last = 0;
|
||||
cli_node.hist_line_count = 0;
|
||||
cli_node.hist_line_new = false;
|
||||
|
||||
cli_node.cmd_args.getData = cliArgsGetData;
|
||||
cli_node.cmd_args.getFloat = cliArgsGetFloat;
|
||||
cli_node.cmd_args.getStr = cliArgsGetStr;
|
||||
cli_node.cmd_args.isStr = cliArgsIsStr;
|
||||
|
||||
cliLineClean(&cli_node);
|
||||
|
||||
|
||||
cliAdd("help", cliShowList);
|
||||
cliAdd("md" , cliMemoryDump);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool cliOpen(uint8_t ch, uint32_t baud)
|
||||
{
|
||||
cli_node.ch = ch;
|
||||
cli_node.baud = baud;
|
||||
|
||||
cli_node.is_open = uartOpen(ch, baud);
|
||||
|
||||
return cli_node.is_open;
|
||||
}
|
||||
|
||||
bool cliOpenLog(uint8_t ch, uint32_t baud)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
cli_node.log_ch = ch;
|
||||
cli_node.log_baud = baud;
|
||||
|
||||
ret = uartOpen(ch, baud);
|
||||
|
||||
if (ret == true)
|
||||
{
|
||||
cli_node.is_log = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool cliLogClose(void)
|
||||
{
|
||||
cli_node.is_log = false;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
void cliShowLog(cli_t *p_cli)
|
||||
{
|
||||
if (cli_node.is_log == true)
|
||||
{
|
||||
uartPrintf(p_cli->log_ch, "Cursor : %d\r\n", p_cli->line.cursor);
|
||||
uartPrintf(p_cli->log_ch, "Count : %d\r\n", p_cli->line.count);
|
||||
uartPrintf(p_cli->log_ch, "buf_len : %d\r\n", p_cli->line.buf_len);
|
||||
uartPrintf(p_cli->log_ch, "buf : %s\r\n", p_cli->line.buf);
|
||||
uartPrintf(p_cli->log_ch, "line_i : %d\r\n", p_cli->hist_line_i);
|
||||
uartPrintf(p_cli->log_ch, "line_lt : %d\r\n", p_cli->hist_line_last);
|
||||
uartPrintf(p_cli->log_ch, "line_c : %d\r\n", p_cli->hist_line_count);
|
||||
|
||||
for (int i=0; i<p_cli->hist_line_count; i++)
|
||||
{
|
||||
uartPrintf(p_cli->log_ch, "buf %d : %s\r\n", i, p_cli->line_buf[i].buf);
|
||||
}
|
||||
uartPrintf(p_cli->log_ch, "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
void cliShowPrompt(cli_t *p_cli)
|
||||
{
|
||||
uartPrintf(p_cli->ch, "\n\r");
|
||||
uartPrintf(p_cli->ch, CLI_PROMPT_STR);
|
||||
}
|
||||
|
||||
void cliMain(void)
|
||||
{
|
||||
#if 0
|
||||
if (cli_node.is_open != true)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if(uartAvailable(cli_node.ch) > 0)
|
||||
{
|
||||
cliUpdate(&cli_node, uartRead(cli_node.ch));
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
|
||||
uint8_t RxData;
|
||||
if(App_Uart_Get_Recv_Data(&RxData) == true)
|
||||
{
|
||||
cliUpdate(&cli_node, RxData);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
uint32_t cliAvailable(void)
|
||||
{
|
||||
#if 0
|
||||
return uartAvailable(cli_node.ch);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t cliRead(void)
|
||||
{
|
||||
#if 0
|
||||
return uartRead(cli_node.ch);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t cliWrite(uint8_t *p_data, uint32_t length)
|
||||
{
|
||||
|
||||
#if 0
|
||||
return uartWrite(cli_node.ch, p_data, length);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
|
||||
{
|
||||
bool ret = false;
|
||||
uint8_t tx_buf[8];
|
||||
cli_line_t *line;
|
||||
|
||||
line = &p_cli->line;
|
||||
|
||||
|
||||
if (p_cli->state == CLI_RX_IDLE)
|
||||
{
|
||||
switch(rx_data)
|
||||
{
|
||||
// 엔터
|
||||
//
|
||||
case CLI_KEY_ENTER:
|
||||
if (line->count > 0)
|
||||
{
|
||||
cliLineAdd(p_cli);
|
||||
cliRunCmd(p_cli);
|
||||
}
|
||||
|
||||
line->count = 0;
|
||||
line->cursor = 0;
|
||||
line->buf[0] = 0;
|
||||
cliShowPrompt(p_cli);
|
||||
break;
|
||||
|
||||
|
||||
case CLI_KEY_ESC:
|
||||
p_cli->state = CLI_RX_SP1;
|
||||
break;
|
||||
|
||||
|
||||
// DEL
|
||||
//
|
||||
case CLI_KEY_DEL:
|
||||
if (line->cursor < line->count)
|
||||
{
|
||||
uint8_t mov_len;
|
||||
|
||||
mov_len = line->count - line->cursor;
|
||||
for (int i=1; i<mov_len; i++)
|
||||
{
|
||||
line->buf[line->cursor + i - 1] = line->buf[line->cursor + i];
|
||||
}
|
||||
|
||||
line->count--;
|
||||
line->buf[line->count] = 0;
|
||||
|
||||
uartPrintf(p_cli->ch, "\x1B[1P");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// 백스페이스
|
||||
//
|
||||
case CLI_KEY_BACK:
|
||||
if (line->count > 0 && line->cursor > 0)
|
||||
{
|
||||
if (line->cursor == line->count)
|
||||
{
|
||||
line->count--;
|
||||
line->buf[line->count] = 0;
|
||||
}
|
||||
|
||||
if (line->cursor < line->count)
|
||||
{
|
||||
uint8_t mov_len;
|
||||
|
||||
mov_len = line->count - line->cursor;
|
||||
|
||||
for (int i=0; i<mov_len; i++)
|
||||
{
|
||||
line->buf[line->cursor + i - 1] = line->buf[line->cursor + i];
|
||||
}
|
||||
|
||||
line->count--;
|
||||
line->buf[line->count] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (line->cursor > 0)
|
||||
{
|
||||
line->cursor--;
|
||||
uartPrintf(p_cli->ch, "\b \b\x1B[1P");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
if ((line->count + 1) < line->buf_len)
|
||||
{
|
||||
if (line->cursor == line->count)
|
||||
{
|
||||
uartWrite(p_cli->ch, &rx_data, 1);
|
||||
|
||||
line->buf[line->cursor] = rx_data;
|
||||
line->count++;
|
||||
line->cursor++;
|
||||
line->buf[line->count] = 0;
|
||||
}
|
||||
if (line->cursor < line->count)
|
||||
{
|
||||
uint8_t mov_len;
|
||||
|
||||
mov_len = line->count - line->cursor;
|
||||
for (int i=0; i<mov_len; i++)
|
||||
{
|
||||
line->buf[line->count - i] = line->buf[line->count - i - 1];
|
||||
}
|
||||
line->buf[line->cursor] = rx_data;
|
||||
line->count++;
|
||||
line->cursor++;
|
||||
line->buf[line->count] = 0;
|
||||
|
||||
uartPrintf(p_cli->ch, "\x1B[4h%c\x1B[4l", rx_data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(p_cli->state)
|
||||
{
|
||||
case CLI_RX_SP1:
|
||||
p_cli->state = CLI_RX_SP2;
|
||||
break;
|
||||
|
||||
case CLI_RX_SP2:
|
||||
p_cli->state = CLI_RX_SP3;
|
||||
break;
|
||||
|
||||
case CLI_RX_SP3:
|
||||
p_cli->state = CLI_RX_IDLE;
|
||||
|
||||
if (rx_data == CLI_KEY_LEFT)
|
||||
{
|
||||
if (line->cursor > 0)
|
||||
{
|
||||
line->cursor--;
|
||||
tx_buf[0] = 0x1B;
|
||||
tx_buf[1] = 0x5B;
|
||||
tx_buf[2] = rx_data;
|
||||
uartWrite(p_cli->ch, tx_buf, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (rx_data == CLI_KEY_RIGHT)
|
||||
{
|
||||
if (line->cursor < line->count)
|
||||
{
|
||||
line->cursor++;
|
||||
|
||||
tx_buf[0] = 0x1B;
|
||||
tx_buf[1] = 0x5B;
|
||||
tx_buf[2] = rx_data;
|
||||
uartWrite(p_cli->ch, tx_buf, 3);
|
||||
}
|
||||
}
|
||||
|
||||
if (rx_data == CLI_KEY_UP)
|
||||
{
|
||||
cliLineChange(p_cli, true);
|
||||
uartPrintf(p_cli->ch, (char *)p_cli->line.buf);
|
||||
}
|
||||
|
||||
if (rx_data == CLI_KEY_DOWN)
|
||||
{
|
||||
cliLineChange(p_cli, false);
|
||||
uartPrintf(p_cli->ch, (char *)p_cli->line.buf);
|
||||
}
|
||||
|
||||
if (rx_data == CLI_KEY_HOME)
|
||||
{
|
||||
uartPrintf(p_cli->ch, "\x1B[%dD", line->cursor);
|
||||
line->cursor = 0;
|
||||
|
||||
p_cli->state = CLI_RX_SP4;
|
||||
}
|
||||
|
||||
if (rx_data == CLI_KEY_END)
|
||||
{
|
||||
uint16_t mov_len;
|
||||
|
||||
if (line->cursor < line->count)
|
||||
{
|
||||
mov_len = line->count - line->cursor;
|
||||
uartPrintf(p_cli->ch, "\x1B[%dC", mov_len);
|
||||
}
|
||||
if (line->cursor > line->count)
|
||||
{
|
||||
mov_len = line->cursor - line->count;
|
||||
uartPrintf(p_cli->ch, "\x1B[%dD", mov_len);
|
||||
}
|
||||
line->cursor = line->count;
|
||||
p_cli->state = CLI_RX_SP4;
|
||||
}
|
||||
break;
|
||||
|
||||
case CLI_RX_SP4:
|
||||
p_cli->state = CLI_RX_IDLE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
cliShowLog(p_cli);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cliLineClean(cli_t *p_cli)
|
||||
{
|
||||
p_cli->line.count = 0;
|
||||
p_cli->line.cursor = 0;
|
||||
p_cli->line.buf_len = CLI_LINE_BUF_MAX - 1;
|
||||
p_cli->line.buf[0] = 0;
|
||||
}
|
||||
|
||||
void cliLineAdd(cli_t *p_cli)
|
||||
{
|
||||
|
||||
p_cli->line_buf[p_cli->hist_line_last] = p_cli->line;
|
||||
|
||||
if (p_cli->hist_line_count < CLI_LINE_HIS_MAX)
|
||||
{
|
||||
p_cli->hist_line_count++;
|
||||
}
|
||||
|
||||
p_cli->hist_line_i = p_cli->hist_line_last;
|
||||
p_cli->hist_line_last = (p_cli->hist_line_last + 1) % CLI_LINE_HIS_MAX;
|
||||
p_cli->hist_line_new = true;
|
||||
}
|
||||
|
||||
void cliLineChange(cli_t *p_cli, int8_t key_up)
|
||||
{
|
||||
uint8_t change_i;
|
||||
|
||||
|
||||
if (p_cli->hist_line_count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (p_cli->line.cursor > 0)
|
||||
{
|
||||
uartPrintf(p_cli->ch, "\x1B[%dD", p_cli->line.cursor);
|
||||
}
|
||||
if (p_cli->line.count > 0)
|
||||
{
|
||||
uartPrintf(p_cli->ch, "\x1B[%dP", p_cli->line.count);
|
||||
}
|
||||
|
||||
|
||||
if (key_up == true)
|
||||
{
|
||||
if (p_cli->hist_line_new == true)
|
||||
{
|
||||
p_cli->hist_line_i = p_cli->hist_line_last;
|
||||
}
|
||||
p_cli->hist_line_i = (p_cli->hist_line_i + p_cli->hist_line_count - 1) % p_cli->hist_line_count;
|
||||
change_i = p_cli->hist_line_i;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_cli->hist_line_i = (p_cli->hist_line_i + 1) % p_cli->hist_line_count;
|
||||
change_i = p_cli->hist_line_i;
|
||||
}
|
||||
|
||||
p_cli->line = p_cli->line_buf[change_i];
|
||||
p_cli->line.cursor = p_cli->line.count;
|
||||
|
||||
p_cli->hist_line_new = false;
|
||||
}
|
||||
|
||||
bool cliRunCmd(cli_t *p_cli)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
||||
if (cliParseArgs(p_cli) == true)
|
||||
{
|
||||
cliPrintf("\r\n");
|
||||
|
||||
cliToUpper(p_cli->argv[0]);
|
||||
|
||||
for (int i=0; i<p_cli->cmd_count; i++)
|
||||
{
|
||||
if (strcmp(p_cli->argv[0], p_cli->cmd_list[i].cmd_str) == 0)
|
||||
{
|
||||
p_cli->cmd_args.argc = p_cli->argc - 1;
|
||||
p_cli->cmd_args.argv = &p_cli->argv[1];
|
||||
p_cli->cmd_list[i].cmd_func(&p_cli->cmd_args);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool cliParseArgs(cli_t *p_cli)
|
||||
{
|
||||
bool ret = false;
|
||||
char *tok;
|
||||
char *next_ptr;
|
||||
uint16_t argc = 0;
|
||||
static const char *delim = " \f\n\r\t\v";
|
||||
char *cmdline;
|
||||
char **argv;
|
||||
|
||||
p_cli->argc = 0;
|
||||
|
||||
cmdline = (char *)p_cli->line.buf;
|
||||
argv = p_cli->argv;
|
||||
|
||||
argv[argc] = NULL;
|
||||
|
||||
for (tok = strtok_r(cmdline, delim, &next_ptr); tok; tok = strtok_r(NULL, delim, &next_ptr))
|
||||
{
|
||||
argv[argc++] = tok;
|
||||
}
|
||||
|
||||
p_cli->argc = argc;
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cliPrintf(const char *fmt, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start (arg, fmt);
|
||||
int32_t len;
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
len = vsnprintf(p_cli->print_buffer, 256, fmt, arg);
|
||||
va_end (arg);
|
||||
|
||||
uartWrite(p_cli->ch, (uint8_t *)p_cli->print_buffer, len);
|
||||
}
|
||||
|
||||
void cliToUpper(char *str)
|
||||
{
|
||||
uint16_t i;
|
||||
uint8_t str_ch;
|
||||
|
||||
for (i=0; i<CLI_CMD_NAME_MAX; i++)
|
||||
{
|
||||
str_ch = str[i];
|
||||
|
||||
if (str_ch == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ((str_ch >= 'a') && (str_ch <= 'z'))
|
||||
{
|
||||
str_ch = str_ch - 'a' + 'A';
|
||||
}
|
||||
str[i] = str_ch;
|
||||
}
|
||||
|
||||
if (i == CLI_CMD_NAME_MAX)
|
||||
{
|
||||
str[i-1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t cliArgsGetData(uint8_t index)
|
||||
{
|
||||
int32_t ret = 0;
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
if (index >= p_cli->cmd_args.argc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = (int32_t)strtoul((const char * ) p_cli->cmd_args.argv[index], (char **)NULL, (int) 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
float cliArgsGetFloat(uint8_t index)
|
||||
{
|
||||
float ret = 0.0;
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
if (index >= p_cli->cmd_args.argc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = (float)strtof((const char * ) p_cli->cmd_args.argv[index], (char **)NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *cliArgsGetStr(uint8_t index)
|
||||
{
|
||||
char *ret = NULL;
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
if (index >= p_cli->cmd_args.argc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = p_cli->cmd_args.argv[index];
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool cliArgsIsStr(uint8_t index, char *p_str)
|
||||
{
|
||||
bool ret = false;
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
if (index >= p_cli->cmd_args.argc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(strcmp(p_str, p_cli->cmd_args.argv[index]) == 0)
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool cliKeepLoop(void)
|
||||
{
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
#if 0
|
||||
|
||||
if (uartAvailable(p_cli->ch) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool cliAdd(const char *cmd_str, void (*p_func)(cli_args_t *))
|
||||
{
|
||||
bool ret = true;
|
||||
cli_t *p_cli = &cli_node;
|
||||
uint16_t index;
|
||||
|
||||
if (p_cli->cmd_count >= CLI_CMD_LIST_MAX)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
index = p_cli->cmd_count;
|
||||
|
||||
strcpy(p_cli->cmd_list[index].cmd_str, cmd_str);
|
||||
p_cli->cmd_list[index].cmd_func = p_func;
|
||||
|
||||
cliToUpper(p_cli->cmd_list[index].cmd_str);
|
||||
|
||||
p_cli->cmd_count++;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void cliShowList(cli_args_t *args)
|
||||
{
|
||||
cli_t *p_cli = &cli_node;
|
||||
|
||||
|
||||
cliPrintf("\r\n");
|
||||
cliPrintf("---------- cmd list ---------\r\n");
|
||||
|
||||
for (int i=0; i<p_cli->cmd_count; i++)
|
||||
{
|
||||
cliPrintf(p_cli->cmd_list[i].cmd_str);
|
||||
cliPrintf("\r\n");
|
||||
}
|
||||
|
||||
cliPrintf("-----------------------------\r\n");
|
||||
}
|
||||
|
||||
void cliMemoryDump(cli_args_t *args)
|
||||
{
|
||||
int idx, size = 16;
|
||||
unsigned int *addr;
|
||||
int idx1, i;
|
||||
unsigned int *ascptr;
|
||||
unsigned char asc[4];
|
||||
|
||||
int argc = args->argc;
|
||||
char **argv = args->argv;
|
||||
|
||||
|
||||
if(args->argc < 1)
|
||||
{
|
||||
cliPrintf(">> md addr [size] \n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(argc > 1)
|
||||
{
|
||||
size = (int)strtoul((const char * ) argv[1], (char **)NULL, (int) 0);
|
||||
}
|
||||
addr = (unsigned int *)strtoul((const char * ) argv[0], (char **)NULL, (int) 0);
|
||||
ascptr = (unsigned int *)addr;
|
||||
|
||||
cliPrintf("\n ");
|
||||
for (idx = 0; idx<size; idx++)
|
||||
{
|
||||
if((idx%4) == 0)
|
||||
{
|
||||
cliPrintf(" 0x%08X: ", (unsigned int)addr);
|
||||
}
|
||||
cliPrintf(" 0x%08X", *(addr));
|
||||
|
||||
if ((idx%4) == 3)
|
||||
{
|
||||
cliPrintf (" |");
|
||||
for (idx1= 0; idx1< 4; idx1++)
|
||||
{
|
||||
memcpy((char *)asc, (char *)ascptr, 4);
|
||||
for (i=0;i<4;i++)
|
||||
{
|
||||
if (asc[i] > 0x1f && asc[i] < 0x7f)
|
||||
{
|
||||
cliPrintf("%c", asc[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
cliPrintf(".");
|
||||
}
|
||||
}
|
||||
ascptr+=1;
|
||||
}
|
||||
cliPrintf("|\r\n ");
|
||||
}
|
||||
addr++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void uartPrintf(uint8_t ch, const char *format, ...)
|
||||
{
|
||||
char buf[256];
|
||||
va_list args;
|
||||
int len;
|
||||
uint32_t ret;
|
||||
|
||||
va_start(args, format);
|
||||
len = vsnprintf(buf, 256, format, args);
|
||||
|
||||
ret = uartWrite(ch, (uint8_t *)buf, len);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static uint32_t uartWrite(uint8_t ch, uint8_t* pTxData, uint32_t txLen)
|
||||
{
|
||||
App_Uart_Transmit_Len(pTxData, txLen);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
/** \file app_cli.h */
|
||||
#if !defined(APP_CLI_H__9DA8C2E3_EABE_4275_933C_0028C1AD1C5F__INCLUDED_)
|
||||
#define APP_CLI_H__9DA8C2E3_EABE_4275_933C_0028C1AD1C5F__INCLUDED_
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
|
||||
#define CLI_CMD_LIST_MAX 16
|
||||
#define CLI_CMD_NAME_MAX 16
|
||||
#define CLI_LINE_HIS_MAX 4
|
||||
#define CLI_LINE_BUF_MAX 64
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t argc;
|
||||
char **argv;
|
||||
int32_t (*getData)(uint8_t index);
|
||||
float (*getFloat)(uint8_t index);
|
||||
char *(*getStr)(uint8_t index);
|
||||
bool (*isStr)(uint8_t index, char *p_str);
|
||||
} cli_args_t;
|
||||
|
||||
|
||||
void App_CLI_Initialization(void);
|
||||
bool cliAdd(const char *cmd_str, void (*p_func)(cli_args_t *));
|
||||
|
||||
|
||||
#if 0
|
||||
bool cliInit(void);
|
||||
bool cliOpen(uint8_t ch, uint32_t baud);
|
||||
bool cliOpenLog(uint8_t ch, uint32_t baud);
|
||||
bool cliMain(void);
|
||||
void cliPrintf(const char *fmt, ...);
|
||||
|
||||
bool cliKeepLoop(void);
|
||||
uint32_t cliAvailable(void);
|
||||
uint8_t cliRead(void);
|
||||
uint32_t cliWrite(uint8_t *p_data, uint32_t length);
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,163 @@
|
||||
#include "app_i2c0.h"
|
||||
|
||||
|
||||
#define I2C0_INSTANCE MXC_I2C0
|
||||
|
||||
|
||||
sys_cfg_i2c_t sys_i2c_cfg = NULL;
|
||||
|
||||
|
||||
|
||||
bool I2C0_Master_Initialization(i2c_speed_t Speed)
|
||||
{
|
||||
int error;
|
||||
|
||||
I2C_Shutdown(I2C0_INSTANCE);
|
||||
|
||||
error = I2C_Init(I2C0_INSTANCE, Speed, &sys_i2c_cfg);
|
||||
I2C_SetTimeout(I2C0_INSTANCE, 100);
|
||||
|
||||
NVIC_ClearPendingIRQ(I2C0_IRQn);
|
||||
NVIC_DisableIRQ(I2C0_IRQn);
|
||||
NVIC_EnableIRQ(I2C0_IRQn);
|
||||
|
||||
return ((error == E_NO_ERROR) ? true : false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
static i2c_req_t I2C0_Master_Req;
|
||||
static int32_t I2C0_MasterError;
|
||||
static bool isRecvComplete;
|
||||
static uint32_t I2C0_MasterTickCount;
|
||||
static void I2C_Master_Callback(i2c_req_t *req, int error);
|
||||
static uint8_t I2C_Master_TxBuff[256];
|
||||
static uint8_t I2C_Master_RxBuff[256];
|
||||
|
||||
void I2C_Master_Initialization(void)
|
||||
{
|
||||
int error;
|
||||
const sys_cfg_i2c_t sys_i2c_master_cfg = NULL; /* No system specific configuration needed. */
|
||||
|
||||
I2C_Shutdown(I2C_MASTER_INSTANCE);
|
||||
|
||||
error = I2C_Init(I2C_MASTER_INSTANCE, I2C_MASTER_FREQUENCY, &sys_i2c_master_cfg);
|
||||
I2C_SetTimeout(I2C_MASTER_INSTANCE, 100);
|
||||
|
||||
if(I2C_MASTER_INSTANCE == MXC_I2C0)
|
||||
{
|
||||
NVIC_ClearPendingIRQ(I2C0_IRQn);
|
||||
NVIC_DisableIRQ(I2C0_IRQn);
|
||||
NVIC_EnableIRQ(I2C0_IRQn);
|
||||
}
|
||||
else if(I2C_MASTER_INSTANCE == MXC_I2C1)
|
||||
{
|
||||
NVIC_ClearPendingIRQ(I2C1_IRQn);
|
||||
NVIC_DisableIRQ(I2C1_IRQn);
|
||||
NVIC_EnableIRQ(I2C1_IRQn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Master interrupt handler
|
||||
void I2C0_IRQHandler(void)
|
||||
{
|
||||
I2C_Handler(I2C_MASTER_INSTANCE);
|
||||
return;
|
||||
}
|
||||
|
||||
static void I2C_Master_Callback(i2c_req_t *req, int error)
|
||||
{
|
||||
I2C_MasterError = error;
|
||||
isRecvComplete = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int32_t I2C_Write(uint8_t SlaveAddress, uint8_t* pTxBuffer, uint32_t TxLen)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
ret = I2C_MasterWrite(I2C_MASTER_INSTANCE, (SlaveAddress << 1), pTxBuffer, TxLen, 0);
|
||||
if(ret != TxLen)
|
||||
{
|
||||
I2C_Master_Initialization();
|
||||
ret = E_COMM_ERR;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = E_NO_ERROR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int32_t I2C_Read(uint8_t SlaveAddress, uint8_t ReadRegAddress, uint8_t* pRxBuffer, uint32_t RxLen)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if(ret = I2C_MasterWrite(I2C_MASTER_INSTANCE, (SlaveAddress << 1), &ReadRegAddress, 1, true) != 1)
|
||||
{
|
||||
I2C_Master_Initialization();
|
||||
return E_COMM_ERR;
|
||||
}
|
||||
|
||||
if(ret = I2C_MasterRead(I2C_MASTER_INSTANCE, (SlaveAddress << 1), &pRxBuffer[0], RxLen, false) != RxLen)
|
||||
{
|
||||
I2C_Master_Initialization();
|
||||
return E_COMM_ERR;
|
||||
}
|
||||
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
int32_t I2C_WriteRead(uint8_t SlaveAddress, uint8_t* pWriteBuff, uint32_t TxLen, uint8_t* pRxBuffer, uint32_t RxLen)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
if(ret = I2C_MasterWrite(I2C_MASTER_INSTANCE, (SlaveAddress << 1), &pWriteBuff[0], TxLen, true) != TxLen)
|
||||
{
|
||||
I2C_Master_Initialization();
|
||||
return E_COMM_ERR;
|
||||
}
|
||||
|
||||
if(ret = I2C_MasterRead(I2C_MASTER_INSTANCE, (SlaveAddress << 1), &pRxBuffer[0], RxLen, false) != RxLen)
|
||||
{
|
||||
I2C_Master_Initialization();
|
||||
return E_COMM_ERR;
|
||||
}
|
||||
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void I2C_Scanner_Process(void)
|
||||
{
|
||||
|
||||
uint8_t regAddress = 0x00;
|
||||
uint8_t regRxdata;
|
||||
for(uint8_t address = 1; address < 127; address++)
|
||||
{
|
||||
dbg_printf(".");
|
||||
if(I2C_Read(address, regAddress, ®Rxdata, 1) == E_NO_ERROR)
|
||||
{
|
||||
dbg_printf("\r\nFound slave ID %03d; 0x%02X\r\n", address, address);
|
||||
//break;
|
||||
}
|
||||
Delay_ms(5);
|
||||
}
|
||||
dbg_printf("\r\n");
|
||||
dbg_printf("scan complete\r\n");
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,10 @@
|
||||
/** \file app_i2c0.h */
|
||||
#if !defined(APP_I2C0_H__B26936C0_09E7_410C_A4ED_75481D0FE5F0__INCLUDED_)
|
||||
#define APP_I2C0_H__B26936C0_09E7_410C_A4ED_75481D0FE5F0__INCLUDED_
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
|
||||
bool I2C0_Master_Initialization(i2c_speed_t Speed);
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
#include "app_i2c1.h"
|
@ -0,0 +1,8 @@
|
||||
/** \file app_i2c1.h */
|
||||
#if !defined(APP_I2C1_H__B26936C0_09E7_410C_A4ED_75481D0FE5F0__INCLUDED_)
|
||||
#define APP_I2C1_H__B26936C0_09E7_410C_A4ED_75481D0FE5F0__INCLUDED_
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,39 @@
|
||||
#include "app_log.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
static LOG_LEVEL nowLogLevel = LOG_LEVEL_DEBUG;
|
||||
|
||||
|
||||
bool App_Log_Initialization(LOG_LEVEL level)
|
||||
{
|
||||
return App_Log_Set_logLevel(level);
|
||||
}
|
||||
|
||||
bool App_Log_Set_logLevel(LOG_LEVEL level)
|
||||
{
|
||||
if(level > LOG_LEVEL_DEBUG)
|
||||
return false;
|
||||
nowLogLevel = level;
|
||||
return true;
|
||||
}
|
||||
|
||||
LOG_LEVEL App_Lgo_Get_logLevel(void)
|
||||
{
|
||||
return nowLogLevel;
|
||||
}
|
||||
|
||||
|
||||
void App_Log_Prinf(LOG_LEVEL level, const char *func, const char *format, ...)
|
||||
{
|
||||
if(nowLogLevel >= level)
|
||||
{
|
||||
va_list arg;
|
||||
fprintf(stderr, "[%d][%s] ", millis(), func);
|
||||
va_start(arg, format);
|
||||
vfprintf(stderr, format, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
/** \file app_log.h */
|
||||
#if !defined(APP_LOG_H__AF0528EC_4FE9_42EF_A325_9764C6E25718__INCLUDED_)
|
||||
#define APP_LOG_H__AF0528EC_4FE9_42EF_A325_9764C6E25718__INCLUDED_
|
||||
|
||||
#include "board_config.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOG_LEVEL_NONE,
|
||||
LOG_LEVEL_ERROR,
|
||||
LOG_LEVEL_WARRING,
|
||||
LOG_LEVEL_INFO,
|
||||
LOG_LEVEL_DEBUG,
|
||||
}LOG_LEVEL;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#define dbg_printf(l, f, a...) \
|
||||
do { \
|
||||
App_Log_Prinf(l, __FUNCTION__, f, ## a); \
|
||||
} while(0)
|
||||
#else
|
||||
#define Log(l, f, a ...) do {} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
bool App_Log_Initialization(LOG_LEVEL level);
|
||||
bool App_Log_Set_logLevel(LOG_LEVEL level);
|
||||
LOG_LEVEL App_Lgo_Get_logLevel(void);
|
||||
void App_Log_Prinf(LOG_LEVEL level, const char *func, const char *format, ...);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 190 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 192 B |
After Width: | Height: | Size: 574 B |
@ -0,0 +1,34 @@
|
||||
const unsigned char gImage_CAMMSYS_Log[512] = {
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X1F,0X1F,0X3F,0X30,0X30,0X30,0X30,0X30,0X30,0X30,0X30,0X30,0X30,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X01,0X07,0X0E,0X1C,0X38,0X1C,0X0E,0X07,0X01,0X00,0X00,
|
||||
0X00,0X00,0X00,0X3F,0X3F,0X1C,0X0E,0X07,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X01,0X07,0X0E,0X1C,0X3F,0X3F,0X00,0X00,0X3F,0X3F,0X1C,0X0E,0X07,0X01,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X01,0X07,0X0E,0X1C,0X3F,0X3F,0X00,0X00,0X1F,0X1F,0X3F,
|
||||
0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X00,0X00,0X00,0X30,0X38,
|
||||
0X1C,0X0E,0X07,0X03,0X01,0X01,0X01,0X03,0X07,0X0E,0X1C,0X38,0X30,0X00,0X00,0X1F,
|
||||
0X1F,0X3F,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X31,0X00,0X00,0X00,
|
||||
0X00,0X00,0XF8,0XFC,0XFC,0X0C,0X0C,0X0C,0X0C,0X0C,0X0C,0X0C,0X0C,0X0C,0X0C,0X00,
|
||||
0X00,0X0C,0X1C,0X38,0XF0,0XC0,0X80,0X00,0X00,0X00,0X00,0X00,0X80,0XC0,0XF0,0X38,
|
||||
0X1C,0X0C,0X00,0XFC,0XFC,0X00,0X00,0X80,0XC0,0XF0,0X78,0X1C,0X0C,0X1C,0X78,0XE0,
|
||||
0XC0,0X80,0X00,0X00,0XFC,0XFC,0X00,0X00,0XFC,0XFC,0X00,0X00,0X80,0XC0,0XF0,0X78,
|
||||
0X1C,0X0C,0X1C,0X78,0XE0,0XC0,0X80,0X00,0X00,0XFC,0XFC,0X00,0X00,0X0C,0X0C,0X8C,
|
||||
0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0XFC,0XFC,0XF8,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X80,0XFC,0XFC,0XFC,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,
|
||||
0X0C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0X8C,0XFC,0XFC,0XF8,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
};
|
After Width: | Height: | Size: 960 B |
@ -0,0 +1,34 @@
|
||||
const unsigned char gImage_background[512] = {
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X18,0X24,0X42,0X42,0X24,0X18,
|
||||
0X00,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0XFF,0X7F,0X3F,0X80,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X80,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0XF0,0XE0,0XC8,0X18,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X18,0X08,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X0E,0X0E,0X0E,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
};
|
@ -0,0 +1,14 @@
|
||||
const unsigned char gImage_number[12][88] = {
|
||||
/*0*/ {0X00,0X00,0X1F,0X0F,0X27,0X30,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X30,0X27,0X0F,0X1F,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0XFC,0XF8,0XF2,0X06,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X06,0XF2,0XF8,0XFC,0X00,0X00},
|
||||
/*1*/ {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X1F,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XF8,0XFC,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00},
|
||||
/*2*/ {0X00,0X00,0X00,0X20,0X30,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X30,0X27,0X0F,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0XFC,0XFE,0XFF,0X00,0X00,0X00,0X00,0X3F,0X7F,0XFF,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X40,0X00,0X00,0X00,0X00,0X00,0XF8,0XF2,0XE6,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X06,0X02,0X00,0X00,0X00},
|
||||
/*3*/ {0X00,0X00,0X20,0X30,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X37,0X2F,0X1F,0X00,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X80,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XBF,0X7F,0X3F,0X00,0X00,0X00,0X00,0X02,0X06,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0XE6,0XF2,0XF8,0X00,0X00},
|
||||
/*4*/ {0X00,0X00,0X3F,0X1F,0X0F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0X1F,0X3F,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFD,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X80,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XF8,0XFC,0XFE,0X00,0X00},
|
||||
/*5*/ {0X00,0X00,0X1F,0X2F,0X37,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X30,0X20,0X00,0X00,0X00,0X00,0X00,0XFF,0XFE,0XFD,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X40,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X80,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0X02,0X06,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X06,0XF2,0XF8,0XFC,0X00,0X00},
|
||||
/*6*/ {0X00,0X00,0X1F,0X2F,0X37,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X30,0X20,0X00,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFF,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X7F,0XFF,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X80,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0XF8,0XF2,0XE6,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X06,0XF2,0XF8,0XFC,0X00,0X00},
|
||||
/*7*/ {0X00,0X00,0X20,0X30,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X37,0X2F,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0X7F,0X3F,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XF8,0XFC,0XFE,0X00,0X00},
|
||||
/*8*/ {0X00,0X00,0X1F,0X2F,0X37,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X37,0X2F,0X1F,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFE,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X3F,0X7F,0XBF,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XBF,0X7F,0X3F,0X00,0X00,0X00,0X00,0XF8,0XF2,0XE6,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0XE6,0XF2,0XF8,0X00,0X00},
|
||||
/*9*/ {0X00,0X00,0X1F,0X2F,0X37,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X38,0X30,0X27,0X0F,0X1F,0X00,0X00,0X00,0X00,0XFE,0XFF,0XFF,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0XFE,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XBF,0X7F,0X3F,0X00,0X00,0X00,0X00,0X00,0X02,0X06,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0X0E,0XE6,0XF2,0XF8,0X00,0X00},
|
||||
/* */ {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00},
|
||||
/*-*/ {0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X01,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X80,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0XC0,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00},
|
||||
};
|
@ -0,0 +1 @@
|
||||
#include "ak9757w.h"
|
@ -0,0 +1,9 @@
|
||||
/** \file ak9757w.h */
|
||||
#if !defined(AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_)
|
||||
#define AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_
|
||||
|
||||
#include "define.h"
|
||||
#include "struct.h"
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,221 @@
|
||||
/** \file ak9757w_def.h */
|
||||
#if !defined(AK9757W_DEF_H__4BA48BEA_F528_4C98_B828_6A11363D6764__INCLUDED_)
|
||||
#define AK9757W_DEF_H__4BA48BEA_F528_4C98_B828_6A11363D6764__INCLUDED_
|
||||
|
||||
#define AK9757W_DEVICE_ADDRESS 0x6C
|
||||
|
||||
|
||||
|
||||
#define AK9757W_REG_RO_COMPANY_CODE 0x00 // Company Code
|
||||
#define AK9757W_REG_RO_DEVICE_ID 0x01 // Device ID
|
||||
#define AK9757W_REG_RO_INFORMATION1 0x02 // Information1
|
||||
#define AK9757W_REG_RO_INFORMATION2 0x03 // Information2
|
||||
#define AK9757W_REG_RO_STATUS 0x04 // Status
|
||||
#define AK9757W_REG_RO_TOUTL 0x05 // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_TOUTH 0x06 // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_TSL 0x07 // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_TSH 0x08 // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_IRL 0x09 // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_IRH 0x0A // TOUT, TS, IR: data register
|
||||
#define AK9757W_REG_RO_STATUS2 0x0B // Status2
|
||||
|
||||
#define AK9757W_REG_RO_SBUF0L 0x0C // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF0H 0x0D // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF1L 0x0E // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF1H 0x0F // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF2L 0x10 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF2H 0x11 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF3L 0x12 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF3H 0x13 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF4L 0x14 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF4H 0x15 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF5L 0x16 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF5H 0x17 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF6L 0x18 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF6H 0x19 // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF7L 0x1A // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF7H 0x1B // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF8L 0x1C // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF8H 0x1D // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF9L 0x1E // Streaming Buffer data
|
||||
#define AK9757W_REG_RO_SBUF9H 0x1F // Streaming Buffer data
|
||||
#define AK9757W_REG_RW_CNTL1 0x20 // Soft Reset
|
||||
#define AK9757W_REG_RW_CNTL2 0x21 // Streaming buffer control
|
||||
#define AK9757W_REG_RW_CNTL3 0x22 // I/V AMP, Temp. calc., ODR setting
|
||||
#define AK9757W_REG_RW_CNTL4 0x23 // Interrupt setting
|
||||
#define AK9757W_REG_RW_CNTL5 0x24 // Threshold judgment setting
|
||||
#define AK9757W_REG_RW_CNTL6 0x25 // Threshold Level setting low
|
||||
#define AK9757W_REG_RW_CNTL7 0x26 // Threshold Level setting high
|
||||
#define AK9757W_REG_RW_CNTL8 0x27 // ADC average number setting
|
||||
#define AK9757W_REG_RW_CNTL9 0x28 // Mode setting
|
||||
|
||||
#define AK9757W_REG_RW_FCOEF4L 0x29 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF4H 0x2A // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF4EX 0x2B // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF3L 0x2C // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF3H 0x2D // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF3EX 0x2E // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF2L 0x2F // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF2H 0x30 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF2EX 0x31 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF1L 0x32 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF1H 0x33 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF1EX 0x34 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF0L 0x35 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_FCOEF0H 0x36 // Calculation coefficient setting
|
||||
|
||||
|
||||
#define AK9757W_REG_RW_GCOEF4L 0x37 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF4H 0x38 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF4EX 0x39 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF3L 0x3A // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF3H 0x3B // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF3EX 0x3C // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF2L 0x3D // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF2H 0x3E // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF3EX 0x3F // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF1L 0x40 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF1H 0x41 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF1EX 0x42 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF0L 0x43 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_GCOEF0H 0x44 // Calculation coefficient setting
|
||||
|
||||
#define AK9757W_REG_RW_XCOEF4L 0x45 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF4H 0x46 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF4EX 0x47 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF3L 0x48 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF3H 0x49 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF3EX 0x4A // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF2L 0x4B // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF2H 0x4C // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF3EX 0x4D // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF1L 0x4E // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF1H 0x4F // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF1EX 0x50 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF0L 0x51 // Calculation coefficient setting
|
||||
#define AK9757W_REG_RW_XCOEF0H 0x52 // Calculation coefficient setting
|
||||
|
||||
#define AK9757W_REG_RW_GIRL 0x54 // IR gain Correction parameter setting
|
||||
#define AK9757W_REG_RW_GIRH 0x55 // IR gain Correction parameter setting
|
||||
|
||||
#define AK9757W_REG_RW_OIRL 0x56 // IR offset Correction parameter setting
|
||||
#define AK9757W_REG_RW_OIRH 0x57 // IR offset Correction parameter setting
|
||||
|
||||
#define AK9757W_REG_RW_GTS 0x58 // TS Gain Correction parameter setting
|
||||
|
||||
#define AK9757W_REG_RW_OTSL 0x59 // TS offset Correction parameter setting
|
||||
#define AK9757W_REG_RW_OTSH 0x5A // TS offset Correction parameter setting
|
||||
|
||||
#define AK9757W_REG_RW_GIT 0x5B // Temperature dependent ingredient of IR gain setting
|
||||
#define AK9757W_REG_RO_CHIPID 0x5C // Chip ID
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
#define AK9757W_COMPANY_CODE_VALUE 0x48
|
||||
#define AK9757W_DEVICE_ID_VALUE 0x17
|
||||
#define AK9757W_INFORMATION1_VALUE 0x00
|
||||
#define AK9757W_INFORMATION2_VALUE 0x00
|
||||
#define AK9757W_STATUS_DRDY_POS 0x00
|
||||
#define AK9757W_STATUS_DRDY_MSK 0x01
|
||||
#define AK9757W_STATUS_BFULL_POS 0x01
|
||||
#define AK9757W_STATUS_BFULL_MSK 0x01
|
||||
#define AK9757W_STATUS_THL_POS 0x02
|
||||
#define AK9757W_STATUS_THL_MSK 0x01
|
||||
#define AK9757W_STATUS_THH_POS 0x03
|
||||
#define AK9757W_STATUS_THH_MSK 0x01
|
||||
#define AK9757W_CNTL1_SRST_POS 0x00
|
||||
#define AK9757W_CNTL1_SRST_MSK 0x01
|
||||
#define AK9757W_CNTL2_BUFON_POS 0x00
|
||||
#define AK9757W_CNTL2_BUFON_MSK 0x01
|
||||
#define AK9757W_CNTL3_ODR_POS 0x00
|
||||
#define AK9757W_CNTL3_ODR_MSK 0x03
|
||||
#define AK9757W_CNTL3_CALC_POS 0x03
|
||||
#define AK9757W_CNTL3_CALC_MSK 0x01
|
||||
#define AK9757W_CNTL3_GAIN_POS 0x04
|
||||
#define AK9757W_CNTL3_GAIN_MSK 0x07
|
||||
#define AK9757W_CNTL3_IROFF_POS 0x07
|
||||
#define AK9757W_CNTL3_IROFF_MSK 0x01
|
||||
#define AK9757W_CNTL4_IDRDY_POS 0x00
|
||||
#define AK9757W_CNTL4_IDRDY_MSK 0x01
|
||||
#define AK9757W_CNTL4_IBFULL_POS 0x01
|
||||
#define AK9757W_CNTL4_IBFULL_MSK 0x01
|
||||
#define AK9757W_CNTL4_ITHL_POS 0x02
|
||||
#define AK9757W_CNTL4_ITHL_MSK 0x01
|
||||
#define AK9757W_CNTL4_ITHU_POS 0x03
|
||||
#define AK9757W_CNTL4_ITHU_MSK 0x01
|
||||
#define AK9757W_CNTL4_IOVF_POS 0x04
|
||||
#define AK9757W_CNTL4_IOVF_MSK 0x01
|
||||
#define AK9757W_CNTL4_ANG_POS 0x07
|
||||
#define AK9757W_CNTL4_ANG_MSK 0x01
|
||||
#define AK9757W_CNTL5_DNUM_POS 0x00
|
||||
#define AK9757W_CNTL5_DNUM_MSK 0x0F
|
||||
#define AK9757W_CNTL5_DIFFON_POS 0x04
|
||||
#define AK9757W_CNTL5_DIFFON_MSK 0x01
|
||||
#define AK9757W_CNTL5_THSEL_POS 0x05
|
||||
#define AK9757W_CNTL5_THSEL_MSK 0x01
|
||||
#define AK9757W_CNTL5_TOUTLPF_POS 0x06
|
||||
#define AK9757W_CNTL5_TOUTLPF_MSK 0x01
|
||||
#define AK9757W_CNTL5_LPFON_POS 0x07
|
||||
#define AK9757W_CNTL5_LPFON_MSK 0x01
|
||||
#define AK9757W_CNTL8_AVN_POS 0x00
|
||||
#define AK9757W_CNTL8_AVN_MSK 0x3F
|
||||
#define AK9757W_CNTL9_MODE_POS 0x00
|
||||
#define AK9757W_CNTL9_MODE_MSK 0x01
|
||||
#define AK9757W_CNTL9_IRINV_POS 0x04
|
||||
#define AK9757W_CNTL9_IRINV_MSK 0x01
|
||||
#define AK9757W_FCOEF2EX_FC2EX_POS 0x00
|
||||
#define AK9757W_FCOEF2EX_FC2EX_MSK 0x3F
|
||||
#define AK9757W_FCOEF1EX_FC1EX_POS 0x00
|
||||
#define AK9757W_FCOEF1EX_FC1EX_MSK 0x1F
|
||||
#define AK9757W_GCOEF2EX_GC2EX_POS 0x00
|
||||
#define AK9757W_GCOEF2EX_GC2EX_MSK 0x3F
|
||||
#define AK9757W_GCOEF1EX_GC1EX_POS 0x00
|
||||
#define AK9757W_GCOEF1EX_GC1EX_MSK 0x1F
|
||||
#define AK9757W_XCOEF2EX_GC2EX_POS 0x00
|
||||
#define AK9757W_XCOEF2EX_GC2EX_MSK 0x3F
|
||||
#define AK9757W_XCOEF1EX_GC1EX_POS 0x00
|
||||
#define AK9757W_XCOEF1EX_GC1EX_MSK 0x1F
|
||||
#define AK9757W_OIR_OIR_H_POS 0x00
|
||||
#define AK9757W_OIR_OIR_H_MSK 0x0F
|
||||
|
||||
#define AK9757W_OTS_OTS_H_POS 0x00
|
||||
#define AK9757W_OTS_OTS_H_MSK 0x3F
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
#define AK9757W_REG_
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|