mirror of
https://github.com/pascallanger/DIY-Multiprotocol-TX-Module.git
synced 2025-02-04 18:38:13 +00:00
Removed some dependencies to the SPI library
This commit is contained in:
parent
b49584ec16
commit
835cc3d0a2
@ -19,7 +19,7 @@
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 1
|
||||
#define VERSION_REVISION 6
|
||||
#define VERSION_PATCH_LEVEL 46
|
||||
#define VERSION_PATCH_LEVEL 47
|
||||
//******************
|
||||
// Protocols
|
||||
//******************
|
||||
|
@ -51,6 +51,7 @@
|
||||
#else
|
||||
#include <libmaple/usart.h>
|
||||
#include <libmaple/timer.h>
|
||||
//#include <libmaple/spi.h>
|
||||
#include <SPI.h>
|
||||
#include <EEPROM.h>
|
||||
HardwareTimer HWTimer2(2);
|
||||
|
@ -23,12 +23,13 @@ void initSPI2()
|
||||
{
|
||||
//SPI_DISABLE();
|
||||
SPI_2.end();
|
||||
SPI2_BASE->CR1 &= ~SPI_CR1_DFF_8_BIT; //8 bits format This bit should be written only when SPI is disabled (SPE = ?0?) for correct operation.
|
||||
SPI2_BASE->CR1 &= ~SPI_CR1_DFF_8_BIT; //8 bits format, this bit should be written only when SPI is disabled (SPE = ?0?) for correct operation.
|
||||
SPI_2.begin(); //Initialize the SPI_2 port.
|
||||
|
||||
SPI_2.setBitOrder(MSBFIRST); // Set the SPI_2 bit order
|
||||
SPI_2.setDataMode(SPI_MODE0); // Set the SPI_2 data mode 0
|
||||
SPI_2.setClockDivider(SPI_CLOCK_DIV8); // Set the speed (36 / 8 = 4.5 MHz SPI_2 speed)
|
||||
SPI2_BASE->CR1 &= ~SPI_CR1_LSBFIRST; // Set the SPI_2 bit order MSB first
|
||||
SPI2_BASE->CR1 &= ~(SPI_CR1_CPOL|SPI_CR1_CPHA); // Set the SPI_2 data mode 0: Clock idles low, data captured on rising edge (first transition)
|
||||
SPI2_BASE->CR1 &= ~(SPI_CR1_BR);
|
||||
SPI2_BASE->CR1 |= SPI_CR1_BR_PCLK_DIV_8; // Set the speed (36 / 8 = 4.5 MHz SPI_2 speed) SPI_CR1_BR_PCLK_DIV_8
|
||||
}
|
||||
|
||||
void SPI_Write(uint8_t command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user