MPAE-16256: Readme and code fixes

master
Teodor-Emilian Petre 2023-08-17 11:54:45 +03:00
rodzic 9de78016c7
commit b8cfc2e0a9
76 zmienionych plików z 5168 dodań i 20797 usunięć

25
.gitignore vendored
Wyświetl plik

@ -1,13 +1,12 @@
# Untracked files in MPLABX projects
/**/build/*
/**/nbproject/*
!/**/nbproject/*.xml
/**/[Ff]ree/production/*
/**/[Pp]ro/production/*
/**/.generated_files/*
# Uncomment these to include hex/elf files
#!/**/[Ff]ree/production/*.hex
#!/**/[Ff]ree/production/*.elf
#!/**/[Pp]ro/production/*.hex
#!/**/[Pp]ro/production/*.elf
/*/dist/
/*/debug/
/*/build/
/*/nbproject/private/
/*/nbproject/*.properties
/*/nbproject/*.mk
/*/nbproject/*.bash
**/*.bak
**/*.o
**/*.d
**/*.elf
**/*.map

Wyświetl plik

@ -2,29 +2,29 @@
"metaDataVersion": "1.0.0",
"category": "com.microchip.ide.project",
"content": {
"metaDataVersion": "1.1.0",
"metaDataVersion": "1.3.0",
"name": "com.microchip.mcu8.mplabx.project.avr128da48-cnano-ws2812-mplab-mcc",
"version": "1.0.1",
"displayName": "RGB lighting with WS2812 using SPI and CCL",
"version": "1.0.2",
"displayName": "RGB lighting with WS2812 using AVR128DA48 Microcontroller with MCC Melody",
"projectName": "avr128da48-cnano-ws2812-mplab-mcc",
"shortDescription": "This repository contains an MCC generated code example that interfaces the WS2812 RGB LED with AVR128DA48 microcontroller using CCL, SPI, TCA and EVSYS.",
"shortDescription": "This repository provides an MPLAB® X project with an MPLAB® Code Configurator (MCC) generated code example for interfacing the CCL (Configurable Custom Logic) and SPI (Serial Peripheral Interface) peripherals with the WS2812 LED.",
"ide": {
"name": "MPLAB X",
"semverRange": ">=5.40.0"
"semverRange": ">=6.10.0"
},
"compiler": [
{
"name": "XC8",
"semverRange": "^2.30.0"
"semverRange": "^2.41.0"
}
],
"dfp": {
"name": "AVR-Dx",
"semverRange": "1.6.88"
"semverRange": "^2.3.272"
},
"configurator": {
"name": "MCC",
"semverRange": "4.0.1"
"semverRange": ">=5.3.7"
},
"device": {
"metaDataVersion": "1.0.0",
@ -37,16 +37,10 @@
}
},
"author": "Microchip",
"subcategories": [
[
"Peripherals",
"CCL"
]
],
"peripherals": [
"CCL"
"CCL", "TCA", "SPI", "EVSYS", "GPIO"
],
"keywords": [ "WS2812", "RGB LED", "RGB lighting"
"keywords": [ "WS2812/11", "RGB LED", "RGB lighting", "AVR128DA48"
],
"additionalData": {
"longDescription": {

195
README.md
Wyświetl plik

@ -1,109 +1,140 @@
[![MCHP](images/microchip.png)](https://www.microchip.com)
<!-- Please do not change this html logo with link -->
# AVR128DA48 RGB lighting with WS2812 using SPI and CCL
<a href="https://www.microchip.com" rel="nofollow"><img src="images/Microchip.png" alt="MCHP" width="300"/></a>
This repository provides an MPLAB® X project with an MPLAB® Code Configurator (MCC) generated code example for interfacing the CCL and SPI peripherals with the WS2812 LED.
<br>The messages compatible with the WS2812 LED are formed from ones and zeros with a specific duration and form. The application translates the messages sent by SPI into messages intelligible by WS2812, using CCL.
<br>Furthermore, it creates a light game on a WS2812 LED band.
<br>The peripherals used are:
- Serial Peripheral Interface (SPI)
- Configurable Custom Logic (CCL)
- Timer/Counter Type A (TCA)
- Event System (EVSYS)
# RGB lighting with WS2812 using AVR128DA48 Microcontroller with MCC Melody
This repository provides an MPLAB® X project with an MPLAB® Code Configurator (MCC) generated code example for interfacing the CCL (Configurable Custom Logic) and SPI (Serial Peripheral Interface) peripherals with the WS2812 LED. The messages compatible with the WS2812 LED are formed from ones and zeros with a specific duration and form. The application translates the messages sent by SPI into messages intelligible by WS2812, using CCL. Furthermore, it creates a light game on a WS2812 LED band.
## Related Documentation
More details and code examples on the AVR128DA48 can be found at the following links:
- [AVR128DA48 Product Page](https://www.microchip.com/wwwproducts/en/AVR128DA48)
- [AVR128DA48 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples?q=avr128da48)
- [AVR128DA48 Project Examples in START](https://start.atmel.com/#examples/AVR128DA48CuriosityNano)
- [WS2812 Datasheet](https://cdn-shop.adafruit.com/datasheets/WS2812.pdf)
- [WS2812 Datasheet](https://www.tme.com/Document/1d930d9b83e8cce43e5d1c490ab0fbe8/WS2818A.pdf)
## Software Used
- MPLAB® X IDE 5.40 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide)
- MPLAB® XC8 2.30 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers)
- MPLAB® Code Configurator (MCC) 4.0.1 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
- MPLAB® Code Configurator (MCC) Device Libraries 8-bit AVR MCUs 2.5.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
- AVR-Dx 1.6.88 or newer Device Pack
- [MPLAB® X IDE](http://www.microchip.com/mplab/mplab-x-ide) v6.10 or newer
- [MPLAB® XC8](http://www.microchip.com/mplab/compilers) v2.41 or newer
- [AVR-Dx Series Device Pack](https://packs.download.microchip.com/) v2.3.272 or newer
## Hardware Used
- AVR128DA48 Curiosity Nano [(DM164151)](https://www.microchip.com/Developmenttools/ProductDetails/DM164151)
- LED Stripe WS2812
- 12V Charger/Voltage Source for the LEDs
## Setup
The AVR128DA48 Curiosity Nano Development Board is used as test platform.
<br><img src="images/AVR128DA48_CNANO_instructions.PNG" width="500">
The following configurations must be made for this project:
System clock: 24 MHz
SPI0:
- Mode: Host
- Clock frequency: 750 kHz
LUT0:
- IN0: TCA0-WO0
- IN1: SPI-CLK
- IN2: TCA0-WO2
- TRUTH table: 0xE0
- Clock source: CLKPER
TCA0:
- Single-slope PWM mode
- Compare channel 0: enabled
- Compare channel 2: enabled
- Channel 0 waveform duty cycle: 0.4%
- Channel 2 waveform duty cycle: 0.7%
- Period: 100 us
EVSYS:
- Event Generators:
- SPI0_CLK: CHANNEL0
- Event Users:
- CHANNEL 0: TCA0CNTB
|Pin | Configuration |
| :--------------: | :----------------: |
|PA0 (TCA0-WO0) | Digital Output |
|PA2 (TCA0-WO2) | Digital Output |
|PA3 (LUT0_OUT) | Digital Output |
|PA4 (SPI0-MOSI) | Digital Output |
|PA6 (SPI0-CLK) | Digital Output |
<br>**Note:** Only PA3(LUT0_OUT) will be used to transmit data to the WS2812 LED. The rest of the pins are routed outside for visualization of intermediary signals.
- AVR128DA48 Curiosity Nano Development Board is used as a test platform.
<br><img src="images/AVR128DA48_CNANO_instructions.png" width="800">
- WS2812 LED Stripe
- 12V Charger / Voltage Source for the LEDs
## Operation
1. Connect the board to the PC.
2. Open the avr128da48-cnano-ws2812-mplab-mcc.X project in MPLAB® X IDE.
To program the Curiosity Nano board with this MPLAB X project, follow the steps provided in the [How to Program the Curiosity Nano Board](#how-to-program-the-curiosity-nano-board) chapter.<br>
3. Set the avr128da48-cnano-ws2812-mplab-mcc.X project as main project. Right click the project in the **Projects** tab and click **Set as Main Project**.
<br><img src="images/Set_as_Main_Project.png" width="600">
## Setup
4. Clean and build the avr128da48-cnano-ws2812-mplab-mcc.X project: right click the **avr128da48-cnano-ws2812-mplab-mcc.X** project and select **Clean and Build**.
<br><img src="images/Clean_and_Build.png" width="600">
The following peripheral and clock configurations are set up using MCC Melody for the AVR128DA48:
5. Select **AVR128DA48 Curiosity Nano** in the Connected Hardware Tool section of the project settings:
- Right click the project and click **Properties**;
- Click the arrow right next to Connected Hardware Tool;
- Select AVR128DA48 Curiosity Nano (click the **SN**), click **Apply** and then click **OK**:
- CLKCTRL:
- Clock Selection: Internal high-frequency oscillator
- Internal Oscillator Frequency: 1-32MHz internal oscillator
- Oscillator Frequency Selection: 24 MHz system clock
<br><img src="images/Selection_Tool.png" width="600">
- SPI0:
- Enable SPI: Enabled
- Modes: Host
- SPI Mode: 1
- Desired Clock Speed (Hz): 750000 (750 kHz)
6. Program the project to the board: right click the project and click **Make and Program Device**.
<br><img src="images/Make_and_Program_Device.png" width="600">
- CCL:
- Enable CCL: Enabled
- LUT0:
- Enable LUT: Enabled
- Enable LUT Output: Enabled
- Input 0: TCA0 (WO0)
- Input 1: SPI0 (MOSI)
- Input 2: TCA0 (WO2)
- Gate Type: Custom
- Output Result: 0xE0
Demo:
<br>The output waveforms are shown in the figure below. SPI_MOSI is the data sent through SPI and the LUT0_OUT is the translated message, intelligible by WS2812 LED.
<br><img src="images/Demo.PNG" width="600">
- TCA0:
- Enable Timer: Enabled
- Clock Selection: System Clock
- Timer Mode: 16 Bit (Normal)
- Count Direction: UP
- Requested Timeout (s): 0.0001 (100 μs)
- Enable Count on Event Input B: Enabled
- Event Action B: Restart on Positive Event Edge
- Waveform Generation Mode: Single Slope PWM
- Enable Channel 0: Enabled
- Enable Channel 2: Enabled
- Duty Cycle 0 (%): 0.4%
- Duty Cycle 2 (%): 0.7%
- EVSYS:
- Generators: SPI0_SCK -> CHANNEL0
- Users: CHANNEL0 -> TCA0CNTB
- Routing: SPI0_SCK -> CHANNEL0 -> TCA0CNTB
| Pin | Configuration |
| :--------------: | :-------------: |
|PA0 (TCA0 WO0) | Digital Output |
|PA2 (TCA0 WO2) | Digital Output |
|PA3 (LUT0 OUT) | Digital Output |
|PA4 (SPI0 MOSI) | Digital Output |
|PA6 (SPI0 SCK) | Digital Output |
|PA7 (SPI0 SS) | Digital Output |
**Note:** Only PA3 (LUT0 OUT) will be used to transmit data to the WS2812 LED. The rest of the pins are routed outside for visualization of intermediary signals.
## Demo
The output waveforms are shown in the figure below. SPI MOSI is the data sent through SPI and the LUT0 OUT is the translated message, intelligible by WS2812 LED.
<br><img src="images/waveforms.png" width="800">
The light game is created on a LED strip which allows control of LEDs in groups of 3. The LED groups are lit from one end to another continuously.
<br><img src="images/Demo.gif" width="500">
<br>**Note:** The number of LEDs (groups of LEDs) must be configured in firmware. See `NUMBER_OF_LEDS` macro define.
<br><img src="images/demo.gif" width="500">
**Note:** The number of LEDs (groups of LEDs) must be configured in firmware. See `NUMBER_OF_LEDS` macro define.
## Summary
The demo shows how to interface WS2812 LED with the SPI peripheral using CCL and TCA.
## How to Program the Curiosity Nano board
This chapter shows how to use the MPLAB X IDE to program an AVR® device with an Example_Project.X. This can be applied for any other projects.
- Connect the board to the PC.
- Open the Example_Project.X project in MPLAB X IDE.
- Set the Example_Project.X project as main project.
- Right click on the project in the **Projects** tab and click **Set as Main Project**.
<br><img src="images/program_set_as_main_project.png" width="500">
- Clean and build the Example_Project.X project.
- Right click on the **Example_Project.X** project and select **Clean and Build**.
<br><img src="images/program_clean_and_build.png" width="500">
- Select the **AVRxxxxx Curiosity Nano** in the Connected Hardware Tool section of the project settings:
- Right click on the project and click **Properties**
- Click on the arrow under the Connected Hardware Tool
- Select the **AVRxxxxx Curiosity Nano** (click on the **SN**), click **Apply** and then click **OK**:
<br><img src="images/program_tool_selection.png" width="500">
- Program the project to the board.
- Right click on the project and click **Make and Program Device**.
<br><img src="images/program_make_and_program_device.png" width="500">
<br>
- [Back to Setup](#setup)
- [Back to Demo](#demo)
- [Back to Summary](#summary)
- [Back to Top](#rgb-lighting-with-ws2812-using-avr128da48-microcontroller-with-mcc-melody)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -1,139 +1,131 @@
/*
(c) 2020 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
(c) 2023 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "mcc_generated_files/mcc.h"
#include "mcc_generated_files/system/system.h"
#include <util/delay.h>
#define TCA0_Enable() do {TCA0.SINGLE.CTRLA |= TCA_SINGLE_ENABLE_bm;} while(0)
#define TCA0_Disable() do {TCA0.SINGLE.CTRLA &= ~TCA_SINGLE_ENABLE_bm;} while(0)
#define LED_MAX_BRIGHT 0xFF
#define LED_MIN_BRIGHT 0x00
#define NUMBER_OF_LEDS 13
#define DELAY_TIME 100 //milliseconds
#define POSITION_MIN 0
#define POSITION_MAX (NUMBER_OF_LEDS - 1)
#define NUMBER_OF_LEDS ( 10 )
#define DELAY_TIME_MS ( 100 )
const uint8_t colorTable[] =
{
LED_MAX_BRIGHT, LED_MIN_BRIGHT, LED_MIN_BRIGHT, // red
LED_MAX_BRIGHT, LED_MAX_BRIGHT, LED_MIN_BRIGHT, // yellow
LED_MIN_BRIGHT, LED_MAX_BRIGHT, LED_MIN_BRIGHT, // green
LED_MIN_BRIGHT, LED_MAX_BRIGHT, LED_MAX_BRIGHT, // cyan
LED_MIN_BRIGHT, LED_MIN_BRIGHT, LED_MAX_BRIGHT, // blue
LED_MAX_BRIGHT, LED_MIN_BRIGHT, LED_MAX_BRIGHT // purple
};
typedef struct
#define LED_MIN_BRIGHT ( 0x00 )
#define LED_MAX_BRIGHT ( 0xFF )
#define POSITION_MIN ( 0 )
#define POSITION_MAX ( NUMBER_OF_LEDS - 1 )
typedef struct COLOR
{
uint8_t redChannel;
uint8_t greenChannel;
uint8_t blueChannel;
} color_t;
void WalkLight(color_t color);
void LightIntoPosition(color_t color, uint8_t position);
void SetLEDColor(color_t color);
void ClearLEDs(void);
inline void ClearLEDs(void);
void WalkLight(color_t const color);
void LightIntoPosition(color_t const color, uint8_t const position);
void SetLEDColor(color_t const color);
color_t const colorTable[] =
{
{ LED_MAX_BRIGHT, LED_MIN_BRIGHT, LED_MIN_BRIGHT }, // Red
{ LED_MAX_BRIGHT, LED_MAX_BRIGHT, LED_MIN_BRIGHT }, // Yellow
{ LED_MIN_BRIGHT, LED_MAX_BRIGHT, LED_MIN_BRIGHT }, // Green
{ LED_MIN_BRIGHT, LED_MAX_BRIGHT, LED_MAX_BRIGHT }, // Cyan
{ LED_MIN_BRIGHT, LED_MIN_BRIGHT, LED_MAX_BRIGHT }, // Blue
{ LED_MAX_BRIGHT, LED_MIN_BRIGHT, LED_MAX_BRIGHT } // Purple
};
color_t const off = {LED_MIN_BRIGHT, LED_MIN_BRIGHT, LED_MIN_BRIGHT};
int main(void)
{
color_t currentColor;
uint8_t colorIndex = 0;
uint8_t i;
/* Initializes MCU, drivers and middle ware */
SYSTEM_Initialize();
ClearLEDs();
_delay_ms(DELAY_TIME);
while (1)
ClearLEDs();
_delay_ms(DELAY_TIME_MS);
while (true)
{
colorIndex = 0;
for(i = 0; i < 6; i++)
for(uint8_t colorIdx = 0; colorIdx < 6; ++colorIdx)
{
currentColor.redChannel = colorTable[colorIndex++];
currentColor.greenChannel = colorTable[colorIndex++];
currentColor.blueChannel = colorTable[colorIndex++];
color_t const currentColor = colorTable[colorIdx];
WalkLight(currentColor);
}
}
}
void WalkLight(color_t color)
inline void ClearLEDs(void)
{
uint8_t i;
for(i = POSITION_MIN; i < POSITION_MAX; i++)
for (uint8_t ledIdx = 0; ledIdx < NUMBER_OF_LEDS; ++ledIdx)
{
LightIntoPosition(color, i);
_delay_ms(DELAY_TIME);
}
for(i = POSITION_MAX+1; i > POSITION_MIN; i--)
{
LightIntoPosition(color, i-1);
_delay_ms(DELAY_TIME);
SetLEDColor(off);
}
}
void LightIntoPosition(color_t color, uint8_t position)
void WalkLight(color_t const color)
{
uint8_t i;
color_t off = {LED_MIN_BRIGHT, LED_MIN_BRIGHT, LED_MIN_BRIGHT};
for(i = 0; i < position; i++)
for (uint8_t position = POSITION_MIN; position < POSITION_MAX; ++position)
{
LightIntoPosition(color, position);
_delay_ms(DELAY_TIME_MS);
}
for (uint8_t position = POSITION_MAX + 1; position > POSITION_MIN; --position)
{
LightIntoPosition(color, position - 1);
_delay_ms(DELAY_TIME_MS);
}
}
void LightIntoPosition(color_t const color, uint8_t const position)
{
for (uint8_t idx = 0; idx < position; ++idx)
{
SetLEDColor(off);
}
SetLEDColor(color);
for(i = position + 1; i < NUMBER_OF_LEDS; i++)
for (uint8_t idx = position + 1; idx < NUMBER_OF_LEDS; ++idx)
{
SetLEDColor(off);
}
}
void SetLEDColor(color_t color)
void SetLEDColor(color_t const color)
{
TCA0_Enable();
SPI0_ExchangeByte(color.redChannel);
SPI0_ExchangeByte(color.blueChannel);
SPI0_ExchangeByte(color.greenChannel);
TCA0_Disable();
}
TCA0_Start();
void ClearLEDs(void)
{
int i;
color_t off = {LED_MIN_BRIGHT, LED_MIN_BRIGHT, LED_MIN_BRIGHT};
for(i = 0; i < NUMBER_OF_LEDS; i++)
{
SetLEDColor(off);
}
}
SPI0_ByteExchange(color.redChannel);
SPI0_ByteExchange(color.blueChannel);
SPI0_ByteExchange(color.greenChannel);
TCA0_Stop();
}

Wyświetl plik

@ -0,0 +1,38 @@
/**
* CCL Generated Header File
*
* @file ccl.h
*
* @defgroup ccl CCL
*
* @brief This file contains the API prototype for the CCL driver.
*
* @version Driver Version 1.1.0
*/
#include <stdint.h>
#include <stdbool.h>
#ifndef CCL_H_INCLUDED
#define CCL_H_INCLUDED
#include "../system/utils/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup ccl
* @brief Initializes the CCL. This is called only once during the system initialization.
* @pre None.
* @param None.
* @return None.
*/
int8_t CCL_Initialize(void);
#ifdef __cplusplus
}
#endif
#endif /* CCL_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,144 @@
/**
* CCL Generated Driver File
*
* @file ccl.c
*
* @ingroup ccl
*
* @brief This file contains the API implementations for the CCL driver.
*
* @version Driver Version 1.1.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../ccl.h"
int8_t CCL_Initialize(void)
{
//INTMODE0 INTDISABLE; INTMODE1 INTDISABLE; INTMODE2 INTDISABLE; INTMODE3 INTDISABLE;
CCL.INTCTRL0 = 0x0;
//INTMODE4 INTDISABLE; INTMODE5 INTDISABLE;
CCL.INTCTRL1 = 0x0;
//INT 0x0;
CCL.INTFLAGS = 0x0;
//INSEL0 TCA0; INSEL1 SPI0;
CCL.LUT0CTRLB = 0x9A;
//INSEL2 TCA0;
CCL.LUT0CTRLC = 0xA;
//INSEL0 MASK; INSEL1 MASK;
CCL.LUT1CTRLB = 0x0;
//INSEL2 MASK;
CCL.LUT1CTRLC = 0x0;
//INSEL0 MASK; INSEL1 MASK;
CCL.LUT2CTRLB = 0x0;
//INSEL2 MASK;
CCL.LUT2CTRLC = 0x0;
//INSEL0 MASK; INSEL1 MASK;
CCL.LUT3CTRLB = 0x0;
//INSEL2 MASK;
CCL.LUT3CTRLC = 0x0;
//INSEL0 MASK; INSEL1 MASK;
CCL.LUT4CTRLB = 0x0;
//INSEL2 MASK;
CCL.LUT4CTRLC = 0x0;
//INSEL0 MASK; INSEL1 MASK;
CCL.LUT5CTRLB = 0x0;
//INSEL2 MASK;
CCL.LUT5CTRLC = 0x0;
//SEQSEL DISABLE;
CCL.SEQCTRL0 = 0x0;
//SEQSEL DISABLE;
CCL.SEQCTRL1 = 0x0;
//SEQSEL DISABLE;
CCL.SEQCTRL2 = 0x0;
//TRUTH 224;
CCL.TRUTH0 = 0xE0;
//TRUTH 0;
CCL.TRUTH1 = 0x0;
//TRUTH 0;
CCL.TRUTH2 = 0x0;
//TRUTH 0;
CCL.TRUTH3 = 0x0;
//TRUTH 0;
CCL.TRUTH4 = 0x0;
//TRUTH 0;
CCL.TRUTH5 = 0x0;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE enabled; FILTSEL DISABLE; OUTEN enabled;
CCL.LUT0CTRLA = 0x41;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE disabled; FILTSEL DISABLE; OUTEN disabled;
CCL.LUT1CTRLA = 0x0;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE disabled; FILTSEL DISABLE; OUTEN disabled;
CCL.LUT2CTRLA = 0x0;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE disabled; FILTSEL DISABLE; OUTEN disabled;
CCL.LUT3CTRLA = 0x0;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE disabled; FILTSEL DISABLE; OUTEN disabled;
CCL.LUT4CTRLA = 0x0;
//CLKSRC CLKPER; EDGEDET DIS; ENABLE disabled; FILTSEL DISABLE; OUTEN disabled;
CCL.LUT5CTRLA = 0x0;
//ENABLE enabled; RUNSTDBY disabled;
CCL.CTRLA = 0x1;
return 0;
}
ISR(CCL_CCL_vect)
{
/*
* Insert your CCL interrupt handling code
*
* Interrupt flag can be cleared by writing 1 to its bit location
* in the INTFLAGS register
*/
}

Wyświetl plik

@ -1,41 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef CLOCK_CONFIG_H
#define CLOCK_CONFIG_H
#ifndef F_CPU
#define F_CPU 24000000
#endif
#endif // CLOCK_CONFIG_H

Wyświetl plik

@ -1,49 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include <avr/io.h>
/**
* \Configures Fuse bits
*/
FUSES =
{
.BODCFG = ACTIVE_DISABLE_gc | LVL_BODLEVEL0_gc | SAMPFREQ_128Hz_gc | SLEEP_DISABLE_gc,
.BOOTSIZE = 0,
.CODESIZE = 0,
.OSCCFG = CLKSEL_OSCHF_gc,
.SYSCFG0 = CRCSEL_CRC16_gc | CRCSRC_NOCRC_gc | RSTPINCFG_GPIO_gc,
.SYSCFG1 = SUT_0MS_gc,
.WDTCFG = PERIOD_OFF_gc | WINDOW_OFF_gc,
};

Wyświetl plik

@ -0,0 +1,62 @@
/**
*
* @file evsys.h
*
* @defgroup evsys_driver Event System
*
* @brief This file contains API prototypes for EVSYS driver.
*
* @version EVSYS Driver Version 1.1.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef EVSYS_H_INCLUDED
#define EVSYS_H_INCLUDED
#include "../system/utils/compiler.h"
/**
* @ingroup evsys_driver
* @brief Initializes the EVSYS driver.
* @param none
* @return none
*/
int8_t EVSYS_Initialize(void);
/**
* @ingroup evsys_driver
* @brief Updates the SWEVENTA register.
* @param channel - 8-bit integer representing event channel that generates a software event. For example to select CH0(CHANNEL0) set value as 0x1.
* @return none
*/
void EVSYS_SoftwareEventASet(uint8_t channel);
/**
* @ingroup evsys_driver
* @brief Updates the SWEVENTB register.
* @param channel - 8-bit integer representing event channel that generates a software event. For example to select CH8(CHANNEL8) set value as 0x1.
* @return none
*/
void EVSYS_SoftwareEventBSet(uint8_t channel);
#endif /* EVSYS_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,145 @@
/**
*
* @file evsys.c
*
* @ingroup evsys_driver
*
* @brief This file contains the implementation for EVSYS driver
*
* @version EVSYS Driver Version 1.1.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../evsys.h"
int8_t EVSYS_Initialize()
{
//CHANNEL0 SPI0_SCK;
EVSYS.CHANNEL0 = 0x68;
//CHANNEL1 OFF;
EVSYS.CHANNEL1 = 0x0;
//CHANNEL2 OFF;
EVSYS.CHANNEL2 = 0x0;
//CHANNEL3 OFF;
EVSYS.CHANNEL3 = 0x0;
//CHANNEL4 OFF;
EVSYS.CHANNEL4 = 0x0;
//CHANNEL5 OFF;
EVSYS.CHANNEL5 = 0x0;
//USER OFF;
EVSYS.USERADC0START = 0x0;
//USER OFF;
EVSYS.USERCCLLUT0A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT0B = 0x0;
//USER OFF;
EVSYS.USERCCLLUT1A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT1B = 0x0;
//USER OFF;
EVSYS.USERCCLLUT2A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT2B = 0x0;
//USER OFF;
EVSYS.USERCCLLUT3A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT3B = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTA = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTB = 0x0;
//USER OFF;
EVSYS.USERTCA0CNTA = 0x0;
//USER CHANNEL0;
EVSYS.USERTCA0CNTB = 0x1;
//USER OFF;
EVSYS.USERTCB0CAPT = 0x0;
//USER OFF;
EVSYS.USERTCB0COUNT = 0x0;
//USER OFF;
EVSYS.USERTCB1CAPT = 0x0;
//USER OFF;
EVSYS.USERTCB1COUNT = 0x0;
//USER OFF;
EVSYS.USERUSART0IRDA = 0x0;
//USER OFF;
EVSYS.USERUSART1IRDA = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTC = 0x0;
//CHANNEL6 OFF;
EVSYS.CHANNEL6 = 0x0;
//CHANNEL7 OFF;
EVSYS.CHANNEL7 = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTD = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTF = 0x0;
//USER OFF;
EVSYS.USERPTCSTART = 0x0;
//USER OFF;
EVSYS.USERTCB2CAPT = 0x0;
//USER OFF;
EVSYS.USERTCB2COUNT = 0x0;
//USER OFF;
EVSYS.USERTCD0INPUTA = 0x0;
//USER OFF;
EVSYS.USERTCD0INPUTB = 0x0;
//USER OFF;
EVSYS.USERUSART2IRDA = 0x0;
//CHANNEL8 OFF;
EVSYS.CHANNEL8 = 0x0;
//CHANNEL9 OFF;
EVSYS.CHANNEL9 = 0x0;
//USER OFF;
EVSYS.USERCCLLUT4A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT4B = 0x0;
//USER OFF;
EVSYS.USERCCLLUT5A = 0x0;
//USER OFF;
EVSYS.USERCCLLUT5B = 0x0;
//USER OFF;
EVSYS.USEREVSYSEVOUTE = 0x0;
//USER OFF;
EVSYS.USERTCA1CNTA = 0x0;
//USER OFF;
EVSYS.USERTCA1CNTB = 0x0;
//USER OFF;
EVSYS.USERTCB3CAPT = 0x0;
//USER OFF;
EVSYS.USERTCB3COUNT = 0x0;
//USER OFF;
EVSYS.USERUSART3IRDA = 0x0;
//USER OFF;
EVSYS.USERUSART4IRDA = 0x0;
return 0;
}
void EVSYS_SoftwareEventASet(uint8_t channel){
EVSYS.SWEVENTA = channel;
}
void EVSYS_SoftwareEventBSet(uint8_t channel){
EVSYS.SWEVENTB = channel;
}

Wyświetl plik

@ -1,68 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef CCL_H_INCLUDED
#define CCL_H_INCLUDED
#include "../utils/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
@Summary
Initializes the CCL_Initialize.
@Description
This routine initializes the CCL_Initialize.
This routine should only be called once during system initialization.
@Preconditions
None
@Param
None
@Example
<code>
CCL_Initialize();
</code>
*/
int8_t CCL_Initialize(void);
#ifdef __cplusplus
}
#endif
#endif /* CCL_H_INCLUDED */

Wyświetl plik

@ -1,82 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef CPU_CCP_H
#define CPU_CCP_H
#include "../utils/compiler.h"
#include "../include/protected_io.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Write to a CCP-protected 8-bit I/O register
*
* \param addr Address of the I/O register
* \param value Value to be written
*
* \note Using IAR Embedded workbench, the choice of memory model has an impact
* on calling convention. The memory model is not visible to the
* preprocessor, so it must be defined in the Assembler preprocessor directives.
*/
static inline void ccp_write_io(void *addr, uint8_t value)
{
protected_write_io(addr, CCP_IOREG_gc, value);
}
/** @} */
/**
* \brief Write to CCP-protected 8-bit SPM register
*
* \param addr Address of the SPM register
* \param value Value to be written
*
* \note Using IAR Embedded workbench, the choice of memory model has an impact
* on calling convention. The memory model is not visible to the
* preprocessor, so it must be defined in the Assembler preprocessor directives.
*/
static inline void ccp_write_spm(void *addr, uint8_t value)
{
protected_write_io(addr, CCP_SPM_gc, value);
}
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* CPU_CCP_H */

Wyświetl plik

@ -1,54 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef CPUINT_H_INCLUDED
#define CPUINT_H_INCLUDED
#include "../utils/compiler.h"
#include "ccp.h"
#include "../utils/atomic.h"
#ifdef __cplusplus
extern "C" {
#endif /** \
* \brief Initialize cpuint interface \
* \
* \return Initialization status \
*/
int8_t CPUINT_Initialize();
#ifdef __cplusplus
}
#endif
#endif /* CPUINT_H_INCLUDED */

Wyświetl plik

@ -1,68 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef EVSYS_H_INCLUDED
#define EVSYS_H_INCLUDED
#include "../utils/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
@Summary
Initializes the EVSYS_Initialize.
@Description
This routine initializes the EVSYS_Initialize.
This routine should only be called once during system initialization.
@Preconditions
None
@Param
None
@Example
<code>
EVSYS_Initialize();
</code>
*/
int8_t EVSYS_Initialize(void);
#ifdef __cplusplus
}
#endif
#endif /* CCL_H_INCLUDED */

Wyświetl plik

@ -1,240 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef PINS_H_INCLUDED
#define PINS_H_INCLUDED
#include <avr/io.h>
#include "port.h"
//get/set PB3 aliases
#define PB3_SetHigh() do { PORTB_OUTSET = 0x8; } while(0)
#define PB3_SetLow() do { PORTB_OUTCLR = 0x8; } while(0)
#define PB3_Toggle() do { PORTB_OUTTGL = 0x8; } while(0)
#define PB3_GetValue() (VPORTB.IN & (0x1 << 3))
#define PB3_SetDigitalInput() do { PORTB_DIRCLR = 0x8; } while(0)
#define PB3_SetDigitalOutput() do { PORTB_DIRSET = 0x8; } while(0)
#define PB3_SetPullUp() do { PORTB_PIN3CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PB3_ResetPullUp() do { PORTB_PIN3CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PB3_SetInverted() do { PORTB_PIN3CTRL |= PORT_INVEN_bm; } while(0)
#define PB3_ResetInverted() do { PORTB_PIN3CTRL &= ~PORT_INVEN_bm; } while(0)
#define PB3_DisableInterruptOnChange() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PB3_EnableInterruptForBothEdges() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PB3_EnableInterruptForRisingEdge() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PB3_EnableInterruptForFallingEdge() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PB3_DisableDigitalInputBuffer() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PB3_EnableInterruptForLowLevelSensing() do { PORTB.PIN3CTRL = (PORTB.PIN3CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA2 aliases
#define PA2_SetHigh() do { PORTA_OUTSET = 0x4; } while(0)
#define PA2_SetLow() do { PORTA_OUTCLR = 0x4; } while(0)
#define PA2_Toggle() do { PORTA_OUTTGL = 0x4; } while(0)
#define PA2_GetValue() (VPORTA.IN & (0x1 << 2))
#define PA2_SetDigitalInput() do { PORTA_DIRCLR = 0x4; } while(0)
#define PA2_SetDigitalOutput() do { PORTA_DIRSET = 0x4; } while(0)
#define PA2_SetPullUp() do { PORTA_PIN2CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA2_ResetPullUp() do { PORTA_PIN2CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA2_SetInverted() do { PORTA_PIN2CTRL |= PORT_INVEN_bm; } while(0)
#define PA2_ResetInverted() do { PORTA_PIN2CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA2_DisableInterruptOnChange() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA2_EnableInterruptForBothEdges() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA2_EnableInterruptForRisingEdge() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA2_EnableInterruptForFallingEdge() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA2_DisableDigitalInputBuffer() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA2_EnableInterruptForLowLevelSensing() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PC3 aliases
#define PC3_SetHigh() do { PORTC_OUTSET = 0x8; } while(0)
#define PC3_SetLow() do { PORTC_OUTCLR = 0x8; } while(0)
#define PC3_Toggle() do { PORTC_OUTTGL = 0x8; } while(0)
#define PC3_GetValue() (VPORTC.IN & (0x1 << 3))
#define PC3_SetDigitalInput() do { PORTC_DIRCLR = 0x8; } while(0)
#define PC3_SetDigitalOutput() do { PORTC_DIRSET = 0x8; } while(0)
#define PC3_SetPullUp() do { PORTC_PIN3CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PC3_ResetPullUp() do { PORTC_PIN3CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PC3_SetInverted() do { PORTC_PIN3CTRL |= PORT_INVEN_bm; } while(0)
#define PC3_ResetInverted() do { PORTC_PIN3CTRL &= ~PORT_INVEN_bm; } while(0)
#define PC3_DisableInterruptOnChange() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PC3_EnableInterruptForBothEdges() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PC3_EnableInterruptForRisingEdge() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PC3_EnableInterruptForFallingEdge() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PC3_DisableDigitalInputBuffer() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PC3_EnableInterruptForLowLevelSensing() do { PORTC.PIN3CTRL = (PORTC.PIN3CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA1 aliases
#define PA1_SetHigh() do { PORTA_OUTSET = 0x2; } while(0)
#define PA1_SetLow() do { PORTA_OUTCLR = 0x2; } while(0)
#define PA1_Toggle() do { PORTA_OUTTGL = 0x2; } while(0)
#define PA1_GetValue() (VPORTA.IN & (0x1 << 1))
#define PA1_SetDigitalInput() do { PORTA_DIRCLR = 0x2; } while(0)
#define PA1_SetDigitalOutput() do { PORTA_DIRSET = 0x2; } while(0)
#define PA1_SetPullUp() do { PORTA_PIN1CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA1_ResetPullUp() do { PORTA_PIN1CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA1_SetInverted() do { PORTA_PIN1CTRL |= PORT_INVEN_bm; } while(0)
#define PA1_ResetInverted() do { PORTA_PIN1CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA1_DisableInterruptOnChange() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA1_EnableInterruptForBothEdges() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA1_EnableInterruptForRisingEdge() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA1_EnableInterruptForFallingEdge() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA1_DisableDigitalInputBuffer() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA1_EnableInterruptForLowLevelSensing() do { PORTA.PIN1CTRL = (PORTA.PIN1CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA4 aliases
#define PA4_SetHigh() do { PORTA_OUTSET = 0x10; } while(0)
#define PA4_SetLow() do { PORTA_OUTCLR = 0x10; } while(0)
#define PA4_Toggle() do { PORTA_OUTTGL = 0x10; } while(0)
#define PA4_GetValue() (VPORTA.IN & (0x1 << 4))
#define PA4_SetDigitalInput() do { PORTA_DIRCLR = 0x10; } while(0)
#define PA4_SetDigitalOutput() do { PORTA_DIRSET = 0x10; } while(0)
#define PA4_SetPullUp() do { PORTA_PIN4CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA4_ResetPullUp() do { PORTA_PIN4CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA4_SetInverted() do { PORTA_PIN4CTRL |= PORT_INVEN_bm; } while(0)
#define PA4_ResetInverted() do { PORTA_PIN4CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA4_DisableInterruptOnChange() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA4_EnableInterruptForBothEdges() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA4_EnableInterruptForRisingEdge() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA4_EnableInterruptForFallingEdge() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA4_DisableDigitalInputBuffer() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA4_EnableInterruptForLowLevelSensing() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA3 aliases
#define PA3_SetHigh() do { PORTA_OUTSET = 0x8; } while(0)
#define PA3_SetLow() do { PORTA_OUTCLR = 0x8; } while(0)
#define PA3_Toggle() do { PORTA_OUTTGL = 0x8; } while(0)
#define PA3_GetValue() (VPORTA.IN & (0x1 << 3))
#define PA3_SetDigitalInput() do { PORTA_DIRCLR = 0x8; } while(0)
#define PA3_SetDigitalOutput() do { PORTA_DIRSET = 0x8; } while(0)
#define PA3_SetPullUp() do { PORTA_PIN3CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA3_ResetPullUp() do { PORTA_PIN3CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA3_SetInverted() do { PORTA_PIN3CTRL |= PORT_INVEN_bm; } while(0)
#define PA3_ResetInverted() do { PORTA_PIN3CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA3_DisableInterruptOnChange() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA3_EnableInterruptForBothEdges() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA3_EnableInterruptForRisingEdge() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA3_EnableInterruptForFallingEdge() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA3_DisableDigitalInputBuffer() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA3_EnableInterruptForLowLevelSensing() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA6 aliases
#define PA6_SetHigh() do { PORTA_OUTSET = 0x40; } while(0)
#define PA6_SetLow() do { PORTA_OUTCLR = 0x40; } while(0)
#define PA6_Toggle() do { PORTA_OUTTGL = 0x40; } while(0)
#define PA6_GetValue() (VPORTA.IN & (0x1 << 6))
#define PA6_SetDigitalInput() do { PORTA_DIRCLR = 0x40; } while(0)
#define PA6_SetDigitalOutput() do { PORTA_DIRSET = 0x40; } while(0)
#define PA6_SetPullUp() do { PORTA_PIN6CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA6_ResetPullUp() do { PORTA_PIN6CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA6_SetInverted() do { PORTA_PIN6CTRL |= PORT_INVEN_bm; } while(0)
#define PA6_ResetInverted() do { PORTA_PIN6CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA6_DisableInterruptOnChange() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA6_EnableInterruptForBothEdges() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA6_EnableInterruptForRisingEdge() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA6_EnableInterruptForFallingEdge() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA6_DisableDigitalInputBuffer() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA6_EnableInterruptForLowLevelSensing() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA5 aliases
#define PA5_SetHigh() do { PORTA_OUTSET = 0x20; } while(0)
#define PA5_SetLow() do { PORTA_OUTCLR = 0x20; } while(0)
#define PA5_Toggle() do { PORTA_OUTTGL = 0x20; } while(0)
#define PA5_GetValue() (VPORTA.IN & (0x1 << 5))
#define PA5_SetDigitalInput() do { PORTA_DIRCLR = 0x20; } while(0)
#define PA5_SetDigitalOutput() do { PORTA_DIRSET = 0x20; } while(0)
#define PA5_SetPullUp() do { PORTA_PIN5CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA5_ResetPullUp() do { PORTA_PIN5CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA5_SetInverted() do { PORTA_PIN5CTRL |= PORT_INVEN_bm; } while(0)
#define PA5_ResetInverted() do { PORTA_PIN5CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA5_DisableInterruptOnChange() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA5_EnableInterruptForBothEdges() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA5_EnableInterruptForRisingEdge() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA5_EnableInterruptForFallingEdge() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA5_DisableDigitalInputBuffer() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA5_EnableInterruptForLowLevelSensing() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PD3 aliases
#define PD3_SetHigh() do { PORTD_OUTSET = 0x8; } while(0)
#define PD3_SetLow() do { PORTD_OUTCLR = 0x8; } while(0)
#define PD3_Toggle() do { PORTD_OUTTGL = 0x8; } while(0)
#define PD3_GetValue() (VPORTD.IN & (0x1 << 3))
#define PD3_SetDigitalInput() do { PORTD_DIRCLR = 0x8; } while(0)
#define PD3_SetDigitalOutput() do { PORTD_DIRSET = 0x8; } while(0)
#define PD3_SetPullUp() do { PORTD_PIN3CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PD3_ResetPullUp() do { PORTD_PIN3CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PD3_SetInverted() do { PORTD_PIN3CTRL |= PORT_INVEN_bm; } while(0)
#define PD3_ResetInverted() do { PORTD_PIN3CTRL &= ~PORT_INVEN_bm; } while(0)
#define PD3_DisableInterruptOnChange() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PD3_EnableInterruptForBothEdges() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PD3_EnableInterruptForRisingEdge() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PD3_EnableInterruptForFallingEdge() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PD3_DisableDigitalInputBuffer() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PD3_EnableInterruptForLowLevelSensing() do { PORTD.PIN3CTRL = (PORTD.PIN3CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
//get/set PA0 aliases
#define PA0_SetHigh() do { PORTA_OUTSET = 0x1; } while(0)
#define PA0_SetLow() do { PORTA_OUTCLR = 0x1; } while(0)
#define PA0_Toggle() do { PORTA_OUTTGL = 0x1; } while(0)
#define PA0_GetValue() (VPORTA.IN & (0x1 << 0))
#define PA0_SetDigitalInput() do { PORTA_DIRCLR = 0x1; } while(0)
#define PA0_SetDigitalOutput() do { PORTA_DIRSET = 0x1; } while(0)
#define PA0_SetPullUp() do { PORTA_PIN0CTRL |= PORT_PULLUPEN_bm; } while(0)
#define PA0_ResetPullUp() do { PORTA_PIN0CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define PA0_SetInverted() do { PORTA_PIN0CTRL |= PORT_INVEN_bm; } while(0)
#define PA0_ResetInverted() do { PORTA_PIN0CTRL &= ~PORT_INVEN_bm; } while(0)
#define PA0_DisableInterruptOnChange() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define PA0_EnableInterruptForBothEdges() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define PA0_EnableInterruptForRisingEdge() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define PA0_EnableInterruptForFallingEdge() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define PA0_DisableDigitalInputBuffer() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define PA0_EnableInterruptForLowLevelSensing() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
void PIN_MANAGER_Initialize();
void PORTB_PB3_DefaultInterruptHandler(void);
void PORTB_PB3_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA2_DefaultInterruptHandler(void);
void PORTA_PA2_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTC_PC3_DefaultInterruptHandler(void);
void PORTC_PC3_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA1_DefaultInterruptHandler(void);
void PORTA_PA1_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA4_DefaultInterruptHandler(void);
void PORTA_PA4_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA3_DefaultInterruptHandler(void);
void PORTA_PA3_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA6_DefaultInterruptHandler(void);
void PORTA_PA6_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA5_DefaultInterruptHandler(void);
void PORTA_PA5_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTD_PD3_DefaultInterruptHandler(void);
void PORTD_PD3_SetInterruptHandler(void (* interruptHandler)(void)) ;
void PORTA_PA0_DefaultInterruptHandler(void);
void PORTA_PA0_SetInterruptHandler(void (* interruptHandler)(void)) ;
#endif /* PINS_H_INCLUDED */

Wyświetl plik

@ -1,95 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
/**
* \defgroup doc_driver_system_protected_io Protected IO
* \ingroup doc_driver_system
*
* \section doc_driver_protected_io_rev Revision History
* - v0.0.0.1 Initial Commit
*
*@{
*/
#ifndef PROTECTED_IO_H
#define PROTECTED_IO_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__DOXYGEN__)
//! \name IAR Memory Model defines.
//@{
/**
* \def CONFIG_MEMORY_MODEL_TINY
* \brief Configuration symbol to enable 8 bit pointers.
*
*/
#define CONFIG_MEMORY_MODEL_TINY
/**
* \def CONFIG_MEMORY_MODEL_SMALL
* \brief Configuration symbol to enable 16 bit pointers.
* \note If no memory model is defined, SMALL is default.
*
*/
#define CONFIG_MEMORY_MODEL_SMALL
/**
* \def CONFIG_MEMORY_MODEL_LARGE
* \brief Configuration symbol to enable 24 bit pointers.
*
*/
#define CONFIG_MEMORY_MODEL_LARGE
//@}
#endif
/**
* \brief Write to am 8-bit I/O register protected by CCP or a protection bit
*
* \param addr Address of the I/O register
* \param magic CCP magic value or Mask for protection bit
* \param value Value to be written
*
* \note Using IAR Embedded workbench, the choice of memory model has an impact
* on calling convention. The memory model is not visible to the
* preprocessor, so it must be defined in the Assembler preprocessor directives.
*/
extern void protected_write_io(void *addr, uint8_t magic, uint8_t value);
/** @} */
#endif /* PROTECTED_IO_H */

Wyświetl plik

@ -1,65 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef RSTCTRL_INCLUDED
#define RSTCTRL_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include "ccp.h"
static inline void RSTCTRL_reset(void)
{
/* SWRR is protected with CCP */
ccp_write_io((void *)&RSTCTRL.SWRR, 0x0);
}
static inline uint8_t RSTCTRL_get_reset_cause(void)
{
return RSTCTRL.RSTFR;
}
static inline void RSTCTRL_clear_reset_cause(void)
{
RSTCTRL.RSTFR
= RSTCTRL_UPDIRF_bm | RSTCTRL_SWRF_bm | RSTCTRL_WDRF_bm | RSTCTRL_EXTRF_bm | RSTCTRL_BORF_bm | RSTCTRL_PORF_bm;
}
#ifdef __cplusplus
}
#endif
#endif /* RSTCTRL_INCLUDED */

Wyświetl plik

@ -1,237 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef SPI0_BASIC_H_INCLUDED
#define SPI0_BASIC_H_INCLUDED
#include "../utils/compiler.h"
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Function pointer to callback function called by SPI IRQ.
NULL=default value: No callback function is to be used.
*/
typedef void (*spi0_TRANSFER_DONE_CB)(void);
typedef struct {
// hardware stuff that controls SPI mode
// hardware stuff that controls SPI baud rate
uint8_t CTRLAvalue;
uint8_t CTRLBvalue;
} spi0_configuration_t;
/** Specify whether the SPI transfer is to be uni- or bidirectional.
A bidirectional transfer (=SPI_EXCHANGE) causes the received data
to overwrite the buffer with the data to transmit.
*/
typedef enum spi0_transfer_type {
SPI0_EXCHANGE, ///< SPI transfer is bidirectional
SPI0_READ, ///< SPI transfer reads, writes only 0s
SPI0_WRITE ///< SPI transfer writes, discards read data
} spi0_transfer_type_t;
/** Status of the SPI hardware and SPI bus.*/
typedef enum spi0_transfer_status {
SPI0_FREE, ///< SPI hardware is not open, bus is free.
SPI0_IDLE, ///< SPI hardware has been opened, no transfer ongoing.
SPI0_BUSY, ///< SPI hardware has been opened, transfer ongoing.
SPI0_DONE ///< SPI hardware has been opened, transfer complete.
} spi0_transfer_status_t;
/** Enumeration of the different configurations supported by the driver.
A configuration is specified as parameter to SPI0_open(),
and is used by the function to set SPI parameters as specified by the
configuration. A user may specify a configuration, e.g. SLAVE_A, used when
communication over SPI with SLAVE_A, and another configuration, SLAVE_B,
used when communication with SLAVE_B. The configurations may use different
SPI configuration such as polarity or SCK frequency.
*/
typedef enum {
SPI0_DEFAULT
} SPI0_configuration_name_t;
/**
* \brief Initialize SPI interface
* If module is configured to disabled state, the clock to the SPI is disabled
* if this is supported by the device's clock system.
*
* \return Initialization status.
* \retval 0 the SPI init was successful
* \retval 1 the SPI init was not successful
*/
uint8_t SPI0_Initialize(void);
/**
* \brief Enable SPI0
* 1. If supported by the clock system, enables the clock to the SPI
* 2. Enables the SPI module by setting the enable-bit in the SPI control register
*
* \return Nothing
*/
void SPI0_Enable();
/**
* \brief Disable SPI0
* 1. Disables the SPI module by clearing the enable-bit in the SPI control register
* 2. If supported by the clock system, disables the clock to the SPI
*
* \return Nothing
*/
void SPI0_Disable();
/**
* \brief Open the SPI SPI0 for communication
*
* \param[in] spiUniqueconfiguration The configuration to use in the transfer
*
* \return Initialization status.
* \retval false The SPI open was successful
* \retval true The SPI open was successful
*/
bool SPI0_Open(spi0_configuration_t spiUniqueConfiguration);
/**
* \brief Sets the index of Configuration to use in the transfer
*
* \param[in] spiUniqueconfiguration The configuration index
*
* \return Setting status.
*/
bool SPI0_OpenConfiguration(uint8_t spiUniqueConfiguration);
/**
* \brief Close the SPI SPI0 for communication
*
* \return Nothing
*/
void SPI0_Close(void);
/**
* \brief Exchange one byte over SPI SPI0. Blocks until done.
*
* \param[in] data The byte to transfer
*
* \return Received data byte.
*/
uint8_t SPI0_ExchangeByte(uint8_t data);
/**
* \brief Exchange a buffer over SPI SPI0. Blocks if using polled driver.
*
* \param[inout] block The buffer to transfer. Received data is returned here.
* \param[in] size The size of buffer to transfer
*
* \return Nothing.
*/
void SPI0_ExchangeBlock(void *block, size_t size);
/**
* \brief Write a buffer over SPI SPI0. Blocks if using polled driver.
*
* \param[in] block The buffer to transfer
* \param[in] size The size of buffer to transfer
*
* \return Nothing.
*/
void SPI0_WriteBlock(void *block, size_t size);
/**
* \brief Read a buffer over SPI SPI0. Blocks if using polled driver.
*
* Zeros are transmitted out of the SPI.
*
* \param[out] block Received data is written here.
* \param[in] size The size of buffer to transfer
*
* \return Nothing.
*/
void SPI0_ReadBlock(void *block, size_t size);
/**
* \brief Write a buffer over SPI SPI0. Blocks if using polled driver.
*
* \param[in] data The byte to transfer
*
* \return Nothing.
*/
void SPI0_WriteByte(uint8_t data);
/**
* \brief Read a buffer over SPI SPI0. Blocks if using polled driver.
*
* \return The received data.
*/
uint8_t SPI0_ReadByte();
/**
* \brief Check if SPI slave is selected, i.e. its SS has been asserted.
*
* \return SPI SS status
* \retval true SPI is selected
* \retval false SPI is not selected
*/
bool SPI0_Selected(void);
/**
* \brief Get received data byte from SPI
*
* \return Received data byte
*/
uint8_t SPI0_GetRxData(void);
/**
* \brief Write data byte to SPI
*
* \param[in] data The data to transfer
*
* \return Nothing
*/
void SPI0_WriteTxData(uint8_t data);
/**
* \brief Wait until SPI has recaived a data byte
*
* \return Nothing
*/
void SPI0_WaitDataready(void);
#ifdef __cplusplus
}
#endif
#endif /* SPI0_BASIC_H_INCLUDED */

Wyświetl plik

@ -1,72 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 2.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef TCA0_H_INCLUDED
#define TCA0_H_INCLUDED
#include "../utils/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Initialize tca interface
*
* \return Initialization status.
*/
typedef void (*TCA0_cb_t)(void);
int8_t TCA0_Initialize();
void TCA0_SetOVFIsrCallback(TCA0_cb_t cb);
void TCA0_SetCMP0IsrCallback(TCA0_cb_t cb);
void TCA0_SetCMP1IsrCallback(TCA0_cb_t cb);
void TCA0_SetCMP2IsrCallback(TCA0_cb_t cb);
void TCA0_EnableInterrupt(void);
void TCA0_DisableInterrupt(void);
uint16_t TCA0_ReadTimer(void);
void TCA0_WriteTimer(uint16_t timerVal);
void TCA0_ClearOverflowInterruptFlag(void);
bool TCA0_IsOverflowInterruptEnabled(void);
void TCA0_ClearCMP0InterruptFlag(void);
bool TCA0_IsCMP0InterruptEnabled(void);
void TCA0_ClearCMP1InterruptFlag(void);
bool TCA0_IsCMP1InterruptEnabled(void);
void TCA0_ClearCMP2InterruptFlag(void);
bool TCA0_IsCMP2InterruptEnabled(void);
#ifdef __cplusplus
}
#endif
#endif /* TCA0_H_INCLUDED */

Wyświetl plik

@ -1,136 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "mcc.h"
/**
* Initializes MCU, drivers and middleware in the project
**/
void SYSTEM_Initialize(void)
{
PIN_MANAGER_Initialize();
BOD_Initialize();
//CPU_Initialize();
WDT_Initialize();
SLPCTRL_Initialize();
CLKCTRL_Initialize();
SPI0_Initialize();
EVSYS_Initialize();
TCA0_Initialize();
CCL_Initialize();
CPUINT_Initialize();
}
/**
* \brief Initialize bod interface
*/
int8_t BOD_Initialize()
{
//SLEEP DIS;
ccp_write_io((void*)&(BOD.CTRLA),0x00);
//VLMCFG FALLING; VLMIE disabled;
BOD.INTCTRL = 0x00;
//VLMLVL OFF;
BOD.VLMCTRLA = 0x00;
return 0;
}
ISR(BOD_VLM_vect)
{
/* Insert your AC interrupt handling code here */
/* The interrupt flag has to be cleared manually */
BOD.INTFLAGS = BOD_VLMIE_bm;
}
/**
* \brief Initialize clkctrl interface
*/
int8_t CLKCTRL_Initialize()
{
//RUNSTDBY disabled;
ccp_write_io((void*)&(CLKCTRL.OSC32KCTRLA),0x00);
//RUNSTDBY disabled; CSUT 1K; SEL disabled; LPMODE disabled; ENABLE disabled;
ccp_write_io((void*)&(CLKCTRL.XOSC32KCTRLA),0x00);
//PDIV 6X; PEN disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLB),0x10);
//CLKOUT disabled; CLKSEL OSCHF;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLA),0x00);
//PLLS enabled; EXTS disabled; XOSC32KS disabled; OSC32KS disabled; OSCHFS disabled; SOSC disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKSTATUS),0x20);
//RUNSTDBY disabled; FREQSEL 24M; AUTOTUNE disabled;
ccp_write_io((void*)&(CLKCTRL.OSCHFCTRLA),0x24);
//LOCKEN disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKLOCK),0x00);
return 0;
}
/**
* \brief Initialize slpctrl interface
*/
int8_t SLPCTRL_Initialize()
{
//SMODE IDLE; SEN disabled;
ccp_write_io((void*)&(SLPCTRL.CTRLA),0x00);
return 0;
}
/**
* \brief Initialize wdt interface
*/
int8_t WDT_Initialize()
{
//WINDOW OFF; PERIOD OFF;
ccp_write_io((void*)&(WDT.CTRLA),0x00);
return 0;
}
/*TODO comment will remove once complier support will be available.
int8_t CPU_Initialize()
{
return 0;
}
*/

Wyświetl plik

@ -1,62 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef MCC_H
#define MCC_H
#ifdef __cplusplus
extern "C" {
#endif
#include "utils/compiler.h"
#include "include/pin_manager.h"
#include "include/ccl.h"
#include "include/spi0.h"
#include "include/cpuint.h"
#include "include/evsys.h"
#include "include/tca0.h"
#include "config/clock_config.h"
/**
* Initializes MCU, drivers and middleware in the project
**/
void SYSTEM_Initialize(void);
int8_t BOD_Initialize();
int8_t CLKCTRL_Initialize();
int8_t SLPCTRL_Initialize();
int8_t WDT_Initialize();
#ifdef __cplusplus
}
#endif
#endif /* MCC_H */

Wyświetl plik

@ -0,0 +1,222 @@
/**
* SPI0 Generated Driver API Header File
*
* @file spi0.h
*
* @defgroup spi0 SPI0
*
* @brief Contains the API prototypes for the SPI0 driver.
*
* @version SPI0 Driver Version 2.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef SPI0_BASIC_H_INCLUDED
#define SPI0_BASIC_H_INCLUDED
#include "../system/utils/compiler.h"
#include <stdbool.h>
#include "spi_interface.h"
#ifdef __cplusplus
extern "C" {
#endif
extern const struct SPI_INTERFACE SPI0_s;
/**
* @ingroup spi0
* @typedef void *spi0_TRANSFER_DONE_CB
* @brief Function pointer to the callback function called when there is an SPI interrupt. The default value is set to NULL which means that no callback function will be used.
*/
typedef void (*spi0_TRANSFER_DONE_CB)(void);
/**
* @ingroup spi0
* @typedef struct SPI0_configuration_t
* @brief Hardware configuration that controls SPI mode and baud rate
*/
typedef struct
{
uint8_t CTRLAvalue;
uint8_t CTRLBvalue;
} SPI0_configuration_t;
/**
* @ingroup spi0
* @typedef enum spi0_transfer_type_t
* @brief Specifies whether the SPI transfer is to be uni- or bidirectional. A bidirectional transfer (=SPI_EXCHANGE) causes the received data to overwrite the buffer with the data to transmit.
*/
typedef enum spi0_transfer_type
{
SPI0_EXCHANGE, ///< SPI transfer is bidirectional
SPI0_READ, ///< SPI transfer reads, writes only 0s
SPI0_WRITE ///< SPI transfer writes, discards read data
} spi0_transfer_type_t;
/**
* @ingroup spi0
* @typedef enum spi0_transfer_status_t
* @brief Status of the SPI hardware and SPI bus.
*/
typedef enum spi0_transfer_status
{
SPI0_FREE, ///< SPI hardware is not open, bus is free.
SPI0_IDLE, ///< SPI hardware has been opened, no transfer ongoing.
SPI0_BUSY, ///< SPI hardware has been opened, transfer ongoing.
SPI0_DONE ///< SPI hardware has been opened, transfer complete.
} spi0_transfer_status_t;
/**
* @ingroup spi0
* @typedef enum SPI0_configuration_name_t
* @brief Enumeration of the different configurations supported by the driver for SPI interface.
*
* NOTE: A user may specify a configuration, e.g. CLIENT_A, used when communication over SPI with CLIENT_A, and another configuration, CLIENT_B,
* used when communication with CLIENT_B. The configurations may use different SPI configuration such as polarity or SCK frequency.
*/
typedef enum
{
SPI0_DEFAULT
} SPI0_configuration_name_t;
/**
* @ingroup spi0
* @brief Initializes the SPI module.
* @param None.
* @return None.
*/
void SPI0_Initialize(void);
/**
* @ingroup spi0
* @brief Enables the SPI module.
* @param None.
* @return None.
*/
void SPI0_Enable(void);
/**
* @ingroup spi0
* @brief Disables the SPI module.
* @param None.
* @return None.
*/
void SPI0_Disable(void);
/**
* @ingroup spi0
* @brief Sets the index of Configuration to use in the transfer.
* @param uint8_t spiConfigIndex - Configuration index. See SPI0_configuration_name_t for configuration list.
* @retval True - SPI open was successful.
* @retval False - SPI open was not successful.
*/
bool SPI0_Open(uint8_t spiConfigIndex);
/**
* @ingroup spi0
* @brief Closes the SPI for communication.
* @param None.
* @return None.
*/
void SPI0_Close(void);
/**
* @ingroup spi0
* @brief Exchanges one byte over SPI. Blocks until done.
* @param uint8_t byteData - The byte to transfer.
* @return uint8_t - Received data byte.
*/
uint8_t SPI0_ByteExchange(uint8_t byteData);
/**
* @ingroup spi0
* @brief Exchanges a buffer over SPI. Blocks if using polled driver.
* @param[inout] void * bufferData The buffer to transfer. Received data is returned here.
* @param[in] size_t bufferSize The size of buffer to transfer.
* @return None.
*/
void SPI0_BufferExchange(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Writes a buffer over SPI. Blocks if using polled driver.
* @param[in] void * bufferData The buffer to transfer.
* @param[in] size_t bufferSize The size of buffer to transfer.
* @return None.
*/
void SPI0_BufferWrite(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Reads a buffer over SPI. Blocks if using polled driver.
* @param[out] void * bufferData Received data is written here.
* @param[in] size_t bufferSize The size of buffer to transfer.
* @return None.
*/
void SPI0_BufferRead(void * bufferData, size_t bufferSize);
/**
* @ingroup spi0
* @brief Writes a data byte to SPI.
* @param uint8_t byteData The byte to transfer.
* @return None.
*/
void SPI0_ByteWrite(uint8_t byteData);
/**
* @ingroup spi0
* @brief Gets the received data byte from SPI.
* @param None.
* @return uint8_t - The received data byte.
*/
uint8_t SPI0_ByteRead(void);
/**
* @ingroup spi0
* @brief Checks if SPI CLIENT is selected, i.e. its SS pin has been asserted.
* @param None.
* @retval True - SPI is selected.
* @retval False - SPI is not selected.
*/
bool SPI0_Selected(void);
/**
* @ingroup spi0
* @brief Waits until SPI has received a data byte.
* @param None.
* @return None.
*/
void SPI0_WaitDataready(void);
uint8_t __attribute__((deprecated)) SPI0_ExchangeByte(uint8_t data);
void __attribute__((deprecated)) SPI0_ExchangeBlock(void *block, size_t blockSize);
void __attribute__((deprecated)) SPI0_WriteBlock(void *block, size_t blockSize);
void __attribute__((deprecated)) SPI0_ReadBlock(void *block, size_t blockSize);
void __attribute__((deprecated)) SPI0_WriteByte(uint8_t byte);
uint8_t __attribute__((deprecated)) SPI0_ReadByte(void);
#ifdef __cplusplus
}
#endif
#endif /* SPI0_BASIC_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,86 @@
/**
SPI Generated Driver API interface File
@Company
Microchip Technology Inc.
@File Name
spi_interface.h
@Summary
This is the generated driver interface file for the SPI driver.
@Description
This interface file provides APIs for driver for SPI.
The generated drivers are tested against the following:
Compiler : XC8 v2.20
MPLAB : MPLABX v5.40
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef SPI_INTERFACE_H
#define SPI_INTERFACE_H
/**
Section: Included Files
*/
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
Section: Data Type Definitions
*/
/**
SPI Driver function structure.
@Summary
Structure containing the function pointers of SPI driver.
*/
struct SPI_INTERFACE
{
void (*Initialize)(void);
void (*Close)(void);
bool (*Open)(uint8_t spiConfigIndex);
void (*BufferExchange)(void *bufferData, size_t bufferSize);
void (*BufferRead)(void *bufferData, size_t bufferSize);
void (*BufferWrite)(void *bufferData, size_t bufferSize);
uint8_t (*ByteExchange)(uint8_t byteData);
uint8_t (*ByteRead)(void);
void (*ByteWrite)(uint8_t byteData);
};
#ifdef __cplusplus
}
#endif
#endif //SPI_INTERFACE_H

Wyświetl plik

@ -0,0 +1,207 @@
/**
* SPI0 Generated Driver File
*
* @file spi0.c
*
* @ingroup spi0
*
* @brief Contains the API Implementations for SPI0 module.
*
* @version SPI0 Driver Version 2.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../spi0.h"
typedef struct spi0_descriptor_s
{
spi0_transfer_status_t status;
} spi0_descriptor_t;
/**
SPI0_DRIVER_FUNCTION object
@brief Defines an object for SPI_DRIVER_FUNCTIONS.
*/
const struct SPI_INTERFACE SPI0_s =
{
.Initialize = SPI0_Initialize,
.Close = SPI0_Close,
.Open = SPI0_Open,
.BufferExchange = SPI0_BufferExchange,
.BufferRead = SPI0_BufferRead,
.BufferWrite = SPI0_BufferWrite,
.ByteExchange = SPI0_ByteExchange,
.ByteRead = SPI0_ByteRead,
.ByteWrite = SPI0_ByteWrite,
};
SPI0_configuration_t spi0_configurations[] =
{
{ 0x35, 0x1 }
};
static spi0_descriptor_t spi0_desc;
void SPI0_Initialize(void)
{
//BUFEN disabled; BUFWR disabled; MODE 1; SSD disabled;
SPI0.CTRLB = 0x1;
//CLK2X enabled; DORD disabled; ENABLE enabled; MASTER enabled; PRESC DIV64;
SPI0.CTRLA = 0x35;
//DREIE disabled; IE disabled; RXCIE disabled; SSIE disabled; TXCIE disabled;
SPI0.INTCTRL = 0x0;
spi0_desc.status = SPI0_FREE;
//BUFOVF disabled; DREIF disabled; RXCIF disabled; SSIF disabled; TXCIF disabled; IF disabled; WRCOL disabled;
SPI0.INTFLAGS = 0x0;
}
void SPI0_Enable(void)
{
SPI0.CTRLA |= SPI_ENABLE_bm;
}
void SPI0_Disable(void)
{
SPI0.CTRLA &= ~SPI_ENABLE_bm;
}
bool SPI0_Open(uint8_t spiConfigIndex)
{
if (spi0_desc.status == SPI0_FREE) {
spi0_desc.status = SPI0_IDLE;
SPI0.CTRLB = spi0_configurations[spiConfigIndex].CTRLBvalue;
SPI0.CTRLA = spi0_configurations[spiConfigIndex].CTRLAvalue;
return true;
} else {
return false;
}
}
void SPI0_Close(void)
{
spi0_desc.status = SPI0_FREE;
}
uint8_t SPI0_ByteExchange(uint8_t data)
{
SPI0.DATA = data;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm));
return SPI0.DATA;
}
bool SPI0_Selected(void)
{
/**
* @brief Returns true if SS pin is selected.
* TODO: Place your code here
*/
return true;
}
void SPI0_WaitDataready(void)
{
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
}
void SPI0_BufferExchange(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
while (size--) {
SPI0.DATA = *b;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
*b = SPI0.DATA;
b++;
}
}
void SPI0_BufferWrite(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
uint8_t rdata;
while (size--) {
SPI0.DATA = *b;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
rdata = SPI0.DATA;
(void)(rdata); // Silence compiler warning
b++;
}
}
void SPI0_BufferRead(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
while (size--) {
SPI0.DATA = 0;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
*b = SPI0.DATA;
b++;
}
}
void SPI0_ByteWrite(uint8_t data)
{
SPI0.DATA = data;
}
uint8_t SPI0_ByteRead(void)
{
return SPI0.DATA;
}
uint8_t SPI0_ExchangeByte(uint8_t data)
{
return SPI0_ByteExchange(data);
}
void SPI0_ExchangeBlock(void *block, size_t blockSize)
{
SPI0_BufferExchange(block, blockSize);
}
void SPI0_WriteBlock(void *block, size_t blockSize)
{
SPI0_BufferWrite(block, blockSize);
}
void SPI0_ReadBlock(void *block, size_t blockSize)
{
SPI0_BufferRead(block, blockSize);
}
void SPI0_WriteByte(uint8_t byte)
{
SPI0_ByteWrite(byte);
}
uint8_t SPI0_ReadByte(void)
{
return SPI0_ByteRead();
}

Wyświetl plik

@ -1,141 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/ccl.h"
int8_t CCL_Initialize()
{
//INTMODE3 INTDISABLE; INTMODE2 INTDISABLE; INTMODE1 INTDISABLE; INTMODE0 INTDISABLE;
CCL.INTCTRL0 = 0x00;
//INTMODE5 INTDISABLE; INTMODE4 INTDISABLE;
CCL.INTCTRL1 = 0x00;
//INT5 disabled; INT4 disabled; INT3 disabled; INT2 disabled; INT1 disabled; INT0 disabled;
CCL.INTFLAGS = 0x00;
//INSEL1 SPI0; INSEL0 TCA0;
CCL.LUT0CTRLB = 0x9A;
//INSEL2 TCA0;
CCL.LUT0CTRLC = 0x0A;
//INSEL1 MASK; INSEL0 MASK;
CCL.LUT1CTRLB = 0x00;
//INSEL2 MASK;
CCL.LUT1CTRLC = 0x00;
//INSEL1 MASK; INSEL0 MASK;
CCL.LUT2CTRLB = 0x00;
//INSEL2 MASK;
CCL.LUT2CTRLC = 0x00;
//INSEL1 MASK; INSEL0 MASK;
CCL.LUT3CTRLB = 0x00;
//INSEL2 MASK;
CCL.LUT3CTRLC = 0x00;
//INSEL1 MASK; INSEL0 MASK;
CCL.LUT4CTRLB = 0x00;
//INSEL2 MASK;
CCL.LUT4CTRLC = 0x00;
//INSEL1 MASK; INSEL0 MASK;
CCL.LUT5CTRLB = 0x00;
//INSEL2 MASK;
CCL.LUT5CTRLC = 0x00;
//SEQSEL0 DISABLE;
CCL.SEQCTRL0 = 0x00;
//SEQSEL1 DISABLE;
CCL.SEQCTRL1 = 0x00;
//SEQSEL2 DISABLE;
CCL.SEQCTRL2 = 0x00;
//
CCL.TRUTH0 = 0xE0;
//
CCL.TRUTH1 = 0x00;
//
CCL.TRUTH2 = 0x00;
//
CCL.TRUTH3 = 0x00;
//
CCL.TRUTH4 = 0x00;
//
CCL.TRUTH5 = 0x00;
//EDGEDET DIS; OUTEN enabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE enabled;
CCL.LUT0CTRLA = 0x41;
//EDGEDET DIS; OUTEN disabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE disabled;
CCL.LUT1CTRLA = 0x00;
//EDGEDET DIS; OUTEN disabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE disabled;
CCL.LUT2CTRLA = 0x00;
//EDGEDET DIS; OUTEN disabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE disabled;
CCL.LUT3CTRLA = 0x00;
//EDGEDET DIS; OUTEN disabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE disabled;
CCL.LUT4CTRLA = 0x00;
//EDGEDET DIS; OUTEN disabled; FILTSEL DISABLE; CLKSRC CLKPER; ENABLE disabled;
CCL.LUT5CTRLA = 0x00;
//RUNSTDBY disabled; ENABLE enabled;
CCL.CTRLA = 0x01;
return 0;
}
ISR(CCL_CCL_vect)
{
/*
* Insert your CCL interrupt handling code
*
* Interrupt flag can be cleared by writing 1 to its bit location
* in the INTFLAGS register
*/
}

Wyświetl plik

@ -1,54 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/cpuint.h"
/**
* \brief Initialize cpuint interface
*/
int8_t CPUINT_Initialize()
{
/* IVSEL and CVT are Configuration Change Protected */
//IVSEL disabled; CVT disabled; LVL0RR disabled;
ccp_write_io((void*)&(CPUINT.CTRLA),0x00);
//LVL0PRI 0;
CPUINT.LVL0PRI = 0x00;
//LVL1VEC 0;
CPUINT.LVL1VEC = 0x00;
return 0;
}

Wyświetl plik

@ -1,142 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/evsys.h"
int8_t EVSYS_Initialize()
{
//CHANNEL0 SPI0_SCK;
EVSYS.CHANNEL0 = 0x68;
//CHANNEL1 OFF;
EVSYS.CHANNEL1 = 0x00;
//CHANNEL2 OFF;
EVSYS.CHANNEL2 = 0x00;
//CHANNEL3 OFF;
EVSYS.CHANNEL3 = 0x00;
//CHANNEL4 OFF;
EVSYS.CHANNEL4 = 0x00;
//CHANNEL5 OFF;
EVSYS.CHANNEL5 = 0x00;
//CHANNEL6 OFF;
EVSYS.CHANNEL6 = 0x00;
//CHANNEL7 OFF;
EVSYS.CHANNEL7 = 0x00;
//CHANNEL8 OFF;
EVSYS.CHANNEL8 = 0x00;
//CHANNEL9 OFF;
EVSYS.CHANNEL9 = 0x00;
//SWEVENTA CH0;
EVSYS.SWEVENTA = 0x01;
//SWEVENTB CH8;
EVSYS.SWEVENTB = 0x00;
//USER OFF;
EVSYS.USERADC0START = 0x00;
//USER OFF;
EVSYS.USERCCLLUT0A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT0B = 0x00;
//USER OFF;
EVSYS.USERCCLLUT1A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT1B = 0x00;
//USER OFF;
EVSYS.USERCCLLUT2A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT2B = 0x00;
//USER OFF;
EVSYS.USERCCLLUT3A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT3B = 0x00;
//USER OFF;
EVSYS.USERCCLLUT4A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT4B = 0x00;
//USER OFF;
EVSYS.USERCCLLUT5A = 0x00;
//USER OFF;
EVSYS.USERCCLLUT5B = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTA = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTB = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTC = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTD = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTE = 0x00;
//USER OFF;
EVSYS.USEREVSYSEVOUTF = 0x00;
//USER OFF;
EVSYS.USERPTCSTART = 0x00;
//USER CHANNEL0;
EVSYS.USERTCA0CNTA = 0x01;
//USER CHANNEL0;
EVSYS.USERTCA0CNTB = 0x01;
//USER CHANNEL0;
EVSYS.USERTCA1CNTA = 0x01;
//USER CHANNEL0;
EVSYS.USERTCA1CNTB = 0x01;
//USER OFF;
EVSYS.USERTCB0CAPT = 0x00;
//USER OFF;
EVSYS.USERTCB0COUNT = 0x00;
//USER OFF;
EVSYS.USERTCB1CAPT = 0x00;
//USER OFF;
EVSYS.USERTCB1COUNT = 0x00;
//USER OFF;
EVSYS.USERTCB2CAPT = 0x00;
//USER OFF;
EVSYS.USERTCB2COUNT = 0x00;
//USER OFF;
EVSYS.USERTCB3CAPT = 0x00;
//USER OFF;
EVSYS.USERTCB3COUNT = 0x00;
//USER OFF;
EVSYS.USERTCD0INPUTA = 0x00;
//USER OFF;
EVSYS.USERTCD0INPUTB = 0x00;
//USER OFF;
EVSYS.USERUSART0IRDA = 0x00;
//USER OFF;
EVSYS.USERUSART1IRDA = 0x00;
//USER OFF;
EVSYS.USERUSART2IRDA = 0x00;
//USER OFF;
EVSYS.USERUSART3IRDA = 0x00;
//USER OFF;
EVSYS.USERUSART4IRDA = 0x00;
return 0;
}

Wyświetl plik

@ -1,332 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/pin_manager.h"
static void (*PORTA_PA2_InterruptHandler)(void);
static void (*PORTB_PB3_InterruptHandler)(void);
static void (*PORTA_PA1_InterruptHandler)(void);
static void (*PORTC_PC3_InterruptHandler)(void);
static void (*PORTA_PA4_InterruptHandler)(void);
static void (*PORTA_PA3_InterruptHandler)(void);
static void (*PORTA_PA6_InterruptHandler)(void);
static void (*PORTA_PA5_InterruptHandler)(void);
static void (*PORTA_PA0_InterruptHandler)(void);
static void (*PORTD_PD3_InterruptHandler)(void);
void PORT_Initialize(void);
void PIN_MANAGER_Initialize()
{
PORT_Initialize();
/* DIR Registers Initialization */
PORTA.DIR = 0x5F;
PORTB.DIR = 0x08;
PORTC.DIR = 0x08;
PORTD.DIR = 0x08;
PORTE.DIR = 0x00;
PORTF.DIR = 0x00;
/* OUT Registers Initialization */
PORTA.OUT = 0x00;
PORTB.OUT = 0x00;
PORTC.OUT = 0x00;
PORTD.OUT = 0x00;
PORTE.OUT = 0x00;
PORTF.OUT = 0x00;
/* PINxCTRL registers Initialization */
PORTA.PIN0CTRL = 0x00;
PORTA.PIN1CTRL = 0x00;
PORTA.PIN2CTRL = 0x00;
PORTA.PIN3CTRL = 0x00;
PORTA.PIN4CTRL = 0x00;
PORTA.PIN5CTRL = 0x00;
PORTA.PIN6CTRL = 0x00;
PORTA.PIN7CTRL = 0x00;
PORTB.PIN0CTRL = 0x00;
PORTB.PIN1CTRL = 0x00;
PORTB.PIN2CTRL = 0x00;
PORTB.PIN3CTRL = 0x00;
PORTB.PIN4CTRL = 0x00;
PORTB.PIN5CTRL = 0x00;
PORTB.PIN6CTRL = 0x00;
PORTB.PIN7CTRL = 0x00;
PORTC.PIN0CTRL = 0x00;
PORTC.PIN1CTRL = 0x00;
PORTC.PIN2CTRL = 0x00;
PORTC.PIN3CTRL = 0x00;
PORTC.PIN4CTRL = 0x00;
PORTC.PIN5CTRL = 0x00;
PORTC.PIN6CTRL = 0x00;
PORTC.PIN7CTRL = 0x00;
PORTD.PIN0CTRL = 0x00;
PORTD.PIN1CTRL = 0x00;
PORTD.PIN2CTRL = 0x00;
PORTD.PIN3CTRL = 0x00;
PORTD.PIN4CTRL = 0x00;
PORTD.PIN5CTRL = 0x00;
PORTD.PIN6CTRL = 0x00;
PORTD.PIN7CTRL = 0x00;
PORTE.PIN0CTRL = 0x00;
PORTE.PIN1CTRL = 0x00;
PORTE.PIN2CTRL = 0x00;
PORTE.PIN3CTRL = 0x00;
PORTE.PIN4CTRL = 0x00;
PORTE.PIN5CTRL = 0x00;
PORTE.PIN6CTRL = 0x00;
PORTE.PIN7CTRL = 0x00;
PORTF.PIN0CTRL = 0x00;
PORTF.PIN1CTRL = 0x00;
PORTF.PIN2CTRL = 0x00;
PORTF.PIN3CTRL = 0x00;
PORTF.PIN4CTRL = 0x00;
PORTF.PIN5CTRL = 0x00;
PORTF.PIN6CTRL = 0x00;
PORTF.PIN7CTRL = 0x00;
/* Multi-pin Config registers Initialization */
PORTA.PINCONFIG = 0x00;
PORTA.PINCTRLCLR = 0x00;
PORTA.PINCTRLSET = 0x00;
PORTA.PINCTRLUPD = 0x00;
PORTB.PINCONFIG = 0x00;
PORTB.PINCTRLCLR = 0x00;
PORTB.PINCTRLSET = 0x00;
PORTB.PINCTRLUPD = 0x00;
PORTC.PINCONFIG = 0x00;
PORTC.PINCTRLCLR = 0x00;
PORTC.PINCTRLSET = 0x00;
PORTC.PINCTRLUPD = 0x00;
PORTD.PINCONFIG = 0x00;
PORTD.PINCTRLCLR = 0x00;
PORTD.PINCTRLSET = 0x00;
PORTD.PINCTRLUPD = 0x00;
PORTE.PINCONFIG = 0x00;
PORTE.PINCTRLCLR = 0x00;
PORTE.PINCTRLSET = 0x00;
PORTE.PINCTRLUPD = 0x00;
PORTF.PINCONFIG = 0x00;
PORTF.PINCTRLCLR = 0x00;
PORTF.PINCTRLSET = 0x00;
PORTF.PINCTRLUPD = 0x00;
/* PORTMUX Initialization */
PORTMUX.ACROUTEA = 0x00;
PORTMUX.CCLROUTEA = 0x00;
PORTMUX.EVSYSROUTEA = 0x00;
PORTMUX.SPIROUTEA = 0x00;
PORTMUX.TCAROUTEA = 0x00;
PORTMUX.TCBROUTEA = 0x01;
PORTMUX.TCDROUTEA = 0x01;
PORTMUX.TWIROUTEA = 0x00;
PORTMUX.USARTROUTEA = 0x00;
PORTMUX.USARTROUTEB = 0x00;
PORTMUX.ZCDROUTEA = 0x00;
// register default ISC callback functions at runtime; use these methods to register a custom function
PORTA_PA2_SetInterruptHandler(PORTA_PA2_DefaultInterruptHandler);
PORTB_PB3_SetInterruptHandler(PORTB_PB3_DefaultInterruptHandler);
PORTA_PA1_SetInterruptHandler(PORTA_PA1_DefaultInterruptHandler);
PORTC_PC3_SetInterruptHandler(PORTC_PC3_DefaultInterruptHandler);
PORTA_PA4_SetInterruptHandler(PORTA_PA4_DefaultInterruptHandler);
PORTA_PA3_SetInterruptHandler(PORTA_PA3_DefaultInterruptHandler);
PORTA_PA6_SetInterruptHandler(PORTA_PA6_DefaultInterruptHandler);
PORTA_PA5_SetInterruptHandler(PORTA_PA5_DefaultInterruptHandler);
PORTA_PA0_SetInterruptHandler(PORTA_PA0_DefaultInterruptHandler);
PORTD_PD3_SetInterruptHandler(PORTD_PD3_DefaultInterruptHandler);
}
void PORT_Initialize(void)
{
/* On AVR devices all peripherals are enable from power on reset, this
* disables all peripherals to save power. Driver shall enable
* peripheral if used */
/* Set all pins to low power mode */
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTE + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTF + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTA + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTB + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTC + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
for (uint8_t i = 0; i < 8; i++) {
*((uint8_t *)&PORTD + 0x10 + i) |= 1 << PORT_PULLUPEN_bp;
}
}
/**
Allows selecting an interrupt handler for PORTA_PA2 at application runtime
*/
void PORTA_PA2_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA2_InterruptHandler = interruptHandler;
}
void PORTA_PA2_DefaultInterruptHandler(void)
{
// add your PORTA_PA2 interrupt custom code
// or set custom function using PORTA_PA2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTB_PB3 at application runtime
*/
void PORTB_PB3_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTB_PB3_InterruptHandler = interruptHandler;
}
void PORTB_PB3_DefaultInterruptHandler(void)
{
// add your PORTB_PB3 interrupt custom code
// or set custom function using PORTB_PB3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA1 at application runtime
*/
void PORTA_PA1_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA1_InterruptHandler = interruptHandler;
}
void PORTA_PA1_DefaultInterruptHandler(void)
{
// add your PORTA_PA1 interrupt custom code
// or set custom function using PORTA_PA1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTC_PC3 at application runtime
*/
void PORTC_PC3_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTC_PC3_InterruptHandler = interruptHandler;
}
void PORTC_PC3_DefaultInterruptHandler(void)
{
// add your PORTC_PC3 interrupt custom code
// or set custom function using PORTC_PC3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA4 at application runtime
*/
void PORTA_PA4_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA4_InterruptHandler = interruptHandler;
}
void PORTA_PA4_DefaultInterruptHandler(void)
{
// add your PORTA_PA4 interrupt custom code
// or set custom function using PORTA_PA4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA3 at application runtime
*/
void PORTA_PA3_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA3_InterruptHandler = interruptHandler;
}
void PORTA_PA3_DefaultInterruptHandler(void)
{
// add your PORTA_PA3 interrupt custom code
// or set custom function using PORTA_PA3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA6 at application runtime
*/
void PORTA_PA6_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA6_InterruptHandler = interruptHandler;
}
void PORTA_PA6_DefaultInterruptHandler(void)
{
// add your PORTA_PA6 interrupt custom code
// or set custom function using PORTA_PA6_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA5 at application runtime
*/
void PORTA_PA5_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA5_InterruptHandler = interruptHandler;
}
void PORTA_PA5_DefaultInterruptHandler(void)
{
// add your PORTA_PA5 interrupt custom code
// or set custom function using PORTA_PA5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTA_PA0 at application runtime
*/
void PORTA_PA0_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTA_PA0_InterruptHandler = interruptHandler;
}
void PORTA_PA0_DefaultInterruptHandler(void)
{
// add your PORTA_PA0 interrupt custom code
// or set custom function using PORTA_PA0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for PORTD_PD3 at application runtime
*/
void PORTD_PD3_SetInterruptHandler(void (* interruptHandler)(void))
{
PORTD_PD3_InterruptHandler = interruptHandler;
}
void PORTD_PD3_DefaultInterruptHandler(void)
{
// add your PORTD_PD3 interrupt custom code
// or set custom function using PORTD_PD3_SetInterruptHandler()
}

Wyświetl plik

@ -1,176 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/spi0.h"
#include "../include/pin_manager.h"
typedef struct spi0_descriptor_s {
spi0_transfer_status_t status;
} spi0_descriptor_t;
spi0_configuration_t spi0_configurations[] = {
{ 0x35, 0x5 }
};
static spi0_descriptor_t spi0_desc;
uint8_t SPI0_Initialize()
{
//DORD disabled; MASTER enabled; CLK2X enabled; PRESC DIV64; ENABLE enabled;
SPI0.CTRLA = 0x35;
//BUFEN disabled; BUFWR disabled; SSD enabled; MODE 1;
SPI0.CTRLB = 0x05;
//RXCIE disabled; TXCIE disabled; DREIE disabled; SSIE disabled; IE disabled;
SPI0.INTCTRL = 0x00;
spi0_desc.status = SPI0_FREE;
//RXCIF disabled; IF disabled; TXCIF disabled; WRCOL disabled; DREIF disabled; SSIF disabled; BUFOVF disabled;
SPI0.INTFLAGS = 0x00;
return 0;
}
void SPI0_Enable()
{
SPI0.CTRLA |= SPI_ENABLE_bm;
}
void SPI0_Disable()
{
SPI0.CTRLA &= ~SPI_ENABLE_bm;
}
bool SPI0_OpenConfiguration(uint8_t spiUniqueConfiguration){
return SPI0_Open(spi0_configurations[spiUniqueConfiguration]);
}
bool SPI0_Open(spi0_configuration_t spiUniqueConfiguration)
{
if (spi0_desc.status == SPI0_FREE) {
spi0_desc.status = SPI0_IDLE;
SPI0.CTRLA = spiUniqueConfiguration.CTRLAvalue;
SPI0.CTRLB = spiUniqueConfiguration.CTRLBvalue;
return true;
} else {
return false;
}
}
void SPI0_Close(void)
{
spi0_desc.status = SPI0_FREE;
}
uint8_t SPI0_ExchangeByte(uint8_t data)
{
SPI0.DATA = data;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm));
return SPI0.DATA;
}
bool SPI0_Selected()
{
/**
* \brief returns true if SS pin is selected
* TODO: Place your code
*/
return true;
}
uint8_t SPI0_GetRxData()
{
return SPI0.DATA;
}
void SPI0_WriteTxData(uint8_t data)
{
SPI0.DATA = data;
}
void SPI0_WaitDataready()
{
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
}
void SPI0_ExchangeBlock(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
while (size--) {
SPI0.DATA = *b;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
*b = SPI0.DATA;
b++;
}
}
void SPI0_WriteBlock(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
uint8_t rdata;
while (size--) {
SPI0.DATA = *b;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
rdata = SPI0.DATA;
(void)(rdata); // Silence compiler warning
b++;
}
}
void SPI0_ReadBlock(void *block, size_t size)
{
uint8_t *b = (uint8_t *)block;
while (size--) {
SPI0.DATA = 0;
while (!(SPI0.INTFLAGS & SPI_RXCIF_bm))
;
*b = SPI0.DATA;
b++;
}
}
void SPI0_WriteByte(uint8_t data)
{
SPI0.DATA = data;
}
uint8_t SPI0_ReadByte()
{
return SPI0.DATA;
}

Wyświetl plik

@ -1,245 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 2.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#include "../include/tca0.h"
void TCA0_DefaultCMP0IsrCallback(void);
void (*TCA0_CMP0_isr_cb)(void) = &TCA0_DefaultCMP0IsrCallback;
void TCA0_DefaultCMP1IsrCallback(void);
void (*TCA0_CMP1_isr_cb)(void) = &TCA0_DefaultCMP1IsrCallback;
void TCA0_DefaultCMP2IsrCallback(void);
void (*TCA0_CMP2_isr_cb)(void) = &TCA0_DefaultCMP2IsrCallback;
void TCA0_DefaultOVFIsrCallback(void);
void (*TCA0_OVF_isr_cb)(void) = &TCA0_DefaultOVFIsrCallback;
void TCA0_DefaultCMP0IsrCallback(void)
{
//Add your ISR code here
}
void TCA0_DefaultCMP1IsrCallback(void)
{
//Add your ISR code here
}
void TCA0_DefaultCMP2IsrCallback(void)
{
//Add your ISR code here
}
void TCA0_DefaultOVFIsrCallback(void)
{
//Add your ISR code here
}
void TCA0_SetOVFIsrCallback(TCA0_cb_t cb)
{
TCA0_OVF_isr_cb = cb;
}
void TCA0_SetCMP0IsrCallback(TCA0_cb_t cb)
{
TCA0_CMP0_isr_cb = cb;
}
void TCA0_SetCMP1IsrCallback(TCA0_cb_t cb)
{
TCA0_CMP1_isr_cb = cb;
}
void TCA0_SetCMP2IsrCallback(TCA0_cb_t cb)
{
TCA0_CMP2_isr_cb = cb;
}
ISR(TCA0_CMP0_vect)
{
if (TCA0_CMP0_isr_cb != NULL)
(*TCA0_CMP0_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP0_bm;
}
ISR(TCA0_CMP1_vect)
{
if (TCA0_CMP1_isr_cb != NULL)
(*TCA0_CMP1_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP1_bm;
}
ISR(TCA0_CMP2_vect)
{
if (TCA0_CMP2_isr_cb != NULL)
(*TCA0_CMP2_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP2_bm;
}
ISR(TCA0_OVF_vect)
{
if (TCA0_OVF_isr_cb != NULL)
(*TCA0_OVF_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm;
}
/**
* \brief Initialize TCA interface
*/
int8_t TCA0_Initialize()
{
//Compare 0
TCA0.SINGLE.CMP0 = 0x0A;
//Compare 1
TCA0.SINGLE.CMP1 = 0x00;
//Compare 2
TCA0.SINGLE.CMP2 = 0x12;
//Count
TCA0.SINGLE.CNT = 0x00;
//CMP2EN enabled; CMP1EN disabled; CMP0EN enabled; ALUPD disabled; WGMODE SINGLESLOPE;
TCA0.SINGLE.CTRLB = 0x53;
//CMP2OV disabled; CMP1OV disabled; CMP0OV disabled;
TCA0.SINGLE.CTRLC = 0x00;
//SPLITM disabled;
TCA0.SINGLE.CTRLD = 0x00;
//CMD NONE; LUPD disabled; DIR disabled;
TCA0.SINGLE.CTRLECLR = 0x00;
//CMD NONE; LUPD disabled; DIR UP;
TCA0.SINGLE.CTRLESET = 0x00;
//CMP2BV disabled; CMP1BV disabled; CMP0BV disabled; PERBV disabled;
TCA0.SINGLE.CTRLFCLR = 0x00;
//CMP2BV disabled; CMP1BV disabled; CMP0BV disabled; PERBV disabled;
TCA0.SINGLE.CTRLFSET = 0x00;
//DBGRUN disabled;
TCA0.SINGLE.DBGCTRL = 0x00;
//EVACTB RESTART_POSEDGE; CNTBEI enabled; EVACTA UPDOWN; CNTAEI disabled;
TCA0.SINGLE.EVCTRL = 0x96;
//CMP2 disabled; CMP1 disabled; CMP0 disabled; OVF disabled;
TCA0.SINGLE.INTCTRL = 0x00;
//CMP2 disabled; CMP1 disabled; CMP0 disabled; OVF disabled;
TCA0.SINGLE.INTFLAGS = 0x00;
//Period
TCA0.SINGLE.PER = 0x95F;
//Temporary data for 16-bit Access
TCA0.SINGLE.TEMP = 0x00;
//RUNSTDBY disabled; CLKSEL DIV1; ENABLE disabled;
TCA0.SINGLE.CTRLA = 0x00;
return 0;
}
void TCA0_WriteTimer(uint16_t timerVal)
{
TCA0.SINGLE.CNT=timerVal;
}
uint16_t TCA0_ReadTimer(void)
{
uint16_t readVal;
readVal = TCA0.SINGLE.CNT;
return readVal;
}
void TCA0_EnableInterrupt(void)
{
TCA0.SINGLE.INTCTRL = 1 << TCA_SINGLE_CMP0_bp /* Compare 0 Interrupt: enabled */
| 1 << TCA_SINGLE_CMP1_bp /* Compare 1 Interrupt: enabled */
| 1 << TCA_SINGLE_CMP2_bp /* Compare 2 Interrupt: enabled */
| 1 << TCA_SINGLE_OVF_bp; /* Overflow Interrupt: enabled */
}
void TCA0_DisableInterrupt(void)
{
TCA0.SINGLE.INTCTRL = 0 << TCA_SINGLE_CMP0_bp /* Compare 0 Interrupt: disabled */
| 0 << TCA_SINGLE_CMP1_bp /* Compare 1 Interrupt: disabled */
| 0 << TCA_SINGLE_CMP2_bp /* Compare 2 Interrupt: disabled */
| 0 << TCA_SINGLE_OVF_bp; /* Overflow Interrupt: disabled */
}
void TCA0_ClearOverflowInterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS &= ~TCA_SINGLE_OVF_bm; /* Overflow Interrupt: disabled */
}
bool TCA0_IsOverflowInterruptEnabled(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_OVF_bm) > 0);
}
void TCA0_ClearCMP0InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS &= ~TCA_SINGLE_CMP0_bm; /* Compare Channel-0 Interrupt: disabled */
}
bool TCA0_IsCMP0InterruptEnabled(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP0_bm) > 0);
}
void TCA0_ClearCMP1InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS &= ~TCA_SINGLE_CMP1_bm; /* Compare Channel-1 Interrupt: disabled */
}
bool TCA0_IsCMP1InterruptEnabled(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP1_bm) > 0);
}
void TCA0_ClearCMP2InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS &= ~TCA_SINGLE_CMP2_bm; /* Compare Channel-2 Interrupt: disabled */
}
bool TCA0_IsCMP2InterruptEnabled(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP2_bm) > 0);
}

