User`s manual
RX62N Group, RX621 Group 5. Usage Examples
PDL_NO_FUNC,
0
);
/* Read data from the EEPROM on channel 1, using the DTC */
read_eeprom_data();
/* Prepare the next data */
R_DTC_Control(
PDL_DTC_UPDATE_DESTINATION | PDL_DTC_UPDATE_COUNT,
dtc_iic0_rx_transfer_data,
PDL_NO_PTR,
&data_storage[5],
5,
PDL_NO_DATA
);
/* Read data from the EEPROM on channel 1, using the DTC */
read_eeprom_data();
}
static void write_eeprom_data(void)
{
bus_busy = true;
/* Send data to the EEPROM on channel 1, using the DTC */
R_IIC_MasterSend(
0,
PDL_IIC_DTC_TRIGGER_ENABLE,
EEPROM_ADDRESS,
PDL_NO_PTR,
0,
iic_tx_dtc_end_handler,
15
);
while (bus_busy == true);
/* Wait for 5ms while the EEPROM updates */
R_CMT_CreateOneShot(
0,
0,
5E-3,
PDL_NO_FUNC,
0
);
}
static void read_eeprom_data(void)
{
bus_busy = true;
/* Read data from the EEPROM on channel 1, using the DTC */
R_IIC_MasterReceive(
0,
PDL_IIC_DTC_TRIGGER_ENABLE,
EEPROM_ADDRESS,
PDL_NO_PTR,
0,
iic_rx_dtc_end_handler,
15
);
while (bus_busy == true);
}
void iic_tx_dtc_end_handler(void)
{
uint32_t status_flags = 0;
/* Wait for the transmission to complete */
do
R20UT0084EE0112 Rev.1.12 Page 5-57
July. 16, 2014