1
|
/*
|
2
|
* Academic License - for use in teaching, academic research, and meeting
|
3
|
* course requirements at degree granting institutions only. Not for
|
4
|
* government, commercial, or other organizational use.
|
5
|
*
|
6
|
* File: Project1.c
|
7
|
*
|
8
|
* Code generated with Waijung 2 ESP32 Target Blockset,
|
9
|
* for Simulink model 'Project1'.
|
10
|
*
|
11
|
* Model version : 1.17
|
12
|
* Simulink Coder version : 23.2 (R2023b) 01-Aug-2023
|
13
|
* C/C++ source code generated on : Thu Jan 16 10:47:35 2025
|
14
|
*
|
15
|
* Target selection: esp32.tlc
|
16
|
* Embedded hardware selection: Cadence Design Systems (Tensilica)->Espressif Xtensa single-/dual-core 32-bit LX6 microprocessor
|
17
|
* Code generation objectives: Unspecified
|
18
|
* Validation result: Not run
|
19
|
*/
|
20
|
|
21
|
#include "Project1.h"
|
22
|
#include "rtwtypes.h"
|
23
|
|
24
|
/* Block signals (default storage) */
|
25
|
B_Project1_T Project1_B;
|
26
|
|
27
|
/* Block states (default storage) */
|
28
|
DW_Project1_T Project1_DW;
|
29
|
|
30
|
/* Real-time model */
|
31
|
static RT_MODEL_Project1_T Project1_M_;
|
32
|
RT_MODEL_Project1_T *const Project1_M = &Project1_M_;
|
33
|
|
34
|
/* Model step function */
|
35
|
void Project1_step(void)
|
36
|
{
|
37
|
/* DiscretePulseGenerator: '<Root>/Pulse Generator' */
|
38
|
Project1_B.PulseGenerator = ((Project1_DW.clockTickCounter < 1) &&
|
39
|
(Project1_DW.clockTickCounter >= 0));
|
40
|
|
41
|
/* DiscretePulseGenerator: '<Root>/Pulse Generator' */
|
42
|
if (Project1_DW.clockTickCounter >= 1) {
|
43
|
Project1_DW.clockTickCounter = 0;
|
44
|
} else {
|
45
|
Project1_DW.clockTickCounter++;
|
46
|
}
|
47
|
|
48
|
/* S-Function (esp32_digital_output): '<Root>/Digital Output' */
|
49
|
|
50
|
/* Updating the pins of DigitalOutput */
|
51
|
gpio_set_level(5,(uint32_t) Project1_B.PulseGenerator);/* GPIO5 */
|
52
|
}
|
53
|
|
54
|
/* Model initialize function */
|
55
|
void Project1_initialize(void)
|
56
|
{
|
57
|
/* Start for S-Function (esp32_digital_output): '<Root>/Digital Output' */
|
58
|
GPIO_enable_DigitalOutput();
|
59
|
}
|
60
|
|
61
|
/* Model terminate function */
|
62
|
void Project1_terminate(void)
|
63
|
{
|
64
|
/* (no terminate code required) */
|
65
|
}
|
66
|
|
67
|
/* [EOF] */
|