Wyświetl plik

@ -0,0 +1,72 @@
/**
* CCP Header File
*
* @file ccp.h
*
* @ingroup config_bitsdriver
*
* @brief This file contains the Configuration Change Protection (CCP) header file for the Configuration bits driver.
*
* @version Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef CPU_CCP_H
#define CPU_CCP_H
#include "../system/utils/compiler.h"
#include "../system/protected_io.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Writes to a CCP-protected 8-bit I/O register.
* @param addr Address of the I/O register.
* @param value Value to be written.
* NOTE: Using IAR Embedded workbench, the choice of memory model has an impact on calling convention.
* Memory model must be defined in the Assembler preprocessor directives to be visible to the preprocessor.
*/
static inline void ccp_write_io(void *addr, uint8_t value)
{
protected_write_io(addr, CCP_IOREG_gc, value);
}
/**
* @brief Writes to a CCP-protected 8-bit SPM register.
* @param addr Address of the SPM register.
* @param value Value to be written.
* NOTE: Using IAR Embedded workbench, the choice of memory model has an impacton calling convention.
* Memory model must be defined in the Assembler preprocessor directives to be visible to the preprocessor.
*/
static inline void ccp_write_spm(void *addr, uint8_t value)
{
protected_write_io(addr, CCP_SPM_gc, value);
}
#ifdef __cplusplus
}
#endif
#endif /* CPU_CCP_H */

