Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
main_tasks.c
1/*
2 (c) 2022 Microchip Technology Inc. and its subsidiaries. You may use this
3 software and any derivatives exclusively with Microchip products.
4
5 THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
6 EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
7 WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
8 PARTICULAR PURPOSE, OR ITS INTERACTION WITH MICROCHIP PRODUCTS, COMBINATION
9 WITH ANY OTHER PRODUCTS, OR USE IN ANY APPLICATION.
10
11 IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
12 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
13 WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
14 BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
15 FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
16 ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
17 THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
18
19 MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE OF THESE
20 TERMS.
21 */
22
27#include "system/pins.h"
29#include "driver/can/drv_can.h"
30#include "driver/i2c/i2c2.h"
31
32
41void Tasks_Background(void)
42{
43 // I2C handler, poll interrupt flag
44 // note that I2C handler is not interrupt driven
45 if (IFS2bits.SI2C2IF)
46 {
47 I2C2_SlaveTasks();
48 IFS2bits.SI2C2IF = 0;
49 }
50
51 // clear Watchdog
52// WATCHDOG_TimerClear();
53}
54
55
65void Tasks_100us(void)
66{
67 // the DMA is triggered when an SPI message is received
68 // an SPI message should be received every 10us
69 // so this function will trigger an SPI timeout after 1ms
70 // and will keep doing this until a reliable SPI comms channel
71 // has been established
73
74 // timeout for I2C handler
75 // expect I2C message from PIC16 on power board every 50ms.
76 // If has not being received within 60ms of last message, then set timeout error flag
77// Drv_I2C_Timeout();
78
79 // check for CAN data from GUI
81
82 // send data to GUI if FIFO from secondary core is full
84
85 // red LED blinking @ 1Hz as heartbeat
86 static uint16_t led_blink_counter = 0;
87 if (++led_blink_counter > 5000)
88 {
90 led_blink_counter = 0;
91 }
92}
void CAN_Receive_from_GUI(void)
Definition drv_can.c:411
void CAN_Transmit_to_GUI(void)
Definition drv_can.c:299
header of the CAN Driver
void Drv_SPI_Timeout(void)
Definition drv_spi.c:146
This is the driver source file for spi builds upon mcc.
#define LD2_RD15_Toggle()
Toggles the RD15 GPIO Pin which has a custom name of LD2_RD15.
Definition pins.h:122