akm센서 기능 구현중

master
imbis 4 months ago
parent 131e37c4c2
commit 6e31ba43b8

Binary file not shown.

@ -7,6 +7,9 @@
"ssd1306_i2c.h": "c", "ssd1306_i2c.h": "c",
"font.h": "c", "font.h": "c",
"stdarg.h": "c", "stdarg.h": "c",
"app_log.h": "c" "app_log.h": "c",
"app_i2c_master.h": "c",
"ak9757w_def.h": "c",
"ak9757w.h": "c"
} }
} }

@ -48,8 +48,6 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t ch;
uint32_t baud;
bool is_open; bool is_open;
bool is_log; bool is_log;
uint8_t log_ch; uint8_t log_ch;
@ -92,8 +90,8 @@ static int32_t cliArgsGetData(uint8_t index);
static float cliArgsGetFloat(uint8_t index); static float cliArgsGetFloat(uint8_t index);
static char *cliArgsGetStr(uint8_t index); static char *cliArgsGetStr(uint8_t index);
static bool cliArgsIsStr(uint8_t index, char *p_str); static bool cliArgsIsStr(uint8_t index, char *p_str);
static void uartPrintf(uint8_t ch, const char *format, ...); static void uartPrintf(const char *format, ...);
static uint32_t uartWrite(uint8_t ch, uint8_t* pTxData, uint32_t txLen); static uint32_t uartWrite(uint8_t* pTxData, uint32_t txLen);
void cliShowList(cli_args_t *args); void cliShowList(cli_args_t *args);
void cliMemoryDump(cli_args_t *args); void cliMemoryDump(cli_args_t *args);
@ -192,26 +190,26 @@ void cliShowLog(cli_t *p_cli)
{ {
if (cli_node.is_log == true) if (cli_node.is_log == true)
{ {
uartPrintf(p_cli->log_ch, "Cursor : %d\r\n", p_cli->line.cursor); uartPrintf("Cursor : %d\r\n", p_cli->line.cursor);
uartPrintf(p_cli->log_ch, "Count : %d\r\n", p_cli->line.count); uartPrintf("Count : %d\r\n", p_cli->line.count);
uartPrintf(p_cli->log_ch, "buf_len : %d\r\n", p_cli->line.buf_len); uartPrintf("buf_len : %d\r\n", p_cli->line.buf_len);
uartPrintf(p_cli->log_ch, "buf : %s\r\n", p_cli->line.buf); uartPrintf("buf : %s\r\n", p_cli->line.buf);
uartPrintf(p_cli->log_ch, "line_i : %d\r\n", p_cli->hist_line_i); uartPrintf("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("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); uartPrintf("line_c : %d\r\n", p_cli->hist_line_count);
for (int i=0; i<p_cli->hist_line_count; i++) 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("buf %d : %s\r\n", i, p_cli->line_buf[i].buf);
} }
uartPrintf(p_cli->log_ch, "\r\n"); uartPrintf("\r\n");
} }
} }
void cliShowPrompt(cli_t *p_cli) void cliShowPrompt(cli_t *p_cli)
{ {
uartPrintf(p_cli->ch, "\n\r"); uartPrintf("\n\r");
uartPrintf(p_cli->ch, CLI_PROMPT_STR); uartPrintf(CLI_PROMPT_STR);
} }
void cliMain(void) void cliMain(void)
@ -316,7 +314,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
line->count--; line->count--;
line->buf[line->count] = 0; line->buf[line->count] = 0;
uartPrintf(p_cli->ch, "\x1B[1P"); uartPrintf("\x1B[1P");
} }
break; break;
@ -351,7 +349,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
if (line->cursor > 0) if (line->cursor > 0)
{ {
line->cursor--; line->cursor--;
uartPrintf(p_cli->ch, "\b \b\x1B[1P"); uartPrintf("\b \b\x1B[1P");
} }
break; break;
@ -361,7 +359,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
{ {
if (line->cursor == line->count) if (line->cursor == line->count)
{ {
uartWrite(p_cli->ch, &rx_data, 1); uartWrite(&rx_data, 1);
line->buf[line->cursor] = rx_data; line->buf[line->cursor] = rx_data;
line->count++; line->count++;
@ -382,7 +380,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
line->cursor++; line->cursor++;
line->buf[line->count] = 0; line->buf[line->count] = 0;
uartPrintf(p_cli->ch, "\x1B[4h%c\x1B[4l", rx_data); uartPrintf("\x1B[4h%c\x1B[4l", rx_data);
} }
} }
break; break;
@ -410,7 +408,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
tx_buf[0] = 0x1B; tx_buf[0] = 0x1B;
tx_buf[1] = 0x5B; tx_buf[1] = 0x5B;
tx_buf[2] = rx_data; tx_buf[2] = rx_data;
uartWrite(p_cli->ch, tx_buf, 3); uartWrite(tx_buf, 3);
} }
} }
@ -423,25 +421,25 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
tx_buf[0] = 0x1B; tx_buf[0] = 0x1B;
tx_buf[1] = 0x5B; tx_buf[1] = 0x5B;
tx_buf[2] = rx_data; tx_buf[2] = rx_data;
uartWrite(p_cli->ch, tx_buf, 3); uartWrite(tx_buf, 3);
} }
} }
if (rx_data == CLI_KEY_UP) if (rx_data == CLI_KEY_UP)
{ {
cliLineChange(p_cli, true); cliLineChange(p_cli, true);
uartPrintf(p_cli->ch, (char *)p_cli->line.buf); uartPrintf((char *)p_cli->line.buf);
} }
if (rx_data == CLI_KEY_DOWN) if (rx_data == CLI_KEY_DOWN)
{ {
cliLineChange(p_cli, false); cliLineChange(p_cli, false);
uartPrintf(p_cli->ch, (char *)p_cli->line.buf); uartPrintf((char *)p_cli->line.buf);
} }
if (rx_data == CLI_KEY_HOME) if (rx_data == CLI_KEY_HOME)
{ {
uartPrintf(p_cli->ch, "\x1B[%dD", line->cursor); uartPrintf("\x1B[%dD", line->cursor);
line->cursor = 0; line->cursor = 0;
p_cli->state = CLI_RX_SP4; p_cli->state = CLI_RX_SP4;
@ -454,12 +452,12 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
if (line->cursor < line->count) if (line->cursor < line->count)
{ {
mov_len = line->count - line->cursor; mov_len = line->count - line->cursor;
uartPrintf(p_cli->ch, "\x1B[%dC", mov_len); uartPrintf("\x1B[%dC", mov_len);
} }
if (line->cursor > line->count) if (line->cursor > line->count)
{ {
mov_len = line->cursor - line->count; mov_len = line->cursor - line->count;
uartPrintf(p_cli->ch, "\x1B[%dD", mov_len); uartPrintf("\x1B[%dD", mov_len);
} }
line->cursor = line->count; line->cursor = line->count;
p_cli->state = CLI_RX_SP4; p_cli->state = CLI_RX_SP4;
@ -473,7 +471,7 @@ bool cliUpdate(cli_t *p_cli, uint8_t rx_data)
cliShowLog(p_cli); //cliShowLog(p_cli);
return ret; return ret;
} }
@ -514,11 +512,11 @@ void cliLineChange(cli_t *p_cli, int8_t key_up)
if (p_cli->line.cursor > 0) if (p_cli->line.cursor > 0)
{ {
uartPrintf(p_cli->ch, "\x1B[%dD", p_cli->line.cursor); uartPrintf("\x1B[%dD", p_cli->line.cursor);
} }
if (p_cli->line.count > 0) if (p_cli->line.count > 0)
{ {
uartPrintf(p_cli->ch, "\x1B[%dP", p_cli->line.count); uartPrintf("\x1B[%dP", p_cli->line.count);
} }
@ -612,7 +610,7 @@ void cliPrintf(const char *fmt, ...)
len = vsnprintf(p_cli->print_buffer, 256, fmt, arg); len = vsnprintf(p_cli->print_buffer, 256, fmt, arg);
va_end (arg); va_end (arg);
uartWrite(p_cli->ch, (uint8_t *)p_cli->print_buffer, len); uartWrite((uint8_t *)p_cli->print_buffer, len);
} }
void cliToUpper(char *str) void cliToUpper(char *str)
@ -828,7 +826,7 @@ void cliMemoryDump(cli_args_t *args)
static void uartPrintf(uint8_t ch, const char *format, ...) static void uartPrintf(const char *format, ...)
{ {
char buf[256]; char buf[256];
va_list args; va_list args;
@ -837,13 +835,12 @@ static void uartPrintf(uint8_t ch, const char *format, ...)
va_start(args, format); va_start(args, format);
len = vsnprintf(buf, 256, format, args); len = vsnprintf(buf, 256, format, args);
ret = uartWrite((uint8_t *)buf, len);
ret = uartWrite(ch, (uint8_t *)buf, len);
va_end(args); va_end(args);
} }
static uint32_t uartWrite(uint8_t ch, uint8_t* pTxData, uint32_t txLen) static uint32_t uartWrite(uint8_t* pTxData, uint32_t txLen)
{ {
App_Uart_Transmit_Len(pTxData, txLen); App_Uart_Transmit_Len(pTxData, txLen);
return 0; return 0;

@ -1,19 +1,18 @@
#include "app_i2c0.h" #include "app_i2c0.h"
#define I2C0_INSTANCE MXC_I2C0
#if 0
sys_cfg_i2c_t sys_i2c_cfg = NULL; sys_cfg_i2c_t sys_i2c_cfg = NULL;
bool I2C0_Master_Initialization(i2c_speed_t Speed) bool I2C_Master_Initialization(mxc_i2c_regs_t* pI2C_Handler, i2c_speed_t Speed)
{ {
int error; int error;
I2C_Shutdown(I2C0_INSTANCE); I2C_Shutdown(I2C0_INSTANCE);
error = I2C_Init(I2C0_INSTANCE, Speed, &sys_i2c_cfg); error = I2C_Init(I2C0_INSTANCE, Speed, &sys_i2c_cfg);
I2C_SetTimeout(I2C0_INSTANCE, 100); I2C_SetTimeout(I2C0_INSTANCE, 100);
@ -26,6 +25,90 @@ bool I2C0_Master_Initialization(i2c_speed_t Speed)
//Master interrupt handler
void I2C0_IRQHandler(void)
{
I2C_Handler(I2C0_INSTANCE);
return;
}
int32_t I2C0_Master_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;
}
@ -160,4 +243,7 @@ void I2C_Scanner_Process(void)
} }
#endif #endif
#endif

@ -5,6 +5,6 @@
#include "board_config.h" #include "board_config.h"
bool I2C0_Master_Initialization(i2c_speed_t Speed); //bool I2C_Master_Initialization(mxc_i2c_regs_t* pI2C_Handler, i2c_speed_t Speed);
#endif #endif

@ -0,0 +1,105 @@
#include "app_i2c_master.h"
static mxc_i2c_regs_t* pI2C_Master = NULL;
static sys_cfg_i2c_t sys_i2c_master_cfg = NULL; /* No system specific configuration needed. */
static void I2C_Master_Handler(void);
bool I2C_Master_Initialization(mxc_i2c_regs_t* pI2C_Handler, i2c_speed_t Speed)
{
int error;
if(!(pI2C_Handler == MXC_I2C0 || pI2C_Handler == MXC_I2C1))
return false;
pI2C_Master = pI2C_Handler;
I2C_Shutdown(pI2C_Master);
error = I2C_Init(pI2C_Master, Speed, &sys_i2c_master_cfg);
I2C_SetTimeout(pI2C_Master, 100);
if(pI2C_Handler == MXC_I2C0)
{
NVIC_ClearPendingIRQ(I2C0_IRQn);
NVIC_DisableIRQ(I2C0_IRQn);
NVIC_SetVector(I2C0_IRQn, I2C_Master_Handler);
NVIC_EnableIRQ(I2C0_IRQn);
}
else if(pI2C_Handler == MXC_I2C1)
{
NVIC_ClearPendingIRQ(I2C1_IRQn);
NVIC_DisableIRQ(I2C1_IRQn);
NVIC_SetVector(I2C1_IRQn, I2C_Master_Handler);
NVIC_EnableIRQ(I2C1_IRQn);
}
return true;
}
static void I2C_Master_Handler(void)
{
UART_Handler(pI2C_Master);
}
int32_t I2C_Master_Write(uint8_t SlaveAddress, uint8_t* pTxBuffer, uint32_t TxLen)
{
int32_t ret;
if(pI2C_Master == NULL)
return E_NULL_PTR;
ret = I2C_MasterWrite(pI2C_Master, (SlaveAddress << 1), pTxBuffer, TxLen, 0);
if(ret != TxLen)
{
I2C_Master_Initialization(TEMP_I2C_INSTANCE, TEMP_I2C_SPEED);
ret = E_COMM_ERR;
}
else
{
ret = E_NO_ERROR;
}
return ret;
}
int32_t I2C_Master_Read(uint8_t SlaveAddress, uint8_t* pRxBuffer, uint32_t RxLen)
{
int32_t ret;
if(pI2C_Master == NULL)
return E_NULL_PTR;
if(ret = I2C_MasterRead(pI2C_Master, (SlaveAddress << 1), &pRxBuffer[0], RxLen, false) != RxLen)
{
I2C_Master_Initialization(TEMP_I2C_INSTANCE, TEMP_I2C_SPEED);
return E_COMM_ERR;
}
return E_NO_ERROR;
}
int32_t I2C_Master_WriteRead(uint8_t SlaveAddress, uint8_t* pWriteBuff, uint32_t TxLen, uint8_t* pRxBuffer, uint32_t RxLen)
{
int32_t ret;
if(pI2C_Master == NULL)
return E_NULL_PTR;
if(ret = I2C_MasterWrite(pI2C_Master, (SlaveAddress << 1), &pWriteBuff[0], TxLen, true) != TxLen)
{
I2C_Master_Initialization(TEMP_I2C_INSTANCE, TEMP_I2C_SPEED);
return E_COMM_ERR;
}
if(ret = I2C_MasterRead(pI2C_Master, (SlaveAddress << 1), &pRxBuffer[0], RxLen, false) != RxLen)
{
I2C_Master_Initialization(TEMP_I2C_INSTANCE, TEMP_I2C_SPEED);
return E_COMM_ERR;
}
return E_NO_ERROR;
}

@ -0,0 +1,13 @@
/** \file app_i2c_master.h */
#if !defined(APP_I2C_MASTER_H__369DA004_50BB_4346_B148_5EE5FE8295F5__INCLUDED_)
#define APP_I2C_MASTER_H__369DA004_50BB_4346_B148_5EE5FE8295F5__INCLUDED_
#include "board_config.h"
bool I2C_Master_Initialization(mxc_i2c_regs_t* pI2C_Handler, i2c_speed_t Speed);
int32_t I2C_Master_Write(uint8_t SlaveAddress, uint8_t* pTxBuffer, uint32_t TxLen);
int32_t I2C_Master_Read(uint8_t SlaveAddress, uint8_t* pRxBuffer, uint32_t RxLen);
int32_t I2C_Master_WriteRead(uint8_t SlaveAddress, uint8_t* pWriteBuff, uint32_t TxLen, uint8_t* pRxBuffer, uint32_t RxLen);
#endif

@ -52,7 +52,7 @@ int32_t App_Uart_Initialization(void)
cfg.stop = UART_STOP_1; cfg.stop = UART_STOP_1;
cfg.flow = UART_FLOW_CTRL_DIS; cfg.flow = UART_FLOW_CTRL_DIS;
cfg.pol = UART_FLOW_POL_DIS; cfg.pol = UART_FLOW_POL_DIS;
cfg.baud = APP_UART_BUADRATE; cfg.baud = APP_UART_BAUDRATE;
while (!(uart->status & MXC_F_UART_STATUS_TX_EMPTY)) while (!(uart->status & MXC_F_UART_STATUS_TX_EMPTY))
{ {

@ -45,7 +45,7 @@
// //
#define APP_UART_INSTANCE MXC_UART1 #define APP_UART_INSTANCE MXC_UART1
#define APP_UART_ALTERNATE MAP_A #define APP_UART_ALTERNATE MAP_A
#define APP_UART_BUADRATE 115200 #define APP_UART_BAUDRATE 115200
#define APP_UART_TX_BUFFER_SIZE 1024 #define APP_UART_TX_BUFFER_SIZE 1024
#define APP_UART_RX_BUFFER_SIZE 128 #define APP_UART_RX_BUFFER_SIZE 128
@ -56,4 +56,14 @@
#define TEMPERATURE_MIN 1000 #define TEMPERATURE_MIN 1000
//////////////////////////////////////////
// Temperature I2c
//////////////////////////////////////////
#define TEMP_I2C_INSTANCE MXC_I2C0
#define TEMP_I2C_SPEED I2C_STD_MODE
#define TEMP_I2C_ADDRESS 0x6C
#endif #endif

@ -5,9 +5,10 @@
#include "app_gpio_led.h" #include "app_gpio_led.h"
#include "app_gpio_i2c.h" #include "app_gpio_i2c.h"
#include "app_i2c_master.h"
#include "app_uart.h" #include "app_uart.h"
#include "app_i2c0.h"
#include "ssd1306.h" #include "ssd1306.h"
#include "ak9757w.h"
#include "app_log.h" #include "app_log.h"
@ -16,8 +17,8 @@
void Test_Process(void) void Test_Process(void)
{ {
//AK9757_Check_ChipID();
//dbg_printf(LOG_LEVEL_DEBUG, "timer test\r\n");
} }
@ -40,12 +41,12 @@ int main(void)
App_Uart_Initialization(); App_Uart_Initialization();
App_Gpio_I2C_Initialization(100000); App_Gpio_I2C_Initialization(100000);
I2C0_Master_Initialization(I2C_FAST_MODE); I2C_Master_Initialization(TEMP_I2C_INSTANCE, I2C_FAST_MODE);
App_Led_Initialization(); App_Led_Initialization();
App_CLI_Initialization(); App_CLI_Initialization();
__enable_irq(); __enable_irq();
App_Led_OutputSet(APP_LED_1, APP_LED_MODE_TOGGLE, 100, 100); App_Led_OutputSet(APP_LED_1, APP_LED_MODE_TOGGLE, 100, 900);
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 1000,Test_Process ); SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 1000,Test_Process );
@ -130,6 +131,9 @@ int main(void)
COMPLETE: COMPLETE:
AK9757W_Initialization();
while(1) while(1)
{ {
SW_Timer_Callback_Process(); SW_Timer_Callback_Process();

@ -1 +1,271 @@
#include "ak9757w.h" #include "ak9757w.h"
#include "ak9757w_def.h"
#include "app_i2c_master.h"
#include "app_log.h"
#include "sw_timer.h"
static AK9757W_HANDLER AK9757W_Handler;
static AK9757W_HANDLER* pHandler = &AK9757W_Handler;
const uint8_t default_cntl_reg_data[] = {0x20, 0xFF, 0xFE, 0x4A, 0xE1, 0x00, 0x00, 0x00, 0xDF, 0xE0};
static bool AK9757W_Check_CompanyCode(void);
static bool AK9757W_Set_Operation_Mode(AK9757W_MODE mode);
static bool AK9757W_Set_ADC_Inverter(AK9757W_MODE mode);
static bool AK9757W_Process(void);
bool AK9757W_Initialization(void)
{
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 10, AK9757W_Process);
return true;
#if 0
if(AK9757W_Check_CompanyCode() == false)
{
return false;
}
if(AK9757_Set_Mode(AK9757W_MODE_CONTINUOUS_MODE) == false)
{
return false;
}
Delay_ms(200);
if(AK9757_Get_SensorID() == false)
{
return false;
}
AK9757W_Handler.isInitComplete = true;
#endif
}
static bool AK9757W_Process(void)
{
switch(pHandler->Step)
{
case STEP_INIT:
AK9757W_Handler.isInitComplete = false;
AK9757W_Handler.SensorID = 0xFFFFFFFF;
pHandler->Step = STEP_CHECK_COMPANY;
break;
case STEP_CHECK_COMPANY:
if(AK9757W_Check_CompanyCode() == false){
pHandler->Step = STEP_ERROR;
}else{
pHandler->Step = STEP_CHECK_ID_POWER_ON;
}
break;
case STEP_CHECK_ID_POWER_ON:
if(AK9757_Set_Mode(AK9757W_MODE_CONTINUOUS_MODE) == false){
pHandler->Step = STEP_ERROR;
}else{
pHandler->TickCount = millis();
AK9757W_Handler.Step = STEP_CHECK_ID_POWER_ON_WAIT;
}
break;
case STEP_CHECK_ID_POWER_ON_WAIT:
if((millis() - pHandler->TickCount) >= AK9757W_CHIPID_READ_WAIT_TIME)
pHandler->Step = STEP_CHECK_ID_READ;
break;
case STEP_CHECK_ID_READ:
if(AK9757_Get_SensorID() == false){
pHandler->Step = STEP_ERROR;
}
else{
pHandler->Step = STEP_CHECK_ID_POWER_OFF;
}
break;
case STEP_CHECK_ID_POWER_OFF:
if(AK9757_Set_Mode(AK9757W_MODE_STAND_BY_MODE) == false){
pHandler->Step = STEP_ERROR;
}
else{
AK9757W_Handler.Step = STEP_WRITE_CNTL1_9;
}
break;
case STEP_WRITE_CNTL1_9:
if(AK9757_Set_CTL1_9_Parameter() == false){
}
else{
}
break;
case STEP_ERROR:
break;
}
}
static bool AK9757W_Check_CompanyCode(void)
{
int error;
uint8_t TxBuff;
uint8_t RxBuff[10];
TxBuff = AK9757W_REG_RO_COMPANY_CODE;
error = I2C_Master_Write(TEMP_I2C_ADDRESS, &TxBuff, 1);
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C Write Error %d\r\n", error);
return false;
}
error = I2C_Master_Read(TEMP_I2C_ADDRESS, &RxBuff[0], 2);
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C Read Error %d\r\n", error);
return false;
}
if(!(RxBuff[0] == AK9757W_COMPANY_CODE_VALUE && RxBuff[1] == AK9757W_DEVICE_ID_VALUE))
{
dbg_printf(LOG_LEVEL_DEBUG, "Read Data %X, %X\r\n", RxBuff[0], RxBuff[1]);
return false;
}
dbg_printf(LOG_LEVEL_DEBUG, "Company %XH, %XH\r\n", RxBuff[0], RxBuff[1]);
return true;
}
bool AK9757_Set_Mode(AK9757W_MODE mode)
{
int error;
uint8_t TxBuff[10];
uint8_t RxBuff[10];
TxBuff[0] = AK9757W_REG_RW_CNTL9;
error = I2C_Master_WriteRead(TEMP_I2C_ADDRESS, &TxBuff[0], 1, &RxBuff[0], 1);
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C Read Error %d\r\n", error);
return false;
}
//#define CLEARBIT(ADDRESS,BIT) (ADDRESS &= ~(1<<BIT))
dbg_printf(LOG_LEVEL_DEBUG, "read data %x\r\n", RxBuff[0]);
TxBuff[1] = RxBuff[0] & ~(AK9757W_CNTL9_MODE_MSK << AK9757W_CNTL9_MODE_POS);
TxBuff[1] |= (mode << AK9757W_CNTL9_MODE_POS);
dbg_printf(LOG_LEVEL_DEBUG, "write data %x\r\n", TxBuff[1]);
error = I2C_Master_Write(TEMP_I2C_ADDRESS, &TxBuff[0], 2);
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C write Error %d\r\n", error);
return false;
}
return true;
}
bool AK9757_Set_AD_OutputDataTyte(AK9757W_IR_ADC_INVERT type)
{
}
bool AK9757_Set_CTL1_9_Parameter(void)
{
int error;
uint8_t i;
memcpy(&pHandler->Cntl_Info.CNTL_Buff[0], &default_cntl_reg_data[0], sizeof(default_cntl_reg_data));
error = I2C_Master_Write(TEMP_I2C_ADDRESS, &pHandler->Cntl_Info.CNTL_Buff[0], sizeof(default_cntl_reg_data));
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C CNTL1~9 write Error %d\r\n", error);
return false;
}
return true;
}
bool AK9757_Get_SensorID(void)
{
int error;
uint8_t TxBuff;
uint8_t RxBuff[10];
TxBuff = AK9757W_REG_RO_CHIPID;
error = I2C_Master_WriteRead(TEMP_I2C_ADDRESS, &TxBuff, 1, &RxBuff[0], 4);
if(error != E_NO_ERROR)
{
dbg_printf(LOG_LEVEL_DEBUG, "I2C Read Error %d\r\n", error);
return false;
}
AK9757W_Handler.SensorID = (RxBuff[0] << 24) | (RxBuff[1] << 16) | (RxBuff[2] << 8) | (RxBuff[3] << 0);
dbg_printf(LOG_LEVEL_DEBUG, "Read ChipID %XH\r\n", AK9757W_Handler.SensorID);
return true;
}