Wyświetl plik

@ -0,0 +1,51 @@
/**
* CLKCTRL Generated Driver API Header File
*
* @file clkctrl.h
*
* @defgroup clkctrl CLKCTRL
*
* @brief This file contains the API prototype for the CLKCTRL driver.
*
* @version CLKCTRL Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef CLOCK_CONFIG_H
#define CLOCK_CONFIG_H
#ifndef F_CPU
#define F_CPU 24000000
#endif
#include "ccp.h"
/**
* @ingroup clkctrl
* @brief Initializes the Clock controller.
* @param None.
* @return None.
*
*/
void CLOCK_Initialize(void);
#endif // CLOCK_CONFIG_H

Wyświetl plik

@ -0,0 +1,42 @@
/**
* CONFIGURATION BITS Generated Driver Header File
*
* @file config_bits.h
*
* @defgroup config_bitsdriver Configuration Bits Driver
*
* @brief This file contains the generated header file for the Configuration bits driver.
*
* @version Driver Version 1.0.4
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef CONFIG_BITS_H
#define CONFIG_BITS_H
#include "../system/clock.h"
#endif //CONFIG_BITS_H
/**
End of File
*/

Wyświetl plik

@ -0,0 +1,57 @@
/**
* Interrupt Manager Generated Driver API Header File.
*
* @file interrupt.h
*
* @defgroup interrupt INTERRUPT
*
* @brief This file contains the API prototype for the Interrupt Manager.
*
* @version Interrupt Manager Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef INTERRUPT_H
#define INTERRUPT_H
#include "../system/utils/compiler.h"
#include "ccp.h"
#include "../system/utils/atomic.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup interrupt
* @brief Initializes the Interrupt module.
* @retval 0 - Initialization is successful.
*/
int8_t CPUINT_Initialize();
#ifdef __cplusplus
}
#endif
#endif /* INTERRUPT_H */

