3.2.1.4 API Mapping

The MCC-generated APIs may differ between 8-bit devices and the PIC32CM family. Therefore, users must ensure that the APIs used in their application are appropriately mapped during migration. The table below lists the MCC-generated APIs used in the application code. Some API names are similar across 8-bit and PIC32CM MCUs. Some peripherals also support a driver interface and provide custom module names, enabling 8‑bit users to migrate their firmware to the PIC32CM family with minimal code modifications.

Table 3-1. API Mapping Between AVR® DA and PIC32CM PL10
PeripheralAVR® DAPIC32CM PL10
SystemSYSTEM_Initialize()SYS_Initialize(NULL)
I2CI2C0_Host_Initialize()SERCOM0_I2C_Initialize()
I2C0_Host_WriteRead(uint16_t address, uint8_t *writeData, size_at writeLength, uint8_t *readData, size_t readLength)SERCOM0_I2C_WriteRead(uint16_t address, uint8_t* wrData, uint32_t wrLength, uint8_t* rdData, uint32_t rdLength)
I2C0_Host_IsBusy()SERCOM0_I2C_IsBusy()
I2C0_Host_ErrorGet()SERCOM0_I2C_ErrorGet()

TWI0_CallbackRegister(void(*callbackHandler)(void))(1)

SERCOM0_I2C_CallbackRegister(SERCOM_I2C_CALLBACK callback, uintptr_t contextHandle)(2)
ADCADC0_Initialize()ADC0_Initialize()
ADC0_Enable()ADC0_Enable()
ADC0_ConversionStart()ADC0_ConversionStart()
ADC0_ConversionResultGet()ADC0_ConversionResultGet()
RTCRTC_Initialize()RTC_Initialize()
RTC_Start()RTC_Timer32Start();
RTC_WriteCounter(uint16_t timerVal)RTC_Timer32CounterSet(uint32_t count);
RTC_WriteCMPRegister(uint16_t value)RTC_Timer32CompareSet(uint32_t compareValue)
RTC_DisableOVFInterrupt()RTC_Timer32InterruptDisable(RTC_TIMER32_INT_MASK interruptMask)
RTC_EnableOVFInterrupt()RTC_Timer32InterruptEnable(RTC_TIMER32_INT_MASK interruptMask)
RTC_SetCMPIsrCallback(RTC_cb_t cb)RTC_Timer32CallbackRegister(RTC_TIMER32_CALLBACK callback, uintptr_t context)
EIC/Port InterruptsSW0_SetInterruptHandler(void (* interruptHandler)(void))EIC_CallbackRegister(EIC_PIN pin, EIC_CALLBACK callback, uintptr_t context)
Timer TCA0_Initialize()TC0_TimerInitialize()
TIMER_Start()TC0_TimerStart()
TIMER_Stop()TC0_TimerStop()
TIMER_OverflowCallbackRegister(TCA0_cb_t CallbackHandler)TC0_TimerCallbackRegister(TC_TIMER_CALLBACK callback, uintptr_t context)
Note:
  1. On the AVR® DA, the callback handler is implemented solely for error handling during I2C transfers. This API is not used within the application. Although I2C interrupts are used in the AVR DA, the host must still wait until the data is read back from the client.
  2. On the PL10, a user-defined interrupt handler is registered through the callback registration API to indicate that the I2C write/read operation has completed.