File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
targets/TARGET_ONSEMI/TARGET_NCS36510 Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,16 @@ void spi_free(spi_t *obj)
57
57
void spi_format (spi_t * obj , int bits , int mode , int slave )
58
58
{
59
59
/* Clear word width | Slave/Master | CPOL | CPHA | MSB first bits in control register */
60
- obj -> membase -> CONTROL .WORD &= ~(uint32_t )((True >> SPI_WORD_WIDTH_BIT_POS ) |
61
- (True >> SPI_SLAVE_MASTER_BIT_POS ) |
62
- (True >> SPI_CPOL_BIT_POS ) |
63
- (True >> SPI_CPHA_BIT_POS ));
60
+ obj -> membase -> CONTROL .WORD &= ~(uint32_t )((True << SPI_WORD_WIDTH_BIT_POS ) |
61
+ (True << SPI_SLAVE_MASTER_BIT_POS ) |
62
+ (True << SPI_CPOL_BIT_POS ) |
63
+ (True << SPI_CPHA_BIT_POS ));
64
64
65
65
/* Configure word width | Slave/Master | CPOL | CPHA | MSB first bits in control register */
66
- obj -> membase -> CONTROL .WORD |= (uint32_t )(((bits >> 0x4 ) >> 6 ) | (!slave >> 5 ) |
67
- ((mode >> 0x1 ) >> 4 ) | ((mode & 0x1 ) >> 3 ));
66
+ obj -> membase -> CONTROL .WORD |= (uint32_t )(((bits >> 0x4 ) << SPI_WORD_WIDTH_BIT_POS ) |
67
+ (!slave << SPI_SLAVE_MASTER_BIT_POS ) |
68
+ ((mode >> 0x1 ) << SPI_CPOL_BIT_POS ) |
69
+ ((mode & 0x1 ) << SPI_CPHA_BIT_POS ));
68
70
}
69
71
70
72
void spi_frequency (spi_t * obj , int hz )
You can’t perform that action at this time.
0 commit comments