Makes SPI edge changes more obvious (#1056)

Rising and Falling mean the opposite when active is set high vs low. Leading and trailing makes much more sense.

Closes #925
This commit is contained in:
Thad House
2018-05-14 18:16:36 -07:00
committed by Peter Johnson
parent 560123ab7d
commit ab70220ecf
9 changed files with 57 additions and 7 deletions

View File

@@ -174,6 +174,24 @@ void SPI::SetLSBFirst() {
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
}
/**
* Configure that the data is stable on the leading edge and the data
* changes on the trailing edge.
*/
void SPI::SetSampleDataOnLeadingEdge() {
m_sampleOnTrailing = false;
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
}
/**
* Configure that the data is stable on the trailing edge and the data
* changes on the leading edge.
*/
void SPI::SetSampleDataOnTrailingEdge() {
m_sampleOnTrailing = true;
HAL_SetSPIOpts(m_port, m_msbFirst, m_sampleOnTrailing, m_clk_idle_high);
}
/**
* Configure that the data is stable on the falling edge and the data
* changes on the rising edge.