MPAE-14424: Initial example project added

master 1.0.0
Erling Holten Wiken 2023-10-03 05:09:10 -06:00 zatwierdzone przez Egil Rotevatn
rodzic 8407d1bb84
commit 2f4caff584
54 zmienionych plików z 8539 dodań i 41 usunięć

9
.gitignore vendored
Wyświetl plik

@ -1,6 +1,7 @@
# Untracked files in MPLABX projects
/**/build/*
/**/nbproject/*
!/**/nbproject/*.xml
/**/dist/*
/**/.generated_files/*
/**/build/*
/**/debug/*
/**/dist/*
/**/nbproject/*
!/**/nbproject/*.xml

Wyświetl plik

@ -4,27 +4,27 @@
"content": {
"metaDataVersion": "1.3.0",
"name": "com.microchip.mcu8.mplabx.project.avr64ea48-temperature-calibration",
"version": " ",
"displayName": "",
"version": "1.0.0",
"displayName": "Calibration of Internal Temperature Sensor",
"projectName": "avr64ea48-temperature-calibration",
"shortDescription": "Demo of how to calibrate the internal temperature sensor",
"ide": {
"name": "MPLAB X",
"semverRange": ">=5.50.0"
"semverRange": ">=6.10.0"
},
"compiler": [
{
"name": "XC8",
"semverRange": "^2.29.0"
"semverRange": ">=2.41.0"
}
],
"dfp": {
"name": "",
"semverRange": ""
"name": "AVR-Ex_DFP",
"semverRange": "^2.5.176"
},
"configurator": {
"name": "",
"semverRange": ""
"name": "MCC",
"semverRange": ">=5.3.7"
},
"device": {
"metaDataVersion": "1.0.0",
@ -36,9 +36,9 @@
"versionRange": "*"
}
},
"author": "Prasad Aradhya",
"peripherals": [],
"keywords": [],
"author": "Microchip",
"peripherals": ["ADC", "UART", "NVMCTRL", "EEPROM"],
"keywords": ["Internal Temperature Sensor", "Calibration"],
"additionalData": {
"longDescription": {
"metaDataVersion": "1.0.0",
@ -51,4 +51,5 @@
}
}
}
}
}

398
README.md
Wyświetl plik

@ -1,45 +1,393 @@
<!-- Please do not change this logo with link -->
[![MCHP](images/microchip.png)](https://www.microchip.com)
# Update the title for avr64ea48-temperature-calibration here
# Improving Internal Temperature Sensor With Customer Production Calibration Adjustment
<!-- This is where the introduction to the example goes, including mentioning the peripherals used -->
The AVR® EA family of devices has an internal temperature sensor. The internal temperature sensor is not directly accessible, only the Analog-to-Digital Converter (ADC) peripheral can access it. The internal temperature sensor outputs a voltage signal T<sub>SENSE</sub> that is internally routed to the ADC and converted to a digital number.
This example shows how to adjust the calibrated offset value for the internal temperature sensor in order to increase the accuracy of the internal temperature sensor for a certain temperature point (typically, it is more accurate in a smaller temperature range).
## Related Documentation
<!-- Any information about an application note or tech brief can be linked here. Use unbreakable links!
In addition a link to the device family landing page and relevant peripheral pages as well:
- [AN3381 - Brushless DC Fan Speed Control Using Temperature Input and Tachometer Feedback](https://microchip.com/00003381/)
- [PIC18F-Q10 Family Product Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic18f-q10-product-family) -->
- [AVR64EA48 device page](https://www.microchip.com/wwwproducts/en/AVR64EA48)
- [MPLAB® Code Configurator](https://www.microchip.com/en-us/development-tools-tools-and-software/embedded-software-center/mplab-code-configurator)
## Software Used
<!-- All software used in this example must be listed here. Use unbreakable links!
- MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide)
- MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers)
- MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
- MPLAB® Code Configurator (MCC) Device Libraries PIC10 / PIC12 / PIC16 / PIC18 MCUs [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator)
- Microchip PIC18F-Q Series Device Support (1.4.109) or newer [(packs.download.microchip.com/)](https://packs.download.microchip.com/) -->
- MPLAB® X IDE 5.50.0 or newer [(MPLAB® X IDE 5.50)](https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-x-ide?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_MMTCha_MPAE_Examples&utm_content=avr64ea48-temperature-calibration-github)
- MPLAB® XC8 2.29.0 or newer compiler [(MPLAB® XC8 2.29)](https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-xc-compilers?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_MMTCha_MPAE_Examples&utm_content=avr64ea48-temperature-calibration-github)
- [MPLAB X IDE v6.10](http://www.microchip.com/mplab/mplab-x-ide) or newer
- [Microchip AVR64EA48 Device Support Pack AVR-Ex_DFP v2.5.176](https://packs.download.microchip.com/) or newer
- [MPLAB XC8 Compiler v2.41](http://www.microchip.com/mplab/compilers) or newer
- MPLAB Code Configurator (MCC)
- [MCC Plugin v5.3.7](https://www.microchip.com/mplab/mplab-code-configurator) or newer
- [MCC Core v5.5.7](https://www.microchip.com/mplab/mplab-code-configurator) or newer
- Pymcuprog Utility [(pymcuprog)](https://pypi.org/project/pymcuprog/)
## Hardware Used
<!-- All hardware used in this example must be listed here. Use unbreakable links!
- PIC18F47Q10 Curiosity Nano [(DM182029)](https://www.microchip.com/Developmenttools/ProductDetails/DM182029)
- Curiosity Nano Base for Click boards™ [(AC164162)](https://www.microchip.com/Developmenttools/ProductDetails/AC164162)
- POT Click board™ [(MIKROE-3402)](https://www.mikroe.com/pot-click) -->
- [AVR64EA48 Curiosity Nano](https://www.microchip.com/en-us/development-tool/EV66E56A)
## Setup
## Test Setup
<!-- Explain how to connect hardware and set up software. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
Connect the Curiosity Nano to the PC using a USB cable. This will let you program the device using MPLAB X, but erase or write eeprom using the python program pymcuprog.
No additional setup is needed as the temperature measurement is done internally in the device.
## Peripherals Configuration Using MPLAB Core Configurator (MCC) Melody
Add the required peripherals: ADC0, UART1 and NVMCTRL. These are found under Drivers in the Device Resources window. Press the green "plus" sign to add to Project Resources, this will also make the peripheral show in the Builder view.
These System peripherals are added automatically: CLKCTRL, Configuration Bits, Interrupt Manager, Main and Pins.
![Adding Peripherals](images/project_resources_1.png)
### System Configuration
The system components (CLKCTRL, Configuration Bits, Interrupt Manager and Main) does not need any configuration since this example uses default settings and no interrupts. Pins need to be configured to reduce power consumption.
### System configuration: Pins Configuration
To reduce power consumption, the pin configuration needs to be set to disable the digital input buffer on unused pins. In this example, the only pins used are the USART1 pins, so the rest of the pins can be set to inputs and the disabled. Open the pin grid view and set all the unused pins to inputs as seen below. The pin grid view button is located at the bottom left of the screen.
![pins-1](images/pingrid_view.png)
Then the pins need to be configured. In the **Pins** Configuration view (located in the **System Firmware** box):
- For each pin except the USART1 pins (PC0 and PC1), set the Input/Sense Configuration (ISC) to "Digital Input Buffer Disabled"
Note that the image do not show all the pins, and all unused pins should be configured in the same way.
![pins-2](images/pins.png)
### Peripherals Configuration: ADC0 Configuration
In **ADC Clock Settings**:
- Select Prescaler Value "System Clock Divided by 10"
- Sample Duration: 64
**Note:** The required minimum sample duration is given as >= 32 µs * f<SUB>CLK_ADC</SUB>. For this example the minimum sample duration is: 32 µs * 333333 Hz = 10.7 ≈ 11.
In **Hardware Settings**:
- Turn on ADC Enable
- Set mode to "SINGLE_12BIT" (12-bit Single-Ended conversion)
- Set Start command to "Start a conversion immediatley"
- Set Reference select to "Internal 1.024V Reference"
- Set first analog channel selection bits (MUXPOS) to "Temperature Sensor"
- Set second analog channel selection bits (MUXNEG) to "Ground"
![ADC0-1](images/ADC0_1.png)
![ADC0-1](images/ADC0_2.png)
### Peripherals Configuration: USART1 Configuration
We are using USART1 because the Rx and Tx pins of USART1 are accessible over the USB interface for the Curiosity Nano board. See the Curiosity Nano User Manual for more information.
In the "USART1_Peripheral" configuration:
- Turn on Enable USART Receiver
- Turn on Enable USART Transmitter
![USART1-1](images/USART1_2.png)
In the "UART1" configuration:
- For Requested Baudrate write "9600"
For the rest we use the default settings, so 8 data bits, 1 stop bit, no parity and no flow control.
- For "UART PLIB Selector" select USART1
![USART1-2](images/USART1_1.png)
### Peripherals Configuration: NVMCTRL Configuration
In **Flash Software Settings**:
- Turn off Generate Flash APIs (we are only using the EEPROM)
In **EEPROM Software Settings**:
- Do nothing, default is correct and EEPROM APIs are generated
![NVMCTRL-1](images/NVMCTRL_1.png)
## Operation
<!-- Explain how to operate the example. Depending on complexity, step-by-step instructions and/or tables and/or images can be used -->
An external temperature reading (assumed to be accurate) will be stored in EEPROM. The code reads the external temperature and calculates a new value for temperature offset, which is then used to calculate a new calibrated temperature.
### Preparations
- Connect the AVR6448 Curiosity Nano (Cnano) to a computer using a USB cable
- Download pymcuprog
- Clone the repository or download the zip to get the source code
- Open the project folder you want to run with MPLAB X IDE
- Compile the code
### Writing a New Temperature Measurement to the EEPROM
This example will use pymcuprog (see link under "Software Used") to write values to the EEPROM. The idea is that this also can be done in a production environment. This is just one example of how to do this, and does not exclude any other method as long as this value finds its way into the correct address of the EEPROM.
This example assumes only one device is connected to the computer. If several devices are connected, the device to be programmed must be specified. To learn more about pymcuprog, see the link under "Software Used". To learn more about the pymcuprog options and arguments, use
```bash
pymcuprog --help
```
In this example, we will store the temperature reading from the external temperature sensor in EEPROM addresses 33 and 34 (relatively). Address 32 will be used to indicate if a reading is stored or not. This is indicated by the data in address 32: if it is 0x5c then we assume a temperature reading is stored, if it is anything else then we assume a temperature reading has not been stored.
The actual EEPROM address range for these bytes are:
- 0x001420 (0x20 = 32) - Byte indicating if temperature is stored
- 0x001421 - High byte of 16-bit temperature measurement
- 0x001422 - Low byte of 16-bit temperature measurement
The temperature could also be stored as an 8-bit value, a signed 8-bit integer covers -127°C to 128°C and so will cover most use cases.
Assuming we are measuring 23°C using the external temperature sensor at the production line, and that we want this value stored in EEPROM address 33 and 34 (EEPROM is 512 bytes and we use 2 bytes, int16_t = 16 bits = 2 bytes). Address 32 is written to 0x5c to indicate a temperature reading is done.
```bash
pymcuprog write -m eeprom -o 32 -l 0x5c 0x00 0x17
```
### Running the Software
After programming the EEPROM with a temperature value, you can run the code on the AVR64EA48 and it will calculate a new offset value and store it in EEPROM.
Before you program the Cnano, make sure that the EEPROM memory space is preserved during programming. Click the box marked "Preserve EEPROM memory" as indicated by the picture below. Make sure to do this for both "free" and "pro" configurations.
![EEPROM_preserve](images/cnano_preserve_EEPROM.png)
It will then proceed to calculate a new temperature using the new offset value.
If no new offset value is found ("empty" EEPROM bytes are read as 0xff) then the code is halted.
### Printing Result to Terminal
If USART output is enabled (include "**#define USART_on**"), the result will be printed to a terminal. Open a terminal window (Microchip Data Visualizer or your favourite terminal application). Find the serial port that the Cnano is connected to and set: baud rate to 9600, 8 bit data, no parity, no stop bit.
## Temperature Sensor
The internal temperature sensor is a Proportional to Absolute Temperature (PTAT) type, meaning it has increasing output voltage with increasing temperature.
The output voltage of the temperature sensor is linear across the temperature range. An approximation of the output voltage is presented here:
V<sub>TSENSE</sub> = M<sub>V</sub> &times; T<sub>SENSE</sub> + V<sub>OFFSET</sub>
where:
V<sub>TSENSE</sub> = output voltage from the temperature sensor
M<sub>V</sub> = slope of the temperature sensor output voltage (V/°C)
V<sub>OFFSET</sub> = output voltage at T<sub>OFFSET </sub>
T<sub>SENSE</sub> = temperature at time of measurement
Due to process variations, V<sub>OFFSET</sub> and M<sub>V</sub> will be different for each device, and because of this each device must be calibrated. Solving the formula for T<sub>SENSE</sub>:
$$
T_{SENSE}=V_{TSENSE}-\frac{V_{OFFSET}}{M_{V}}
$$
While accurate, this equation requires that V<sub>OFFSET</sub> is known, but this is typically not the case. By measuring the temperature sensor voltage at a known temperature, using a nominal slope for the sensor, the temperature can be calculated using the following formula:
$$
T_{SENSE}=\frac{V_{TSENSE}-V_{REF}}{M_{REF}}+T_{REF}
$$
where:
V<sub>REF</sub> = is the reference voltage of the sensor
M<sub>REF</sub> = slope of the temperature sensor (V / &#176;C)
T<sub>REF</sub> = the reference temperature
If V<sub>TSENSE</sub> is expressed as ADC counts, the ADC reference voltage must be in ADC counts. M<sub>REF</sub> should also be in ADC counts per temperature to get the calculation correct.
### Factory Calibration of the Internal Temperature Sensor
The characteristics for the temperature sensor is close to linear in the temperature range of the device and these equations are based on this fact and measurements done using the 1.024V internal reference.
The Slope and Offset are calculated based on two measurements in production:
- Measurement 1: ADC result RES<sub>ADC1</sub> at temperature T<sub>1</sub>
- Measurement 2: ADC result RES<sub>ADC2</sub> at temperature T<sub>2</sub>
With a linear approximation the temperature is given by
$$
T=A \times RES_{ADC} + B = A \times (RES_{ADC} + \frac{B}{A})
$$
Where the temperature sensor output is increasing with increasing temperatures.
$$
A=\frac{T_{2}-T_{1}}{RES_{ADC2}-RES_{ADC1}}
$$
<br>
$$
B=T_{1}-A \times RES_{ADC1}
$$
<br>
### Internal Temperature Sensor (PTAT)
The temperature sensor follows a PTAT curve, so it has increasing output voltage with increasing temperature. In this case there is no need to negate the slope:
<br>
$$
T=A \times (RES_{ADC} + \frac{B}A)
$$
<br>
Using a scaling factor of 4096 (12-bit DAC, 4096 = 0xfff+1) to make sure the number in the calibration register is an integer, the values to be placed in the calibration row are the following (rounded off to closest integer):
<br>
$$
Slope = 4096 \times A = 4096 \times \frac{T_{2} - T_{1}}{RES_{ADC2} - RES_{ADC1}}
$$
<br>
$$
Offset=\frac{B}A=\frac{T{1} \times (RES_{ADC2} - RES_{ADC1})}{T_{2} - T_{1}} - \frac{RES_{ADC1} \times (T_{2} - T_{1})}{T_{2} - T_{1}} =
\frac{T_{1} \times RES_{ADC2} - T_{2} \times RES_{ADC1}}{T_{2} - T_{1}}
$$
<br>
This gives the following formula for the temperature sensor:
<br>
$$
T = \frac{(RES_{ADC} + Offset) \times Slope}{4096}
$$
<br>
This formula requires two calibration values to be stored in the signature row:
- SIGROW.TEMPSENSE0: Internal temperature sensor slope
- SIGROW.TEMPSENSE1: Internal temperature sensor offset
<br>
### Temperature Measurement Using Factory Calibrated Values
An AVR64EA48 device was tested in a climate chamber to verify the accuracy of the internal temperature sensor. The temperature range was -40°C to +125°C in steps of 5°C, and each temperature step was held for 5 minutes to allow the device to adjust to the new temperature. The temperature measurements are plottet below, showing the difference between the actual temperature (the climate chamber was used as reference) and the measured temperature using the AVR64EA48 device.
![temp_plot](images/temp_plot.png)
For this particular measurement it can be seen that adjusting the offset so that the temperature measurements show 1°C more, the accuracy across the range is improved. For low temperatures the difference will be -0.5°C instead of +0.5°C, while for high temperatures the difference will be 1°C less than previous, so this will also improve.
## User Calibration of the Internal Temperature Sensor
During production, the internal temperature sensor is calibrated at two temperatures, room temperature and 125°C. The measurements are taken during wafer production, and the temperatures are not expected to be uniform across the wafer. After this, the die is bonded and packaged, which is expected to make factory calibration less accurate. Since there is no measurement taken at cold temperatures, it is expected that the temperature measurements for cold temperatures will deviate more from the actual temperature in that region.
To compensate for this, it is possible to do additional calibration of the temperature sensor to get better readings. In the following example we will show how to do a single point calibration of the device during production programming to improve the temperature sensor accuracy.
### Module Configuration
1. Configure the voltage reference to internal 1.024V by writing to the Reference Selection (REFSEL) bit field the ADCn.CTRLC register.
2. Select the temperature sensor as input in the Positive Input Multiplexer (ADCn.MUXPOS) register.
3. Configure the ADC Sample Duration by writing a value ≥ 35 μs × f<sub>CLK_ADC</sub> to the Sample Duration (SAMPDUR) bit field in the Control E (ADCn.CTRLE) register.
4. Configure the USART to send the calculated temperature value to a terminal window for a visual representation. Note that the "#define USART_ON" must be included in the code if output to terminal is desired.
### Temperature Measurement
Read the external temperature reading, stored in EEPROM. See section *Writing a new temperature measurement to the EEPROM* for information about how to add data to EEPROM. If no temperature is stored, the code execution is stopped.
```c
external_temperature = Read_External_Temperature(); // get external temperature
if(external_temperature == 0x7fff) // if external temperature is not stored, break
break;
}
```
Read the factory stored values for Offset and Gain:
```c
sigrow_offset = Get_Sigrow_Offset(); // get factory calibration value for offset
sigrow_gain = Get_Sigrow_Gain(); // get factory calibration value for gain
```
Acquire the internal temperature sensor output using the factory stored values for Offset and Gain by running a 12-bit Single-Ended ADC conversion:
```c
// read out internal temperature using factory calibration
internal_temperature = Read_int_temp(sigrow_offset, sigrow_gain);
```
Now calculate a new offset value based on the previous read external temperature. By solving the formula for the temperature sensor with regards to Offset we get:
$$
Offset=\frac{4096 \times T}{Slope} - RES_{ADC}
$$
Using this formula, we can calculate a new offset value by using the voltage output from the internal temperature sensor (RES<sub>ADC</sub>) at a known temperature. The new offset value is stored in EEPROM, to be kept there to be used instead of the factory stored value (SIGROW.TEMPSENSE1):
```c
// calculate new offset using external temperature reading
new_offset = Calculate_offset(external_temperature);
// write high byte of new offset to EEPROM
data = new_offset >> 8; // note the use of uint8_t when sending signed 2 byte value,
// else the sign bit may be changed
nvm_status_t EEstatus = EEPROM_Write(CALCULATED_OFFSET, data);
while(EEPROM_IsBusy())
;
// write low byte of new offset to EEPROM
data = new_offset;
EEstatus = EEPROM_Write((CALCULATED_OFFSET + 1), data);
while(EEPROM_IsBusy())
;
```
The new offset is calculated in the first function called (Calculate_offset):
```c
int16_t Calculate_offset(int16_t temp)
{
while(ADC0.STATUS) // wait for ADC0 ready
;
ADC0_StartConversion(ADC_MUXPOS_TEMPSENSE_gc); // start temperature measurement
while(!ADC0_IsConversionDone()) // wait for conversion to complete
;
int16_t sigrow_gain = (int16_t) SIGROW.TEMPSENSE0; // signed gain from signature row
uint16_t adc_reading = ADC0.RESULT; // ADC conversion result
int16_t ext_temp_K = temp + 273; // convert temperature from Celsius to Kelvin
// Calculate offset based on known external temperature
float calculated_offset = ( ((float) ext_temp_K * SCALING_FACTOR) / (float) sigrow_gain ) - (float) adc_reading;
calculated_offset += 0.5; // add 0.5 to fix rounding errors
calculated_offset = (int16_t) calculated_offset; // recast value to int16_t
return calculated_offset;
}
```
Finally, the internal temperature sensor is read again (forever, in a while(1) loop), using the new offset value. Note that there is a warning during compilation, since this value is not used for anything.
```c
while(1)
{
if(external_temperature == 0x7fff) // if external temperature is not stored, break
break;
// Now do a new temperature reading using adjusted offset
internal_temperature = Read_int_temp(new_offset, sigrow_gain);
}
```
The code does not check if a new offset is already calculated and stored in EEPROM. One way to do this is by checking for a value other than `0xffff`, since unused or erased EEPROM bytes will read `0xff`.
## Summary
<!-- Summarize what the example has shown -->
In this guide we have learned how to use an external temperature measurement to calibrate the internal temperature sensor.
Writing the external temperature value to EEPROM was done using `pymcuprog`.

Wyświetl plik

@ -0,0 +1,113 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL
# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin
RANLIB=ranlib
# build
build: .build-post
.build-pre:
# Add your pre 'build' code here...
.build-post: .build-impl
# Add your post 'build' code here...
# clean
clean: .clean-post
.clean-pre:
# Add your pre 'clean' code here...
# WARNING: the IDE does not call this target since it takes a long time to
# simply run make. Instead, the IDE removes the configuration directories
# under build and dist directly without calling make.
# This target is left here so people can do a clean when running a clean
# outside the IDE.
.clean-post: .clean-impl
# Add your post 'clean' code here...
# clobber
clobber: .clobber-post
.clobber-pre:
# Add your pre 'clobber' code here...
.clobber-post: .clobber-impl
# Add your post 'clobber' code here...
# all
all: .all-post
.all-pre:
# Add your pre 'all' code here...
.all-post: .all-impl
# Add your post 'all' code here...
# help
help: .help-post
.help-pre:
# Add your pre 'help' code here...
.help-post: .help-impl
# Add your post 'help' code here...
# include project implementation makefile
include nbproject/Makefile-impl.mk
# include project make variables
include nbproject/Makefile-variables.mk

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -0,0 +1,352 @@
/*
* MAIN Generated Driver File
*
* @file main.c
*
* @defgroup main MAIN
*
* @brief This is the generated driver implementation file for the MAIN driver.
*
* @version MAIN 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.
*/
// includes
#include "mcc_generated_files/system/system.h"
#include <stdio.h>
#include <util/delay.h>
//defines
#define USART_ON // enable output to terminal
#define SCALING_FACTOR 4096 // 12-bit: 2^12 = 4096
// EEPROM address space starts at 0x001400, these addresses are relative to that
#define CALCULATED_OFFSET_HIGH_ADDRESS 0x18 // Calculated offset high byte address
#define CALCULATED_OFFSET_LOW_ADDRESS (CALCULATED_OFFSET_HIGH_ADDRESS+1) // Calculated offset low byte address
#define EXTERNAL_TEMPERATURE_CHECK_ADDRESS 0x20 // External temperature Check byte address
#define EXTERNAL_TEMPERATURE_HIGH_ADDRESS (EXTERNAL_TEMPERATURE_CHECK_ADDRESS+1) // External temperature High byte address
#define EXTERNAL_TEMPERATURE_LOW_ADDRESS (EXTERNAL_TEMPERATURE_HIGH_ADDRESS+1) // External temperature Low byte address
// global variables
char string_buffer[10];
//functions
void USART1_SendString(const char *strptr);
int16_t ReadInternalTemperature(int16_t offset, int16_t gain);
void EEPROM_ReadRange(uint16_t addr_start, uint16_t addr_end);
int16_t ReadExternalTemperature(void);
int16_t GetSigrowOffset(void);
int16_t GetSigrowGain(void);
int16_t CalculateOffset(int16_t temp);
/*
* USART1_send_string
*
* Send a string using USART1 Tx
* C automatically adds a NULL at the end of a string, so when
* the NULL value is reached the while(*strptr) loop ends
*/
void USART1_SendString(const char *strptr)
{
while(*strptr) // loop until reaching NULL
{
USART1_Write(*strptr); // send byte
strptr++; // increment string pointer
while(!(USART1_IsTxDone())) // wait for Tx buffer empty
;
USART1.STATUS |= USART_TXCIF_bm; // clear Transmit complete flag
}
}
/*
* Read_int_temp
*
* Make a reading of the internal temperature
* Return temperature as signed 16-bit integer
*/
int16_t ReadInternalTemperature(int16_t offset, int16_t gain)
{
while(ADC0.STATUS) // wait for ADC0 ready
;
ADC0_StartConversion(ADC_MUXPOS_TEMPSENSE_gc); // start temperature measurement
while(!ADC0_IsConversionDone()) // wait for conversion to complete
;
uint16_t adc_reading = ADC0.RESULT; // ADC conversion result
int32_t temp = ((int32_t) adc_reading) + offset; // add offset to ADC result
temp *= gain; // result can overflow 16-bit value
temp += SCALING_FACTOR / 2; // ensures correct rounding on division below
temp /= SCALING_FACTOR; // round to the nearest integer in Kelvin
uint16_t temp_in_K = (uint16_t) temp; // absolute temperature
int16_t temp_in_C = temp_in_K - 273; // temperature in C°
#ifdef USART_ON
sprintf(string_buffer, "%d°C\n", temp_in_C);
USART1_SendString("Internal temperature reading: ");
USART1_SendString(string_buffer);
#endif
return temp_in_C;
}
/*
* Read_EEPROM
*
* Read out the contents of the EEPROM from addr_start (int16_t) to addr_end (int16_t)
* and print to terminal (over USART1)
*/
void EEPROM_ReadRange(uint16_t addr_start, uint16_t addr_end)
{
uint16_t i = 0;
uint8_t new_line = 0;
uint16_t EEPROM_address;
uint8_t EEPROM_data;
for(i = addr_start; i < addr_end + 1; i++)
{
if(new_line == 0)
{
EEPROM_address = EEPROM_START + i; // fetch EEPROM address
sprintf(string_buffer, "\n%#x: ", EEPROM_address); // convert hex address to string
USART1_SendString(string_buffer); // print hex address
}
new_line++; // increment new_line counter
EEPROM_data = EEPROM_Read(i); // read EEPROM byte at address i
while(EEPROM_IsBusy())
; // waint for EEPROM to complete
sprintf(string_buffer, "%02x ", EEPROM_data); // convert EEPROM hex data to string
USART1_SendString(string_buffer); // send to terminal
if(new_line == 8) { // after 8 bytes, new line
new_line = 0;
}
}
USART1_SendString("\n\n"); // send to terminal
}
/*
* Read_Ext_Temp
*
* Read out the two bytes of external temperature value stored in
* EEPROM address "EXTERNAL TEMPERATURE" + 1 and print to terminal (over USART1)
*/
int16_t ReadExternalTemperature(void)
{
int8_t t_hi, t_lo, temp_saved;
int16_t temp;
// if temperature is stored, first byte should be 0x5c
temp_saved = EEPROM_Read(EXTERNAL_TEMPERATURE_CHECK_ADDRESS);
while(EEPROM_IsBusy())
;
// if external temperature value is stored
if(temp_saved == 0x5c) {
t_hi = EEPROM_Read(EXTERNAL_TEMPERATURE_HIGH_ADDRESS); // read high byte
while(EEPROM_IsBusy())
;
t_lo = EEPROM_Read(EXTERNAL_TEMPERATURE_LOW_ADDRESS); // read low byte
while(EEPROM_IsBusy())
;
temp = (t_hi << 8) | t_lo; // convert into 16-bit
#ifdef USART_ON
sprintf(string_buffer,"%d°C\n",temp);
USART1_SendString("\nExternal temperature measurement is: ");
USART1_SendString(string_buffer);
#endif
}
// if external temperature is not stored
else {
#ifdef USART_ON
USART1_SendString("\nNo external temperature stored! \n\n");
#endif
temp = 0x7fff; // set to max to indicate no temp stored
}
return temp;
}
/*
* Get_Sigrow_Offset
*
* Read out the Offset from SIGROW
* and print to terminal (over USART1) and returns value (int16_t)
*/
int16_t GetSigrowOffset(void)
{
int16_t offset;
offset = (int16_t) SIGROW.TEMPSENSE1; // signed offset from signature row
#ifdef USART_ON
sprintf(string_buffer, "%d\n", offset);
USART1_SendString("\nFactory calibrated Offset: ");
USART1_SendString(string_buffer);
#endif
return offset;
}
/*
* Get_Sigrow_Offset
*
* Read out the Offset from SIGROW
* and print to terminal (over USART1)
*/
int16_t GetSigrowGain(void)
{
int16_t gain;
gain = (int16_t) SIGROW.TEMPSENSE0; // signed offset from signature row
#ifdef USART_ON
sprintf(string_buffer, "%d\n", gain);
USART1_SendString("\nFactory calibrated Gain: ");
USART1_SendString(string_buffer);
#endif
return gain;
}
/*
* Calculate_offset
*
* Calculate a new offset using external temperature reading (int16_t) as input
* Stores new offset as int16_t in EEPROM address "CALCULATED_OFFSET" (see defines)
*/
int16_t CalculateOffset(int16_t temp)
{
while(ADC0.STATUS) // wait for ADC0 ready
;
ADC0_StartConversion(ADC_MUXPOS_TEMPSENSE_gc); // start temperature measurement
while(!ADC0_IsConversionDone()) // wait for conversion to complete
;
int16_t sigrow_gain = (int16_t) SIGROW.TEMPSENSE0; // signed gain from signature row
uint16_t adc_reading = ADC0.RESULT; // ADC conversion result
int16_t ext_temp_K = temp + 273; // convert temperature from Celsius to Kelvin
// Calculate offset based on known external temperature
float calculated_offset = ( ((float) ext_temp_K * SCALING_FACTOR) / (float) sigrow_gain ) - (float) adc_reading;
calculated_offset += 0.5; // add 0.5 to fix rounding errors
calculated_offset = (int16_t) calculated_offset; // recast value to int16_t
return calculated_offset;
}
/*
Main application
*/
int main(void)
{
int16_t external_temperature;
int16_t sigrow_offset;
int16_t sigrow_gain;
int16_t internal_temperature;
int16_t new_offset;
uint8_t data;
SYSTEM_Initialize(); // init system
#ifdef USART_ON
USART1_SendString("\n\n\n\n\nStarting...\n");
// Show EEPROM contents
USART1_SendString("\nListing EEPROM contents:\n");
EEPROM_ReadRange(0, 511); // EEPROM is 512 bytes
USART1_SendString("\nChecking for external temperature stored in EEPROM...\n");
#endif
external_temperature = ReadExternalTemperature(); // get external temperature
sigrow_offset = GetSigrowOffset(); // get factory calibration value for offset
sigrow_gain = GetSigrowGain(); // get factory calibration value for gain
// read out internal temperature using factory calibration
internal_temperature = ReadInternalTemperature(sigrow_offset, sigrow_gain);
// calculate new offset using external temperature reading
new_offset = CalculateOffset(external_temperature);
// write high byte of new offset to EEPROM
data = new_offset >> 8; // note the use of uint8_t when sending signed 2 byte value,
// else the sign bit may be changed
nvm_status_t EEstatus = EEPROM_Write(CALCULATED_OFFSET_HIGH_ADDRESS, data);
while(EEPROM_IsBusy())
;
if(EEstatus == NVM_ERROR)
{
#ifdef USART_ON
USART1_SendString("\nSomething went wrong! (New Offset high byte)\n");
#endif
}
// write low byte of new offset to EEPROM
data = new_offset;
EEstatus = EEPROM_Write(CALCULATED_OFFSET_LOW_ADDRESS, data);
while(EEPROM_IsBusy())
;
if(EEstatus == NVM_ERROR)
{
#ifdef USART_ON
USART1_SendString("\nSomething went wrong! (New Offset low byte)\n");
#endif
}
#ifdef USART_ON
USART1_SendString("\n\nNew offset calculated!\n");
USART1_SendString("\nValue is...........");
sprintf(string_buffer, "%d\n\n", new_offset);
USART1_SendString("\nNew calculated Offset: ");
USART1_SendString(string_buffer);
#endif
while(1)
{
if(external_temperature != 0x7fff) // if external temperature is stored, check temperature
{
IO_PB3_SetDigitalOutput(); // turn on LED0
// Now do a new temperature reading using adjusted offset
internal_temperature = ReadInternalTemperature(new_offset, sigrow_gain);
IO_PB3_SetDigitalInput(); // turn off CNANO LED0 (setting pin to input, turn off input buffer)
_delay_ms(5000); // wait 5 seconds between measurements
}
}
}

