Line 1... |
Line 1... |
// #################################################################################################
|
// #################################################################################################
|
// # << NEORV32: neorv32_twi.c - Two-Wire Interface Master (TWI) HW Driver >> #
|
// # << NEORV32: neorv32_twi.c - Two-Wire Interface Controller (TWI) HW Driver >> #
|
// # ********************************************************************************************* #
|
// # ********************************************************************************************* #
|
// # BSD 3-Clause License #
|
// # BSD 3-Clause License #
|
// # #
|
// # #
|
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. #
|
// # Copyright (c) 2020, Stephan Nolting. All rights reserved. #
|
// # #
|
// # #
|
Line 34... |
Line 34... |
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* @file neorv32_twi.c
|
* @file neorv32_twi.c
|
* @author Stephan Nolting
|
* @author Stephan Nolting
|
* @brief Two-Wire Interface Master (TWI) HW driver source file.
|
* @brief Two-Wire Interface Controller (TWI) HW driver source file.
|
*
|
*
|
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_USE = true).
|
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_USE = true).
|
**************************************************************************/
|
**************************************************************************/
|
|
|
#include "neorv32.h"
|
#include "neorv32.h"
|
Line 92... |
Line 92... |
TWI_CT &= ~((uint32_t)(1 << TWI_CT_IRQ_EN));
|
TWI_CT &= ~((uint32_t)(1 << TWI_CT_IRQ_EN));
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Activate sending ACKs by master (MACK).
|
* Activate sending ACKs by controller (MACK).
|
**************************************************************************/
|
**************************************************************************/
|
void neorv32_twi_mack_enable(void) {
|
void neorv32_twi_mack_enable(void) {
|
|
|
TWI_CT |= ((uint32_t)(1 << TWI_CT_MACK));
|
TWI_CT |= ((uint32_t)(1 << TWI_CT_MACK));
|
}
|
}
|
|
|
|
|
/**********************************************************************//**
|
/**********************************************************************//**
|
* Deacivate sending ACKs by master (MACK).
|
* Deacivate sending ACKs by controller (MACK).
|
**************************************************************************/
|
**************************************************************************/
|
void neorv32_twi_mack_disable(void) {
|
void neorv32_twi_mack_disable(void) {
|
|
|
TWI_CT &= ~((uint32_t)(1 << TWI_CT_MACK));
|
TWI_CT &= ~((uint32_t)(1 << TWI_CT_MACK));
|
}
|
}
|