VSF Documented
multiplex_spi.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_COMMON_MULTIPLEX_SPI_H__
19#define __HAL_DRIVER_COMMON_MULTIPLEX_SPI_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_SPI == ENABLED
26
27#if defined(__VSF_MULTIPLEX_SPI_CLASS_IMPLEMENT)
28# define __VSF_CLASS_IMPLEMENT__
29# undef __VSF_MULTIPLEX_SPI_CLASS_IMPLEMENT
30#elif defined(__VSF_MULTIPLEX_SPI_CLASS_INHERIT__)
31# define __VSF_CLASS_INHERIT__
32# undef __VSF_MULTIPLEX_SPI_CLASS_INHERIT__
33#endif
34
35#include "utilities/ooc_class.h"
36
37/*============================ MACROS ========================================*/
38
39#ifndef VSF_MULTIPLEXER_SPI_CFG_MASK_TYPE
40# define VSF_MULTIPLEXER_SPI_CFG_MASK_TYPE uint8_t
41#endif
42
43/*============================ MACROFIED FUNCTIONS ===========================*/
44/*============================ TYPES =========================================*/
45
47
53
55
56vsf_class(vsf_multiplex_spi_info_t) {
57 public_member(
58 vsf_spi_t *spi;
59 )
60
61 private_member(
63
64 // inited configraction
65 vsf_multiplex_spi_t *cfg_spi_ptr;
66 spi_multi_mask_t init_mask;
67
68 // enable/disable mask
69 spi_multi_mask_t en_mask;
70
71 // cs mask
72 spi_multi_mask_t cs_mask;
73
74 // irq mask
75 vsf_spi_irq_mask_t irq_mask; // All CS IRQ Mask Wire-OR
76 )
77};
78
80 public_member(
81 vsf_multiplex_spi_info_t *spi_info_ptr;
82 int8_t cs_index;
83 vsf_gpio_t *gpio;
84 vsf_gpio_pin_mask_t pin_mask;
85 )
86
87 private_member(
89 vsf_spi_cfg_t spi_cfg; // init and re-init
90 vsf_spi_irq_mask_t irq_mask; // enable/disable interrupt
91 uint_fast32_t transferred_count;
93 )
94};
95
96/*============================ GLOBAL VARIABLES ==============================*/
97
98#define VSF_SPI_CFG_DEC_PREFIX vsf_multiplex
99#define VSF_SPI_CFG_DEC_UPCASE_PREFIX VSF_MULTIPLEX
101
102/*============================ LOCAL VARIABLES ===============================*/
103/*============================ PROTOTYPES ====================================*/
104/*============================ IMPLEMENTATION ================================*/
105
106#endif /*VSF_HAL_USE_SPI*/
107
108#endif /*__HAL_DRIVER_COMMON_MULTIPLEX_SPI_H__*/
Definition multiplex_spi.h:79
#define VSF_MULTIPLEXER_SPI_CFG_MASK_TYPE
Definition multiplex_spi.h:40
VSF_MULTIPLEXER_SPI_CFG_MASK_TYPE spi_multi_mask_t
Definition multiplex_spi.h:46
#define vsf_class(__name)
Definition ooc_class.h:48
#define vsf_declare_class(__name)
Definition ooc_class.h:45
const i_spi_t vsf_spi_irq_mask_t irq_mask
Definition spi_interface.h:38
unsigned int uint_fast32_t
Definition stdint.h:27
signed char int8_t
Definition stdint.h:4
Definition multiplex_spi.h:48
uint_fast32_t count
Definition multiplex_spi.h:51
void * out_buffer_ptr
Definition multiplex_spi.h:49
void * in_buffer_ptr
Definition multiplex_spi.h:50
Definition vsf_template_gpio.h:471
Definition vsf_list.h:876
Definition vsf_list.h:896
spi configuration for api
Definition vsf_template_spi.h:525
Definition vsf_template_spi.h:541
#define vsf_gpio_pin_mask_t
Definition vsf_template_gpio.h:187
vsf_spi_irq_mask_t
Predefined VSF SPI interrupt that can be reimplemented in specific hal drivers.
Definition vsf_template_spi.h:454