Wyświetl plik

@ -0,0 +1,328 @@
/**
* Generated Pins header File
*
* @file pins.h
*
* @defgroup pinsdriver Pins Driver
*
* @brief This is generated driver header for pins.
* This header file provides APIs for all pins selected in the GUI.
*
* @version Driver Version 1.1.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef PINS_H_INCLUDED
#define PINS_H_INCLUDED
#include <avr/io.h>
#include "./port.h"
//get/set TCA0_WO0 aliases
#define TCA0_WO0_SetHigh() do { PORTA_OUTSET = 0x1; } while(0)
#define TCA0_WO0_SetLow() do { PORTA_OUTCLR = 0x1; } while(0)
#define TCA0_WO0_Toggle() do { PORTA_OUTTGL = 0x1; } while(0)
#define TCA0_WO0_GetValue() (VPORTA.IN & (0x1 << 0))
#define TCA0_WO0_SetDigitalInput() do { PORTA_DIRCLR = 0x1; } while(0)
#define TCA0_WO0_SetDigitalOutput() do { PORTA_DIRSET = 0x1; } while(0)
#define TCA0_WO0_SetPullUp() do { PORTA_PIN0CTRL |= PORT_PULLUPEN_bm; } while(0)
#define TCA0_WO0_ResetPullUp() do { PORTA_PIN0CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define TCA0_WO0_SetInverted() do { PORTA_PIN0CTRL |= PORT_INVEN_bm; } while(0)
#define TCA0_WO0_ResetInverted() do { PORTA_PIN0CTRL &= ~PORT_INVEN_bm; } while(0)
#define TCA0_WO0_DisableInterruptOnChange() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define TCA0_WO0_EnableInterruptForBothEdges() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define TCA0_WO0_EnableInterruptForRisingEdge() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define TCA0_WO0_EnableInterruptForFallingEdge() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define TCA0_WO0_DisableDigitalInputBuffer() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define TCA0_WO0_EnableInterruptForLowLevelSensing() do { PORTA.PIN0CTRL = (PORTA.PIN0CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA0_SetInterruptHandler TCA0_WO0_SetInterruptHandler
//get/set TCA0_WO2 aliases
#define TCA0_WO2_SetHigh() do { PORTA_OUTSET = 0x4; } while(0)
#define TCA0_WO2_SetLow() do { PORTA_OUTCLR = 0x4; } while(0)
#define TCA0_WO2_Toggle() do { PORTA_OUTTGL = 0x4; } while(0)
#define TCA0_WO2_GetValue() (VPORTA.IN & (0x1 << 2))
#define TCA0_WO2_SetDigitalInput() do { PORTA_DIRCLR = 0x4; } while(0)
#define TCA0_WO2_SetDigitalOutput() do { PORTA_DIRSET = 0x4; } while(0)
#define TCA0_WO2_SetPullUp() do { PORTA_PIN2CTRL |= PORT_PULLUPEN_bm; } while(0)
#define TCA0_WO2_ResetPullUp() do { PORTA_PIN2CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define TCA0_WO2_SetInverted() do { PORTA_PIN2CTRL |= PORT_INVEN_bm; } while(0)
#define TCA0_WO2_ResetInverted() do { PORTA_PIN2CTRL &= ~PORT_INVEN_bm; } while(0)
#define TCA0_WO2_DisableInterruptOnChange() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define TCA0_WO2_EnableInterruptForBothEdges() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define TCA0_WO2_EnableInterruptForRisingEdge() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define TCA0_WO2_EnableInterruptForFallingEdge() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define TCA0_WO2_DisableDigitalInputBuffer() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define TCA0_WO2_EnableInterruptForLowLevelSensing() do { PORTA.PIN2CTRL = (PORTA.PIN2CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA2_SetInterruptHandler TCA0_WO2_SetInterruptHandler
//get/set LUT0_OUT aliases
#define LUT0_OUT_SetHigh() do { PORTA_OUTSET = 0x8; } while(0)
#define LUT0_OUT_SetLow() do { PORTA_OUTCLR = 0x8; } while(0)
#define LUT0_OUT_Toggle() do { PORTA_OUTTGL = 0x8; } while(0)
#define LUT0_OUT_GetValue() (VPORTA.IN & (0x1 << 3))
#define LUT0_OUT_SetDigitalInput() do { PORTA_DIRCLR = 0x8; } while(0)
#define LUT0_OUT_SetDigitalOutput() do { PORTA_DIRSET = 0x8; } while(0)
#define LUT0_OUT_SetPullUp() do { PORTA_PIN3CTRL |= PORT_PULLUPEN_bm; } while(0)
#define LUT0_OUT_ResetPullUp() do { PORTA_PIN3CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define LUT0_OUT_SetInverted() do { PORTA_PIN3CTRL |= PORT_INVEN_bm; } while(0)
#define LUT0_OUT_ResetInverted() do { PORTA_PIN3CTRL &= ~PORT_INVEN_bm; } while(0)
#define LUT0_OUT_DisableInterruptOnChange() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define LUT0_OUT_EnableInterruptForBothEdges() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define LUT0_OUT_EnableInterruptForRisingEdge() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define LUT0_OUT_EnableInterruptForFallingEdge() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define LUT0_OUT_DisableDigitalInputBuffer() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define LUT0_OUT_EnableInterruptForLowLevelSensing() do { PORTA.PIN3CTRL = (PORTA.PIN3CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA3_SetInterruptHandler LUT0_OUT_SetInterruptHandler
//get/set SPI0_MISO aliases
#define SPI0_MISO_SetHigh() do { PORTA_OUTSET = 0x20; } while(0)
#define SPI0_MISO_SetLow() do { PORTA_OUTCLR = 0x20; } while(0)
#define SPI0_MISO_Toggle() do { PORTA_OUTTGL = 0x20; } while(0)
#define SPI0_MISO_GetValue() (VPORTA.IN & (0x1 << 5))
#define SPI0_MISO_SetDigitalInput() do { PORTA_DIRCLR = 0x20; } while(0)
#define SPI0_MISO_SetDigitalOutput() do { PORTA_DIRSET = 0x20; } while(0)
#define SPI0_MISO_SetPullUp() do { PORTA_PIN5CTRL |= PORT_PULLUPEN_bm; } while(0)
#define SPI0_MISO_ResetPullUp() do { PORTA_PIN5CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define SPI0_MISO_SetInverted() do { PORTA_PIN5CTRL |= PORT_INVEN_bm; } while(0)
#define SPI0_MISO_ResetInverted() do { PORTA_PIN5CTRL &= ~PORT_INVEN_bm; } while(0)
#define SPI0_MISO_DisableInterruptOnChange() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define SPI0_MISO_EnableInterruptForBothEdges() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define SPI0_MISO_EnableInterruptForRisingEdge() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define SPI0_MISO_EnableInterruptForFallingEdge() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define SPI0_MISO_DisableDigitalInputBuffer() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define SPI0_MISO_EnableInterruptForLowLevelSensing() do { PORTA.PIN5CTRL = (PORTA.PIN5CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA5_SetInterruptHandler SPI0_MISO_SetInterruptHandler
//get/set SPI0_MOSI aliases
#define SPI0_MOSI_SetHigh() do { PORTA_OUTSET = 0x10; } while(0)
#define SPI0_MOSI_SetLow() do { PORTA_OUTCLR = 0x10; } while(0)
#define SPI0_MOSI_Toggle() do { PORTA_OUTTGL = 0x10; } while(0)
#define SPI0_MOSI_GetValue() (VPORTA.IN & (0x1 << 4))
#define SPI0_MOSI_SetDigitalInput() do { PORTA_DIRCLR = 0x10; } while(0)
#define SPI0_MOSI_SetDigitalOutput() do { PORTA_DIRSET = 0x10; } while(0)
#define SPI0_MOSI_SetPullUp() do { PORTA_PIN4CTRL |= PORT_PULLUPEN_bm; } while(0)
#define SPI0_MOSI_ResetPullUp() do { PORTA_PIN4CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define SPI0_MOSI_SetInverted() do { PORTA_PIN4CTRL |= PORT_INVEN_bm; } while(0)
#define SPI0_MOSI_ResetInverted() do { PORTA_PIN4CTRL &= ~PORT_INVEN_bm; } while(0)
#define SPI0_MOSI_DisableInterruptOnChange() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define SPI0_MOSI_EnableInterruptForBothEdges() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define SPI0_MOSI_EnableInterruptForRisingEdge() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define SPI0_MOSI_EnableInterruptForFallingEdge() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define SPI0_MOSI_DisableDigitalInputBuffer() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define SPI0_MOSI_EnableInterruptForLowLevelSensing() do { PORTA.PIN4CTRL = (PORTA.PIN4CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA4_SetInterruptHandler SPI0_MOSI_SetInterruptHandler
//get/set SPI0_SCK aliases
#define SPI0_SCK_SetHigh() do { PORTA_OUTSET = 0x40; } while(0)
#define SPI0_SCK_SetLow() do { PORTA_OUTCLR = 0x40; } while(0)
#define SPI0_SCK_Toggle() do { PORTA_OUTTGL = 0x40; } while(0)
#define SPI0_SCK_GetValue() (VPORTA.IN & (0x1 << 6))
#define SPI0_SCK_SetDigitalInput() do { PORTA_DIRCLR = 0x40; } while(0)
#define SPI0_SCK_SetDigitalOutput() do { PORTA_DIRSET = 0x40; } while(0)
#define SPI0_SCK_SetPullUp() do { PORTA_PIN6CTRL |= PORT_PULLUPEN_bm; } while(0)
#define SPI0_SCK_ResetPullUp() do { PORTA_PIN6CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define SPI0_SCK_SetInverted() do { PORTA_PIN6CTRL |= PORT_INVEN_bm; } while(0)
#define SPI0_SCK_ResetInverted() do { PORTA_PIN6CTRL &= ~PORT_INVEN_bm; } while(0)
#define SPI0_SCK_DisableInterruptOnChange() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define SPI0_SCK_EnableInterruptForBothEdges() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define SPI0_SCK_EnableInterruptForRisingEdge() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define SPI0_SCK_EnableInterruptForFallingEdge() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define SPI0_SCK_DisableDigitalInputBuffer() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define SPI0_SCK_EnableInterruptForLowLevelSensing() do { PORTA.PIN6CTRL = (PORTA.PIN6CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA6_SetInterruptHandler SPI0_SCK_SetInterruptHandler
//get/set SPI0_SS aliases
#define SPI0_SS_SetHigh() do { PORTA_OUTSET = 0x80; } while(0)
#define SPI0_SS_SetLow() do { PORTA_OUTCLR = 0x80; } while(0)
#define SPI0_SS_Toggle() do { PORTA_OUTTGL = 0x80; } while(0)
#define SPI0_SS_GetValue() (VPORTA.IN & (0x1 << 7))
#define SPI0_SS_SetDigitalInput() do { PORTA_DIRCLR = 0x80; } while(0)
#define SPI0_SS_SetDigitalOutput() do { PORTA_DIRSET = 0x80; } while(0)
#define SPI0_SS_SetPullUp() do { PORTA_PIN7CTRL |= PORT_PULLUPEN_bm; } while(0)
#define SPI0_SS_ResetPullUp() do { PORTA_PIN7CTRL &= ~PORT_PULLUPEN_bm; } while(0)
#define SPI0_SS_SetInverted() do { PORTA_PIN7CTRL |= PORT_INVEN_bm; } while(0)
#define SPI0_SS_ResetInverted() do { PORTA_PIN7CTRL &= ~PORT_INVEN_bm; } while(0)
#define SPI0_SS_DisableInterruptOnChange() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x0 ; } while(0)
#define SPI0_SS_EnableInterruptForBothEdges() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x1 ; } while(0)
#define SPI0_SS_EnableInterruptForRisingEdge() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x2 ; } while(0)
#define SPI0_SS_EnableInterruptForFallingEdge() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x3 ; } while(0)
#define SPI0_SS_DisableDigitalInputBuffer() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x4 ; } while(0)
#define SPI0_SS_EnableInterruptForLowLevelSensing() do { PORTA.PIN7CTRL = (PORTA.PIN7CTRL & ~PORT_ISC_gm) | 0x5 ; } while(0)
#define PA7_SetInterruptHandler SPI0_SS_SetInterruptHandler
/**
* @ingroup pinsdriver
* @brief GPIO and peripheral I/O initialization
* @param none
* @return none
*/
void PIN_MANAGER_Initialize();
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for TCA0_WO0 pin.
* This is a predefined interrupt handler to be used together with the TCA0_WO0_SetInterruptHandler() method.
* This handler is called every time the TCA0_WO0 ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void TCA0_WO0_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for TCA0_WO0 pin input-sense-config functionality.
* Allows selecting an interrupt handler for TCA0_WO0 at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void TCA0_WO0_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for TCA0_WO2 pin.
* This is a predefined interrupt handler to be used together with the TCA0_WO2_SetInterruptHandler() method.
* This handler is called every time the TCA0_WO2 ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void TCA0_WO2_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for TCA0_WO2 pin input-sense-config functionality.
* Allows selecting an interrupt handler for TCA0_WO2 at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void TCA0_WO2_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for LUT0_OUT pin.
* This is a predefined interrupt handler to be used together with the LUT0_OUT_SetInterruptHandler() method.
* This handler is called every time the LUT0_OUT ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void LUT0_OUT_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for LUT0_OUT pin input-sense-config functionality.
* Allows selecting an interrupt handler for LUT0_OUT at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void LUT0_OUT_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for SPI0_MISO pin.
* This is a predefined interrupt handler to be used together with the SPI0_MISO_SetInterruptHandler() method.
* This handler is called every time the SPI0_MISO ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void SPI0_MISO_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for SPI0_MISO pin input-sense-config functionality.
* Allows selecting an interrupt handler for SPI0_MISO at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void SPI0_MISO_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for SPI0_MOSI pin.
* This is a predefined interrupt handler to be used together with the SPI0_MOSI_SetInterruptHandler() method.
* This handler is called every time the SPI0_MOSI ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void SPI0_MOSI_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for SPI0_MOSI pin input-sense-config functionality.
* Allows selecting an interrupt handler for SPI0_MOSI at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void SPI0_MOSI_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for SPI0_SCK pin.
* This is a predefined interrupt handler to be used together with the SPI0_SCK_SetInterruptHandler() method.
* This handler is called every time the SPI0_SCK ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void SPI0_SCK_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for SPI0_SCK pin input-sense-config functionality.
* Allows selecting an interrupt handler for SPI0_SCK at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void SPI0_SCK_SetInterruptHandler(void (* interruptHandler)(void)) ;
/**
* @ingroup pinsdriver
* @brief Default Interrupt Handler for SPI0_SS pin.
* This is a predefined interrupt handler to be used together with the SPI0_SS_SetInterruptHandler() method.
* This handler is called every time the SPI0_SS ISR is executed.
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param none
* @return none
*/
void SPI0_SS_DefaultInterruptHandler(void);
/**
* @ingroup pinsdriver
* @brief Interrupt Handler Setter for SPI0_SS pin input-sense-config functionality.
* Allows selecting an interrupt handler for SPI0_SS at application runtime
* @pre PIN_MANAGER_Initialize() has been called at least once
* @param InterruptHandler function pointer.
* @return none
*/
void SPI0_SS_SetInterruptHandler(void (* interruptHandler)(void)) ;
#endif /* PINS_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,80 @@
/**
* protected_io Header File
*
* @file protected_io.h
*
* @defgroup doc_driver_system_protected_io Protected IO
*
* @brief This file contains the generated prtected_io header file for the CONFIGURATION BITS.
*
* @version Driver Version 1.0.0
*
*@{
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef PROTECTED_IO_H
#define PROTECTED_IO_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__DOXYGEN__)
//! \name IAR Memory Model defines.
//@{
/**
* @def CONFIG_MEMORY_MODEL_TINY
* @brief Configuration symbol to enable 8 bit pointers.
*/
#define CONFIG_MEMORY_MODEL_TINY
/**
* @def CONFIG_MEMORY_MODEL_SMALL
* @brief Configuration symbol to enable 16 bit pointers.
* NOTE: If no memory model is defined, SMALL is default.
*/
#define CONFIG_MEMORY_MODEL_SMALL
/**
* @def CONFIG_MEMORY_MODEL_LARGE
* @brief Configuration symbol to enable 24 bit pointers.
*/
#define CONFIG_MEMORY_MODEL_LARGE
//@}
#endif
/**
* @brief Writes to an 8-bit I/O register protected by CCP or a protection bit.
* @param addr Address of the I/O register.
* @param magic CCP magic value or Mask for protection bit.
* @param value Value to be written.
* NOTE: Using IAR Embedded workbench, the choice of memory model has an impact on calling convention.
* Memory model must be defined in the Assembler preprocessor directives to be visible to the preprocessor.
*/
extern void protected_write_io(void *addr, uint8_t magic, uint8_t value);
/** @} */
#endif /* PROTECTED_IO_H */