Wyświetl plik

@ -0,0 +1,255 @@
/**
* ADC0 Generated Driver API Header File
*
* @file adc0.h
*
* @defgroup adc0 ADC0
*
* @brief This file contains API prototypes and other datatypes for ADC0 module.
*
* @version ADC0 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 ADC0_H
#define ADC0_H
#include "../system/utils/compiler.h"
#define ADC_TIMEBASE_VALUE ((uint8_t)ceil(F_CPU * 0.000001) << ADC_TIMEBASE0_bp)
/**
* @ingroup adc0
* @enum ADC0_window_mode_t
* @brief Window Comparator Modes
*/
typedef enum {
ADC0_window_disabled, /**<Window Comparison is Disabled*/
ADC0_window_below, /**<Result is below a threshold*/
ADC0_window_above, /**<Result is above a threshold*/
ADC0_window_inside, /**<Result is inside a window*/
ADC0_window_outside /**<Result is outside a window*/
} ADC0_window_mode_t;
/**
* @ingroup adc0
* @typedef void adc_irq_cb_t
* @brief Function pointer to callback function called by IRQ. NULL=default value: No callback function is to be used.
*/
typedef void (*adc_irq_cb_t)(void);
/**
* @ingroup adc0
* @typedef uint32_t adc_result_t
* @brief Datatype for the result of non-differential ADC conversion.
*/
typedef uint32_t adc_result_t;
/**
* @ingroup adc0
* @typedef int32_t diff_adc_result_t
* @brief Datatype for the result of differential ADC conversion.
*/
typedef int32_t diff_adc_result_t;
/**
* @ingroup adc0
* @typedef ADC_MUXPOS_t adc_0_channel_t
* @brief Datatype for the ADC Positive Input Selection
*/
typedef ADC_MUXPOS_t adc_0_channel_t;
/**
* @ingroup adc0
* @typedef ADC_MUXNEG_t adc_0_muxneg_channel_t
* @brief Datatype for the ADC Negative Input Selection
*/
typedef ADC_MUXNEG_t adc_0_muxneg_channel_t;
/**
* @ingroup adc0
* @brief Initializes ADC interface. If module is configured to disabled state, the clock to the ADC is disabled if this is supported by the device's clock system.
* @param none
* @retval 0 - the ADC init was successful
* @retval 1 - the ADC init was not successful
*/
int8_t ADC0_Initialize(void);
/**
* @ingroup adc0
* @brief Enable ADC0. If supported by the clock system, enables the clock to the ADC. Enables the ADC module by setting the enable-bit in the ADC control register.
* @param none
* @return none
*/
void ADC0_Enable(void);
/**
* @ingroup adc0
* @brief Disable ADC0. Disables the ADC module by clearing the enable-bit in the ADC control register. If supported by the clock system, disables the clock to the ADC.
* @param none
* @return none
*/
void ADC0_Disable(void);
/**
* @ingroup adc0
* @brief Set conversion window comparator high threshold
* @param adc_result_t high - desired window comparator high threshold register value
* @return none
*/
void ADC0_SetWindowHigh(adc_result_t high);
/**
* @ingroup adc0
* @brief Set conversion window comparator low threshold
* @param adc_result_t low - desired window comparator low threshold register value
* @return none
*/
void ADC0_SetWindowLow(adc_result_t low);
/**
* @ingroup adc0
* @brief Set conversion window mode
* @param ADC0_window_mode_t mode - window mode
* @return none
*/
void ADC0_SetWindowMode(ADC0_window_mode_t mode);
/**
* @ingroup adc0
* @brief Set ADC channel to be used for windowed conversion mode
* @param adc_0_channel_t channel - The ADC channel to start conversion on
* @return none
*/
void ADC0_SetWindowChannel(adc_0_channel_t channel);
/**
* @ingroup adc0
* @brief Start a single-ended conversion on ADC0
* @param adc_0_channel_t channel - The ADC channel to start conversion on
* @return none
*/
void ADC0_StartConversion(adc_0_channel_t channel);
/**
* @ingroup adc0
* @brief Start a differential conversion on ADC0
* @param adc_0_channel_t channel - The ADC positive input channel to start conversion on
* @param adc_0_muxneg_channel_t channel1 - The ADC negative input channel to start conversion on
* @return none
*/
void ADC0_StartDiffConversion(adc_0_channel_t channel, adc_0_muxneg_channel_t channel1);
/**
* @ingroup adc0
* @brief Stop a conversion on ADC0
* @param none
* @return none
*/
void ADC0_StopConversion(void);
/**
* @ingroup adc0
* @brief Check if the ADC conversion is done
* @param none
* @retval 1 (true) - The ADC conversion is done
* @retval 0 (false) - The ADC converison is not done
*/
bool ADC0_IsConversionDone(void);
/**
* @ingroup adc0
* @brief Read a conversion result from ADC0
* @param none
* @return adc_result_t - Conversion result read from the ADC0 module
*/
adc_result_t ADC0_GetConversionResult(void);
/**
* @ingroup adc0
* @brief Get the latest ADC conversion output from ADC0
* @param none
* @return adc_result_t - Latest conversion Sample from the ADC0 module
*/
adc_result_t ADC0_GetConversionSample(void);
/**
* @ingroup adc0
* @brief Read the conversion window result from ADC0
* @param none
* @retval 1 (true) - a comparison results in a trigger condition
* @retval 0 (false) - a comparison does not result in a trigger condition.
*/
bool ADC0_GetWindowResult(void);
/**
* @ingroup adc0
* @brief Start a conversion, wait until ready, and return the conversion result
* @param adc_0_channel_t channel - The ADC channel to get the conversion result
* @return adc_result_t - Conversion result read from the ADC0 ADC module
*/
adc_result_t ADC0_GetConversion(adc_0_channel_t channel);
/**
* @ingroup adc0
* @brief Start a differential conversion, wait until ready, and return the conversion result
* @param bool enablePGA - The ADC positive input channel to get the conversion result
* @param adc_0_channel_t channel - The ADC negative input channel to get the conversion result
* @return diff_adc_result_t - Conversion result read from the ADC0 ADC module
*/
diff_adc_result_t ADC0_GetDiffConversion(bool enablePGA, adc_0_channel_t channel, adc_0_muxneg_channel_t channel1);
/**
* @ingroup adc0
* @brief Return the number of bits in the ADC conversion result
* @param none
* @return uint8_t - The number of bits in the ADC conversion result
*/
uint8_t ADC0_GetResolution(void);
/**
* @ingroup adc0
* @brief Setter function for ADC Sample Ready interrupt callback.
* @param adc_irq_cb_t callback - Pointer to custom callback
* @return none
*/
void ADC0_SampleReadyCallbackRegister(adc_irq_cb_t callback);
/**
* @ingroup adc0
* @brief Setter function for ADC Result Ready interrupt callback.
* @param adc_irq_cb_t callback - Pointer to custom callback
* @return none
*/
void ADC0_ResultReadyCallbackRegister(adc_irq_cb_t callback);
/**
* @ingroup adc0
* @brief Setter function for ADC error callback.
* @param adc_irq_cb_t callback - Pointer to custom callback
* @return none
*/
void ADC0_ErrorCallbackRegister(adc_irq_cb_t callback);
#endif //ADC0_H