@ -2,8 +2,22 @@
#if !defined(AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_) #if !defined(AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_)
#define AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_ #define AK9757W_H__A67BB088_3F4F_4CEB_8E75_7951713E9C3C__INCLUDED_
#include "define.h" #include "board_config.h"
#include "struct.h" #include "ak9757w_def.h"
#define AK9757W_CHIPID_READ_WAIT_TIME 100
bool AK9757W_Initialization(void);
bool AK9757_Get_SensorID(void);
bool AK9757_Set_Mode(AK9757W_MODE mode);
bool AK9757_Set_AD_OutputDataTyte(AK9757W_IR_ADC_INVERT type);
bool AK9757_Set_CTL1_9_Parameter(void);
#endif #endif

@ -178,7 +178,6 @@
#define AK9757W_XCOEF1EX_GC1EX_MSK 0x1F #define AK9757W_XCOEF1EX_GC1EX_MSK 0x1F
#define AK9757W_OIR_OIR_H_POS 0x00 #define AK9757W_OIR_OIR_H_POS 0x00
#define AK9757W_OIR_OIR_H_MSK 0x0F #define AK9757W_OIR_OIR_H_MSK 0x0F
#define AK9757W_OTS_OTS_H_POS 0x00 #define AK9757W_OTS_OTS_H_POS 0x00
#define AK9757W_OTS_OTS_H_MSK 0x3F #define AK9757W_OTS_OTS_H_MSK 0x3F
@ -186,6 +185,68 @@
typedef enum _ak9757w_mode
{
AK9757W_MODE_STAND_BY_MODE = 0,
AK9757W_MODE_CONTINUOUS_MODE = 1,
}AK9757W_MODE;
typedef enum _ak9757w_ir_adc_invert
{
AK9757W_ADC_NORMAL = 0,
AK9757W_ADC_INVERT = 1,
}AK9757W_IR_ADC_INVERT;
typedef enum _ak9757w_step
{
STEP_INIT,
STEP_CHECK_COMPANY,
STEP_CHECK_ID_POWER_ON,
STEP_CHECK_ID_POWER_ON_WAIT,
STEP_CHECK_ID_READ,
STEP_CHECK_ID_POWER_OFF,
STEP_WRITE_CNTL1_9,
STEP_ERROR,
}AK9757W_STEP;
typedef union
{
struct
{
uint8_t get_addr;
uint8_t cntl1;
uint8_t cntl2;
uint8_t cntl3;
uint8_t cntl4;
uint8_t cntl5;
uint8_t cntl6;
uint8_t cntl7;
uint8_t cntl8;
uint8_t cntl9;
}CNTL;
uint8_t CNTL_Buff[10];
}CNTL_INFO;
typedef struct _ak9757w_handler
{
bool isInitComplete;
uint32_t SensorID;
CNTL_INFO Cntl_Info;
AK9757W_STEP Step;
uint32_t TickCount;
}AK9757W_HANDLER;