Wyświetl plik

@ -0,0 +1,69 @@
/**
* CLKCTRL Generated Driver File
*
* @file clkctrl.c
*
* @ingroup clkctrl
*
* @brief This file contains the API implementation for the CLKCTRL driver.
*
* @version CLKCTRL Driver Version 1.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../clock.h"
void CLOCK_Initialize(void)
{
//CLKOUT disabled; CLKSEL Internal high-frequency oscillator;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLA),0x0);
//PDIV 2X; PEN disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLB),0x0);
//LOCKEN disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKLOCK),0x0);
//EXTS disabled; OSCHFS disabled; OSC32KS disabled; PLLS disabled; SOSC disabled; XOSC32KS disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKSTATUS),0x0);
//AUTOTUNE disabled; FRQSEL 24 MHz system clock; RUNSTDBY disabled;
ccp_write_io((void*)&(CLKCTRL.OSCHFCTRLA),0x24);
//TUNE 0x0;
ccp_write_io((void*)&(CLKCTRL.OSCHFTUNE),0x0);
//RUNSTDBY disabled;
ccp_write_io((void*)&(CLKCTRL.OSC32KCTRLA),0x0);
//MULFAC PLL is disabled; RUNSTDBY disabled; SOURCE disabled;
ccp_write_io((void*)&(CLKCTRL.PLLCTRLA),0x0);
//CSUT 1k cycles; ENABLE disabled; LPMODE disabled; RUNSTDBY disabled; SEL disabled;
ccp_write_io((void*)&(CLKCTRL.XOSC32KCTRLA),0x0);
}
/**
End of File
*/