Wyświetl plik

@ -0,0 +1,244 @@
/**
* ADC0 Generated Driver File
*
* @file adc0.c
*
* @ingroup adc0
*
* @brief This file contains the driver code for ADC0 module.
*
* @version ADC0 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 "../adc0.h"
adc_irq_cb_t ADC0_SampleReadyCallback = NULL;
adc_irq_cb_t ADC0_ResultReadyCallback = NULL;
adc_irq_cb_t ADC0_ErrorCallback = NULL;
int8_t ADC0_Initialize(void)
{
//PRESC System clock divided by 10;
ADC0.CTRLB = 0x4;
//CHOPPING DISABLE; FREERUN disabled; LEFTADJ disabled; SAMPNUM No accumulation;
ADC0.CTRLF = 0x0;
//REFSEL Internal 1.024V Reference;
ADC0.CTRLC = 0x4;
//WINCM No Window Comparison; WINSRC RESULT;
ADC0.CTRLD = 0x0;
//SAMPDUR 64;
ADC0.CTRLE = 0x40;
//GAIN 1x gain; PGABIASSEL 100% BIAS current.; PGAEN disabled;
ADC0.PGACTRL = 0x0;
//DBGRUN disabled;
ADC0.DBGCTRL = 0x0;
//DIFF disabled; MODE SINGLE_12BIT; START Start a conversion immediately. This will be set back to STOP when the first conversion is done, unless Free-Running mode is enabled;
ADC0.COMMAND = 0x11;
//RESOVR disabled; RESRDY disabled; SAMPOVR disabled; SAMPRDY disabled; TRIGOVR disabled; WCMP disabled;
ADC0.INTCTRL = 0x0;
//MUXPOS Temperature Sensor; VIA Inputs connected directly to ADC;
ADC0.MUXPOS = 0x32;
//MUXNEG Ground; VIA Inputs connected directly to ADC;
ADC0.MUXNEG = 0x30;
// Window comparator high threshold
ADC0.WINHT = 0x0;
// Window comparator low threshold
ADC0.WINLT = 0x0;
//ENABLE enabled; LOWLAT disabled; RUNSTDBY disabled;
ADC0.CTRLA = 0x1;
return 0;
}
void ADC0_Enable(void)
{
ADC0.CTRLA |= ADC_ENABLE_bm;
}
void ADC0_Disable(void)
{
ADC0.CTRLA &= ~ADC_ENABLE_bm;
}
void ADC0_SetWindowHigh(adc_result_t high)
{
ADC0.WINHT = high;
}
void ADC0_SetWindowLow(adc_result_t low)
{
ADC0.WINLT = low;
}
void ADC0_SetWindowMode(ADC0_window_mode_t mode)
{
ADC0.CTRLD = mode;
}
void ADC0_SetWindowChannel(adc_0_channel_t channel)
{
ADC0.MUXPOS &= ADC_VIA_gm;
ADC0.MUXPOS |= channel;
}
void ADC0_StartConversion(adc_0_channel_t channel)
{
ADC0.MUXPOS &= ADC_VIA_gm;
ADC0.MUXPOS |= channel;
ADC0.COMMAND &= ~ADC_DIFF_bm;
ADC0.COMMAND |= ADC_START_IMMEDIATE_gc;
}
void ADC0_StartDiffConversion(adc_0_channel_t channel, adc_0_muxneg_channel_t channel1)
{
ADC0.MUXPOS &= ADC_VIA_gm;
ADC0.MUXPOS |= channel;
ADC0.MUXNEG &= ADC_VIA_gm;
ADC0.MUXNEG |= channel1;
ADC0.COMMAND |= (ADC_START_IMMEDIATE_gc | ADC_DIFF_bm);
}
void ADC0_StopConversion(void)
{
ADC0.COMMAND |= ADC_START_STOP_gc;
}
bool ADC0_IsConversionDone(void)
{
return (ADC0.INTFLAGS & ADC_RESRDY_bm);
}
adc_result_t ADC0_GetConversionResult(void)
{
return (ADC0.RESULT);
}
adc_result_t ADC0_GetConversionSample(void)
{
return (ADC0.SAMPLE);
}
bool ADC0_GetWindowResult(void)
{
bool temp = (ADC0.INTFLAGS & ADC_WCMP_bm);
ADC0.INTFLAGS = ADC_WCMP_bm; // Clear intflag if set
return temp;
}
adc_result_t ADC0_GetConversion(adc_0_channel_t channel)
{
adc_result_t res;
ADC0_StartConversion(channel);
while (!ADC0_IsConversionDone());
res = ADC0_GetConversionResult();
ADC0.INTFLAGS = ADC_RESRDY_bm;
return res;
}
diff_adc_result_t ADC0_GetDiffConversion(bool enablePGA, adc_0_channel_t channel, adc_0_muxneg_channel_t channel1)
{
diff_adc_result_t res;
ADC0_StartDiffConversion(channel, channel1|(enablePGA<<6));
while (!ADC0_IsConversionDone());
res = ADC0_GetConversionResult();
ADC0.INTFLAGS |= ADC_RESRDY_bm;
return res;
}
uint8_t ADC0_GetResolution(void)
{
return (ADC0.COMMAND & ADC_MODE_SINGLE_8BIT_gc) ? 8 : 12;
}
void ADC0_SampleReadyCallbackRegister(adc_irq_cb_t callback)
{
ADC0_SampleReadyCallback = callback;
}
void ADC0_ResultReadyCallbackRegister(adc_irq_cb_t callback)
{
ADC0_ResultReadyCallback = callback;
}
void ADC0_ErrorCallbackRegister(adc_irq_cb_t callback)
{
ADC0_ErrorCallback = callback;
}
ISR(ADC0_SAMPRDY_vect)
{
//Clear the interrupt flag
ADC0.INTFLAGS = ADC_SAMPRDY_bm;
if (ADC0_SampleReadyCallback != NULL)
{
ADC0_SampleReadyCallback();
}
}
ISR(ADC0_RESRDY_vect)
{
//Clear the interrupt flag
ADC0.INTFLAGS = ADC_RESRDY_bm;
if (ADC0_ResultReadyCallback != NULL)
{
ADC0_ResultReadyCallback();
}
}
ISR(ADC0_ERROR_vect)
{
//Clear the interrupt flag
ADC0.INTFLAGS = ADC_TRIGOVR_bm;
//Clear the interrupt flag
ADC0.INTFLAGS = ADC_SAMPOVR_bm;
//Clear the interrupt flag
ADC0.INTFLAGS = ADC_RESOVR_bm;
if (ADC0_ErrorCallback != NULL)
{
ADC0_ErrorCallback();
}
}

Wyświetl plik

@ -0,0 +1,103 @@
/**
*
* @file nvm.h
*
* @defgroup nvm_driver Non-Volatile Memory
*
* @brief This file contains API prototypes and other data types for the Non-Volatile Memory (NVM) driver.
*
* @version NVM Driver Version 2.1.0
*/
#ifndef NVM_H
#define NVM_H
#include <string.h>
/**
* @ingroup nvm_driver
* @brief Datatypes for NVM address and data
*/
/**
* @ingroup nvm_driver
* @brief Data type for the EEPROM data.
*/
typedef uint8_t eeprom_data_t;
/**
* @ingroup nvm_driver
* @brief Data type for the EEPROM address.
*/
typedef uint16_t eeprom_address_t;
/**
* @ingroup nvm_driver
* @enum nvm_status_t
* @brief Contains the return codes for the NVM driver APIs.
*/
typedef enum {
NVM_OK, /**<0 - The NVM operation succeeded.*/
NVM_ERROR, /**<1 - The NVM operation failed.*/
NVM_BUSY /**<2 - The NVM write operation ongoing.*/
} nvm_status_t;
/**
* @ingroup nvm_driver
* @brief Initializes the NVM driver.
* @param None.
* @return None.
*/
void NVM_Initialize(void);
/**
* @ingroup nvm_driver
* @brief Returns the status of last the NVM operation.
* @param None.
* @retval NVM_OK - The NVM operation succeeded.
* @retval NVM_ERROR - The NVM operation failed.
*/
nvm_status_t NVM_StatusGet(void);
/**
* @ingroup nvm_driver
* @brief Clears the status of last the NVM operation.
* @param None.
* @retval None.
*/
void NVM_StatusClear(void);
/**
* @ingroup nvm_driver
* @brief Reads one byte from the given EEPROM address.
* @pre NVM must be initialized with @ref NVM_Initialize() before calling this API.
* @param [in] address - Address of the EEPROM location to be read.
* @return Byte read from the given EEPROM address.
*/
eeprom_data_t EEPROM_Read(eeprom_address_t address);
/**
* @ingroup nvm_driver
* @brief Writes one byte to the given EEPROM address.
* The EEPROM busy status must be checked using the @ref EEPROM_IsBusy() API to know if the write operation is completed.
* Use the @ref NVM_StatusGet() API to see the result of the write operation.
* @param [in] address - Address of the EEPROM location to be written.
* @param [in] data - Byte to be written to the given EEPROM location.
* @return None.
*/
nvm_status_t EEPROM_Write(eeprom_address_t address, eeprom_data_t data);
/**
* @ingroup nvm_driver
* @brief Checks if the EEPROM is busy.
* @pre NVM must be initialized with @ref NVM_Initialize() before calling this API.
* @param None.
* @retval True - The EEPROM operation is being performed.
* @retval False - The EEPROM operation is not being performed.
*/
bool EEPROM_IsBusy(void);
#endif /* NVM_H */

