| BlueNRG-1 SDK drivers APIs

- Main Page
- Modules
- Classes
- Files

- File List
- File Members

SDK_EVAL_SPI.c
Go to the documentation of this file.
1
24 /* Includes ------------------------------------------------------------------*/
25 #include "SDK_EVAL_SPI.h"
26
27
56 #define SEND_START 0
57 #define SEND_READ_REG 1
58 #define SEND_WRITE_REG 2
59 #define SEND_WRITE_DATA 3
60
73 volatile uint8_t spi_buffer_tx[SPI_BUFF_SIZE];
74 volatile uint8_t spi_buffer_rx[SPI_BUFF_SIZE];
75
79 volatile FlagStatus spi_eot = SET;
80
81 static uint16_t byte_to_send = 0;
82 static uint8_t* spi_buffer_ptr;
83 static uint8_t buffer_idx = 0;
84 static uint8_t byte_to_send_max = 0;
85 static uint8_t register_addr = 0;
86 static uint8_t spi_irq_state = SEND_START;
87
133 ErrorStatus SdkEvalSpiInit(uint32_t baudrate)
134 {
135 SPI_InitType SPI_InitStructure;
136 GPIO_InitType GPIO_InitStructure;
137
138 /* Enable SPI and GPIO clocks */
139 SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_GPIO | CLOCK_PERIPH_SPI, ENABLE);
140
141 /* Configure SPI pins */
142 GPIO_StructInit(&GPIO_InitStructure);
143 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_MOSI_PIN;
144 GPIO_InitStructure.GPIO_Mode = SDK_EVAL_SPI_PERIPH_MOSI_MODE;
145 GPIO_InitStructure.GPIO_Pull = ENABLE;
146 GPIO_InitStructure.GPIO_HighPwr = DISABLE;
147 GPIO_Init(&GPIO_InitStructure);
148
149 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_MISO_PIN;
150 GPIO_InitStructure.GPIO_Mode = SDK_EVAL_SPI_PERIPH_MISO_MODE;
151 GPIO_Init(&GPIO_InitStructure);
152
153 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_SCLK_PIN;
154 GPIO_InitStructure.GPIO_Mode = SDK_EVAL_SPI_PERIPH_SCLK_MODE;
155 GPIO_Init(&GPIO_InitStructure);
156
157 /* Configure CS pin */
158 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_SENSOR_PIN;
159 GPIO_InitStructure.GPIO_Mode = GPIO_Output;
160 GPIO_Init(&GPIO_InitStructure);
161 SDK_EVAL_SPI_CS_HIGH();
162
163 /* Configure SPI in master mode */
164 SPI_StructInit(&SPI_InitStructure);
165 SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
166 SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b ;
167 SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
168 SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
169 SPI_InitStructure.SPI_BaudRate = baudrate;
170 SPI_Init(&SPI_InitStructure);
171
172 /* Set null character */
173 SPI_SetDummyCharacter(0xFF);
174
175 /* Clear RX and TX FIFO */
176 SPI_ClearTXFIFO();
177 SPI_ClearRXFIFO();
178
179 /* Enable SPI functionality */
180 SPI_Cmd(ENABLE);
181
182 return SUCCESS;
183
184 }
185
186
195 ErrorStatus SdkEvalSpiRead(uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead)
196 {
197 /* Set communication mode */
198 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
199
200 SDK_EVAL_SPI_CS_LOW();
201
202 /* Write data to send to TX FIFO */
203 while(RESET == SPI_GetFlagStatus(SPI_FLAG_TFE));
204 SPI_SendData(0x80 | RegisterAddr);
205 while(RESET == SPI_GetFlagStatus(SPI_FLAG_RNE));
206 SPI_ReceiveData();
207
208 for(uint8_t i = 0; i< NumByteToRead; i++) {
209 while(RESET == SPI_GetFlagStatus(SPI_FLAG_TFE));
210 SPI_SendData(0xFF);
211 while(RESET == SPI_GetFlagStatus(SPI_FLAG_RNE));
212 pBuffer[i] = SPI_ReceiveData();
213 }
214
215 while (SET == SPI_GetFlagStatus(SPI_FLAG_BSY));
216
217 SDK_EVAL_SPI_CS_HIGH();
218
219 return SUCCESS;
220 }
221
222
231 ErrorStatus SdkEvalSpiWrite(uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite)
232 {
233 /* Set communication mode */
234 SPI_SetMasterCommunicationMode(SPI_TRANSMIT_MODE);
235
236 SDK_EVAL_SPI_CS_LOW();
237
238 /* Write command to be send send to TX FIFO */
239 SPI_SendData(RegisterAddr);
240
241 /* Write data to be send send to TX FIFO */
242 for(uint8_t i=0;i<NumByteToWrite;i++)
243 SPI_SendData(pBuffer[i]);
244
245 /* Wait until data transfer is finished */
246 while (SET == SPI_GetFlagStatus(SPI_FLAG_BSY));
247
248 SDK_EVAL_SPI_CS_HIGH();
249 return SUCCESS;
250
251 }
252
253
254
261 ErrorStatus SdkEvalSpiDmaInit(uint32_t baudrate)
262 {
263 SPI_InitType SPI_InitStructure;
264 GPIO_InitType GPIO_InitStructure;
265 DMA_InitType DMA_InitStructure;
266 NVIC_InitType NVIC_InitStructure;
267
268 /* Enable SPI and GPIO clocks */
269 SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_GPIO | CLOCK_PERIPH_SPI | CLOCK_PERIPH_DMA, ENABLE);
270
271 /* Configure SPI pins */
272 GPIO_StructInit(&GPIO_InitStructure);
273 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_MOSI_PIN | SDK_EVAL_SPI_PERIPH_SCLK_PIN | SDK_EVAL_SPI_PERIPH_MISO_PIN;
274 GPIO_InitStructure.GPIO_Mode = Serial0_Mode;
275 GPIO_InitStructure.GPIO_Pull = ENABLE;
276 GPIO_InitStructure.GPIO_HighPwr = DISABLE;
277 GPIO_Init(&GPIO_InitStructure);
278
279 /* Configure CS pin */
280 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_SENSOR_PIN;
281 GPIO_InitStructure.GPIO_Mode = GPIO_Output;
282 GPIO_Init(&GPIO_InitStructure);
283 SDK_EVAL_SPI_CS_HIGH();
284
285 /* Configure SPI in master mode */
286 SPI_StructInit(&SPI_InitStructure);
287 SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
288 SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b ;
289 SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
290 SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
291 SPI_InitStructure.SPI_BaudRate = baudrate;
292 SPI_Init(&SPI_InitStructure);
293
294 /* Set communication mode */
295 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
296
297 /* Clear RX and TX FIFO */
298 SPI_ClearTXFIFO();
299 SPI_ClearRXFIFO();
300
301 /* Configure DMA SPI TX channel */
302 DMA_InitStructure.DMA_PeripheralBaseAddr = SPI_DR_BASE_ADDR;
303 DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)spi_buffer_tx;
304 DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
305 DMA_InitStructure.DMA_BufferSize = (uint32_t)SPI_BUFF_SIZE;
306 DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
307 DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
308 DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
309 DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
310 DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
311 DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;
312 DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
313 DMA_Init(DMA_CH_SPI_TX, &DMA_InitStructure);
314
315 /* Configure DMA SPI RX channel */
316 DMA_InitStructure.DMA_PeripheralBaseAddr = SPI_DR_BASE_ADDR;
317 DMA_InitStructure.DMA_MemoryBaseAddr = (uint32_t)spi_buffer_rx;
318 DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
319 DMA_InitStructure.DMA_BufferSize = (uint32_t)SPI_BUFF_SIZE;
320 DMA_Init(DMA_CH_SPI_RX, &DMA_InitStructure);
321
322 /* Enable DMA_CH_SPI_RX Transfer Complete interrupt */
323 DMA_FlagConfig(DMA_CH_SPI_RX, DMA_FLAG_TC, ENABLE);
324
325 /* Enable SPI_TX/SPI_RX DMA requests */
326 SPI_DMACmd(SPI_DMAReq_Tx | SPI_DMAReq_Rx, ENABLE);
327
328 /* Enable the DMA Interrupt */
329 NVIC_InitStructure.NVIC_IRQChannel = DMA_IRQn;
330 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = HIGH_PRIORITY;
331 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
332 NVIC_Init(&NVIC_InitStructure);
333
334 /* Enable SPI functionality */
335 SPI_Cmd(ENABLE);
336
337 return SUCCESS;
338 }
339
340
349 ErrorStatus SdkEvalSpiDmaRead( uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead )
350 {
352 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
353
354 spi_buffer_tx[0] = 0x80 | RegisterAddr;
355 for(uint8_t i=0;i<NumByteToRead;i++) {
356 spi_buffer_tx[1+i] = 0xFF;
357 }
358 while(spi_eot==RESET);
359 spi_eot = RESET;
360
361 SDK_EVAL_SPI_CS_LOW();
362
363 /* Reset DMA_CH_UART_TX remaining bytes register */
364 DMA_CH_SPI_TX->CNDTR = NumByteToRead+1;
365 DMA_CH_SPI_RX->CNDTR = NumByteToRead+1;
366
367 /* DMA_CH_UART_TX enable */
368 DMA_CH_SPI_RX->CCR_b.EN = SET;
369 DMA_CH_SPI_TX->CCR_b.EN = SET;
370
371 while(spi_eot==RESET);
372
373 for(uint8_t i=0;i<NumByteToRead;i++) {
374 pBuffer[i] = spi_buffer_rx[1+i];
375 }
376
377 return SUCCESS;
378 }
379
380
389 ErrorStatus SdkEvalSpiDmaWrite( uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite )
390 {
392 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
393
394 spi_buffer_tx[0] = RegisterAddr;
395 for(uint8_t i=0;i<NumByteToWrite;i++) {
396 spi_buffer_tx[1+i] = pBuffer[i];
397 }
398 while(spi_eot==RESET);
399 spi_eot = RESET;
400
401 SDK_EVAL_SPI_CS_LOW();
402
403 /* Reset DMA_CH_UART_TX remaining bytes register */
404 DMA_CH_SPI_TX->CNDTR = NumByteToWrite+1;
405 DMA_CH_SPI_RX->CNDTR = NumByteToWrite+1;
406
407 /* DMA_CH_UART_TX enable */
408 DMA_CH_SPI_RX->CCR_b.EN = SET;
409 DMA_CH_SPI_TX->CCR_b.EN = SET;
410
411 return SUCCESS;
412 }
413
414
420 void DmaSpiHandlerCallback(void)
421 {
422 /* Check DMA_CH_SPI_RX_IT_TC */
423 if(DMA_GetFlagStatus(DMA_CH_SPI_RX_IT_TC)) {
424
425 /* Clear pending bit */
426 DMA_ClearFlag(DMA_CH_SPI_RX_IT_TC);
427
428 /* DMA_SPI_TX/RX disable */
429 DMA_CH_SPI_TX->CCR_b.EN = RESET;
430 DMA_CH_SPI_RX->CCR_b.EN = RESET;
431
432 /* Put the CS pin high */
433 SDK_EVAL_SPI_CS_HIGH();
434
435 /* Set the spi_eot flag */
436 spi_eot = SET;
437 }
438
439 }
440
441
442
449 ErrorStatus SdkEvalSpiIrqInit(uint32_t baudrate)
450 {
451 SPI_InitType SPI_InitStructure;
452 GPIO_InitType GPIO_InitStructure;
453 NVIC_InitType NVIC_InitStructure;
454
455 /* Enable SPI and GPIO clocks */
456 SysCtrl_PeripheralClockCmd(CLOCK_PERIPH_GPIO | CLOCK_PERIPH_SPI, ENABLE);
457
458 /* Configure SPI pins */
459 GPIO_StructInit(&GPIO_InitStructure);
460 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_MOSI_PIN | SDK_EVAL_SPI_PERIPH_SCLK_PIN | SDK_EVAL_SPI_PERIPH_MISO_PIN;
461 GPIO_InitStructure.GPIO_Mode = Serial0_Mode;
462 GPIO_InitStructure.GPIO_Pull = ENABLE;
463 GPIO_InitStructure.GPIO_HighPwr = DISABLE;
464 GPIO_Init(&GPIO_InitStructure);
465
466 /* Configure CS pin */
467 GPIO_InitStructure.GPIO_Pin = SDK_EVAL_SPI_PERIPH_SENSOR_PIN;
468 GPIO_InitStructure.GPIO_Mode = GPIO_Output;
469 GPIO_Init(&GPIO_InitStructure);
470 SDK_EVAL_SPI_CS_HIGH();
471
472 /* Configure SPI in master mode */
473 SPI_StructInit(&SPI_InitStructure);
474 SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
475 SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b ;
476 SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
477 SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
478 SPI_InitStructure.SPI_BaudRate = baudrate;
479 SPI_Init(&SPI_InitStructure);
480
481 /* Set communication mode */
482 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
483
484 /* Clear RX and TX FIFO */
485 SPI_ClearTXFIFO();
486 SPI_ClearRXFIFO();
487
488 /* Configure the level of FIFO for interrupt */
489 SPI_TxFifoInterruptLevelConfig(SPI_FIFO_LEV_1);
490 SPI_RxFifoInterruptLevelConfig(SPI_FIFO_LEV_1);
491
492 /* Enable the DMA Interrupt */
493 NVIC_InitStructure.NVIC_IRQChannel = SPI_IRQn;
494 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = LOW_PRIORITY;
495 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
496 NVIC_Init(&NVIC_InitStructure);
497
498 /* Enable SPI functionality */
499 SPI_Cmd(ENABLE);
500
501 return SUCCESS;
502 }
503
504
505
514 ErrorStatus SdkEvalSpiIrqRead( uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead )
515 {
517 SPI_SetMasterCommunicationMode(SPI_FULL_DUPLEX_MODE);
518
519 byte_to_send = NumByteToRead;
520 byte_to_send_max = NumByteToRead;
521 register_addr = RegisterAddr;
522 spi_buffer_ptr = pBuffer;
523 buffer_idx = 0;
524 spi_irq_state = SEND_READ_REG;
525 spi_eot = RESET;
526
527 SDK_EVAL_SPI_CS_LOW();
528 SPI_ITConfig(SPI_IT_TX | SPI_IT_RX, ENABLE);
529
530 while(spi_eot == RESET);
531
532 SPI_ITConfig(SPI_IT_TX | SPI_IT_RX, DISABLE);
533 SDK_EVAL_SPI_CS_HIGH();
534
535 return SUCCESS;
536 }
537
538
547 ErrorStatus SdkEvalSpiIrqWrite( uint8_t* pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite )
548 {
549 /* Set communication mode */
550 SPI_SetMasterCommunicationMode(SPI_TRANSMIT_MODE);
551
552 byte_to_send = NumByteToWrite;
553 byte_to_send_max = NumByteToWrite;
554 register_addr = RegisterAddr;
555 spi_buffer_ptr = pBuffer;
556 buffer_idx = 0;
557 spi_irq_state = SEND_WRITE_REG;
558 spi_eot = RESET;
559
560 SDK_EVAL_SPI_CS_LOW();
561 SPI_ITConfig(SPI_IT_TX, ENABLE);
562
563 while(spi_eot == RESET);
564
565 SPI_ITConfig(SPI_IT_TX, DISABLE);
566 SDK_EVAL_SPI_CS_HIGH();
567 return SUCCESS;
568 }
569
570
576 void IrqSpiHandlerCallback(void)
577 {
578 /* Check if SPI RX interrupt event occured */
579 if(SPI_GetITStatus(SPI_IT_RX) == SET) {
580
581 if(buffer_idx==0) { /* First reception is discarded, dummy data from sensor */
582 SPI_ReceiveData();
583 }
584 else {
585 spi_buffer_ptr[buffer_idx-1] = SPI_ReceiveData();
586 }
587
588 /* When all the bytes are received, the flag is set */
589 if(byte_to_send_max == buffer_idx)
590 spi_eot = SET;
591
592 /* Increase the buffer index */
593 buffer_idx++;
594 }
595
596 /* Check if SPI RX interrupt event occured */
597 if(SPI_GetITStatus(SPI_IT_TX) == SET) {
598
599 if(byte_to_send>0) {
600 if(spi_irq_state == SEND_READ_REG) {
601 spi_irq_state = SEND_START;
602
603 /* Send the header byte for read operation from register_addr */
604 SPI_SendData(0x80 | register_addr);
605 }
606 else if(spi_irq_state == SEND_WRITE_REG) {
607 spi_irq_state = SEND_WRITE_DATA;
608
609 /* Send the header byte for write operation from register_addr */
610 SPI_SendData(register_addr);
611 }
612 else if(spi_irq_state == SEND_WRITE_DATA){
613
614 /* Decrease the bytes to send */
615 byte_to_send--;
616
617 /* Send data to write */
618 SPI_SendData(spi_buffer_ptr[buffer_idx]);
619
620 /* Increase the buffer index */
621 buffer_idx++;
622 }
623 else {
624 /* Decrease the bytes to send */
625 byte_to_send--;
626
627 /* Send dummy data */
628 SPI_SendData(0xFF);
629 }
630 }
631 else {
632 SPI_ITConfig(SPI_IT_TX , DISABLE);
633 if(spi_irq_state == SEND_WRITE_DATA)
634 spi_eot = SET;
635 }
636
637 }
638
639 }
640
641
657 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
SDK_EVAL_SPI_PERIPH_MISO_MODE
#define SDK_EVAL_SPI_PERIPH_MISO_MODE
Definition: USER_Platform_Configuration.h:94
SdkEvalSpiWrite
ErrorStatus SdkEvalSpiWrite(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite)
SPI function to write registers of a slave device.
Definition: SDK_EVAL_SPI.c:231
DMA_CH_SPI_RX
#define DMA_CH_SPI_RX
SPI_RX DMA channel.
Definition: SDK_EVAL_SPI.h:89
spi_buffer_rx
volatile uint8_t spi_buffer_rx[SPI_BUFF_SIZE]
Definition: SDK_EVAL_SPI.c:74
SDK_EVAL_SPI.h
This file provides all the low level API to manage SPI interface for eval board.
SdkEvalSpiIrqInit
ErrorStatus SdkEvalSpiIrqInit(uint32_t baudrate)
Configures SPI interface and the SPI_TX/SPI_RX IRQ sources.
Definition: SDK_EVAL_SPI.c:449
SDK_EVAL_SPI_PERIPH_SCLK_PIN
#define SDK_EVAL_SPI_PERIPH_SCLK_PIN
Definition: USER_Platform_Configuration.h:96
DmaSpiHandlerCallback
void DmaSpiHandlerCallback(void)
SPI DMA ISR callback function.
Definition: SDK_EVAL_SPI.c:420
spi_buffer_tx
volatile uint8_t spi_buffer_tx[SPI_BUFF_SIZE]
SPI buffers used for DMA application.
Definition: SDK_EVAL_SPI.c:73
IrqSpiHandlerCallback
void IrqSpiHandlerCallback(void)
SPI IRQ ISR callback function.
Definition: SDK_EVAL_SPI.c:576
SdkEvalSpiInit
ErrorStatus SdkEvalSpiInit(uint32_t baudrate)
Configures SPI interface.
Definition: SDK_EVAL_SPI.c:133
SEND_START
#define SEND_START
SPI IRQ mode defines.
Definition: SDK_EVAL_SPI.c:56
SPI_BUFF_SIZE
#define SPI_BUFF_SIZE
SPI buffer max size.
Definition: SDK_EVAL_SPI.h:74
SDK_EVAL_SPI_PERIPH_MISO_PIN
#define SDK_EVAL_SPI_PERIPH_MISO_PIN
Definition: USER_Platform_Configuration.h:93
SEND_READ_REG
#define SEND_READ_REG
Definition: SDK_EVAL_SPI.c:57
SdkEvalSpiDmaRead
ErrorStatus SdkEvalSpiDmaRead(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead)
SPI DMA function to read registers from a slave device.
Definition: SDK_EVAL_SPI.c:349
SDK_EVAL_SPI_PERIPH_SENSOR_PIN
#define SDK_EVAL_SPI_PERIPH_SENSOR_PIN
BlueNRG1 Eval Board (STEVAL-IDB007Vx) SPI definitions.
Definition: USER_Platform_Configuration.h:87
SdkEvalSpiIrqWrite
ErrorStatus SdkEvalSpiIrqWrite(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite)
SPI IRQ function to write registers of a slave device.
Definition: SDK_EVAL_SPI.c:547
SEND_WRITE_DATA
#define SEND_WRITE_DATA
Definition: SDK_EVAL_SPI.c:59
SDK_EVAL_SPI_PERIPH_MOSI_PIN
#define SDK_EVAL_SPI_PERIPH_MOSI_PIN
Definition: USER_Platform_Configuration.h:90
SDK_EVAL_SPI_PERIPH_MOSI_MODE
#define SDK_EVAL_SPI_PERIPH_MOSI_MODE
Definition: USER_Platform_Configuration.h:91
SDK_EVAL_SPI_CS_LOW
#define SDK_EVAL_SPI_CS_LOW()
Put the CS pin low.
Definition: SDK_EVAL_SPI.h:121
SEND_WRITE_REG
#define SEND_WRITE_REG
Definition: SDK_EVAL_SPI.c:58
DMA_CH_SPI_TX
#define DMA_CH_SPI_TX
SPI_TX DMA channel.
Definition: SDK_EVAL_SPI.h:79
SdkEvalSpiDmaWrite
ErrorStatus SdkEvalSpiDmaWrite(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToWrite)
SPI DMA function to write registers of a slave device.
Definition: SDK_EVAL_SPI.c:389
DMA_CH_SPI_RX_IT_TC
#define DMA_CH_SPI_RX_IT_TC
SPI_RX DMA Transfer Complete Interrupt.
Definition: SDK_EVAL_SPI.h:94
SPI_DR_BASE_ADDR
#define SPI_DR_BASE_ADDR
SPI DR address.
Definition: SDK_EVAL_SPI.h:69
SDK_EVAL_SPI_PERIPH_SCLK_MODE
#define SDK_EVAL_SPI_PERIPH_SCLK_MODE
Definition: USER_Platform_Configuration.h:97
SdkEvalSpiRead
ErrorStatus SdkEvalSpiRead(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead)
SPI function to read registers from a slave device.
Definition: SDK_EVAL_SPI.c:195
SdkEvalSpiDmaInit
ErrorStatus SdkEvalSpiDmaInit(uint32_t baudrate)
Configures SPI interface and the SPI_TX/SPI_RX DMA channels.
Definition: SDK_EVAL_SPI.c:261
SdkEvalSpiIrqRead
ErrorStatus SdkEvalSpiIrqRead(uint8_t *pBuffer, uint8_t RegisterAddr, uint8_t NumByteToRead)
SPI IRQ function to read registers from a slave device.
Definition: SDK_EVAL_SPI.c:514
SDK_EVAL_SPI_CS_HIGH
#define SDK_EVAL_SPI_CS_HIGH()
Put the CS pin high.
Definition: SDK_EVAL_SPI.h:116
spi_eot
volatile FlagStatus spi_eot
SPI flag set at end of transaction.
Definition: SDK_EVAL_SPI.c:79