Wyświetl plik

@ -0,0 +1,47 @@
/**
* CONFIGURATION BITS Generated Driver Source File
*
* @file config_bits.c
*
* @ingroup config_bitsdriver
*
* @brief This file contains the generated Device Configuration Bits file.
*
* @version Driver Version 1.0.4
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include <avr/io.h>
/**
* Configures the Fuse bits.
*/
FUSES =
{
.BODCFG = ACTIVE_DISABLE_gc | LVL_BODLEVEL0_gc | SAMPFREQ_128Hz_gc | SLEEP_DISABLE_gc,
.BOOTSIZE = 0x0,
.CODESIZE = 0x0,
.OSCCFG = CLKSEL_OSCHF_gc,
.SYSCFG0 = CRCSEL_CRC16_gc | CRCSRC_NOCRC_gc | RSTPINCFG_GPIO_gc,
.SYSCFG1 = SUT_0MS_gc,
.WDTCFG = PERIOD_OFF_gc | WINDOW_OFF_gc,
};

Wyświetl plik

@ -0,0 +1,52 @@
/**
* Interrupt Manager Generated Driver File.
*
* @file interrupt.c
*
* @ingroup interrupt
*
* @brief This file contains the API implementation for the Interrupt Manager.
*
* @version Interrupt Manager Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../interrupt.h"
int8_t CPUINT_Initialize()
{
/* IVSEL and CVT are Configuration Change Protected */
//CVT disabled; IVSEL disabled; LVL0RR disabled;
ccp_write_io((void*)&(CPUINT.CTRLA),0x0);
//LVL0PRI 0;
CPUINT.LVL0PRI = 0x0;
//LVL1VEC 0;
CPUINT.LVL1VEC = 0x0;
return 0;
}

Wyświetl plik

