#include "hal_data.h" FSP_CPP_HEADER void R_BSP_WarmStart(bsp_warm_start_event_t event); FSP_CPP_FOOTER volatile int g_i2c_tx_flag = 0; volatile int g_i2c_rx_flag = 0; /*******************************************************************************************************************//** * main() is generated by the RA Configuration editor and is used to generate threads if an RTOS is used. This function * is called by main() when no RTOS is used. **********************************************************************************************************************/ void hal_entry(void) { /* TODO: add your own code here */ fsp_err_t err; unsigned char tx_buffer[10] = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0x10}; R_SCI_I2C_Open(&g_i2c9_ctrl, &g_i2c9_cfg); g_i2c_tx_flag = 0; err = R_SCI_I2C_Write(&g_i2c9_ctrl, &tx_buffer[0], 1, false); if (err != FSP_SUCCESS) { __NOP(); } while(1) { //送信完了待ち if (g_i2c_tx_flag == 1) break; } while(1) { __NOP(); //送信完了 } #if BSP_TZ_SECURE_BUILD /* Enter non-secure code */ R_BSP_NonSecureEnter(); #endif } /*******************************************************************************************************************//** * This function is called at various points during the startup process. This implementation uses the event that is * called right before main() to set up the pins. * * @param[in] event Where at in the start up process the code is currently at **********************************************************************************************************************/ void R_BSP_WarmStart(bsp_warm_start_event_t event) { if (BSP_WARM_START_RESET == event) { #if BSP_FEATURE_FLASH_LP_VERSION != 0 /* Enable reading from data flash. */ R_FACI_LP->DFLCTL = 1U; /* Would normally have to wait tDSTOP(6us) for data flash recovery. Placing the enable here, before clock and * C runtime initialization, should negate the need for a delay since the initialization will typically take more than 6us. */ #endif } if (BSP_WARM_START_POST_C == event) { /* C runtime environment and system clocks are setup. */ /* Configure pins. */ IOPORT_CFG_OPEN (&IOPORT_CFG_CTRL, &IOPORT_CFG_NAME); } } #if BSP_TZ_SECURE_BUILD FSP_CPP_HEADER BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable (); /* Trustzone Secure Projects require at least one nonsecure callable function in order to build (Remove this if it is not required to build). */ BSP_CMSE_NONSECURE_ENTRY void template_nonsecure_callable () { } FSP_CPP_FOOTER #endif void sci_i2c_master_callback(i2c_master_callback_args_t * p_args) { //SLAVEを接続していない場合 //割り込みには飛んでくるが //p_args->event == I2C_MASTER_EVENT_ABORTED if (p_args->event == I2C_MASTER_EVENT_TX_COMPLETE) { g_i2c_tx_flag = 1; } else if (p_args->event == I2C_MASTER_EVENT_RX_COMPLETE) { g_i2c_rx_flag = 1; } }