Wyświetl plik

@ -0,0 +1,77 @@
/**
*
* @file nvm.c
*
* @ingroup nvm_driver
*
* @brief This file contains the implementation for NVM driver
*
* @version NVM Driver Version 2.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 <avr/pgmspace.h>
#include "../../system/utils/compiler.h"
#include "../../system/ccp.h"
#include "../nvm.h"
void NVM_Initialize(void)
{
//APPCODEWP false; APPDATAWP false; BOOTRP false; EEWP disabled; FLMAP SECTION0; FLMAPLOCK disabled;
ccp_write_io((void*)&NVMCTRL.CTRLB, 0x0);
}
nvm_status_t NVM_StatusGet(void)
{
return (((NVMCTRL.STATUS & NVMCTRL_ERROR_gm) != 0) ? NVM_ERROR : NVM_OK);
}
void NVM_StatusClear(void)
{
NVMCTRL.STATUS &= ~NVMCTRL_ERROR_gm;
}
eeprom_data_t EEPROM_Read(eeprom_address_t address)
{
return *(eeprom_data_t *)(EEPROM_START + address);
}
nvm_status_t EEPROM_Write(eeprom_address_t address, eeprom_data_t data)
{
// Write byte to page buffer
*(eeprom_data_t *)(EEPROM_START + address) = data;
// Erase byte and program it with desired value
ccp_write_spm((void *)&NVMCTRL.CTRLA, NVMCTRL_CMD_EEPERW_gc);
return (((NVMCTRL.STATUS & NVMCTRL_ERROR_gm) != 0) ? NVM_ERROR : NVM_OK);
}
bool EEPROM_IsBusy(void)
{
return (NVMCTRL.STATUS & NVMCTRL_EEBUSY_bm);
}

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,69 @@
/**
* CLKCTRL Generated Driver API Header File
*
* @file clkctrl.h
*
* @defgroup clkctrl CLKCTRL
*
* @brief This header file provides APIs for the CLKCTRL driver.
*
* @version CLKCTRL Driver Version 1.0.2
*/
/*
© [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_H
#define CLOCK_H
#ifndef F_CPU
#define F_CPU 3333333UL
#endif
#include "ccp.h"
#define CLKCTRL_TIMEBASE_VALUE ((uint8_t)ceil(F_CPU * 0.000001))
/**
* @ingroup clkctrl
* @brief Initialize CLKCTRL module
* @param none
* @return none
*/
void CLOCK_Initialize(void);
/**
* @ingroup clkctrl
* @brief Enable Clock Failure Detection on main clock
* @param CLKCTRL_CFDSRC_t cfd_source - main clock source for CFD
* @return none
*/
void CFD_Enable(CLKCTRL_CFDSRC_t cfd_source);
/**
* @ingroup clkctrl
* @brief Disable Clock Failure Detection on main clock
* @param none
* @return none
*/
void CFD_Disable();
#endif // CLOCK_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.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 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,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,99 @@
/**
* CLKCTRL Generated Driver File
*
* @file clkctrl.c
*
* @ingroup clkctrl
*
* @brief This file contains the driver code for CLKCTRL module.
*
* version CLKCTRL Driver Version 1.1.3
*/
/*
© [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)
{
// Set the CLKCTRL module to the options selected in the user interface.
//CLKOUT disabled; CLKSEL Internal high-frequency oscillator;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLA),0x0);
//PDIV Divide by 6; PEN enabled;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLB),0x11);
//
ccp_write_io((void*)&(CLKCTRL.MCLKSTATUS),0x0);
//RUNSTDBY disabled;
ccp_write_io((void*)&(CLKCTRL.OSC32KCTRLA),0x0);
//AUTOTUNE OFF; RUNSTDBY disabled;
ccp_write_io((void*)&(CLKCTRL.OSCHFCTRLA),0x0);
//TUNE 0x0;
ccp_write_io((void*)&(CLKCTRL.OSCHFTUNE),0x0);
//CSUT 1k cycles; ENABLE disabled; LPMODE disabled; RUNSTDBY disabled; SEL disabled;
ccp_write_io((void*)&(CLKCTRL.XOSC32KCTRLA),0x0);
//CFDEN disabled; CFDSRC CLKMAIN; CFDTST disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKCTRLC),0x0);
//CFD disabled; INTTYPE INT;
ccp_write_io((void*)&(CLKCTRL.MCLKINTCTRL),0x0);
//CFD disabled;
ccp_write_io((void*)&(CLKCTRL.MCLKINTFLAGS),0x0);
//CSUTHF 256CYC; ENABLE disabled; RUNSTDBY disabled; SELHF CRYSTAL;
ccp_write_io((void*)&(CLKCTRL.XOSCHFCTRLA),0x0);
//TIMEBASE 4;
ccp_write_io((void*)&(CLKCTRL.MCLKTIMEBASE),0x4);
// System clock stability check by polling the status register.
while(!(CLKCTRL.MCLKSTATUS & CLKCTRL_OSCHFS_bm));
// System clock stability check by polling the PLL status.
}
void CFD_Enable(CLKCTRL_CFDSRC_t cfd_source)
{
/* Enable Clock Failure Detection on main clock */
ccp_write_io((uint8_t *) & CLKCTRL.MCLKCTRLC, cfd_source | CLKCTRL_CFDEN_bm);
}
void CFD_Disable()
{
/* Disable Clock Failure Detection on main clock */
ccp_write_io((uint8_t *) & CLKCTRL.MCLKCTRLC, CLKCTRL.MCLKCTRLC & ~CLKCTRL_CFDEN_bm);
}
/**
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.2
*/
/*
© [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 = OSCHFFRQ_20M_gc,
.SYSCFG0 = CRCSEL_CRC16_gc | CRCSRC_NOCRC_gc | RSTPINCFG_NONE_gc | UPDIPINCFG_UPDI_gc,
.SYSCFG1 = SUT_64MS_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,962 @@
/**
* 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 (*IO_PC1_InterruptHandler)(void);
static void (*IO_PC0_InterruptHandler)(void);
static void (*IO_PA0_InterruptHandler)(void);
static void (*IO_PA1_InterruptHandler)(void);
static void (*IO_PA2_InterruptHandler)(void);
static void (*IO_PA3_InterruptHandler)(void);
static void (*IO_PA4_InterruptHandler)(void);
static void (*IO_PA5_InterruptHandler)(void);
static void (*IO_PA6_InterruptHandler)(void);
static void (*IO_PA7_InterruptHandler)(void);
static void (*IO_PB0_InterruptHandler)(void);
static void (*IO_PB1_InterruptHandler)(void);
static void (*IO_PB2_InterruptHandler)(void);
static void (*IO_PB3_InterruptHandler)(void);
static void (*IO_PB4_InterruptHandler)(void);
static void (*IO_PB5_InterruptHandler)(void);
static void (*IO_PC2_InterruptHandler)(void);
static void (*IO_PC3_InterruptHandler)(void);
static void (*IO_PC4_InterruptHandler)(void);
static void (*IO_PC5_InterruptHandler)(void);
static void (*IO_PC6_InterruptHandler)(void);
static void (*IO_PC7_InterruptHandler)(void);
static void (*IO_PD0_InterruptHandler)(void);
static void (*IO_PD1_InterruptHandler)(void);
static void (*IO_PD2_InterruptHandler)(void);
static void (*IO_PD3_InterruptHandler)(void);
static void (*IO_PD4_InterruptHandler)(void);
static void (*IO_PD5_InterruptHandler)(void);
static void (*IO_PD6_InterruptHandler)(void);
static void (*IO_PD7_InterruptHandler)(void);
static void (*IO_PE0_InterruptHandler)(void);
static void (*IO_PE1_InterruptHandler)(void);
static void (*IO_PE2_InterruptHandler)(void);
static void (*IO_PE3_InterruptHandler)(void);
static void (*IO_PF0_InterruptHandler)(void);
static void (*IO_PF1_InterruptHandler)(void);
static void (*IO_PF2_InterruptHandler)(void);
static void (*IO_PF3_InterruptHandler)(void);
static void (*IO_PF4_InterruptHandler)(void);
static void (*IO_PF5_InterruptHandler)(void);
static void (*IO_PF6_InterruptHandler)(void);
static void (*IO_PF7_InterruptHandler)(void);
void PIN_MANAGER_Initialize()
{
/* DIR Registers Initialization */
PORTA.DIR = 0x0;
PORTB.DIR = 0x0;
PORTC.DIR = 0x1;
PORTD.DIR = 0x0;
PORTE.DIR = 0x0;
PORTF.DIR = 0x0;
/* OUT Registers Initialization */
PORTA.OUT = 0x0;
PORTB.OUT = 0x0;
PORTC.OUT = 0x1;
PORTD.OUT = 0x0;
PORTE.OUT = 0x0;
PORTF.OUT = 0x0;
/* PINxCTRL registers Initialization */
PORTA.PIN0CTRL = 0x4;
PORTA.PIN1CTRL = 0x4;
PORTA.PIN2CTRL = 0x4;
PORTA.PIN3CTRL = 0x4;
PORTA.PIN4CTRL = 0x4;
PORTA.PIN5CTRL = 0x4;
PORTA.PIN6CTRL = 0x4;
PORTA.PIN7CTRL = 0x4;
PORTB.PIN0CTRL = 0x4;
PORTB.PIN1CTRL = 0x4;
PORTB.PIN2CTRL = 0x4;
PORTB.PIN3CTRL = 0x4;
PORTB.PIN4CTRL = 0x4;
PORTB.PIN5CTRL = 0x4;
PORTB.PIN6CTRL = 0x0;
PORTB.PIN7CTRL = 0x0;
PORTC.PIN0CTRL = 0x0;
PORTC.PIN1CTRL = 0x0;
PORTC.PIN2CTRL = 0x4;
PORTC.PIN3CTRL = 0x4;
PORTC.PIN4CTRL = 0x4;
PORTC.PIN5CTRL = 0x4;
PORTC.PIN6CTRL = 0x4;
PORTC.PIN7CTRL = 0x4;
PORTD.PIN0CTRL = 0x4;
PORTD.PIN1CTRL = 0x4;
PORTD.PIN2CTRL = 0x4;
PORTD.PIN3CTRL = 0x4;
PORTD.PIN4CTRL = 0x4;
PORTD.PIN5CTRL = 0x4;
PORTD.PIN6CTRL = 0x4;
PORTD.PIN7CTRL = 0x4;
PORTE.PIN0CTRL = 0x4;
PORTE.PIN1CTRL = 0x4;
PORTE.PIN2CTRL = 0x4;
PORTE.PIN3CTRL = 0x4;
PORTE.PIN4CTRL = 0x0;
PORTE.PIN5CTRL = 0x0;
PORTE.PIN6CTRL = 0x0;
PORTE.PIN7CTRL = 0x0;
PORTF.PIN0CTRL = 0x4;
PORTF.PIN1CTRL = 0x4;
PORTF.PIN2CTRL = 0x4;
PORTF.PIN3CTRL = 0x4;
PORTF.PIN4CTRL = 0x4;
PORTF.PIN5CTRL = 0x4;
PORTF.PIN6CTRL = 0x4;
PORTF.PIN7CTRL = 0x4;
/* PORTMUX Initialization */
PORTMUX.ACROUTEA = 0x0;
PORTMUX.CCLROUTEA = 0x0;
PORTMUX.EVSYSROUTEA = 0x0;
PORTMUX.SPIROUTEA = 0x0;
PORTMUX.TCAROUTEA = 0x0;
PORTMUX.TCBROUTEA = 0x0;
PORTMUX.TWIROUTEA = 0x0;
PORTMUX.USARTROUTEA = 0x0;
PORTMUX.USARTROUTEB = 0x0;
// register default ISC callback functions at runtime; use these methods to register a custom function
IO_PC1_SetInterruptHandler(IO_PC1_DefaultInterruptHandler);
IO_PC0_SetInterruptHandler(IO_PC0_DefaultInterruptHandler);
IO_PA0_SetInterruptHandler(IO_PA0_DefaultInterruptHandler);
IO_PA1_SetInterruptHandler(IO_PA1_DefaultInterruptHandler);
IO_PA2_SetInterruptHandler(IO_PA2_DefaultInterruptHandler);
IO_PA3_SetInterruptHandler(IO_PA3_DefaultInterruptHandler);
IO_PA4_SetInterruptHandler(IO_PA4_DefaultInterruptHandler);
IO_PA5_SetInterruptHandler(IO_PA5_DefaultInterruptHandler);
IO_PA6_SetInterruptHandler(IO_PA6_DefaultInterruptHandler);
IO_PA7_SetInterruptHandler(IO_PA7_DefaultInterruptHandler);
IO_PB0_SetInterruptHandler(IO_PB0_DefaultInterruptHandler);
IO_PB1_SetInterruptHandler(IO_PB1_DefaultInterruptHandler);
IO_PB2_SetInterruptHandler(IO_PB2_DefaultInterruptHandler);
IO_PB3_SetInterruptHandler(IO_PB3_DefaultInterruptHandler);
IO_PB4_SetInterruptHandler(IO_PB4_DefaultInterruptHandler);
IO_PB5_SetInterruptHandler(IO_PB5_DefaultInterruptHandler);
IO_PC2_SetInterruptHandler(IO_PC2_DefaultInterruptHandler);
IO_PC3_SetInterruptHandler(IO_PC3_DefaultInterruptHandler);
IO_PC4_SetInterruptHandler(IO_PC4_DefaultInterruptHandler);
IO_PC5_SetInterruptHandler(IO_PC5_DefaultInterruptHandler);
IO_PC6_SetInterruptHandler(IO_PC6_DefaultInterruptHandler);
IO_PC7_SetInterruptHandler(IO_PC7_DefaultInterruptHandler);
IO_PD0_SetInterruptHandler(IO_PD0_DefaultInterruptHandler);
IO_PD1_SetInterruptHandler(IO_PD1_DefaultInterruptHandler);
IO_PD2_SetInterruptHandler(IO_PD2_DefaultInterruptHandler);
IO_PD3_SetInterruptHandler(IO_PD3_DefaultInterruptHandler);
IO_PD4_SetInterruptHandler(IO_PD4_DefaultInterruptHandler);
IO_PD5_SetInterruptHandler(IO_PD5_DefaultInterruptHandler);
IO_PD6_SetInterruptHandler(IO_PD6_DefaultInterruptHandler);
IO_PD7_SetInterruptHandler(IO_PD7_DefaultInterruptHandler);
IO_PE0_SetInterruptHandler(IO_PE0_DefaultInterruptHandler);
IO_PE1_SetInterruptHandler(IO_PE1_DefaultInterruptHandler);
IO_PE2_SetInterruptHandler(IO_PE2_DefaultInterruptHandler);
IO_PE3_SetInterruptHandler(IO_PE3_DefaultInterruptHandler);
IO_PF0_SetInterruptHandler(IO_PF0_DefaultInterruptHandler);
IO_PF1_SetInterruptHandler(IO_PF1_DefaultInterruptHandler);
IO_PF2_SetInterruptHandler(IO_PF2_DefaultInterruptHandler);
IO_PF3_SetInterruptHandler(IO_PF3_DefaultInterruptHandler);
IO_PF4_SetInterruptHandler(IO_PF4_DefaultInterruptHandler);
IO_PF5_SetInterruptHandler(IO_PF5_DefaultInterruptHandler);
IO_PF6_SetInterruptHandler(IO_PF6_DefaultInterruptHandler);
IO_PF7_SetInterruptHandler(IO_PF7_DefaultInterruptHandler);
}
/**
Allows selecting an interrupt handler for IO_PC1 at application runtime
*/
void IO_PC1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC1_InterruptHandler = interruptHandler;
}
void IO_PC1_DefaultInterruptHandler(void)
{
// add your IO_PC1 interrupt custom code
// or set custom function using IO_PC1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC0 at application runtime
*/
void IO_PC0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC0_InterruptHandler = interruptHandler;
}
void IO_PC0_DefaultInterruptHandler(void)
{
// add your IO_PC0 interrupt custom code
// or set custom function using IO_PC0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA0 at application runtime
*/
void IO_PA0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA0_InterruptHandler = interruptHandler;
}
void IO_PA0_DefaultInterruptHandler(void)
{
// add your IO_PA0 interrupt custom code
// or set custom function using IO_PA0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA1 at application runtime
*/
void IO_PA1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA1_InterruptHandler = interruptHandler;
}
void IO_PA1_DefaultInterruptHandler(void)
{
// add your IO_PA1 interrupt custom code
// or set custom function using IO_PA1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA2 at application runtime
*/
void IO_PA2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA2_InterruptHandler = interruptHandler;
}
void IO_PA2_DefaultInterruptHandler(void)
{
// add your IO_PA2 interrupt custom code
// or set custom function using IO_PA2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA3 at application runtime
*/
void IO_PA3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA3_InterruptHandler = interruptHandler;
}
void IO_PA3_DefaultInterruptHandler(void)
{
// add your IO_PA3 interrupt custom code
// or set custom function using IO_PA3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA4 at application runtime
*/
void IO_PA4_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA4_InterruptHandler = interruptHandler;
}
void IO_PA4_DefaultInterruptHandler(void)
{
// add your IO_PA4 interrupt custom code
// or set custom function using IO_PA4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA5 at application runtime
*/
void IO_PA5_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA5_InterruptHandler = interruptHandler;
}
void IO_PA5_DefaultInterruptHandler(void)
{
// add your IO_PA5 interrupt custom code
// or set custom function using IO_PA5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA6 at application runtime
*/
void IO_PA6_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA6_InterruptHandler = interruptHandler;
}
void IO_PA6_DefaultInterruptHandler(void)
{
// add your IO_PA6 interrupt custom code
// or set custom function using IO_PA6_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PA7 at application runtime
*/
void IO_PA7_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PA7_InterruptHandler = interruptHandler;
}
void IO_PA7_DefaultInterruptHandler(void)
{
// add your IO_PA7 interrupt custom code
// or set custom function using IO_PA7_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB0 at application runtime
*/
void IO_PB0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB0_InterruptHandler = interruptHandler;
}
void IO_PB0_DefaultInterruptHandler(void)
{
// add your IO_PB0 interrupt custom code
// or set custom function using IO_PB0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB1 at application runtime
*/
void IO_PB1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB1_InterruptHandler = interruptHandler;
}
void IO_PB1_DefaultInterruptHandler(void)
{
// add your IO_PB1 interrupt custom code
// or set custom function using IO_PB1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB2 at application runtime
*/
void IO_PB2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB2_InterruptHandler = interruptHandler;
}
void IO_PB2_DefaultInterruptHandler(void)
{
// add your IO_PB2 interrupt custom code
// or set custom function using IO_PB2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB3 at application runtime
*/
void IO_PB3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB3_InterruptHandler = interruptHandler;
}
void IO_PB3_DefaultInterruptHandler(void)
{
// add your IO_PB3 interrupt custom code
// or set custom function using IO_PB3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB4 at application runtime
*/
void IO_PB4_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB4_InterruptHandler = interruptHandler;
}
void IO_PB4_DefaultInterruptHandler(void)
{
// add your IO_PB4 interrupt custom code
// or set custom function using IO_PB4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PB5 at application runtime
*/
void IO_PB5_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PB5_InterruptHandler = interruptHandler;
}
void IO_PB5_DefaultInterruptHandler(void)
{
// add your IO_PB5 interrupt custom code
// or set custom function using IO_PB5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC2 at application runtime
*/
void IO_PC2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC2_InterruptHandler = interruptHandler;
}
void IO_PC2_DefaultInterruptHandler(void)
{
// add your IO_PC2 interrupt custom code
// or set custom function using IO_PC2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC3 at application runtime
*/
void IO_PC3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC3_InterruptHandler = interruptHandler;
}
void IO_PC3_DefaultInterruptHandler(void)
{
// add your IO_PC3 interrupt custom code
// or set custom function using IO_PC3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC4 at application runtime
*/
void IO_PC4_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC4_InterruptHandler = interruptHandler;
}
void IO_PC4_DefaultInterruptHandler(void)
{
// add your IO_PC4 interrupt custom code
// or set custom function using IO_PC4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC5 at application runtime
*/
void IO_PC5_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC5_InterruptHandler = interruptHandler;
}
void IO_PC5_DefaultInterruptHandler(void)
{
// add your IO_PC5 interrupt custom code
// or set custom function using IO_PC5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC6 at application runtime
*/
void IO_PC6_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC6_InterruptHandler = interruptHandler;
}
void IO_PC6_DefaultInterruptHandler(void)
{
// add your IO_PC6 interrupt custom code
// or set custom function using IO_PC6_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PC7 at application runtime
*/
void IO_PC7_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PC7_InterruptHandler = interruptHandler;
}
void IO_PC7_DefaultInterruptHandler(void)
{
// add your IO_PC7 interrupt custom code
// or set custom function using IO_PC7_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD0 at application runtime
*/
void IO_PD0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD0_InterruptHandler = interruptHandler;
}
void IO_PD0_DefaultInterruptHandler(void)
{
// add your IO_PD0 interrupt custom code
// or set custom function using IO_PD0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD1 at application runtime
*/
void IO_PD1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD1_InterruptHandler = interruptHandler;
}
void IO_PD1_DefaultInterruptHandler(void)
{
// add your IO_PD1 interrupt custom code
// or set custom function using IO_PD1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD2 at application runtime
*/
void IO_PD2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD2_InterruptHandler = interruptHandler;
}
void IO_PD2_DefaultInterruptHandler(void)
{
// add your IO_PD2 interrupt custom code
// or set custom function using IO_PD2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD3 at application runtime
*/
void IO_PD3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD3_InterruptHandler = interruptHandler;
}
void IO_PD3_DefaultInterruptHandler(void)
{
// add your IO_PD3 interrupt custom code
// or set custom function using IO_PD3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD4 at application runtime
*/
void IO_PD4_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD4_InterruptHandler = interruptHandler;
}
void IO_PD4_DefaultInterruptHandler(void)
{
// add your IO_PD4 interrupt custom code
// or set custom function using IO_PD4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD5 at application runtime
*/
void IO_PD5_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD5_InterruptHandler = interruptHandler;
}
void IO_PD5_DefaultInterruptHandler(void)
{
// add your IO_PD5 interrupt custom code
// or set custom function using IO_PD5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD6 at application runtime
*/
void IO_PD6_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD6_InterruptHandler = interruptHandler;
}
void IO_PD6_DefaultInterruptHandler(void)
{
// add your IO_PD6 interrupt custom code
// or set custom function using IO_PD6_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PD7 at application runtime
*/
void IO_PD7_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PD7_InterruptHandler = interruptHandler;
}
void IO_PD7_DefaultInterruptHandler(void)
{
// add your IO_PD7 interrupt custom code
// or set custom function using IO_PD7_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PE0 at application runtime
*/
void IO_PE0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PE0_InterruptHandler = interruptHandler;
}
void IO_PE0_DefaultInterruptHandler(void)
{
// add your IO_PE0 interrupt custom code
// or set custom function using IO_PE0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PE1 at application runtime
*/
void IO_PE1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PE1_InterruptHandler = interruptHandler;
}
void IO_PE1_DefaultInterruptHandler(void)
{
// add your IO_PE1 interrupt custom code
// or set custom function using IO_PE1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PE2 at application runtime
*/
void IO_PE2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PE2_InterruptHandler = interruptHandler;
}
void IO_PE2_DefaultInterruptHandler(void)
{
// add your IO_PE2 interrupt custom code
// or set custom function using IO_PE2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PE3 at application runtime
*/
void IO_PE3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PE3_InterruptHandler = interruptHandler;
}
void IO_PE3_DefaultInterruptHandler(void)
{
// add your IO_PE3 interrupt custom code
// or set custom function using IO_PE3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF0 at application runtime
*/
void IO_PF0_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF0_InterruptHandler = interruptHandler;
}
void IO_PF0_DefaultInterruptHandler(void)
{
// add your IO_PF0 interrupt custom code
// or set custom function using IO_PF0_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF1 at application runtime
*/
void IO_PF1_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF1_InterruptHandler = interruptHandler;
}
void IO_PF1_DefaultInterruptHandler(void)
{
// add your IO_PF1 interrupt custom code
// or set custom function using IO_PF1_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF2 at application runtime
*/
void IO_PF2_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF2_InterruptHandler = interruptHandler;
}
void IO_PF2_DefaultInterruptHandler(void)
{
// add your IO_PF2 interrupt custom code
// or set custom function using IO_PF2_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF3 at application runtime
*/
void IO_PF3_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF3_InterruptHandler = interruptHandler;
}
void IO_PF3_DefaultInterruptHandler(void)
{
// add your IO_PF3 interrupt custom code
// or set custom function using IO_PF3_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF4 at application runtime
*/
void IO_PF4_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF4_InterruptHandler = interruptHandler;
}
void IO_PF4_DefaultInterruptHandler(void)
{
// add your IO_PF4 interrupt custom code
// or set custom function using IO_PF4_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF5 at application runtime
*/
void IO_PF5_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF5_InterruptHandler = interruptHandler;
}
void IO_PF5_DefaultInterruptHandler(void)
{
// add your IO_PF5 interrupt custom code
// or set custom function using IO_PF5_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF6 at application runtime
*/
void IO_PF6_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF6_InterruptHandler = interruptHandler;
}
void IO_PF6_DefaultInterruptHandler(void)
{
// add your IO_PF6 interrupt custom code
// or set custom function using IO_PF6_SetInterruptHandler()
}
/**
Allows selecting an interrupt handler for IO_PF7 at application runtime
*/
void IO_PF7_SetInterruptHandler(void (* interruptHandler)(void))
{
IO_PF7_InterruptHandler = interruptHandler;
}
void IO_PF7_DefaultInterruptHandler(void)
{
// add your IO_PF7 interrupt custom code
// or set custom function using IO_PF7_SetInterruptHandler()
}
ISR(PORTA_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTA.INTFLAGS & PORT_INT0_bm)
{
IO_PA0_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT1_bm)
{
IO_PA1_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT2_bm)
{
IO_PA2_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT3_bm)
{
IO_PA3_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT4_bm)
{
IO_PA4_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT5_bm)
{
IO_PA5_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT6_bm)
{
IO_PA6_InterruptHandler();
}
if(VPORTA.INTFLAGS & PORT_INT7_bm)
{
IO_PA7_InterruptHandler();
}
/* Clear interrupt flags */
VPORTA.INTFLAGS = 0xff;
}
ISR(PORTB_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTB.INTFLAGS & PORT_INT0_bm)
{
IO_PB0_InterruptHandler();
}
if(VPORTB.INTFLAGS & PORT_INT1_bm)
{
IO_PB1_InterruptHandler();
}
if(VPORTB.INTFLAGS & PORT_INT2_bm)
{
IO_PB2_InterruptHandler();
}
if(VPORTB.INTFLAGS & PORT_INT3_bm)
{
IO_PB3_InterruptHandler();
}
if(VPORTB.INTFLAGS & PORT_INT4_bm)
{
IO_PB4_InterruptHandler();
}
if(VPORTB.INTFLAGS & PORT_INT5_bm)
{
IO_PB5_InterruptHandler();
}
/* Clear interrupt flags */
VPORTB.INTFLAGS = 0xff;
}
ISR(PORTC_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTC.INTFLAGS & PORT_INT1_bm)
{
IO_PC1_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT0_bm)
{
IO_PC0_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT2_bm)
{
IO_PC2_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT3_bm)
{
IO_PC3_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT4_bm)
{
IO_PC4_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT5_bm)
{
IO_PC5_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT6_bm)
{
IO_PC6_InterruptHandler();
}
if(VPORTC.INTFLAGS & PORT_INT7_bm)
{
IO_PC7_InterruptHandler();
}
/* Clear interrupt flags */
VPORTC.INTFLAGS = 0xff;
}
ISR(PORTD_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTD.INTFLAGS & PORT_INT0_bm)
{
IO_PD0_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT1_bm)
{
IO_PD1_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT2_bm)
{
IO_PD2_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT3_bm)
{
IO_PD3_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT4_bm)
{
IO_PD4_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT5_bm)
{
IO_PD5_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT6_bm)
{
IO_PD6_InterruptHandler();
}
if(VPORTD.INTFLAGS & PORT_INT7_bm)
{
IO_PD7_InterruptHandler();
}
/* Clear interrupt flags */
VPORTD.INTFLAGS = 0xff;
}
ISR(PORTE_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTE.INTFLAGS & PORT_INT0_bm)
{
IO_PE0_InterruptHandler();
}
if(VPORTE.INTFLAGS & PORT_INT1_bm)
{
IO_PE1_InterruptHandler();
}
if(VPORTE.INTFLAGS & PORT_INT2_bm)
{
IO_PE2_InterruptHandler();
}
if(VPORTE.INTFLAGS & PORT_INT3_bm)
{
IO_PE3_InterruptHandler();
}
/* Clear interrupt flags */
VPORTE.INTFLAGS = 0xff;
}
ISR(PORTF_PORT_vect)
{
// Call the interrupt handler for the callback registered at runtime
if(VPORTF.INTFLAGS & PORT_INT0_bm)
{
IO_PF0_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT1_bm)
{
IO_PF1_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT2_bm)
{
IO_PF2_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT3_bm)
{
IO_PF3_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT4_bm)
{
IO_PF4_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT5_bm)
{
IO_PF5_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT6_bm)
{
IO_PF6_InterruptHandler();
}
if(VPORTF.INTFLAGS & PORT_INT7_bm)
{
IO_PF7_InterruptHandler();
}
/* Clear interrupt flags */
VPORTF.INTFLAGS = 0xff;
}
/**
End of File
*/