@ -0,0 +1,294 @@
/**
* Generated Driver File
*
* @file pins.c
*
* @ingroup pinsdriver
*
* @brief This is generated driver implementation for pins.
* This file provides implementations for pin APIs for all pins selected in the GUI.
*
* @version Driver Version 1.1.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../pins.h"
static void (*TCA0_WO0_InterruptHandler)(void);
static void (*TCA0_WO2_InterruptHandler)(void);
static void (*LUT0_OUT_InterruptHandler)(void);
static void (*SPI0_MISO_InterruptHandler)(void);
static void (*SPI0_MOSI_InterruptHandler)(void);
static void (*SPI0_SCK_InterruptHandler)(void);
static void (*SPI0_SS_InterruptHandler)(void);
void PIN_MANAGER_Initialize()
{
/* DIR Registers Initialization */
PORTA.DIR = 0xDD;
PORTB.DIR = 0x0;
PORTC.DIR = 0x0;
PORTD.DIR = 0x0;
PORTE.DIR = 0x0;
PORTF.DIR = 0x0;
/* OUT Registers Initialization */
PORTA.OUT = 0x0;
PORTB.OUT = 0x0;
PORTC.OUT = 0x0;
PORTD.OUT = 0x0;
PORTE.OUT = 0x0;
PORTF.OUT = 0x0;
/* PINxCTRL registers Initialization */
PORTA.PIN0CTRL = 0x0;
PORTA.PIN1CTRL = 0x0;
PORTA.PIN2CTRL = 0x0;
PORTA.PIN3CTRL = 0x0;
PORTA.PIN4CTRL = 0x0;
PORTA.PIN5CTRL = 0x0;
PORTA.PIN6CTRL = 0x0;
PORTA.PIN7CTRL = 0x0;
PORTB.PIN0CTRL = 0x0;
PORTB.PIN1CTRL = 0x0;
PORTB.PIN2CTRL = 0x0;
PORTB.PIN3CTRL = 0x0;
PORTB.PIN4CTRL = 0x0;
PORTB.PIN5CTRL = 0x0;
PORTB.PIN6CTRL = 0x0;
PORTB.PIN7CTRL = 0x0;
PORTC.PIN0CTRL = 0x0;
PORTC.PIN1CTRL = 0x0;
PORTC.PIN2CTRL = 0x0;
PORTC.PIN3CTRL = 0x0;
PORTC.PIN4CTRL = 0x0;
PORTC.PIN5CTRL = 0x0;
PORTC.PIN6CTRL = 0x0;
PORTC.PIN7CTRL = 0x0;
PORTD.PIN0CTRL = 0x0;
PORTD.PIN1CTRL = 0x0;
PORTD.PIN2CTRL = 0x0;
PORTD.PIN3CTRL = 0x0;
PORTD.PIN4CTRL = 0x0;
PORTD.PIN5CTRL = 0x0;
PORTD.PIN6CTRL = 0x0;
PORTD.PIN7CTRL = 0x0;
PORTE.PIN0CTRL = 0x0;
PORTE.PIN1CTRL = 0x0;
PORTE.PIN2CTRL = 0x0;
PORTE.PIN3CTRL = 0x0;
PORTE.PIN4CTRL = 0x0;
PORTE.PIN5CTRL = 0x0;
PORTE.PIN6CTRL = 0x0;
PORTE.PIN7CTRL = 0x0;
PORTF.PIN0CTRL = 0x0;
PORTF.PIN1CTRL = 0x0;
PORTF.PIN2CTRL = 0x0;
PORTF.PIN3CTRL = 0x0;
PORTF.PIN4CTRL = 0x0;
PORTF.PIN5CTRL = 0x0;
PORTF.PIN6CTRL = 0x0;
PORTF.PIN7CTRL = 0x0;
/* PORTMUX Initialization */
PORTMUX.ACROUTEA = 0x0;
PORTMUX.CCLROUTEA = 0x0;
PORTMUX.EVSYSROUTEA = 0x0;
PORTMUX.SPIROUTEA = 0x0;
PORTMUX.TCAROUTEA = 0x0;
PORTMUX.TCBROUTEA = 0x0;
PORTMUX.TCDROUTEA = 0x0;
PORTMUX.TWIROUTEA = 0x0;
PORTMUX.USARTROUTEA = 0x0;
PORTMUX.USARTROUTEB = 0x0;
PORTMUX.ZCDROUTEA = 0x0;
// register default ISC callback functions at runtime; use these methods to register a custom function
TCA0_WO0_SetInterruptHandler(TCA0_WO0_DefaultInterruptHandler);
TCA0_WO2_SetInterruptHandler(TCA0_WO2_DefaultInterruptHandler);
LUT0_OUT_SetInterruptHandler(LUT0_OUT_DefaultInterruptHandler);
SPI0_MISO_SetInterruptHandler(SPI0_MISO_DefaultInterruptHandler);
SPI0_MOSI_SetInterruptHandler(SPI0_MOSI_DefaultInterruptHandler);
SPI0_SCK_SetInterruptHandler(SPI0_SCK_DefaultInterruptHandler);
SPI0_SS_SetInterruptHandler(SPI0_SS_DefaultInterruptHandler);
}
/**
Allows selecting an interrupt handler for TCA0_WO0 at application runtime
*/
void TCA0_WO0_SetInterruptHandler(void (* interruptHandler)(void))
{
TCA0_WO0_InterruptHandler = interruptHandler;
}
void TCA0_WO0_DefaultInterruptHandler(void)
{
// add your TCA0_WO0 interrupt custom code
// or set custom function using TCA0_WO0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for TCA0_WO2 at application runtime
*/
void TCA0_WO2_SetInterruptHandler(void (* interruptHandler)(void))
{
TCA0_WO2_InterruptHandler = interruptHandler;
}
void TCA0_WO2_DefaultInterruptHandler(void)
{
// add your TCA0_WO2 interrupt custom code
// or set custom function using TCA0_WO2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for LUT0_OUT at application runtime
*/
void LUT0_OUT_SetInterruptHandler(void (* interruptHandler)(void))
{
LUT0_OUT_InterruptHandler = interruptHandler;
}
void LUT0_OUT_DefaultInterruptHandler(void)
{
// add your LUT0_OUT interrupt custom code
// or set custom function using LUT0_OUT_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for SPI0_MISO at application runtime
*/
void SPI0_MISO_SetInterruptHandler(void (* interruptHandler)(void))
{
SPI0_MISO_InterruptHandler = interruptHandler;
}
void SPI0_MISO_DefaultInterruptHandler(void)
{
// add your SPI0_MISO interrupt custom code
// or set custom function using SPI0_MISO_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for SPI0_MOSI at application runtime
*/
void SPI0_MOSI_SetInterruptHandler(void (* interruptHandler)(void))
{
SPI0_MOSI_InterruptHandler = interruptHandler;
}
void SPI0_MOSI_DefaultInterruptHandler(void)
{
// add your SPI0_MOSI interrupt custom code
// or set custom function using SPI0_MOSI_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for SPI0_SCK at application runtime
*/
void SPI0_SCK_SetInterruptHandler(void (* interruptHandler)(void))
{
SPI0_SCK_InterruptHandler = interruptHandler;
}
void SPI0_SCK_DefaultInterruptHandler(void)
{
// add your SPI0_SCK interrupt custom code
// or set custom function using SPI0_SCK_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for SPI0_SS at application runtime
*/
void SPI0_SS_SetInterruptHandler(void (* interruptHandler)(void))
{
SPI0_SS_InterruptHandler = interruptHandler;
}
void SPI0_SS_DefaultInterruptHandler(void)
{
// add your SPI0_SS interrupt custom code
// or set custom function using SPI0_SS_SetInterruptHandler()
}
ISR(PORTA_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTA.INTFLAGS & PORT_INT0_bm)
{
TCA0_WO0_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT2_bm)
{
TCA0_WO2_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT3_bm)
{
LUT0_OUT_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT5_bm)
{
SPI0_MISO_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT4_bm)
{
SPI0_MOSI_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT6_bm)
{
SPI0_SCK_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT7_bm)
{
SPI0_SS_InterruptHandler();
}
/* Clear interrupt flags */
VPORTA.INTFLAGS = 0xff;
}
ISR(PORTB_PORT_vect)
{
/* Clear interrupt flags */
VPORTB.INTFLAGS = 0xff;
}
ISR(PORTC_PORT_vect)
{
/* Clear interrupt flags */
VPORTC.INTFLAGS = 0xff;
}
ISR(PORTD_PORT_vect)
{
/* Clear interrupt flags */
VPORTD.INTFLAGS = 0xff;
}
ISR(PORTE_PORT_vect)
{
/* Clear interrupt flags */
VPORTE.INTFLAGS = 0xff;
}
ISR(PORTF_PORT_vect)
{
/* Clear interrupt flags */
VPORTF.INTFLAGS = 0xff;
}
/**
End of File
*/

Wyświetl plik

@ -1,33 +1,33 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
* protected_io Source Code File
*
* @file protected_io.S
*
* @ingroup config_bitsdriver
*
* @brief This file contains the generated protected_io source code file for the CONFIGURATION BITS.
*
* @version Driver Version 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/

Wyświetl plik

@ -0,0 +1,46 @@
/**
* System Driver Source File
*
* @file system.c
*
* @ingroup systemdriver
*
* @brief This file contains the API implementation for the System driver.
*
* @version Driver Version 1.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../system.h"
void SYSTEM_Initialize(void)
{
CLOCK_Initialize();
PIN_MANAGER_Initialize();
CCL_Initialize();
EVSYS_Initialize();
SPI0_Initialize();
TCA0_Initialize();
CPUINT_Initialize();
}

Wyświetl plik

@ -0,0 +1,64 @@
/**
* System Driver Header File
*
* @file system.h
*
* @defgroup systemdriver System Driver
*
* @brief This file contains the API prototypes for the System driver.
*
* @version Driver Version 1.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef MCC_H
#define MCC_H
#ifdef __cplusplus
extern "C" {
#endif
#include "../system/utils/compiler.h"
#include "config_bits.h"
#include "../system/clock.h"
#include "../system/pins.h"
#include "../ccl/ccl.h"
#include "../evsys/evsys.h"
#include "../spi/spi0.h"
#include "../timer/tca0.h"
#include "../system/interrupt.h"
/**
* @ingroup systemdriver
* @brief Initializes the system module. This routine must be called only once during the system initialization and before any other routine is called.
* @param None.
* @return None.
*/
void SYSTEM_Initialize(void);
#ifdef __cplusplus
}
#endif
#endif /* MCC_H */
/**
End of File
*/

Wyświetl plik

@ -0,0 +1,49 @@
/**
* Assembler Header File
*
* @file assembler.h
*
* @ingroup config_bitsdriver
*
* @brief This file contains the assembler header file for the configuration bits driver.
*
* @version Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef ASSEMBLER_H_INCLUDED
#define ASSEMBLER_H_INCLUDED
#if !defined(__ASSEMBLER__) && !defined(__IAR_SYSTEMS_ASM__) && !defined(__DOXYGEN__)
#error This file may only be included from assembly files
#endif
#if defined(__ASSEMBLER__)
#include "assembler/gas.h"
#include <avr/io.h>
#elif defined(__IAR_SYSTEMS_ASM__)
#include "assembler/iar.h"
#include <ioavr.h>
#endif
#endif /* ASSEMBLER_H_INCLUDED */

Wyświetl plik

@ -1,33 +1,33 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
* GAS Header File
*
* @file gas.h
*
* @ingroup config_bitsdriver
*
* @brief This file contains the generated GAS header file for the Configuration bits driver.
*
* @version Driver Version 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
@ -50,7 +50,11 @@
.if \is_public
.global \name
.endif
#ifdef __XC8
.section .text.\name, code
#else
.section .text.\name, "ax", @progbits
#endif
.type \name, @function
\name :
.endm

Wyświetl plik

@ -1,33 +1,33 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
* IAR Header File
*
* @file iar.h
*
* @ingroup config_bitsdriver
*
* @brief This file contains the generated IAR header file for the Configuration bits driver.
*
* @version Driver Version 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/

Wyświetl plik

@ -0,0 +1,87 @@
/**
* CONFIGURATION BITS Generated Atomic Header File
*
* @file atomic.h
*
* @defgroup doc_driver_utils_atomic Atomic memory access and critical sections
*
* @brief This file contains the atomic memory access and critical sections header file for the configuration bits driver.
*
* @version Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef ATOMIC_H
#define ATOMIC_H
/* clang-format off */
#if defined(__GNUC__) || defined (__DOXYGEN__)
/**
* @brief Enters critical region. Saves the contents of the status register, including the Global Interrupt Enable bit, so that it can be restored upon leaving the critical region.
* Thereafter, clears the Global Interrupt Enable Bit.This macro takes a parameter P that is unused for the GCC compiler,but necessary for code compatibility with the IAR compiler.
* The IAR compiler declares a variable with the name of the parameter forholding the SREG value.
* Compilation will fail when the variable declared in the macro is not unique within the scope that the critical region is declared within.
* @param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG.
*/
#define ENTER_CRITICAL(UNUSED) __asm__ __volatile__ ( \
"in __tmp_reg__, __SREG__" "\n\t" \
"cli" "\n\t" \
"push __tmp_reg__" "\n\t" \
::: "memory" \
)
/**
* @brief Exits a critical region. Restores the contents of the status register, including the Global Interrupt Enable bit, as it was when entering the critical region.
* This macro takes a parameter P that is unused for the GCC compiler, but necessary for code compatibility with the IAR compiler.
* The IAR compiler uses this parameter as the name of a variable that holds the SREG value.
* The parameter must be identical to the parameter used in the corresponding ENTER_CRITICAL().
* @param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG
*/
#define EXIT_CRITICAL(UNUSED) __asm__ __volatile__ ( \
"pop __tmp_reg__" "\n\t" \
"out __SREG__, __tmp_reg__" "\n\t" \
::: "memory" \
)
#define DISABLE_INTERRUPTS() __asm__ __volatile__ ( "cli" ::: "memory")
#define ENABLE_INTERRUPTS() __asm__ __volatile__ ( "sei" ::: "memory")
#elif defined(__ICCAVR__)
#define ENTER_CRITICAL(P) unsigned char P = __save_interrupt();__disable_interrupt();
#define EXIT_CRITICAL(P) __restore_interrupt(P);
#define DISABLE_INTERRUPTS() __disable_interrupt();
#define ENABLE_INTERRUPTS() __enable_interrupt();
#else
# error Unsupported compiler.
#endif
/* clang-format on */
#endif /* ATOMIC_H */

Wyświetl plik

@ -0,0 +1,72 @@
/**
* Compiler Header File
*
* @file compiler.h
*
* @defgroup doc_driver_utils_compiler Compiler abstraction
*
* @brief This file contains the compiler abstraction layer and code utilities for 8-bit AVR. This module provides various abstraction layers and utilities to make code compatible between different compilers.
*
* @version Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef UTILS_COMPILER_H
#define UTILS_COMPILER_H
#if defined(__GNUC__)
#include <avr/io.h>
#include <avr/builtins.h>
#if defined(__XC8__)
#include <xc.h>
#endif
#elif defined(__ICCAVR__)
#define ENABLE_BIT_DEFINITIONS 1
#include <ioavr.h>
#include <intrinsics.h>
#ifndef CCP_IOREG_gc
#define CCP_IOREG_gc 0xD8 /* CPU_CCP_IOREG_gc */
#endif
#ifndef CCP_SPM_gc
#define CCP_SPM_gc 0x9D /* CPU_CCP_SPM_gc */
#endif
#else
#error Unsupported compiler.
#endif
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include "interrupt_avr8.h"
/**
* @def UNUSED
* @brief Marking \a v as a unused parameter or value.
*/
#define UNUSED(v) (void)(v)
#endif /* UTILS_COMPILER_H */

Wyświetl plik

@ -0,0 +1,88 @@
/**
* interrupt_avr8 Header File
*
* @file interrupt_avr8.h
*
* @defgroup doc_driver_utils_interrupts ISR abstraction
*
* @brief Interrupt-related functionality.
*
* @version Driver Version 1.0.0
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef UTILS_INTERRUPT_AVR8_H
#define UTILS_INTERRUPT_AVR8_H
/**
* \weakgroup interrupt_group
*
* @{
*/
#ifdef ISR_CUSTOM_H
#include ISR_CUSTOM_H
#else
/**
* @def ISR
* @brief Define service routine for specified interrupt vector.
* @code
ISR(FOO_vect)
{
...
}
* @endcode
*
* @param vect Interrupt vector name as found in the device header files.
*/
#if defined(__DOXYGEN__)
#define ISR(vect)
#elif defined(__GNUC__)
#include <avr/interrupt.h>
#elif defined(__ICCAVR__)
#define __ISR(x) _Pragma(#x)
#define ISR(vect) __ISR(vector = vect) __interrupt void handler_##vect(void)
#endif
#endif // ISR_CUSTOM_H
#ifdef __GNUC__
#define cpu_irq_enable() sei()
#define cpu_irq_disable() cli()
#else
#define cpu_irq_enable() __enable_interrupt()
#define cpu_irq_disable() __disable_interrupt()
#endif
//! @}
/**
* \weakgroup interrupt_deprecated_group
* @{
*/
// Deprecated definitions.
#define Enable_global_interrupt() cpu_irq_enable()
#define Disable_global_interrupt() cpu_irq_disable()
#define Is_global_interrupt_enabled() cpu_irq_is_enabled()
//! @}
#endif /* UTILS_INTERRUPT_AVR8_H */

Wyświetl plik

@ -0,0 +1,52 @@
/**
* utils Header File
*
* @file system.h
*
* @defgroup doc_driver_utils AVR Code utility functions
*
* @brief This file contains the compiler abstraction layer and code utilities for AVR.This module provides various abstraction layers and utilities to make code compatible between different compilers.
*
* @version Driver Version 1.0.1
* \{
*
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef UTILS_H_INCLUDED
#define UTILS_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Retrieve array size
*/
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* UTILS_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,60 @@
/**
* utils_assert Header File
*
* @file utils_assert.h
*
* @defgroup doc_driver_utils_assert Functionality for assert
*
* @brief This file contains the generated utils_assert header file for the configuration bits driver.
*
* @version Driver Version 1.0.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef _ASSERT_H_INCLUDED
#define _ASSERT_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
/**
* @brief Assert macro
* Macro used to throw asserts. It can be mapped to different function based on debug level.
* @param[in] condition A condition to be checked; assert is thrown if the given condition is false.
*/
#ifdef DEBUG
#define ASSERT(condition) \
if (!(condition)) \
while (true) \
;
#else
#define ASSERT(condition) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _ASSERT_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,259 @@
/**
* TCA0 Generated Driver File
*
* @file tca0.c
*
* @ingroup tca0_normal
*
* @brief This file contains the API implementations for TCA0 module driver in Normal (16-bit) mode.
*
* @version TCA0 Driver Version 2.1.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#include "../tca0.h"
const struct TMR_INTERFACE TCA0_Interface = {
.Initialize = TCA0_Initialize,
.Start = TCA0_Start,
.Stop = TCA0_Stop,
.PeriodCountSet = TCA0_Write,
.TimeoutCallbackRegister = TCA0_OverflowCallbackRegister,
.Tasks = NULL
};
void TCA0_DefaultCompare0CallbackRegister(void);
void (*TCA0_CMP0_isr_cb)(void) = &TCA0_DefaultCompare0CallbackRegister;
void TCA0_DefaultCompare1CallbackRegister(void);
void (*TCA0_CMP1_isr_cb)(void) = &TCA0_DefaultCompare1CallbackRegister;
void TCA0_DefaultCompare2CallbackRegister(void);
void (*TCA0_CMP2_isr_cb)(void) = &TCA0_DefaultCompare2CallbackRegister;
void TCA0_DefaultOverflowCallbackRegister(void);
void (*TCA0_OVF_isr_cb)(void) = &TCA0_DefaultOverflowCallbackRegister;
void TCA0_DefaultCompare0CallbackRegister(void)
{
//Add your ISR code here
}
void TCA0_DefaultCompare1CallbackRegister(void)
{
//Add your ISR code here
}
void TCA0_DefaultCompare2CallbackRegister(void)
{
//Add your ISR code here
}
void TCA0_DefaultOverflowCallbackRegister(void)
{
//Add your ISR code here
}
void TCA0_OverflowCallbackRegister(TCA0_cb_t cb)
{
TCA0_OVF_isr_cb = cb;
}
void TCA0_Compare0CallbackRegister(TCA0_cb_t cb)
{
TCA0_CMP0_isr_cb = cb;
}
void TCA0_Compare1CallbackRegister(TCA0_cb_t cb)
{
TCA0_CMP1_isr_cb = cb;
}
void TCA0_Compare2CallbackRegister(TCA0_cb_t cb)
{
TCA0_CMP2_isr_cb = cb;
}
ISR(TCA0_CMP0_vect)
{
if (TCA0_CMP0_isr_cb != NULL)
(*TCA0_CMP0_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP0_bm;
}
ISR(TCA0_CMP1_vect)
{
if (TCA0_CMP1_isr_cb != NULL)
(*TCA0_CMP1_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP1_bm;
}
ISR(TCA0_CMP2_vect)
{
if (TCA0_CMP2_isr_cb != NULL)
(*TCA0_CMP2_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP2_bm;
}
ISR(TCA0_OVF_vect)
{
if (TCA0_OVF_isr_cb != NULL)
(*TCA0_OVF_isr_cb)();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm;
}
void TCA0_Initialize(void) {
// Compare 0
TCA0.SINGLE.CMP0 = 0xA;
// Compare 1
TCA0.SINGLE.CMP1 = 0x0;
// Compare 2
TCA0.SINGLE.CMP2 = 0x11;
// Count
TCA0.SINGLE.CNT = 0x0;
// ALUPD disabled; CMP0EN enabled; CMP1EN disabled; CMP2EN enabled; WGMODE SINGLESLOPE;
TCA0.SINGLE.CTRLB = 0x53;
// CMP0OV disabled; CMP1OV disabled; CMP2OV disabled;
TCA0.SINGLE.CTRLC = 0x0;
// SPLITM disabled;
TCA0.SINGLE.CTRLD = 0x0;
// CMD NONE; DIR disabled; LUPD disabled;
TCA0.SINGLE.CTRLECLR = 0x0;
// CMD NONE; DIR UP; LUPD disabled;
TCA0.SINGLE.CTRLESET = 0x0;
// CMP0BV disabled; CMP1BV disabled; CMP2BV disabled; PERBV disabled;
TCA0.SINGLE.CTRLFCLR = 0x0;
// CMP0BV disabled; CMP1BV disabled; CMP2BV disabled; PERBV disabled;
TCA0.SINGLE.CTRLFSET = 0x0;
// DBGRUN disabled;
TCA0.SINGLE.DBGCTRL = 0x0;
// CNTAEI disabled; CNTBEI enabled; EVACTA CNT_POSEDGE; EVACTB RESTART_POSEDGE;
TCA0.SINGLE.EVCTRL = 0x90;
// CMP0 disabled; CMP1 disabled; CMP2 disabled; OVF disabled;
TCA0.SINGLE.INTCTRL = 0x0;
// CMP0 disabled; CMP1 disabled; CMP2 disabled; OVF disabled;
TCA0.SINGLE.INTFLAGS = 0x0;
// Period
TCA0.SINGLE.PER = 0x95F;
// Temporary data for 16-bit Access
TCA0.SINGLE.TEMP = 0x0;
// CLKSEL DIV1; ENABLE enabled; RUNSTDBY disabled;
TCA0.SINGLE.CTRLA = 0x1;
}
void TCA0_Start(void)
{
TCA0.SINGLE.CTRLA|= TCA_SINGLE_ENABLE_bm;
}
void TCA0_Stop(void)
{
TCA0.SINGLE.CTRLA&= ~TCA_SINGLE_ENABLE_bm;
}
void TCA0_Write(uint16_t timerVal)
{
TCA0.SINGLE.PER=timerVal;
}
uint16_t TCA0_Read(void)
{
uint16_t readVal;
readVal = TCA0.SINGLE.CNT;
return readVal;
}
void TCA0_EnableInterrupt(void)
{
TCA0.SINGLE.INTCTRL = 1 << TCA_SINGLE_CMP0_bp /* Compare 0 Interrupt: enabled */
| 1 << TCA_SINGLE_CMP1_bp /* Compare 1 Interrupt: enabled */
| 1 << TCA_SINGLE_CMP2_bp /* Compare 2 Interrupt: enabled */
| 1 << TCA_SINGLE_OVF_bp; /* Overflow Interrupt: enabled */
}
void TCA0_DisableInterrupt(void)
{
TCA0.SINGLE.INTCTRL = 0 << TCA_SINGLE_CMP0_bp /* Compare 0 Interrupt: disabled */
| 0 << TCA_SINGLE_CMP1_bp /* Compare 1 Interrupt: disabled */
| 0 << TCA_SINGLE_CMP2_bp /* Compare 2 Interrupt: disabled */
| 0 << TCA_SINGLE_OVF_bp; /* Overflow Interrupt: disabled */
}
void TCA0_ClearOverflowInterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm; /* Clear Overflow Interrupt Flag */
}
bool TCA0_IsOverflowInterruptFlagSet(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_OVF_bm) > 0);
}
void TCA0_ClearCMP0InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP0_bm; /* Clear Compare Channel-0 Interrupt Flag */
}
bool TCA0_IsCMP0InterruptFlagSet(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP0_bm) > 0);
}
void TCA0_ClearCMP1InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP1_bm; /* Clear Compare Channel-1 Interrupt Flag */
}
bool TCA0_IsCMP1InterruptFlagSet(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP1_bm) > 0);
}
void TCA0_ClearCMP2InterruptFlag(void)
{
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_CMP2_bm; /* Clear Compare Channel-2 Interrupt Flag */
}
bool TCA0_IsCMP2InterruptFlagSet(void)
{
return ((TCA0.SINGLE.INTFLAGS & TCA_SINGLE_CMP2_bm) > 0);
}

Wyświetl plik

@ -0,0 +1,199 @@
/**
* TCA0 Generated Driver API Header File
*
* @file tca0.h
*
* @defgroup tca0_normal TCA0 in Normal Mode
*
* @brief This file contains the API prototypes for the TCA0 driver in Normal (16-bit) mode.
*
* @version TCA0 Driver Version 2.1.1
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef TCA0_H_INCLUDED
#define TCA0_H_INCLUDED
#include <stdint.h>
#include <stdbool.h>
#include "../system/system.h"
#include "timer_interface.h"
#include "../system/utils/compiler.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup tca0_normal
* @typedef void TCA0_cb_t
* @brief Function pointer to the callback function called by TCA when operating in Normal mode. The default value is set to NULL which means that no callback function will be used.
*/
typedef void (*TCA0_cb_t)(void);
extern const struct TMR_INTERFACE TCA0_Interface;
/**
* @ingroup tca0_normal
* @brief Initializes the TCA.
* @param None.
* @return None.
*/
void TCA0_Initialize(void);
/**
* @ingroup tca0_normal
* @brief Starts the 16-bit timer/counter for the TCA.
* @param None.
* @return None.
*/
void TCA0_Start(void);
/**
* @ingroup tca0_normal
* @brief Stops the 16-bit timer/counter for the TCA.
* @param None.
* @return None.
*/
void TCA0_Stop(void);
/**
* @ingroup tca0_normal
* @brief Interrupt Service Routine (ISR) callback function register to be called if the Overflow Interrupt flag is set.
* @param TCA0_cb_t cb - Callback function for Overflow event.
* @return None.
*/
void TCA0_OverflowCallbackRegister(TCA0_cb_t cb);
/**
* @ingroup tca0_normal
* @brief ISR callback function to be called if the Compare 0 Match Interrupt flag is set.
* @param TCA0_cb_t cb - Callback function for Compare 0 match event.
* @return None.
*/
void TCA0_Compare0CallbackRegister(TCA0_cb_t cb);
/**
* @ingroup tca0_normal
* @brief ISR callback function to be called if the Compare 1 Match Interrupt flag is set.
* @param TCA0_cb_t cb - Callback function for Compare 1 match event.
* @return None.
*/
void TCA0_Compare1CallbackRegister(TCA0_cb_t cb);
/**
* @ingroup tca0_normal
* @brief ISR callback function to be called if the Compare 2 Match Interrupt flag is set.
* @param TCA0_cb_t cb - Callback function for Compare 2 match event.
* @return None.
*/
void TCA0_Compare2CallbackRegister(TCA0_cb_t cb);
/**
* @ingroup tca0_normal
* @brief Enables the 16-bit timer/counter interrupt for the TCA.
* @param None.
* @return None.
*/
void TCA0_EnableInterrupt(void);
/**
* @ingroup tca0_normal
* @brief Disables the 16-bit timer/counter interrupt for the TCA.
* @param None.
* @return None.
*/
void TCA0_DisableInterrupt(void);
/**
* @ingroup tca0_normal
* @brief Reads the 16-bit timer/counter value for the TCA.
* @param None.
* @return uint16_t - timer/counter value returns from the TCA0.
*/
uint16_t TCA0_Read(void);
/**
* @ingroup tca0_normal
* @brief Writes the timer value to load to the TCA.
* @param uint16_t timerVal - Loading the timer value for the TCA.
* @return None.
*/
void TCA0_Write(uint16_t timerVal);
/**
* @ingroup tca0_normal
* @brief Clears the Overflow Interrupt flag after the Overflow flag set.
* @param None.
* @return None.
*/
void TCA0_ClearOverflowInterruptFlag(void);
/**
* @ingroup tca0_normal
* @brief Checks the Overflow Interrupt flag status for the TCA.
* @param None.
* @retval True - Overflow Interrupt flag is set.
* @retval False - Overflow Interrupt flag is not set.
*/
bool TCA0_IsOverflowInterruptFlagSet(void);
/**
* @ingroup tca0_normal
* @brief Clears the Compare 0 Interrupt flag after the Compare 0 flag is set.
* @param None.
* @return None.
*/
void TCA0_ClearCMP0InterruptFlag(void);
/**
* @ingroup tca0_normal
* @brief Checks the Compare 0 Interrupt flag status for the TCA.
* @param None.
* @retval True - Compare 0 Interrupt flag is set.
* @retval False - Compare 0 Interrupt flag is not set.
*/
bool TCA0_IsCMP0InterruptFlagSet(void);
/**
* @ingroup tca0_normal
* @brief Clears the Compare 1 Interrupt flag after the Compare 1 flag is set.
* @param None.
* @return None.
*/
void TCA0_ClearCMP1InterruptFlag(void);
/**
* @ingroup tca0_normal
* @brief Checks the Compare 1 Interrupt flag status for the TCA.
* @param None.
* @retval True - Compare 1 Interrupt flag is set.
* @retval False - Compare 1 Interrupt flag is not set.
*/
bool TCA0_IsCMP1InterruptFlagSet(void);
/**
* @ingroup tca0_normal
* @brief Clears the Compare 2 Interrupt flag after the Compare 2 flag is set.
* @param None.
* @return None.
*/
void TCA0_ClearCMP2InterruptFlag(void);
/**
* @ingroup tca0_normal
* @brief Checks the Compare 2 Interrupt flag status for the TCA.
* @param None.
* @retval True - Compare 2 Interrupt flag is set.
* @retval False - Compare 2 Interrupt flag is not set.
*/
bool TCA0_IsCMP2InterruptFlagSet(void);
#ifdef __cplusplus
}
#endif
#endif /* TCA0_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,69 @@
/**
@Company
Microchip Technology Inc.
@File Name
TMR_interface.h
@Summary
This is the generated header file for Timer module interfaces.
@Description
This header file provides interfaces to Timer driver APIs.
Generation Information :
Driver Version : 1.00
The generated drivers are tested against the following:
MPLAB : MPLAB X v5.40
*/
/*
© [2023] Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip
software and any derivatives exclusively with Microchip products.
You are responsible for complying with 3rd party license terms
applicable to your use of 3rd party software (including open source
software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
THIS SOFTWARE.
*/
#ifndef TMR_INTERFACE_H
#define TMR_INTERFACE_H
/**
* @brief This file contains API prototypes and other datatypes for Timer-0 module.
* @defgroup timer_interface Timer Interface
* @{
*/
#include<stddef.h>
/**
@ingroup timer_interface
@typedef struct TMR_INTERFACE
@brief This structure contains the interfaces to Timer module
*/
struct TMR_INTERFACE
{
void (*Initialize)(void);
void (*Start)(void);
void (*Stop)(void);
void (*PeriodCountSet)(size_t count);
void (*TimeoutCallbackRegister)(void (* CallbackHandler)(void));
void (*Tasks)(void);
};
/**
* @}
*/
#endif //TMR_INTERFACE_H

Wyświetl plik

@ -1,49 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef ASSEMBLER_H_INCLUDED
#define ASSEMBLER_H_INCLUDED
#if !defined(__ASSEMBLER__) && !defined(__IAR_SYSTEMS_ASM__) && !defined(__DOXYGEN__)
#error This file may only be included from assembly files
#endif
#if defined(__ASSEMBLER__)
#include "assembler/gas.h"
#include <avr/io.h>
#elif defined(__IAR_SYSTEMS_ASM__)
#include "assembler/iar.h"
#include <ioavr.h>
#endif
#endif /* ASSEMBLER_H_INCLUDED */

Wyświetl plik

