IRPyro Micro controller template only
Routines to enable the MCU to use the USART and the I2C
main_IRPyro_microcontroller_only_demo.c
Go to the documentation of this file.
1 /**
2 ******************************************************************************
3 * @file main_IRPyro_microcontroller_only_demo.c
4 * @author _KEMET, Ltd
5 * @date March 2018
6 * @version Release 1.0.0
7 * @copyright (c) 2018 _KEMET, Ltd
8 * @brief Examples of single sensor and multiple sensor streaming. Also IOCTL
9 * of a single sensor.
10 *
11 * @verbatim
12  ===============================================================================
13  ##### How to use this example #####
14  ===============================================================================
15  [..]
16  Requirements
17  (#) Keil compiler version 5 onwards (https://www.keil.com/download/product/)
18  to build this example.
19  (#) C99 option enabled on the compiler to support initialization macros.
20  (#) The STM32 Standard Peripheral Library, see:
21  (http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32-standard-peripheral-libraries.html)
22  [..]
23  (#) See Micro_controller_template.c for details on how to configure SDA,SCL
24  INT and CS lines values.
25  (#) Compile, load and run.
26  (#) Display collected data on RealTerm or equivalent
27  @endverbatim
28  ******************************************************************************
29  @attention <h2><center>&copy; COPYRIGHT 2018 _KEMET, Ltd</center></h2>
30  @verbatim
31  Copyright (c) 2018, _KEMET, Ltd
32  All rights reserved.
33 
34  THIS SOFTWARE IS PROVIDED BY _KEMET, Ltd ''AS IS'' AND ANY
35  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37  DISCLAIMED. IN NO EVENT SHALL _KEMET, Ltd BE LIABLE FOR ANY
38  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
41  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44  @endverbatim
45 
46  ******************************************************************************
47  */
48 /* Includes ------------------------------------------------------------------*/
50 
51 static void Configure_MCU(void);
52 static void demo_board_sensor_control(int value);
53 static void usart_callback_setup(void);
54 
55 /** @defgroup IRPyroAPI_micro_controller_only Bare bones micro controller firmware
56  * @brief Support micro controller functions without the API component
57  * @{
58  */
59 /**
60  * @brief Call point to the example functions
61  */
62 int main(void)
63 {
64  Configure_MCU();
65 }
66 /**
67  * @brief Example to initialize the STM32F303K8 micro controller
68  * @attention Set your serial terminal console with the following parameters:
69  * @verbatim
70  * Baud Rate: 921600
71  * Parity: None
72  * Data Bits: 8
73  * Stop Bits: 1
74  * Hardware Flow Control: None
75  * Software Flow Control: None
76  * @endverbatim
77  * @note Modify accordingly depending on architecture
78  */
79 static void Configure_MCU(void)
80 {
81  /*-------------------------- board setup ---------------------------------*/
84  // disable all CS lines
86  /*----------------- enable the sensor for streaming-----------------------*/
87  while(1)
88  {
89  UART_PutString(USART2, (uint8_t*)"MCU configured and ready!\n");
90  }
91 }
92 
93 /**
94  * @brief USART TX function
95  */
96 static void tx_function(void)
97 {
98 
99 }
100 /**
101  * @brief USART RX function
102  */
103 static void rx_function(void)
104 {
105  uint8_t uart_byte = (uint8_t)USART_ReceiveData(USART2);
106 }
107 /**
108  * @brief configures USART irq functions
109  */
110 static void usart_callback_setup(void)
111 {
114 }
115 /**
116  * @brief Changes the state of all the CS lines as used on the IRPyro backplane board
117  * @param state 0 disabled / 1 enabled
118  */
120 {
121  CS_pin_set(2,1,state);
122  CS_pin_set(2,3,state);
123  CS_pin_set(2,4,state);
124  CS_pin_set(2,5,state);
125 }
126 /** end of IRPyroAPI_micro_controller_only
127  * @}
128  */
129 /* ********** Copyright (c) 2018 _KEMET, Ltd. **********END OF FILE************/
Configure_MCU
static void Configure_MCU(void)
Example to initialize the STM32F303K8 micro controller.
Definition: main_IRPyro_microcontroller_only_demo.c:79
demo_board_sensor_control
static void demo_board_sensor_control(int value)
Changes the state of all the CS lines as used on the IRPyro backplane board.
Definition: main_IRPyro_microcontroller_only_demo.c:119
main
int main(void)
Call point to the example functions.
Definition: main_IRPyro_microcontroller_only_demo.c:62
Micro_controller_template_init
void Micro_controller_template_init(void)
Groups all required initialization in one function.
Definition: Micro_controller_template.c:175
rx_function
static void rx_function(void)
USART RX function.
Definition: main_IRPyro_microcontroller_only_demo.c:103
USART_Callback_Rx_Setup
void USART_Callback_Rx_Setup(USART_callback Callback)
Configures function callbacks.
Definition: Micro_controller_template.c:1146
main_IRPyro_microcontroller_only_demo.h
Function prototypes and initialization macros for example code.
UART_PutString
void UART_PutString(USART_TypeDef *USARTx, uint8_t *str)
Puts a string in the USART.
Definition: Micro_controller_template.c:1069
usart_callback_setup
static void usart_callback_setup(void)
configures USART irq functions
Definition: main_IRPyro_microcontroller_only_demo.c:110
CS_pin_set
void CS_pin_set(uint8_t port, uint8_t pin, uint8_t value)
ON/OFF control from the MCU to the IRPyro sensor.
Definition: Micro_controller_template.c:534
tx_function
static void tx_function(void)
USART TX function.
Definition: main_IRPyro_microcontroller_only_demo.c:96
USART_Callback_Tx_Setup
void USART_Callback_Tx_Setup(USART_callback Callback)
Configures function callbacks.
Definition: Micro_controller_template.c:1120
uart_byte
volatile uint8_t uart_byte
Definition: Micro_controller_template.c:1053