Wyświetl plik

@ -0,0 +1,90 @@
/**
* 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
*/
/*
© [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 "../utils/assembler.h"
/*
* GNU and IAR use different calling conventions. Since this is
* a very small and simple function to begin with, it's easier
* to implement it twice than to deal with the differences
* within a single implementation.
*/
PUBLIC_FUNCTION(protected_write_io)
#if defined(__GNUC__)
#ifdef RAMPZ
out _SFR_IO_ADDR(RAMPZ), r1 // Clear bits 23:16 of Z
#endif
movw r30, r24 // Load addr into Z
out CCP, r22 // Start CCP handshake
st Z, r20 // Write value to I/O register
ret // Return to caller
#elif defined(__IAR_SYSTEMS_ASM__)
# if !defined(CONFIG_MEMORY_MODEL_TINY) && !defined(CONFIG_MEMORY_MODEL_SMALL) \
&& !defined(CONFIG_MEMORY_MODEL_LARGE)
# define CONFIG_MEMORY_MODEL_SMALL
# endif
# if defined(CONFIG_MEMORY_MODEL_LARGE)
ldi r20, 0
out RAMPZ, r20 // Reset bits 23:16 of Z
movw r30, r16 // Load addr into Z
# elif defined(CONFIG_MEMORY_MODEL_TINY)
ldi r31, 0 // Reset bits 8:15 of Z
mov r30, r16 // Load addr into Z
# else
movw r30, r16 // Load addr into Z
# endif
# if defined(CONFIG_MEMORY_MODEL_TINY)
out CCP, r17 // Start CCP handshake
st Z, r18 // Write value to I/O register
# elif defined(CONFIG_MEMORY_MODEL_SMALL)
out CCP, r18 // Start CCP handshake
st Z, r19 // Write value to I/O register
# elif defined(CONFIG_MEMORY_MODEL_LARGE)
out CCP, r19 // Start CCP handshake
st Z, r20 // Write value to I/O register
# else
# error Unknown memory model in use, no idea how registers should be accessed
# endif
ret
#else
# error Unknown assembler
#endif
END_FUNC(protected_write_io)
END_FILE()