@ -1,113 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef ATOMIC_H
#define ATOMIC_H
/**
* \defgroup doc_driver_utils_atomic Atomic memory access and critical sections
* \ingroup doc_driver_utils
*
* Atomic memory access and critical sections
*
* \{
*/
/* clang-format off */
#if defined(__GNUC__) || defined (__DOXYGEN__)
/**
* \brief Enter a critical region
*
* Saves the contents of the status register, including the Global
* Interrupt Enable bit, so that it can be restored upon leaving the
* critical region. Thereafter, clears the Global Interrupt Enable Bit.
* This macro takes a parameter P that is unused for the GCC compiler,
* but necessary for code compatibility with the IAR compiler. The IAR
* compiler declares a variable with the name of the parameter for
* holding the SREG value. Since a variable is declared in the macro,
* this variable must have a name that is unique within the scope
* that the critical region is declared within, otherwise compilation
* will fail.
*
* \param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG
*
*/
#define ENTER_CRITICAL(UNUSED) __asm__ __volatile__ ( \
"in __tmp_reg__, __SREG__" "\n\t" \
"cli" "\n\t" \
"push __tmp_reg__" "\n\t" \
::: "memory" \
)
/**
* \brief Exit a critical region
*
* Restores the contents of the status register, including the Global
* Interrupt Enable bit, as it was when entering the critical region.
* This macro takes a parameter P that is unused for the GCC compiler,
* but necessary for code compatibility with the IAR compiler. The IAR
* compiler uses this parameter as the name of a variable that holds
* the SREG value. The parameter must be identical to the parameter
* used in the corresponding ENTER_CRITICAL().
*
* \param[in] UNUSED(GCC)/P(IAR) Name of variable storing SREG
*
*/
#define EXIT_CRITICAL(UNUSED) __asm__ __volatile__ ( \
"pop __tmp_reg__" "\n\t" \
"out __SREG__, __tmp_reg__" "\n\t" \
::: "memory" \
)
#define DISABLE_INTERRUPTS() __asm__ __volatile__ ( "cli" ::: "memory")
#define ENABLE_INTERRUPTS() __asm__ __volatile__ ( "sei" ::: "memory")
#elif defined(__ICCAVR__)
#define ENTER_CRITICAL(P) unsigned char P = __save_interrupt();__disable_interrupt();
#define EXIT_CRITICAL(P) __restore_interrupt(P);
#define DISABLE_INTERRUPTS() __disable_interrupt();
#define ENABLE_INTERRUPTS() __enable_interrupt();
#else
# error Unsupported compiler.
#endif
/* clang-format on */
#endif /* ATOMIC_H */

Wyświetl plik

@ -1,80 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
#ifndef UTILS_COMPILER_H
#define UTILS_COMPILER_H
/**
* \defgroup doc_driver_utils_compiler Compiler abstraction
* \ingroup doc_driver_utils
*
* Compiler abstraction layer and code utilities for 8-bit AVR.
* This module provides various abstraction layers and utilities
* to make code compatible between different compilers.
*
* \{
*/
#if defined(__GNUC__)
#include <avr/io.h>
#include <avr/builtins.h>
#elif defined(__ICCAVR__)
#define ENABLE_BIT_DEFINITIONS 1
#include <ioavr.h>
#include <intrinsics.h>
#ifndef CCP_IOREG_gc
#define CCP_IOREG_gc 0xD8 /* CPU_CCP_IOREG_gc */
#endif
#ifndef CCP_SPM_gc
#define CCP_SPM_gc 0x9D /* CPU_CCP_SPM_gc */
#endif
#else
#error Unsupported compiler.
#endif
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include <stdlib.h>
#include "interrupt_avr8.h"
/**
* \def UNUSED
* \brief Marking \a v as a unused parameter or value.
*/
#define UNUSED(v) (void)(v)
#endif /* UTILS_COMPILER_H */

Wyświetl plik

@ -1,100 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
/**
* \defgroup doc_driver_utils_interrupts ISR abstraction
* \ingroup doc_driver_utils
*
* Interrupt-related functionality.
*
* \{
*/
#ifndef UTILS_INTERRUPT_AVR8_H
#define UTILS_INTERRUPT_AVR8_H
/**
* \weakgroup interrupt_group
*
* @{
*/
#ifdef ISR_CUSTOM_H
#include ISR_CUSTOM_H
#else
/**
* \def ISR
* \brief Define service routine for specified interrupt vector
*
* Usage:
* \code
ISR(FOO_vect)
{
...
}
\endcode
*
* \param vect Interrupt vector name as found in the device header files.
*/
#if defined(__DOXYGEN__)
#define ISR(vect)
#elif defined(__GNUC__)
#include <avr/interrupt.h>
#elif defined(__ICCAVR__)
#define __ISR(x) _Pragma(#x)
#define ISR(vect) __ISR(vector = vect) __interrupt void handler_##vect(void)
#endif
#endif // ISR_CUSTOM_H
#ifdef __GNUC__
#define cpu_irq_enable() sei()
#define cpu_irq_disable() cli()
#else
#define cpu_irq_enable() __enable_interrupt()
#define cpu_irq_disable() __disable_interrupt()
#endif
//! @}
/**
* \weakgroup interrupt_deprecated_group
* @{
*/
// Deprecated definitions.
#define Enable_global_interrupt() cpu_irq_enable()
#define Disable_global_interrupt() cpu_irq_disable()
#define Is_global_interrupt_enabled() cpu_irq_is_enabled()
//! @}
#endif /* UTILS_INTERRUPT_AVR8_H */

Wyświetl plik

@ -1,61 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
/**
* \defgroup doc_driver_utils AVR Code utility functions
*
* Compiler abstraction layer and code utilities for AVR.
* This module provides various abstraction layers and utilities
* to make code compatible between different compilers.
*
* \{
*/
#ifndef UTILS_H_INCLUDED
#define UTILS_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief Retrieve array size
*/
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* UTILS_H_INCLUDED */

Wyświetl plik

@ -1,72 +0,0 @@
/**
@Company
Microchip Technology Inc.
@Description
This Source file provides APIs.
Generation Information :
Driver Version : 1.0.0
*/
/*
(c) 2018 Microchip Technology Inc. and its subsidiaries.
Subject to your compliance with these terms, you may use Microchip software and any
derivatives exclusively with Microchip products. It is your responsibility to comply with third party
license terms applicable to your use of third party software (including open source software) that
may accompany Microchip software.
THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS
FOR A PARTICULAR PURPOSE.
IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP
HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO
THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL
CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT
OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS
SOFTWARE.
*/
/**
* \defgroup doc_driver_utils_assert Functionality for assert.
* \ingroup doc_driver_utils
*
* \{
*/
#ifndef _ASSERT_H_INCLUDED
#define _ASSERT_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
/**
* \brief Assert macro
*
* This macro is used to throw asserts. It can be mapped to different function
* based on debug level.
*
* \param[in] condition A condition to be checked;
* assert is thrown if the given condition is false
*/
#ifdef DEBUG
#define ASSERT(condition) \
if (!(condition)) \
while (true) \
;
#else
#define ASSERT(condition) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _ASSERT_H_INCLUDED */

Wyświetl plik

@ -7,34 +7,42 @@
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
<logicalFolder name="config" displayName="config" projectFiles="true">
<itemPath>mcc_generated_files/config/clock_config.h</itemPath>
<logicalFolder name="ccl" displayName="ccl" projectFiles="true">
<itemPath>mcc_generated_files/ccl/ccl.h</itemPath>
</logicalFolder>
<logicalFolder name="include" displayName="include" projectFiles="true">
<itemPath>mcc_generated_files/include/ccp.h</itemPath>
<itemPath>mcc_generated_files/include/rstctrl.h</itemPath>
<itemPath>mcc_generated_files/include/cpuint.h</itemPath>
<itemPath>mcc_generated_files/include/spi0.h</itemPath>
<itemPath>mcc_generated_files/include/port.h</itemPath>
<itemPath>mcc_generated_files/include/protected_io.h</itemPath>
<itemPath>mcc_generated_files/include/pin_manager.h</itemPath>
<itemPath>mcc_generated_files/include/tca0.h</itemPath>
<itemPath>mcc_generated_files/include/evsys.h</itemPath>
<itemPath>mcc_generated_files/include/ccl.h</itemPath>
<logicalFolder name="evsys" displayName="evsys" projectFiles="true">
<itemPath>mcc_generated_files/evsys/evsys.h</itemPath>
</logicalFolder>
<logicalFolder name="utils" displayName="utils" projectFiles="true">
<logicalFolder name="assembler" displayName="assembler" projectFiles="true">
<itemPath>mcc_generated_files/utils/assembler/gas.h</itemPath>
<itemPath>mcc_generated_files/utils/assembler/iar.h</itemPath>
<logicalFolder name="spi" displayName="spi" projectFiles="true">
<itemPath>mcc_generated_files/spi/spi0.h</itemPath>
<itemPath>mcc_generated_files/spi/spi_interface.h</itemPath>
</logicalFolder>
<logicalFolder name="system" displayName="system" projectFiles="true">
<logicalFolder name="utils" displayName="utils" projectFiles="true">
<logicalFolder name="assembler" displayName="assembler" projectFiles="true">
<itemPath>mcc_generated_files/system/utils/assembler/iar.h</itemPath>
<itemPath>mcc_generated_files/system/utils/assembler/gas.h</itemPath>
</logicalFolder>
<itemPath>mcc_generated_files/system/utils/utils.h</itemPath>
<itemPath>mcc_generated_files/system/utils/atomic.h</itemPath>
<itemPath>mcc_generated_files/system/utils/interrupt_avr8.h</itemPath>
<itemPath>mcc_generated_files/system/utils/compiler.h</itemPath>
<itemPath>mcc_generated_files/system/utils/utils_assert.h</itemPath>
<itemPath>mcc_generated_files/system/utils/assembler.h</itemPath>
</logicalFolder>
<itemPath>mcc_generated_files/utils/assembler.h</itemPath>
<itemPath>mcc_generated_files/utils/compiler.h</itemPath>
<itemPath>mcc_generated_files/utils/interrupt_avr8.h</itemPath>
<itemPath>mcc_generated_files/utils/atomic.h</itemPath>
<itemPath>mcc_generated_files/utils/utils.h</itemPath>
<itemPath>mcc_generated_files/utils/utils_assert.h</itemPath>
<itemPath>mcc_generated_files/system/protected_io.h</itemPath>
<itemPath>mcc_generated_files/system/port.h</itemPath>
<itemPath>mcc_generated_files/system/system.h</itemPath>
<itemPath>mcc_generated_files/system/ccp.h</itemPath>
<itemPath>mcc_generated_files/system/interrupt.h</itemPath>
<itemPath>mcc_generated_files/system/clock.h</itemPath>
<itemPath>mcc_generated_files/system/config_bits.h</itemPath>
<itemPath>mcc_generated_files/system/pins.h</itemPath>
</logicalFolder>
<logicalFolder name="timer" displayName="timer" projectFiles="true">
<itemPath>mcc_generated_files/timer/timer_interface.h</itemPath>
<itemPath>mcc_generated_files/timer/tca0.h</itemPath>
</logicalFolder>
<itemPath>mcc_generated_files/mcc.h</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="LinkerScript"
@ -47,17 +55,36 @@
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/src/pin_manager.c</itemPath>
<itemPath>mcc_generated_files/src/cpuint.c</itemPath>
<itemPath>mcc_generated_files/src/spi0.c</itemPath>
<itemPath>mcc_generated_files/src/protected_io.S</itemPath>
<itemPath>mcc_generated_files/src/tca0.c</itemPath>
<itemPath>mcc_generated_files/src/evsys.c</itemPath>
<itemPath>mcc_generated_files/src/ccl.c</itemPath>
<logicalFolder name="ccl" displayName="ccl" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/ccl/src/ccl.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="evsys" displayName="evsys" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/evsys/src/evsys.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="spi" displayName="spi" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/spi/src/spi0.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="system" displayName="system" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/system/src/system.c</itemPath>
<itemPath>mcc_generated_files/system/src/protected_io.S</itemPath>
<itemPath>mcc_generated_files/system/src/pins.c</itemPath>
<itemPath>mcc_generated_files/system/src/config_bits.c</itemPath>
<itemPath>mcc_generated_files/system/src/clock.c</itemPath>
<itemPath>mcc_generated_files/system/src/interrupt.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="timer" displayName="timer" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/timer/src/tca0.c</itemPath>
</logicalFolder>
</logicalFolder>
<itemPath>mcc_generated_files/device_config.c</itemPath>
<itemPath>mcc_generated_files/mcc.c</itemPath>
</logicalFolder>
<itemPath>main.c</itemPath>
</logicalFolder>
@ -65,7 +92,7 @@
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
<itemPath>MyConfig.mc3</itemPath>
<itemPath>avr128da48-cnano-ws2812-mplab-mcc.mc3</itemPath>
</logicalFolder>
</logicalFolder>
<projectmakefile>Makefile</projectmakefile>
@ -78,11 +105,11 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>noID</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.31</languageToolchainVersion>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
<pack name="AVR-Dx_DFP" vendor="Microchip" version="1.6.88"/>
<pack name="AVR-Dx_DFP" vendor="Microchip" version="2.3.272"/>
</packs>
<ScriptingSettings>
</ScriptingSettings>
@ -103,6 +130,7 @@
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeUseCleanTarget>false</makeUseCleanTarget>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
@ -134,9 +162,9 @@
<property key="optimization-level" value="-O1"/>
<property key="optimization-speed" value="false"/>
<property key="optimization-stable-enable" value="false"/>
<property key="pack-struct" value="true"/>
<property key="preprocess-assembler" value="true"/>
<property key="short-enums" value="true"/>
<property key="tentative-definitions" value="-fno-common"/>
<property key="undefine-macros" value=""/>
<property key="use-cci" value="false"/>
<property key="use-iar" value="false"/>
@ -187,37 +215,26 @@
<property key="opt-xc8-linker-file" value="false"/>
<property key="opt-xc8-linker-link_startup" value="false"/>
<property key="opt-xc8-linker-serial" value=""/>
<property key="program-the-device-with-default-config-words" value="true"/>
<property key="program-the-device-with-default-config-words" value="false"/>
<property key="remove-unused-sections" value="true"/>
</HI-TECH-LINK>
<XC8-CO>
<property key="coverage-enable" value=""/>
</XC8-CO>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="gcc-opt-driver-new" value="true"/>
<property key="gcc-opt-std" value="-std=c99"/>
<property key="gcc-output-file-format" value="dwarf-3"/>
<property key="omit-pack-options" value="false"/>
<property key="omit-pack-options-new" value="1"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
<property key="user-pack-device-support" value=""/>
</XC8-config-global>
<nEdbgTool>
<Tool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/>
<property key="communication.speed" value="0.500"/>
<property key="debugoptions.useswbreakpoints" value="true"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="firmware.path"
value="Press to browse for a specific firmware version"/>
<property key="firmware.toolpack"
value="Press to select which tool pack to use"/>
<property key="firmware.update.action" value="firmware.update.use.latest"/>
<property key="freeze.timers" value="false"/>
<property key="lastid" value=""/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
@ -231,7 +248,78 @@
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programmerToGoFilePath"
value="C:/GITHUB/avr128da48-cnano-ws2812-mplab-mcc/avr128da48-cnano-ws2812-mplab-mcc.X/debug/default/avr128da48-cnano-ws2812-mplab-mcc_ptg"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${memories.dataflash.default}"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value="1400-15ff"/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>
<property key="programoptions.preserveuserid" value="false"/>
<property key="programoptions.programuserotp" value="false"/>
<property key="toolpack.updateoptions"
value="toolpack.updateoptions.uselatestoolpack"/>
<property key="toolpack.updateoptions.packversion"
value="Press to select which tool pack to use"/>
<property key="voltagevalue" value=""/>
</Tool>
<XC8-CO>
<property key="coverage-enable" value=""/>
<property key="stack-guidance" value="false"/>
</XC8-CO>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="constdata-progmem" value="true"/>
<property key="gcc-opt-driver-new" value="true"/>
<property key="gcc-opt-std" value="-std=c99"/>
<property key="gcc-output-file-format" value="dwarf-3"/>
<property key="mapped-progmem" value="false"/>
<property key="omit-pack-options" value="false"/>
<property key="omit-pack-options-new" value="1"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="smart-io-format" value=""/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
<property key="user-pack-device-support" value=""/>
<property key="wpo-lto" value="false"/>
</XC8-config-global>
<nEdbgTool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/>
<property key="communication.speed" value="0.500"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="firmware.path"
value="Press to browse for a specific firmware version"/>
<property key="firmware.toolpack"
value="Press to select which tool pack to use"/>
<property key="firmware.update.action" value="firmware.update.use.latest"/>
<property key="freeze.timers" value="false"/>
<property key="lastid" value=""/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
<property key="memories.configurationmemory2" value="true"/>
<property key="memories.dataflash" value="true"/>
<property key="memories.eeprom" value="true"/>
<property key="memories.exclude.configurationmemory" value="true"/>
<property key="memories.flashdata" value="true"/>
<property key="memories.id" value="true"/>
<property key="memories.instruction.ram.ranges"
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
@ -257,11 +345,11 @@
<targetPluginBoard></targetPluginBoard>
<platformTool>noID</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.31</languageToolchainVersion>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
<pack name="AVR-Dx_DFP" vendor="Microchip" version="1.6.88"/>
<pack name="AVR-Dx_DFP" vendor="Microchip" version="2.3.272"/>
</packs>
<ScriptingSettings>
</ScriptingSettings>
@ -282,6 +370,7 @@
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeUseCleanTarget>false</makeUseCleanTarget>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
@ -313,9 +402,9 @@
<property key="optimization-level" value="-Os"/>
<property key="optimization-speed" value="false"/>
<property key="optimization-stable-enable" value="false"/>
<property key="pack-struct" value="true"/>
<property key="preprocess-assembler" value="true"/>
<property key="short-enums" value="true"/>
<property key="tentative-definitions" value="-fno-common"/>
<property key="undefine-macros" value=""/>
<property key="use-cci" value="false"/>
<property key="use-iar" value="false"/>
@ -366,37 +455,26 @@
<property key="opt-xc8-linker-file" value="false"/>
<property key="opt-xc8-linker-link_startup" value="false"/>
<property key="opt-xc8-linker-serial" value=""/>
<property key="program-the-device-with-default-config-words" value="true"/>
<property key="program-the-device-with-default-config-words" value="false"/>
<property key="remove-unused-sections" value="true"/>
</HI-TECH-LINK>
<XC8-CO>
<property key="coverage-enable" value=""/>
</XC8-CO>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="gcc-opt-driver-new" value="true"/>
<property key="gcc-opt-std" value="-std=c99"/>
<property key="gcc-output-file-format" value="dwarf-3"/>
<property key="omit-pack-options" value="false"/>
<property key="omit-pack-options-new" value="1"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
<property key="user-pack-device-support" value=""/>
</XC8-config-global>
<nEdbgTool>
<Tool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/>
<property key="communication.speed" value="0.500"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="firmware.path"
value="Press to browse for a specific firmware version"/>
<property key="firmware.toolpack"
value="Press to select which tool pack to use"/>
<property key="firmware.update.action" value="firmware.update.use.latest"/>
<property key="freeze.timers" value="false"/>
<property key="lastid" value=""/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
@ -410,7 +488,78 @@
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programmerToGoFilePath"
value="C:/GITHUB/avr128da48-cnano-ws2812-mplab-mcc/avr128da48-cnano-ws2812-mplab-mcc.X/debug/default/avr128da48-cnano-ws2812-mplab-mcc_ptg"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"
value="${memories.dataflash.default}"/>
<property key="programoptions.preserveeeprom" value="false"/>
<property key="programoptions.preserveeeprom.ranges" value="1400-15ff"/>
<property key="programoptions.preserveprogram.ranges" value=""/>
<property key="programoptions.preserveprogramrange" value="false"/>
<property key="programoptions.preserveuserid" value="false"/>
<property key="programoptions.programuserotp" value="false"/>
<property key="toolpack.updateoptions"
value="toolpack.updateoptions.uselatestoolpack"/>
<property key="toolpack.updateoptions.packversion"
value="Press to select which tool pack to use"/>
<property key="voltagevalue" value=""/>
</Tool>
<XC8-CO>
<property key="coverage-enable" value=""/>
<property key="stack-guidance" value="false"/>
</XC8-CO>
<XC8-config-global>
<property key="advanced-elf" value="true"/>
<property key="constdata-progmem" value="true"/>
<property key="gcc-opt-driver-new" value="true"/>
<property key="gcc-opt-std" value="-std=c99"/>
<property key="gcc-output-file-format" value="dwarf-3"/>
<property key="mapped-progmem" value="false"/>
<property key="omit-pack-options" value="false"/>
<property key="omit-pack-options-new" value="1"/>
<property key="output-file-format" value="-mcof,+elf"/>
<property key="smart-io-format" value=""/>
<property key="stack-size-high" value="auto"/>
<property key="stack-size-low" value="auto"/>
<property key="stack-size-main" value="auto"/>
<property key="stack-type" value="compiled"/>
<property key="user-pack-device-support" value=""/>
<property key="wpo-lto" value="false"/>
</XC8-config-global>
<nEdbgTool>
<property key="AutoSelectMemRanges" value="auto"/>
<property key="communication.activationmode" value="nohv"/>
<property key="communication.interface" value="updi"/>
<property key="communication.speed" value="0.500"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
<property key="firmware.path"
value="Press to browse for a specific firmware version"/>
<property key="firmware.toolpack"
value="Press to select which tool pack to use"/>
<property key="firmware.update.action" value="firmware.update.use.latest"/>
<property key="freeze.timers" value="false"/>
<property key="lastid" value=""/>
<property key="memories.aux" value="false"/>
<property key="memories.bootflash" value="true"/>
<property key="memories.configurationmemory" value="true"/>
<property key="memories.configurationmemory2" value="true"/>
<property key="memories.dataflash" value="true"/>
<property key="memories.eeprom" value="true"/>
<property key="memories.exclude.configurationmemory" value="true"/>
<property key="memories.flashdata" value="true"/>
<property key="memories.id" value="true"/>
<property key="memories.instruction.ram.ranges"
value="${memories.instruction.ram.ranges}"/>
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-ffff"/>
<property key="poweroptions.powerenable" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
<property key="programoptions.preservedataflash" value="false"/>
<property key="programoptions.preservedataflash.ranges"

Wyświetl plik

@ -4,12 +4,8 @@
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>avr128da48-cnano-ws2812-mplab-mcc</name>
<creation-uuid>6e4782f0-477d-4431-8a1e-a387b18a3fed</creation-uuid>
<creation-uuid>49648111-33f3-4c9b-a598-f0722578e929</creation-uuid>
<make-project-type>0</make-project-type>
<c-extensions>c</c-extensions>
<cpp-extensions/>
<header-extensions>h</header-extensions>
<asminc-extensions/>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<make-dep-projects/>
<sourceRootList/>

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 41 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 48 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 41 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 53 KiB

Plik binarny nie jest wyświetlany.

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 41 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 38 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 38 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 33 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 148 KiB

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 151 KiB