@ -8,6 +8,7 @@ typedef struct _timer_callback_info
SW_TIMER_CALLBACK_TYPE SW_Callback_Type; SW_TIMER_CALLBACK_TYPE SW_Callback_Type;
uint32_t SW_Timer_StartTick; uint32_t SW_Timer_StartTick;
uint32_t SW_Timer_PeriodCount; uint32_t SW_Timer_PeriodCount;
void* pSW_Timer_Patameter;
SW_TIMER_CALLBACK_FN SW_Timer_CallbackFunction; SW_TIMER_CALLBACK_FN SW_Timer_CallbackFunction;
}SW_TIMER_INFO; }SW_TIMER_INFO;

File diff suppressed because one or more lines are too long

@ -117,6 +117,16 @@
<pMon>BIN\CMSIS_AGDI.dll</pMon> <pMon>BIN\CMSIS_AGDI.dll</pMon>
</DebugOpt> </DebugOpt>
<TargetDriverDllRegistry> <TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0MAX32660 -FS00 -FL080000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM))</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>CMSIS_AGDI</Key>
<Name>-X"" -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0MAX32660.FLM -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM)</Name>
</SetRegEntry>
<SetRegEntry> <SetRegEntry>
<Number>0</Number> <Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key> <Key>ARMRTXEVENTFLAGS</Key>
@ -137,16 +147,6 @@
<Key>DLGUARM</Key> <Key>DLGUARM</Key>
<Name></Name> <Name></Name>
</SetRegEntry> </SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>CMSIS_AGDI</Key>
<Name>-X"" -O206 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0MAX32660.FLM -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0MAX32660 -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM))</Name>
</SetRegEntry>
</TargetDriverDllRegistry> </TargetDriverDllRegistry>
<Breakpoint> <Breakpoint>
<Bp> <Bp>
@ -240,31 +240,31 @@
<Group> <Group>
<GroupName>Application</GroupName> <GroupName>Application</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>1</GroupNumber> <GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber> <FileNumber>1</FileNumber>
<FileType>5</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\board_config.h</PathWithFileName> <PathWithFileName>..\Application\main.c</PathWithFileName>
<FilenameWithoutPath>board_config.h</FilenameWithoutPath> <FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
<File> <File>
<GroupNumber>1</GroupNumber> <GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber> <FileNumber>2</FileNumber>
<FileType>1</FileType> <FileType>5</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\main.c</PathWithFileName> <PathWithFileName>..\Application\board_config.h</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath> <FilenameWithoutPath>board_config.h</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
@ -335,8 +335,8 @@
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\app_ring_buffer.c</PathWithFileName> <PathWithFileName>..\Application\app_i2c_master.c</PathWithFileName>
<FilenameWithoutPath>app_ring_buffer.c</FilenameWithoutPath> <FilenameWithoutPath>app_i2c_master.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
@ -347,8 +347,8 @@
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\app_uart.c</PathWithFileName> <PathWithFileName>..\Application\app_ring_buffer.c</PathWithFileName>
<FilenameWithoutPath>app_uart.c</FilenameWithoutPath> <FilenameWithoutPath>app_ring_buffer.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
@ -359,8 +359,8 @@
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\app_i2c0.c</PathWithFileName> <PathWithFileName>..\Application\app_uart.c</PathWithFileName>
<FilenameWithoutPath>app_i2c0.c</FilenameWithoutPath> <FilenameWithoutPath>app_uart.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
@ -371,18 +371,6 @@
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\Application\app_i2c1.c</PathWithFileName>
<FilenameWithoutPath>app_i2c1.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Application\app_log.c</PathWithFileName> <PathWithFileName>..\Application\app_log.c</PathWithFileName>
<FilenameWithoutPath>app_log.c</FilenameWithoutPath> <FilenameWithoutPath>app_log.c</FilenameWithoutPath>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
@ -390,7 +378,7 @@
</File> </File>
<File> <File>
<GroupNumber>1</GroupNumber> <GroupNumber>1</GroupNumber>
<FileNumber>13</FileNumber> <FileNumber>12</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -404,13 +392,13 @@
<Group> <Group>
<GroupName>Device</GroupName> <GroupName>Device</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>2</GroupNumber> <GroupNumber>2</GroupNumber>
<FileNumber>14</FileNumber> <FileNumber>13</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -430,7 +418,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>3</GroupNumber> <GroupNumber>3</GroupNumber>
<FileNumber>15</FileNumber> <FileNumber>14</FileNumber>
<FileType>2</FileType> <FileType>2</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -450,7 +438,7 @@
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>16</FileNumber> <FileNumber>15</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -462,7 +450,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>17</FileNumber> <FileNumber>16</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -474,7 +462,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>18</FileNumber> <FileNumber>17</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -486,7 +474,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>19</FileNumber> <FileNumber>18</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -498,7 +486,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>20</FileNumber> <FileNumber>19</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -510,7 +498,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>21</FileNumber> <FileNumber>20</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -522,7 +510,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>22</FileNumber> <FileNumber>21</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -534,7 +522,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>23</FileNumber> <FileNumber>22</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -546,7 +534,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>24</FileNumber> <FileNumber>23</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -558,7 +546,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>25</FileNumber> <FileNumber>24</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -570,7 +558,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>26</FileNumber> <FileNumber>25</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -582,7 +570,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>27</FileNumber> <FileNumber>26</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -594,7 +582,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>28</FileNumber> <FileNumber>27</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -606,7 +594,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>29</FileNumber> <FileNumber>28</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -618,7 +606,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>30</FileNumber> <FileNumber>29</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -630,7 +618,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>31</FileNumber> <FileNumber>30</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -642,7 +630,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>32</FileNumber> <FileNumber>31</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -654,7 +642,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>33</FileNumber> <FileNumber>32</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -666,7 +654,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>34</FileNumber> <FileNumber>33</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -678,7 +666,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>35</FileNumber> <FileNumber>34</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -690,7 +678,7 @@
</File> </File>
<File> <File>
<GroupNumber>4</GroupNumber> <GroupNumber>4</GroupNumber>
<FileNumber>36</FileNumber> <FileNumber>35</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -704,13 +692,13 @@
<Group> <Group>
<GroupName>SSD1306</GroupName> <GroupName>SSD1306</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>37</FileNumber> <FileNumber>36</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -722,7 +710,7 @@
</File> </File>
<File> <File>
<GroupNumber>5</GroupNumber> <GroupNumber>5</GroupNumber>
<FileNumber>38</FileNumber> <FileNumber>37</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
@ -735,13 +723,33 @@
</Group> </Group>
<Group> <Group>
<GroupName>Resource</GroupName> <GroupName>Sensor</GroupName>
<tvExp>1</tvExp> <tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>6</GroupNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Application\sensor\ak9757w.c</PathWithFileName>
<FilenameWithoutPath>ak9757w.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Resource</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>39</FileNumber> <FileNumber>39</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
@ -753,7 +761,7 @@
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>40</FileNumber> <FileNumber>40</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
@ -765,7 +773,7 @@
<bShared>0</bShared> <bShared>0</bShared>
</File> </File>
<File> <File>
<GroupNumber>6</GroupNumber> <GroupNumber>7</GroupNumber>
<FileNumber>41</FileNumber> <FileNumber>41</FileNumber>
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>