Wyświetl plik

@ -0,0 +1,45 @@
/**
* 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)
{
PIN_MANAGER_Initialize();
ADC0_Initialize();
CLOCK_Initialize();
NVM_Initialize();
USART1_Initialize();
CPUINT_Initialize();
}

Wyświetl plik

@ -0,0 +1,63 @@
/**
* 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/pins.h"
#include "../adc/adc0.h"
#include "../system/clock.h"
#include "../nvm/nvm.h"
#include "../uart/usart1.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

@ -0,0 +1,120 @@
/**
* 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
*/
/*
© [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_GAS_H_INCLUDED
#define ASSEMBLER_GAS_H_INCLUDED
#ifndef __DOXYGEN__
/* clang-format off */
/* IAR doesn't accept dots in macro names */
.macro ld_addr, reg, sym
lda.w \reg, \sym
.endm
/* Define a function \a name that is either globally visible or only
* file-local.
*/
.macro gas_begin_func name, is_public
.if \is_public
.global \name
.endif
#ifdef __XC8
.section .text.\name, code
#else
.section .text.\name, "ax", @progbits
#endif
.type \name, @function
\name :
.endm
/* Define a function \a name that is either globally visible or only
* file-local in a given segment.
*/
.macro gas_begin_func_segm name, is_public, segment
.if \is_public
.global \name
.endif
.section .\segment, "ax", @progbits
.type \name, @function
\name :
.endm
/* Define \a name as a weak alias for the function \a strong_name */
.macro gas_weak_function_alias name, strong_name
.global \name
.weak \name
.type \name, @function
.set \name, \strong_name
.endm
/* Define a weak function called \a name */
.macro gas_weak_function name
.weak \name
gas_begin_func \name 1
.endm
#define REPEAT(count) .rept count
#define END_REPEAT() .endr
#define FILL_BYTES(count) .fill count
#define SET_LOC(offset) .org offset
#define L(name) .L##name
#define EXTERN_SYMBOL(name)
#define TEXT_SECTION(name) \
.section name, "ax", @progbits
#define RODATA_SECTION(name) \
.section name, "a", @progbits
#define DATA_SECTION(name) \
.section name, "aw", @progbits
#define BSS_SECTION(name) \
.section name, "aw", @nobits
#define FUNCTION(name) gas_begin_func name 0
#define PUBLIC_FUNCTION(name) gas_begin_func name 1
#define PUBLIC_FUNCTION_SEGMENT(name, segment) \
gas_begin_func_segm name 1 segment
#define WEAK_FUNCTION(name) gas_weak_function name
#define WEAK_FUNCTION_ALIAS(name, strong_name) \
gas_weak_function_alias name strong_name
#define END_FUNC(name) \
.size name, . - name
#define END_FILE()
/* clang-format on */
#endif /* __DOXYGEN__ */
#endif /* ASSEMBLER_GAS_H_INCLUDED */

Wyświetl plik

