Merge branch 'stm32f2' of github.com:fnoble/libopenstm32 into stm32f2
This commit is contained in:
@@ -290,6 +290,7 @@ void spi_disable(u32 spi);
|
|||||||
void spi_write(u32 spi, u16 data);
|
void spi_write(u32 spi, u16 data);
|
||||||
void spi_send(u32 spi, u16 data);
|
void spi_send(u32 spi, u16 data);
|
||||||
u16 spi_read(u32 spi);
|
u16 spi_read(u32 spi);
|
||||||
|
u16 spi_xfer(u32 spi, u16 data);
|
||||||
void spi_set_bidirectional_mode(u32 spi);
|
void spi_set_bidirectional_mode(u32 spi);
|
||||||
void spi_set_unidirectional_mode(u32 spi);
|
void spi_set_unidirectional_mode(u32 spi);
|
||||||
void spi_set_bidirectional_receive_only_mode(u32 spi);
|
void spi_set_bidirectional_receive_only_mode(u32 spi);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void spi_write(u32 spi, u16 data)
|
|||||||
void spi_send(u32 spi, u16 data)
|
void spi_send(u32 spi, u16 data)
|
||||||
{
|
{
|
||||||
/* wait for transfer finished */
|
/* wait for transfer finished */
|
||||||
while (SPI_SR(spi) & SPI_SR_BSY );
|
while (!(SPI_SR(spi) & SPI_SR_TXE ));
|
||||||
|
|
||||||
/* Write data (8 or 16 bits, depending on DFF) into DR. */
|
/* Write data (8 or 16 bits, depending on DFF) into DR. */
|
||||||
SPI_DR(spi) = data;
|
SPI_DR(spi) = data;
|
||||||
@@ -85,6 +85,20 @@ void spi_send(u32 spi, u16 data)
|
|||||||
|
|
||||||
u16 spi_read(u32 spi)
|
u16 spi_read(u32 spi)
|
||||||
{
|
{
|
||||||
|
/* wait for transfer finished */
|
||||||
|
while (!(SPI_SR(spi) & SPI_SR_RXNE ));
|
||||||
|
|
||||||
|
/* Read the data (8 or 16 bits, depending on DFF bit) from DR. */
|
||||||
|
return SPI_DR(spi);
|
||||||
|
}
|
||||||
|
|
||||||
|
u16 spi_xfer(u32 spi, u16 data)
|
||||||
|
{
|
||||||
|
spi_write(spi, data);
|
||||||
|
|
||||||
|
/* wait for transfer finished */
|
||||||
|
while (!(SPI_SR(spi) & SPI_SR_RXNE ));
|
||||||
|
|
||||||
/* Read the data (8 or 16 bits, depending on DFF bit) from DR. */
|
/* Read the data (8 or 16 bits, depending on DFF bit) from DR. */
|
||||||
return SPI_DR(spi);
|
return SPI_DR(spi);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libopencm3/stm32/scb.h>
|
#include <libopencm3/stm32/f1/scb.h>
|
||||||
|
|
||||||
void scb_reset_core(void)
|
void scb_reset_core(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libopencm3/stm32/rcc.h>
|
#include <libopencm3/stm32/f1/rcc.h>
|
||||||
#include <libopencm3/cm3/common.h>
|
#include <libopencm3/cm3/common.h>
|
||||||
#include <libopencm3/stm32/tools.h>
|
#include <libopencm3/stm32/tools.h>
|
||||||
#include <libopencm3/stm32/usb.h>
|
#include <libopencm3/stm32/f1/usb.h>
|
||||||
#include <libopencm3/usb/usbd.h>
|
#include <libopencm3/usb/usbd.h>
|
||||||
#include "usb_private.h"
|
#include "usb_private.h"
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <libopencm3/stm32/rcc.h>
|
#include <libopencm3/stm32/f1/rcc.h>
|
||||||
#include <libopencm3/cm3/common.h>
|
#include <libopencm3/cm3/common.h>
|
||||||
#include <libopencm3/stm32/tools.h>
|
#include <libopencm3/stm32/tools.h>
|
||||||
#include <libopencm3/stm32/otg_fs.h>
|
#include <libopencm3/stm32/otg_fs.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user