/**
Unmap and close the SPI controller associated with this object.
*/
void QuarkSpiControllerClass::end()
{
    if (m_registers != nullptr)
    {
        // Disable the SPI controller.
        m_registers->SSCR0.SSE = 0;
        m_registers = nullptr;
    }

    if (m_hController != INVALID_HANDLE_VALUE)
    {
        // Unmap the SPI controller.
        DmapCloseController(m_hController);
    }
}
/**
Unmap and close the SPI controller associated with this object.
*/
void BcmSpiControllerClass::end()
{
    _CS cs;

    if (m_registers != nullptr)
    {
        cs.ALL_BITS = m_registers->CS.ALL_BITS;
        cs.TA = 0;                              // No tranfer is active
        m_registers->CS.ALL_BITS = cs.ALL_BITS;

        m_registers = nullptr;
    }

    if (m_hController != INVALID_HANDLE_VALUE)
    {
        // Unmap the SPI controller.
        DmapCloseController(m_hController);
    }
}