px-fwlib
0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers
generated with
Doxygen
1.9.2
px_spi_cfg_template.h
1
#ifndef __PX_SPI_CFG_H__
2
#define __PX_SPI_CFG_H__
3
/* =============================================================================
4
____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5
| _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6
| |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7
| __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8
|_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10
Copyright (c) 2018 Pieter Conradie <https://piconomix.com>
11
12
License: MIT
13
https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15
Title: px_spi_cfg.h : SPI Peripheral Driver configuration
16
Author(s): Pieter Conradie
17
Creation Date: 2018-03-02
18
19
============================================================================= */
20
21
/**
22
* @addtogroup STM32_SPI
23
*
24
* @{
25
*/
26
27
/* _____STANDARD INCLUDES____________________________________________________ */
28
29
/* _____PROJECT INCLUDES_____________________________________________________ */
30
#include "px_defs.h"
31
#include "px_board.h"
32
33
/* _____DEFINITIONS__________________________________________________________ */
34
/// Enable/disable support for SPI1 peripheral
35
#define PX_SPI_CFG_SPI1_EN 1
36
37
/// Enable/disable support for SPI2 peripheral
38
#define PX_SPI_CFG_SPI2_EN 1
39
40
/// Specify default baud rate
41
#define PX_SPI_CFG_DEFAULT_BAUD PX_SPI_BAUD_CLK_DIV_32
42
43
/// Specify default SPI mode (clock phase and polarity)
44
#define PX_SPI_CFG_DEFAULT_MODE PX_SPI_MODE0
45
46
/// Specify default SPI data order
47
#define PX_SPI_CFG_DEFAULT_DATA_ORDER PX_SPI_DATA_ORDER_MSB
48
49
/**
50
* Map PX_SPI_CFG_CS_LO() macro to px_board_spi_cs_lo() function.
51
* A manual Chip Select function must be implemented, e.g.
52
*
53
* void px_board_spi_cs_lo(uint8_t cs_id)
54
* {
55
* switch(cs_id)
56
* {
57
* case BOARD_SPI_CS:
58
* PX_GPIO_PIN_SET_LO(PX_GPIO_SPI_CS);
59
* break;
60
*
61
* default:
62
* break;
63
* }
64
* }
65
*/
66
#define PX_SPI_CFG_CS_LO(cs_id) px_board_spi_cs_lo(cs_id)
67
68
/**
69
* Map PX_SPI_CFG_CS_HI() macro to px_board_spi_cs_hi() function.
70
* A manual Chip Select function must be implemented, e.g.
71
*
72
* void px_board_spi_cs_hi(uint8_t cs_id)
73
* {
74
* switch(cs_id)
75
* {
76
* case BOARD_SPI_CS:
77
* PX_GPIO_OUT_SET_HI(PX_GPIO_SPI_CS);
78
* break;
79
*
80
* default:
81
* break;
82
* }
83
* }
84
*
85
*/
86
#define PX_SPI_CFG_CS_HI(cs_id) px_board_spi_cs_hi(cs_id)
87
88
/// @}
89
#endif