@ -14,16 +14,16 @@
<uAC6>0</uAC6> <uAC6>0</uAC6>
<TargetOption> <TargetOption>
<TargetCommonOption> <TargetCommonOption>
<Device>MAX32660</Device> <Device>MAX32660:Cortex-M4</Device>
<Vendor>Maxim</Vendor> <Vendor>Maxim</Vendor>
<PackID>Maxim.MAX32660.1.4.0</PackID> <PackID>Maxim.MAX32660.1.5.0</PackID>
<PackURL>http://www.mxim.net/microcontroller/pack/</PackURL> <PackURL>https://www.mxim.net/microcontroller/pack/</PackURL>
<Cpu>IRAM(0x20000000,0x00018000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu> <Cpu>IRAM(0x20000000,0x00020000) IROM(0x00000000,0x00080000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
<FlashUtilSpec></FlashUtilSpec> <FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile> <StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0MAX32660 -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM))</FlashDriverDll> <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0MAX32660 -FS00 -FL080000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM))</FlashDriverDll>
<DeviceId>0</DeviceId> <DeviceId>0</DeviceId>
<RegisterFile>$$Device:MAX32660$Libraries\Device\Maxim\MAX32660\Include\max32660.h</RegisterFile> <RegisterFile>$$Device:MAX32660$Libraries\CMSIS\Device\Maxim\MAX32660\Include\max32660.h</RegisterFile>
<MemoryEnv></MemoryEnv> <MemoryEnv></MemoryEnv>
<Cmp></Cmp> <Cmp></Cmp>
<Asm></Asm> <Asm></Asm>
@ -33,7 +33,7 @@
<SLE66CMisc></SLE66CMisc> <SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc> <SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc> <SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:MAX32660$SVD\MAX32660\max32660.svd</SFDFile> <SFDFile>$$Device:MAX32660$Libraries\CMSIS\Device\Maxim\MAX32660\Include\max32660.svd</SFDFile>
<bCustSvd>0</bCustSvd> <bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv> <UseEnv>0</UseEnv>
<BinPath></BinPath> <BinPath></BinPath>
@ -246,12 +246,12 @@
<IRAM> <IRAM>
<Type>0</Type> <Type>0</Type>
<StartAddress>0x20000000</StartAddress> <StartAddress>0x20000000</StartAddress>
<Size>0x18000</Size> <Size>0x20000</Size>
</IRAM> </IRAM>
<IROM> <IROM>
<Type>1</Type> <Type>1</Type>
<StartAddress>0x0</StartAddress> <StartAddress>0x0</StartAddress>
<Size>0x40000</Size> <Size>0x80000</Size>
</IROM> </IROM>
<XRAM> <XRAM>
<Type>0</Type> <Type>0</Type>
@ -276,7 +276,7 @@
<OCR_RVCT4> <OCR_RVCT4>
<Type>1</Type> <Type>1</Type>
<StartAddress>0x0</StartAddress> <StartAddress>0x0</StartAddress>
<Size>0x40000</Size> <Size>0x80000</Size>
</OCR_RVCT4> </OCR_RVCT4>
<OCR_RVCT5> <OCR_RVCT5>
<Type>1</Type> <Type>1</Type>
@ -301,7 +301,7 @@
<OCR_RVCT9> <OCR_RVCT9>
<Type>0</Type> <Type>0</Type>
<StartAddress>0x20000000</StartAddress> <StartAddress>0x20000000</StartAddress>
<Size>0x18000</Size> <Size>0x20000</Size>
</OCR_RVCT9> </OCR_RVCT9>
<OCR_RVCT10> <OCR_RVCT10>
<Type>0</Type> <Type>0</Type>
@ -322,7 +322,7 @@
<PlainCh>0</PlainCh> <PlainCh>0</PlainCh>
<Ropi>0</Ropi> <Ropi>0</Ropi>
<Rwpi>0</Rwpi> <Rwpi>0</Rwpi>
<wLevel>2</wLevel> <wLevel>1</wLevel>
<uThumb>0</uThumb> <uThumb>0</uThumb>
<uSurpInc>0</uSurpInc> <uSurpInc>0</uSurpInc>
<uC99>1</uC99> <uC99>1</uC99>
@ -339,7 +339,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define>TARGET=32660,TARGET_REV=0x4131</Define> <Define>TARGET=32660,TARGET_REV=0x4131</Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>..\SDK\Device;..\SDK\Device\Include;..\SDK\Driver\Include;..\SDK\Driver\Source;..\SDK\FlashLoader;..\SDK\Startup;..\Application;..\Application\oled_ssd1306;..\Application\resource</IncludePath> <IncludePath>..\SDK\Device;..\SDK\Device\Include;..\SDK\Driver\Include;..\SDK\Driver\Source;..\SDK\FlashLoader;..\SDK\Startup;..\Application;..\Application\oled_ssd1306;..\Application\resource;..\Application\sensor</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>
@ -383,16 +383,16 @@
<Group> <Group>
<GroupName>Application</GroupName> <GroupName>Application</GroupName>
<Files> <Files>
<File>
<FileName>board_config.h</FileName>
<FileType>5</FileType>
<FilePath>..\Application\board_config.h</FilePath>
</File>
<File> <File>
<FileName>main.c</FileName> <FileName>main.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\Application\main.c</FilePath> <FilePath>..\Application\main.c</FilePath>
</File> </File>
<File>
<FileName>board_config.h</FileName>
<FileType>5</FileType>
<FilePath>..\Application\board_config.h</FilePath>
</File>
<File> <File>
<FileName>interrput_handler.c</FileName> <FileName>interrput_handler.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@ -418,6 +418,11 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\Application\app_gpio_i2c.c</FilePath> <FilePath>..\Application\app_gpio_i2c.c</FilePath>
</File> </File>
<File>
<FileName>app_i2c_master.c</FileName>
<FileType>1</FileType>
<FilePath>..\Application\app_i2c_master.c</FilePath>
</File>
<File> <File>
<FileName>app_ring_buffer.c</FileName> <FileName>app_ring_buffer.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@ -428,16 +433,6 @@
<FileType>1</FileType> <FileType>1</FileType>
<FilePath>..\Application\app_uart.c</FilePath> <FilePath>..\Application\app_uart.c</FilePath>
</File> </File>
<File>
<FileName>app_i2c0.c</FileName>
<FileType>1</FileType>
<FilePath>..\Application\app_i2c0.c</FilePath>
</File>
<File>
<FileName>app_i2c1.c</FileName>
<FileType>1</FileType>
<FilePath>..\Application\app_i2c1.c</FilePath>
</File>
<File> <File>
<FileName>app_log.c</FileName> <FileName>app_log.c</FileName>
<FileType>1</FileType> <FileType>1</FileType>
@ -595,6 +590,16 @@
</File> </File>
</Files> </Files>
</Group> </Group>
<Group>
<GroupName>Sensor</GroupName>
<Files>
<File>
<FileName>ak9757w.c</FileName>
<FileType>1</FileType>
<FilePath>..\Application\sensor\ak9757w.c</FilePath>
</File>
</Files>
</Group>
<Group> <Group>
<GroupName>Resource</GroupName> <GroupName>Resource</GroupName>
<Files> <Files>