@ -0,0 +1,104 @@
/**
* 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
*/
/*
© [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_IAR_H_INCLUDED
#define ASSEMBLER_IAR_H_INCLUDED
/* clang-format off */
ld_addr MACRO reg, sym
mov reg, LWRD sym
orh reg, HWRD sym
ENDM
call MACRO sym
rcall sym
ENDM
iar_begin_func MACRO name, sect, is_public, is_weak
MODULE name
RSEG CODE:CODE:NOROOT(1)
IF is_weak == 1
PUBWEAK name
ELSEIF is_public
PUBLIC name
ENDIF
name:
ENDM
iar_begin_func_segm MACRO name, sect, is_public, is_weak, segment
MODULE name
RSEG segment:CODE:NOROOT(1)
IF is_weak == 1
PUBWEAK name
ELSEIF is_public
PUBLIC name
ENDIF
name:
ENDM
iar_weak_alias MACRO name, strong_name
PUBWEAK name
name:
rjmp strong_name
ENDM
#define lo(x) LWRD x
#define hi(x) HWRD x
#define REPEAT(count) REPT count
#define END_REPEAT() ENDR
#define SET_LOC(offset) ORG offset
#define END_FILE() END
#define FILL_BYTES(count) DS8 count
#define L(name) name
#define EXTERN_SYMBOL(name) EXTERN name
#define FUNCTION(name) iar_begin_func name, text_##name, 0, 0
#define PUBLIC_FUNCTION(name) iar_begin_func name, text_##name, 1, 0
#define PUBLIC_FUNCTION_SEGMENT(name, segment) \
iar_begin_func_segm name, text_##name, 1, 0, segment
#define WEAK_FUNCTION(name) iar_begin_func name, text_##name, 1, 1
#define WEAK_FUNCTION_ALIAS(name, strong_name) \
iar_weak_alias name, strong_name
#define END_FUNC(name) ENDMOD
#define TEXT_SECTION(name) RSEG name:CODE:NOROOT
#define RODATA_SECTION(name) RSEG name:CONST:NOROOT
#define DATA_SECTION(name) RSEG name:DATA:NOROOT
#define BSS_SECTION(name) RSEG name:DATA:NOROOT
/* clang-format on */
#endif /* ASSEMBLER_IAR_H_INCLUDED */

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,309 @@
/**
* USART1 Generated Driver API Header File
*
* @file usart1.c
*
* @ingroup usart1
*
* @brief This is the generated driver implementation file for the USART1 driver using
*
* @version USART1 Driver Version 2.0.3
*/
/*
© [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.
*/
/**
Section: Included Files
*/
#include "../usart1.h"
/**
Section: Macro Declarations
*/
/**
Section: Driver Interface
*/
const uart_drv_interface_t UART1 = {
.Initialize = &USART1_Initialize,
.Deinitialize = &USART1_Deinitialize,
.Read = &USART1_Read,
.Write = &USART1_Write,
.IsRxReady = &USART1_IsRxReady,
.IsTxReady = &USART1_IsTxReady,
.IsTxDone = &USART1_IsTxDone,
.TransmitEnable = &USART1_TransmitEnable,
.TransmitDisable = &USART1_TransmitDisable,
.AutoBaudSet = &USART1_AutoBaudSet,
.AutoBaudQuery = &USART1_AutoBaudQuery,
.BRGCountSet = NULL,
.BRGCountGet = NULL,
.BaudRateSet = NULL,
.BaudRateGet = NULL,
.AutoBaudEventEnableGet = NULL,
.ErrorGet = &USART1_ErrorGet,
.TxCompleteCallbackRegister = NULL,
.RxCompleteCallbackRegister = NULL,
.TxCollisionCallbackRegister = NULL,
.FramingErrorCallbackRegister = &USART1_FramingErrorCallbackRegister,
.OverrunErrorCallbackRegister = &USART1_OverrunErrorCallbackRegister,
.ParityErrorCallbackRegister = &USART1_ParityErrorCallbackRegister,
.EventCallbackRegister = NULL,
};
/**
Section: USART1 variables
*/
static volatile usart1_status_t usart1RxLastError;
/**
Section: USART1 APIs
*/
void (*USART1_FramingErrorHandler)(void);
void (*USART1_OverrunErrorHandler)(void);
void (*USART1_ParityErrorHandler)(void);
static void USART1_DefaultFramingErrorCallback(void);
static void USART1_DefaultOverrunErrorCallback(void);
static void USART1_DefaultParityErrorCallback(void);
/**
Section: USART1 APIs
*/
void USART1_Initialize(void)
{
// Set the USART1 module to the options selected in the user interface.
//BAUD 1388;
USART1.BAUD = (uint16_t)USART1_BAUD_RATE(9600);
// ABEIE disabled; DREIE disabled; LBME disabled; RS485 DISABLE; RXCIE disabled; RXSIE disabled; TXCIE disabled;
USART1.CTRLA = 0x0;
// MPCM disabled; ODME disabled; RXEN enabled; RXMODE NORMAL; SFDEN disabled; TXEN enabled;
USART1.CTRLB = 0xC0;
// CMODE Asynchronous Mode; UCPHA enabled; UDORD disabled; CHSIZE Character size: 8 bit; PMODE No Parity; SBMODE 1 stop bit;
USART1.CTRLC = 0x3;
//DBGRUN disabled;
USART1.DBGCTRL = 0x0;
//IREI disabled;
USART1.EVCTRL = 0x0;
//RXPL 0x0;
USART1.RXPLCTRL = 0x0;
//TXPL 0x0;
USART1.TXPLCTRL = 0x0;
USART1_FramingErrorCallbackRegister(USART1_DefaultFramingErrorCallback);
USART1_OverrunErrorCallbackRegister(USART1_DefaultOverrunErrorCallback);
USART1_ParityErrorCallbackRegister(USART1_DefaultParityErrorCallback);
usart1RxLastError.status = 0;
}
void USART1_Deinitialize(void)
{
USART1.BAUD = 0x00;
USART1.CTRLA = 0x00;
USART1.CTRLB = 0x00;
USART1.CTRLC = 0x00;
USART1.DBGCTRL = 0x00;
USART1.EVCTRL = 0x00;
USART1.RXPLCTRL = 0x00;
USART1.TXPLCTRL = 0x00;
}
void USART1_Enable(void)
{
USART1.CTRLB |= USART_RXEN_bm | USART_TXEN_bm;
}
void USART1_Disable(void)
{
USART1.CTRLB &= ~(USART_RXEN_bm | USART_TXEN_bm);
}
void USART1_TransmitEnable(void)
{
USART1.CTRLB |= USART_TXEN_bm;
}
void USART1_TransmitDisable(void)
{
USART1.CTRLB &= ~(USART_TXEN_bm);
}
void USART1_ReceiveEnable(void)
{
USART1.CTRLB |= USART_RXEN_bm ;
}
void USART1_ReceiveDisable(void)
{
USART1.CTRLB &= ~(USART_RXEN_bm);
}
void USART1_AutoBaudSet(bool enable)
{
if(enable)
{
USART1.CTRLB |= USART_RXMODE_gm & (0x02 << USART_RXMODE_gp);
USART1.STATUS |= USART_WFB_bm ;
}
else
{
USART1.CTRLB &= ~(USART_RXMODE_gm);
USART1.STATUS &= ~(USART_BDF_bm);
}
}
bool USART1_AutoBaudQuery(void)
{
return (bool)(USART1.STATUS & USART_BDF_bm) ;
}
bool USART1_IsAutoBaudDetectError(void)
{
return (bool)(USART1.STATUS & USART_ISFIF_bm) ;
}
void USART1_AutoBaudDetectErrorReset(void)
{
USART1.STATUS |= USART_ISFIF_bm ;
USART1_AutoBaudSet(false);
USART1_ReceiveDisable();
asm("nop");
asm("nop");
asm("nop");
asm("nop");
USART1_ReceiveEnable();
USART1_AutoBaudSet(true);
}
bool USART1_IsRxReady(void)
{
return (bool)(USART1.STATUS & USART_RXCIF_bm);
}
bool USART1_IsTxReady(void)
{
return (bool)(USART1.STATUS & USART_DREIF_bm);
}
bool USART1_IsTxDone(void)
{
return (bool)(USART1.STATUS & USART_TXCIF_bm);
}
size_t USART1_ErrorGet(void)
{
usart1RxLastError.status = 0;
if(USART1.RXDATAH & USART_FERR_bm)
{
usart1RxLastError.ferr = 1;
if(NULL != USART1_FramingErrorHandler)
{
USART1_FramingErrorHandler();
}
}
if(USART1.RXDATAH & USART_PERR_bm)
{
usart1RxLastError.perr = 1;
if(NULL != USART1_ParityErrorHandler)
{
USART1_ParityErrorHandler();
}
}
if(USART1.RXDATAH & USART_BUFOVF_bm)
{
usart1RxLastError.oerr = 1;
if(NULL != USART1_OverrunErrorHandler)
{
USART1_OverrunErrorHandler();
}
}
return usart1RxLastError.status;
}
uint8_t USART1_Read(void)
{
return USART1.RXDATAL;
}
void USART1_Write(uint8_t txData)
{
USART1.TXDATAL = txData; // Write the data byte to the USART.
}
static void USART1_DefaultFramingErrorCallback(void)
{
}
static void USART1_DefaultOverrunErrorCallback(void)
{
}
static void USART1_DefaultParityErrorCallback(void)
{
}
void USART1_FramingErrorCallbackRegister(void (* callbackHandler)(void))
{
if(NULL != callbackHandler)
{
USART1_FramingErrorHandler = callbackHandler;
}
}
void USART1_OverrunErrorCallbackRegister(void (* callbackHandler)(void))
{
if(NULL != callbackHandler)
{
USART1_OverrunErrorHandler = callbackHandler;
}
}
void USART1_ParityErrorCallbackRegister(void (* callbackHandler)(void))
{
if(NULL != callbackHandler)
{
USART1_ParityErrorHandler = callbackHandler;
}
}

Wyświetl plik

@ -0,0 +1,90 @@
/**
* UART Generated Driver Interface Header File
*
* @file uart_drv_interface.h
*
* @defgroup uart_drv_interface UART_DRV_INTERFACE
*
* @brief This file contains APIs for UART module.
*
* @version UART 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 UART_DRV_INTERFACE_H
#define UART_DRV_INTERFACE_H
/**
Section: Included Files
*/
#include <stdbool.h>
#include <stdint.h>
#include "uart_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
Section: Data Type Definitions
*/
/**
@ingroup UART
@struct uart_drv_interface_t
@brief Structure containing the function pointers of UART driver.
*/
typedef struct {
void (*Initialize)(void);
void (*Deinitialize)(void);
uint8_t (*Read)(void);
void (*Write)(uint8_t);
bool (*IsRxReady)(void);
bool (*IsTxReady)(void);
bool (*IsTxDone)(void);
void (*TransmitEnable)(void);
void (*TransmitDisable)(void);
void (*AutoBaudSet)(bool enable);
bool (*AutoBaudQuery)(void);
bool (*AutoBaudEventEnableGet)(void);
void (*BRGCountSet)(uint32_t brgValue);
uint32_t (*BRGCountGet)(void);
void (*BaudRateSet)(uint32_t baudRate);
uint32_t (*BaudRateGet)(void);
size_t (*ErrorGet)(void);
void (*TxCompleteCallbackRegister)(void (*CallbackHandler) (void));
void (*RxCompleteCallbackRegister)(void (*CallbackHandler) (void));
void (*TxCollisionCallbackRegister)(void (*CallbackHandler) (void));
void (*FramingErrorCallbackRegister)(void (*CallbackHandler) (void));
void (*OverrunErrorCallbackRegister)(void (*CallbackHandler) (void));
void (*ParityErrorCallbackRegister)(void (*CallbackHandler) (void));
void (*EventCallbackRegister)(void (*CallbackHandler) (void));
}uart_drv_interface_t;
#ifdef __cplusplus
}
#endif
#endif /* UART_DRV_INTERFACE_H */

Wyświetl plik

@ -0,0 +1,81 @@
/**
* UART Generated Driver Interface Header File
*
* @file uart_types.h
*
* @defgroup uart_types UART_TYPES
*
* @brief This file contains APIs for UART module.
*
* @version UART Driver Version 2.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 UART_TYPES_H
#define UART_TYPES_H
/**
Section: Included Files
*/
#include <stdbool.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
Section: Data Type Definitions
*/
/**
@ingroup uartdriver
@enum UART_STANDARD_BAUDS
@brief This Enum can be used to set UART standard
baud-rates using \ref UARTx_BRGSet function e.g. \ref UART1_BRGSet.
*/
enum UART_STANDARD_BAUDS{
UART_110 = 0,
UART_300 = 1,
UART_600 = 2,
UART_1200 = 3,
UART_2400 = 4,
UART_4800 = 5,
UART_9600 = 6,
UART_14400 = 7,
UART_19200 = 8,
UART_38400 = 9,
UART_57600 = 10,
UART_115200 = 11,
UART_230400 = 12,
UART_460800 = 13,
UART_921600 = 14,
};
#ifdef __cplusplus
}
#endif
#endif /* UART_TYPES_H */

Wyświetl plik

@ -0,0 +1,304 @@
/**
* USART1 Generated Driver API Header File
*
* @file usart1.h
*
* @defgroup usart1 USART1
*
* @brief This file contains API prototypes and other datatypes for USART1 module.
*
* @version USART1 Driver Version 2.0.3
*/
/*
© [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 USART1_H
#define USART1_H
/**
Section: Included Files
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "../system/system.h"
#include "uart_drv_interface.h"
#ifdef __cplusplus // Provide C++ Compatibility
extern "C" {
#endif
/* Normal Mode, Baud register value */
#define USART1_BAUD_RATE(BAUD_RATE) (((float)3333333 * 64 / (16 * (float)BAUD_RATE)) + 0.5)
#define UART1_interface UART1
#define UART1_Initialize USART1_Initialize
#define UART1_Deinitialize USART1_Deinitialize
#define UART1_Write USART1_Write
#define UART1_Read USART1_Read
#define UART1__IsRxReady USART1_IsRxReady
#define UART1_IsTxReady USART1_IsTxReady
#define UART1_IsTxDone USART1_IsTxDone
#define UART1_TransmitEnable USART1_TransmitEnable
#define UART1_TransmitDisable USART1_TransmitDisable
#define UART1_AutoBaudSet USART1_AutoBaudSet
#define UART1_AutoBaudQuery USART1_AutoBaudQuery
#define UART1_BRGCountSet (NULL)
#define UART1_BRGCountGet (NULL)
#define UART1_BaudRateSet (NULL)
#define UART1_BaudRateGet (NULL)
#define UART1__AutoBaudEventEnableGet (NULL)
#define UART1_ErrorGet USART1_ErrorGet
#define UART1_TxCompleteCallbackRegister (NULL)
#define UART1_RxCompleteCallbackRegister (NULL)
#define UART1_TxCollisionCallbackRegister (NULL)
#define UART1_FramingErrorCallbackRegister USART1_FramingErrorCallbackRegister
#define UART1_OverrunErrorCallbackRegister USART1_OverrunErrorCallbackRegister
#define UART1_ParityErrorCallbackRegister USART1_ParityErrorCallbackRegister
#define UART1_EventCallbackRegister (NULL)
/**
@ingroup usart1
@struct usart1_status_t
@breif This is an instance of USART1_STATUS for USART1 module
*/
typedef union {
struct {
uint8_t perr : 1; /**<This is a bit field for Parity Error status*/
uint8_t ferr : 1; /**<This is a bit field for Framing Error status*/
uint8_t oerr : 1; /**<This is a bit field for Overfrun Error status*/
uint8_t reserved : 5; /**<Reserved*/
};
size_t status; /**<Group byte for status errors*/
}usart1_status_t;
/**
Section: Data Type Definitions
*/
/**
* @ingroup usart1
* @brief External object for usart1_interface.
*/
extern const uart_drv_interface_t UART1;
/**
* @ingroup usart1
* @brief This API initializes the USART1 driver.
* This routine initializes the USART1 module.
* This routine must be called before any other USART1 routine is called.
* This routine should only be called once during system initialization.
* @param None.
* @return None.
*/
void USART1_Initialize(void);
/**
* @ingroup usart1
* @brief This API Deinitializes the USART1 driver.
* This routine disables the USART1 module.
* @param None.
* @return None.
*/
void USART1_Deinitialize(void);
/**
* @ingroup usart1
* @brief This API enables the USART1 module.
* @param None.
* @return None.
*/
void USART1_Enable(void);
/**
* @ingroup usart1
* @brief This API disables the USART1 module.
* @param None.
* @return None.
*/
void USART1_Disable(void);
/**
* @ingroup usart1
* @brief This API enables the USART1 transmitter.
* USART1 should also be enable to send bytes over TX pin.
* @param None.
* @return None.
*/
void USART1_TransmitEnable(void);
/**
* @ingroup usart1
* @brief This API disables the USART1 transmitter.
* @param None.
* @return None.
*/
void USART1_TransmitDisable(void);
/**
* @ingroup usart1
* @brief This API enables the USART1 Receiver.
* USART1 should also be enable to receive bytes over RX pin.
* @param None.
* @return None.
*/
void USART1_ReceiveEnable(void);
/**
* @ingroup usart1
* @brief This API disables the USART1 Receiver.
* @param None.
* @return None.
*/
void USART1_ReceiveDisable(void);
/**
* @ingroup usart1
* @brief This API enables the USART1 AutoBaud Detection.
* @param bool enable.
* @return None.
*/
void USART1_AutoBaudSet(bool enable);
/**
* @ingroup usart1
* @brief This API reads the USART1 AutoBaud Detection Complete bit.
* @param None.
* @return None.
*/
bool USART1_AutoBaudQuery(void);
/**
* @ingroup usart1
* @brief This API reads the USART1 AutoBaud Detection error bit.
* @param None.
* @return None.
*/
bool USART1_IsAutoBaudDetectError(void);
/**
* @ingroup usart1
* @brief This API Reset the USART1 AutoBaud Detection error bit.
* @param None.
* @return None.
*/
void USART1_AutoBaudDetectErrorReset(void);
/**
* @ingroup usart1
* @brief This API checks if USART1 receiver has received data and ready to be read.
* @param None.
* @retval true if USART1 receiver FIFO has a data
* @retval false USART1 receiver FIFO is empty
*/
bool USART1_IsRxReady(void);
/**
* @ingroup usart1
* @brief This function checks if USART1 transmitter is ready to accept a data byte.
* @param None.
* @retval true if USART1 transmitter FIFO has atleast 1 byte space
* @retval false if USART1 transmitter FIFO is full
*/
bool USART1_IsTxReady(void);
/**
* @ingroup usart1
* @brief This function return the status of transmit shift register (TSR).
* @param None.
* @retval true if Data completely shifted out from the TSR
* @retval false if Data is present in Transmit FIFO and/or in TSR
*/
bool USART1_IsTxDone(void);
/**
* @ingroup usart1
* @brief This function gets the error status of the last read byte.
* This function should be called before USART1_Read().
* @param None.
* @return Status of the last read byte. See usart1_status_t struct for more details.
*/
size_t USART1_ErrorGet(void);
/**
* @ingroup usart1
* @brief This function reads the 8 bits from receiver FIFO register.
* @pre The transfer status should be checked to see if the receiver is not empty
* before calling this function. USART1_IsRxReady() should be checked in if () before calling this API.
* @param None.
* @return 8-bit data from RX FIFO register.
*/
uint8_t USART1_Read(void);
/**
* @ingroup usart1
* @brief This function writes a byte of data to the transmitter FIFO register.
* @pre The transfer status should be checked to see if the transmitter is ready to accept a byte
* before calling this function. USART1_IsTxReady() should be checked in if() before calling this API.
* @param txData - Data byte to write to the TX FIFO.
* @return None.
*/
void USART1_Write(uint8_t txData);
/**
* @ingroup usart1
* @brief This API registers the function to be called upon USART1 framing error.
* @param callbackHandler - a function pointer which will be called upon framing error condition.
* @return None.
*/
void USART1_FramingErrorCallbackRegister(void (* callbackHandler)(void));
/**
* @ingroup usart1
* @brief This API registers the function to be called upon USART1 overrun error.
* @param callbackHandler - a function pointer which will be called upon overrun error condition.
* @return None.
*/
void USART1_OverrunErrorCallbackRegister(void (* callbackHandler)(void));
/**
* @ingroup usart1
* @brief This API registers the function to be called upon USART1 Parity error.
* @param callbackHandler - a function pointer which will be called upon Parity error condition.
* @return None.
*/
void USART1_ParityErrorCallbackRegister(void (* callbackHandler)(void));
#ifdef __cplusplus // Provide C++ Compatibility
}
#endif
#endif // USART1_H

