ST / ST_Events-old

Dependents:   HelloWorld_CCA01M1 HelloWorld_CCA02M1 CI-data-logger-server HelloWorld_CCA02M1 ... more

This is a fork of the events subdirectory of https://github.com/ARMmbed/mbed-os.

Note, you must import this library with import name: events!!!

Files at this revision

API Documentation at this revision

Comitter:
Sam Grove
Date:
Thu Feb 09 09:49:04 2017 -0600
Parent:
9805:89376b94cf76
Parent:
9806:a7d81ecc3a7c
Child:
9809:330c90456c65
Commit message:
Merge pull request #3723 from pradeep-gr/feature-spi

NCS36510: spi_format function bug fix

Changed in this revision

--- a/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c	Thu Feb 09 09:47:45 2017 -0600
+++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c	Thu Feb 09 09:49:04 2017 -0600
@@ -57,14 +57,16 @@
 void spi_format(spi_t *obj, int bits, int mode, int slave)
 {
     /* Clear word width | Slave/Master | CPOL | CPHA | MSB first bits in control register */
-    obj->membase->CONTROL.WORD &= ~(uint32_t)((True >> SPI_WORD_WIDTH_BIT_POS) |
-                                  (True >> SPI_SLAVE_MASTER_BIT_POS) |
-                                  (True >> SPI_CPOL_BIT_POS) |
-                                  (True >> SPI_CPHA_BIT_POS));
+    obj->membase->CONTROL.WORD &= ~(uint32_t)((True << SPI_WORD_WIDTH_BIT_POS) |
+                                    (True << SPI_SLAVE_MASTER_BIT_POS) |
+                                    (True << SPI_CPOL_BIT_POS) |
+                                    (True << SPI_CPHA_BIT_POS));
 
     /* Configure word width | Slave/Master | CPOL | CPHA | MSB first bits in control register */
-    obj->membase->CONTROL.WORD |= (uint32_t)(((bits >> 0x4) >> 6) | (!slave >> 5) |
-                                  ((mode >> 0x1) >> 4) | ((mode & 0x1) >> 3));
+    obj->membase->CONTROL.WORD |= (uint32_t)(((bits >> 0x4) << SPI_WORD_WIDTH_BIT_POS) |
+                                              (!slave << SPI_SLAVE_MASTER_BIT_POS) |
+                                              ((mode >> 0x1) << SPI_CPOL_BIT_POS) |
+                                              ((mode & 0x1) << SPI_CPHA_BIT_POS));
 }
 
 void spi_frequency(spi_t *obj, int hz)