File diff suppressed because it is too large Load Diff

@ -773,10 +773,10 @@ ARM Macro Assembler Page 12
00000000 00000000
Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp.sp --apcs= Command Line: --debug --xref --diag_suppress=9931 --cpu=Cortex-M4.fp.sp --apcs=
interwork --depend=.\objects\startup_max32660.d -o.\objects\startup_max32660.o interwork --depend=.\objects\startup_max32660.d -o.\objects\startup_max32660.o
-IC:\Users\befs\AppData\Local\Arm\Packs\Maxim\MAX32660\1.4.0\Libraries\Device\M -IC:\Users\befs\AppData\Local\Arm\Packs\Maxim\MAX32660\1.5.0\Libraries\CMSIS\De
axim\MAX32660\Include -IC:\Keil_v5\ARM\CMSIS\Include --predefine="__MICROLIB SE vice\Maxim\MAX32660\Include -IC:\Keil_v5\ARM\CMSIS\Include --predefine="__MICRO
TA 1" --predefine="__UVISION_VERSION SETA 533" --predefine="MAX32660 SETA 1" -- LIB SETA 1" --predefine="__UVISION_VERSION SETA 533" --predefine="MAX32660 SETA
list=.\listings\startup_max32660.lst ..\SDK\Startup\startup_max32660.s 1" --list=.\listings\startup_max32660.lst ..\SDK\Startup\startup_max32660.s

Loading…
Cancel
Save