Wyświetl plik

@ -0,0 +1,577 @@
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="65">
<logicalFolder name="root" displayName="root" projectFiles="true">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
projectFiles="true">
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
<logicalFolder name="adc" displayName="adc" projectFiles="true">
<itemPath>mcc_generated_files/adc/adc0.h</itemPath>
</logicalFolder>
<logicalFolder name="nvm" displayName="nvm" projectFiles="true">
<itemPath>mcc_generated_files/nvm/nvm.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_assert.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.h</itemPath>
<itemPath>mcc_generated_files/system/utils/assembler.h</itemPath>
<itemPath>mcc_generated_files/system/utils/atomic.h</itemPath>
</logicalFolder>
<itemPath>mcc_generated_files/system/pins.h</itemPath>
<itemPath>mcc_generated_files/system/config_bits.h</itemPath>
<itemPath>mcc_generated_files/system/interrupt.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/clock.h</itemPath>
<itemPath>mcc_generated_files/system/ccp.h</itemPath>
</logicalFolder>
<logicalFolder name="uart" displayName="uart" projectFiles="true">
<itemPath>mcc_generated_files/uart/uart_types.h</itemPath>
<itemPath>mcc_generated_files/uart/usart1.h</itemPath>
<itemPath>mcc_generated_files/uart/uart_drv_interface.h</itemPath>
</logicalFolder>
</logicalFolder>
</logicalFolder>
<logicalFolder name="LinkerScript"
displayName="Linker Files"
projectFiles="true">
</logicalFolder>
<logicalFolder name="SourceFiles"
displayName="Source Files"
projectFiles="true">
<logicalFolder name="MCC Generated Files"
displayName="MCC Generated Files"
projectFiles="true">
<logicalFolder name="adc" displayName="adc" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/adc/src/adc0.c</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="nvm" displayName="nvm" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/nvm/src/nvm.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/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>
<itemPath>mcc_generated_files/system/src/protected_io.S</itemPath>
</logicalFolder>
</logicalFolder>
<logicalFolder name="uart" displayName="uart" projectFiles="true">
<logicalFolder name="src" displayName="src" projectFiles="true">
<itemPath>mcc_generated_files/uart/src/usart1.c</itemPath>
</logicalFolder>
</logicalFolder>
</logicalFolder>
<itemPath>main.c</itemPath>
</logicalFolder>
<logicalFolder name="ExternalFiles"
displayName="Important Files"
projectFiles="false">
<itemPath>Makefile</itemPath>
<itemPath>avr64ea48-temperature-calibration.mc3</itemPath>
</logicalFolder>
</logicalFolder>
<projectmakefile>Makefile</projectmakefile>
<confs>
<conf name="free" type="2">
<toolsSet>
<developmentServer>localhost</developmentServer>
<targetDevice>AVR64EA48</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
<pack name="AVR-Ex_DFP" vendor="Microchip" version="2.5.176"/>
</packs>
<ScriptingSettings>
</ScriptingSettings>
<compileType>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
<archiverTool>
</archiverTool>
<loading>
<useAlternateLoadableFile>false</useAlternateLoadableFile>
<parseOnProdLoad>false</parseOnProdLoad>
<alternateLoadableFile></alternateLoadableFile>
</loading>
<subordinates>
</subordinates>
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeUseCleanTarget>false</makeUseCleanTarget>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
</makeCustomizationType>
<HI-TECH-COMP>
<property key="additional-warnings" value="true"/>
<property key="asmlist" value="true"/>
<property key="call-prologues" value="false"/>
<property key="default-bitfield-type" value="true"/>
<property key="default-char-type" value="true"/>
<property key="define-macros" value=""/>
<property key="disable-optimizations" value="true"/>
<property key="extra-include-directories" value=""/>
<property key="favor-optimization-for" value="-speed,+space"/>
<property key="garbage-collect-data" value="true"/>
<property key="garbage-collect-functions" value="true"/>
<property key="identifier-length" value="255"/>
<property key="local-generation" value="false"/>
<property key="operation-mode" value="free"/>
<property key="opt-xc8-compiler-strict_ansi" value="false"/>
<property key="optimization-assembler" value="true"/>
<property key="optimization-assembler-files" value="false"/>
<property key="optimization-debug" value="false"/>
<property key="optimization-invariant-enable" value="false"/>
<property key="optimization-invariant-value" value="16"/>
<property key="optimization-level" value="-O0"/>
<property key="optimization-speed" value="false"/>
<property key="optimization-stable-enable" value="false"/>
<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"/>
<property key="verbose" value="false"/>
<property key="warning-level" value="-3"/>
<property key="what-to-do" value="ignore"/>
</HI-TECH-COMP>
<HI-TECH-LINK>
<property key="additional-options-checksum" value=""/>
<property key="additional-options-code-offset" value=""/>
<property key="additional-options-command-line" value=""/>
<property key="additional-options-errata" value=""/>
<property key="additional-options-extend-address" value="false"/>
<property key="additional-options-trace-type" value=""/>
<property key="additional-options-use-response-files" value="false"/>
<property key="backup-reset-condition-flags" value="false"/>
<property key="calibrate-oscillator" value="false"/>
<property key="calibrate-oscillator-value" value="0x3400"/>
<property key="clear-bss" value="true"/>
<property key="code-model-external" value="wordwrite"/>
<property key="code-model-rom" value=""/>
<property key="create-html-files" value="false"/>
<property key="data-model-ram" value=""/>
<property key="data-model-size-of-double" value="24"/>
<property key="data-model-size-of-double-gcc" value="no-short-double"/>
<property key="data-model-size-of-float" value="24"/>
<property key="data-model-size-of-float-gcc" value="no-short-float"/>
<property key="display-class-usage" value="false"/>
<property key="display-hex-usage" value="false"/>
<property key="display-overall-usage" value="true"/>
<property key="display-psect-usage" value="false"/>
<property key="extra-lib-directories" value=""/>
<property key="fill-flash-options-addr" value=""/>
<property key="fill-flash-options-const" value=""/>
<property key="fill-flash-options-how" value="0"/>
<property key="fill-flash-options-inc-const" value="1"/>
<property key="fill-flash-options-increment" value=""/>
<property key="fill-flash-options-seq" value=""/>
<property key="fill-flash-options-what" value="0"/>
<property key="format-hex-file-for-download" value="false"/>
<property key="initialize-data" value="true"/>
<property key="input-libraries" value="libm"/>
<property key="keep-generated-startup.as" value="false"/>
<property key="link-in-c-library" value="true"/>
<property key="link-in-c-library-gcc" value=""/>
<property key="link-in-peripheral-library" value="false"/>
<property key="managed-stack" value="false"/>
<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="false"/>
<property key="remove-unused-sections" value="true"/>
</HI-TECH-LINK>
<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"/>
<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-7fff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/GIT/AVR EA/EBE - 8-bit Examples/avr64ea48-temperature-calibration/avr64ea48-temperature-calibration.X/debug/free/avr64ea48-temperature-calibration_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="true"/>
<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="3.3"/>
</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-7fff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/MPLABXProjects/avr64ea48-temperature-calibration/avr64ea48-temperature-calibration.X/debug/free/avr64ea48-temperature-calibration_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="true"/>
<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="3.3"/>
</nEdbgTool>
</conf>
<conf name="pro" type="2">
<toolsSet>
<developmentServer>localhost</developmentServer>
<targetDevice>AVR64EA48</targetDevice>
<targetHeader></targetHeader>
<targetPluginBoard></targetPluginBoard>
<platformTool>nEdbgTool</platformTool>
<languageToolchain>XC8</languageToolchain>
<languageToolchainVersion>2.41</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
<pack name="AVR-Ex_DFP" vendor="Microchip" version="2.5.176"/>
</packs>
<ScriptingSettings>
</ScriptingSettings>
<compileType>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
<archiverTool>
</archiverTool>
<loading>
<useAlternateLoadableFile>false</useAlternateLoadableFile>
<parseOnProdLoad>false</parseOnProdLoad>
<alternateLoadableFile></alternateLoadableFile>
</loading>
<subordinates>
</subordinates>
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
<makeUseCleanTarget>false</makeUseCleanTarget>
<makeCustomizationPreStep></makeCustomizationPreStep>
<makeCustomizationPostStepEnabled>false</makeCustomizationPostStepEnabled>
<makeCustomizationPostStep></makeCustomizationPostStep>
<makeCustomizationPutChecksumInUserID>false</makeCustomizationPutChecksumInUserID>
<makeCustomizationEnableLongLines>false</makeCustomizationEnableLongLines>
<makeCustomizationNormalizeHexFile>false</makeCustomizationNormalizeHexFile>
</makeCustomizationType>
<HI-TECH-COMP>
<property key="additional-warnings" value="true"/>
<property key="asmlist" value="true"/>
<property key="call-prologues" value="false"/>
<property key="default-bitfield-type" value="true"/>
<property key="default-char-type" value="true"/>
<property key="define-macros" value=""/>
<property key="disable-optimizations" value="false"/>
<property key="extra-include-directories" value=""/>
<property key="favor-optimization-for" value="-speed,+space"/>
<property key="garbage-collect-data" value="true"/>
<property key="garbage-collect-functions" value="true"/>
<property key="identifier-length" value="255"/>
<property key="local-generation" value="false"/>
<property key="operation-mode" value="pro"/>
<property key="opt-xc8-compiler-strict_ansi" value="false"/>
<property key="optimization-assembler" value="true"/>
<property key="optimization-assembler-files" value="false"/>
<property key="optimization-debug" value="false"/>
<property key="optimization-invariant-enable" value="false"/>
<property key="optimization-invariant-value" value="16"/>
<property key="optimization-level" value="-Os"/>
<property key="optimization-speed" value="false"/>
<property key="optimization-stable-enable" value="false"/>
<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"/>
<property key="verbose" value="false"/>
<property key="warning-level" value="-3"/>
<property key="what-to-do" value="ignore"/>
</HI-TECH-COMP>
<HI-TECH-LINK>
<property key="additional-options-checksum" value=""/>
<property key="additional-options-code-offset" value=""/>
<property key="additional-options-command-line" value=""/>
<property key="additional-options-errata" value=""/>
<property key="additional-options-extend-address" value="false"/>
<property key="additional-options-trace-type" value=""/>
<property key="additional-options-use-response-files" value="false"/>
<property key="backup-reset-condition-flags" value="false"/>
<property key="calibrate-oscillator" value="false"/>
<property key="calibrate-oscillator-value" value="0x3400"/>
<property key="clear-bss" value="true"/>
<property key="code-model-external" value="wordwrite"/>
<property key="code-model-rom" value=""/>
<property key="create-html-files" value="false"/>
<property key="data-model-ram" value=""/>
<property key="data-model-size-of-double" value="24"/>
<property key="data-model-size-of-double-gcc" value="no-short-double"/>
<property key="data-model-size-of-float" value="24"/>
<property key="data-model-size-of-float-gcc" value="no-short-float"/>
<property key="display-class-usage" value="false"/>
<property key="display-hex-usage" value="false"/>
<property key="display-overall-usage" value="true"/>
<property key="display-psect-usage" value="false"/>
<property key="extra-lib-directories" value=""/>
<property key="fill-flash-options-addr" value=""/>
<property key="fill-flash-options-const" value=""/>
<property key="fill-flash-options-how" value="0"/>
<property key="fill-flash-options-inc-const" value="1"/>
<property key="fill-flash-options-increment" value=""/>
<property key="fill-flash-options-seq" value=""/>
<property key="fill-flash-options-what" value="0"/>
<property key="format-hex-file-for-download" value="false"/>
<property key="initialize-data" value="true"/>
<property key="input-libraries" value="libm"/>
<property key="keep-generated-startup.as" value="false"/>
<property key="link-in-c-library" value="true"/>
<property key="link-in-c-library-gcc" value=""/>
<property key="link-in-peripheral-library" value="false"/>
<property key="managed-stack" value="false"/>
<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="false"/>
<property key="remove-unused-sections" value="true"/>
</HI-TECH-LINK>
<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"/>
<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-7fff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/GIT/AVR EA/EBE - 8-bit Examples/avr64ea48-temperature-calibration/avr64ea48-temperature-calibration.X/debug/pro/avr64ea48-temperature-calibration_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="true"/>
<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="3.3"/>
</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-7fff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="C:/MPLABXProjects/avr64ea48-temperature-calibration/avr64ea48-temperature-calibration.X/debug/pro/avr64ea48-temperature-calibration_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="true"/>
<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="3.3"/>
</nEdbgTool>
</conf>
</confs>
</configurationDescriptor>

Wyświetl plik

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>com.microchip.mplab.nbide.embedded.makeproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/make-project/1">
<name>avr64ea48-temperature-calibration</name>
<creation-uuid>7cf695e3-154d-45e5-a675-ce46b1013169</creation-uuid>
<make-project-type>0</make-project-type>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<make-dep-projects/>
<sourceRootList/>
<confList>
<confElem>
<name>free</name>
<type>2</type>
</confElem>
<confElem>
<name>pro</name>
<type>2</type>
</confElem>
</confList>
<formatting>
<project-formatting-style>false</project-formatting-style>
</formatting>
</data>
</configuration>
</project>

BIN
images/ADC0.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/ADC0_1.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/ADC0_2.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/CLKCTRL.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/NVMCTRL.png 100644

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/USART1.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/USART1_1.png 100644

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/USART1_2.png 100644

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/pins.png 100644

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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

BIN
images/streamer.png 100644

Plik binarny nie jest wyświetlany.

Po

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

Plik binarny nie jest wyświetlany.

Po

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