File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,6 @@ static int spi_config(const struct device *dev,
95
95
return - ENOTSUP ;
96
96
}
97
97
98
- if (config -> operation & (SPI_MODE_CPOL | SPI_MODE_CPHA )) {
99
- LOG_ERR ("Only supports CPOL=CPHA=0" );
100
- return - ENOTSUP ;
101
- }
102
-
103
98
if (config -> operation & SPI_OP_MODE_SLAVE ) {
104
99
LOG_ERR ("Slave mode not supported" );
105
100
return - ENOTSUP ;
@@ -112,6 +107,20 @@ static int spi_config(const struct device *dev,
112
107
gecko_config -> base -> CTRL &= ~USART_CTRL_LOOPBK ;
113
108
}
114
109
110
+ /* Set CPOL */
111
+ if (config -> operation & SPI_MODE_CPOL ) {
112
+ gecko_config -> base -> CTRL |= USART_CTRL_CLKPOL ;
113
+ } else {
114
+ gecko_config -> base -> CTRL &= ~USART_CTRL_CLKPOL ;
115
+ }
116
+
117
+ /* Set CPHA */
118
+ if (config -> operation & SPI_MODE_CPHA ) {
119
+ gecko_config -> base -> CTRL |= USART_CTRL_CLKPHA ;
120
+ } else {
121
+ gecko_config -> base -> CTRL &= ~USART_CTRL_CLKPHA ;
122
+ }
123
+
115
124
/* Set word size */
116
125
gecko_config -> base -> FRAME = usartDatabits8
117
126
| USART_FRAME_STOPBITS_DEFAULT
You can’t perform that action at this time.
0 commit comments