Skip to content

Commit 6f20211

Browse files
committed
MPAE-19450 updated to public version of I2C_Host Example for release, readme fixes
1 parent adaeb75 commit 6f20211

File tree

11 files changed

+81
-73
lines changed

11 files changed

+81
-73
lines changed

.main-meta/main.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"configurator": {
2626
"name": "MCC",
27-
"semverRange": "^5.8.0"
27+
"semverRange": "^5.6.2"
2828
},
2929
"device": {
3030
"metaDataVersion": "1.0.0",

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ The [I<sup>2</sup>C Proximity Sensor example](https://onlinedocs.microchip.com/v
1919

2020
This example demonstrates how to read the value of the VCNL4200 proximity sensor on the Curiosity Nano Explorer, with the Data Streamer Visualization Output selected. Every 100 ms, an LED and a Debug I/O pin are toggled. A Timer overflow callback is used to send a Data Streamer frame every 100 ms.
2121

22-
In the MCC Melody Data Streamer library configruation, the appropriately typed variables are added to the Data Streamer table.
22+
In the MCC Melody Data Streamer library configuration, the appropriately typed variables are added to the Data Streamer table.
2323

2424
![alt text](images/pic18f57q43-i2c-proximity-sensor-callbacks-datastreamerTable_uartPins.png)
2525

2626

27-
The below image of the MPLAB Data Visualizer shows the application running, where the variable configured in the Data Streamer Table have been imported as a Variable Streamer in the [MPLAB® Data Visualizer](https://www.microchip.com/en-us/tools-resources/debug/mplab-data-visualizer "MPLAB® Data Visualizer"), via a generated .ds (data streamer file).
27+
The below image of the MPLAB Data Visualizer shows the application running, where the variable configured in the Data Streamer Table have been imported as a Variable Streamer in the [MPLAB® Data Visualizer](https://www.microchip.com/en-us/tools-resources/debug/mplab-data-visualizer "MPLAB® Data Visualizer"), via a generated `.ds` (data streamer file).
2828
![alt text](images/pic18f57q43-i2c-proximity-sensor-dataStreamer.png)
2929

3030
The following is a block diagram view of the application, as seen in the [MCC Melody Builder](https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=MCC.MELODY.BUILDER&version=latest&redirect=true "MCC Melody Builder").
@@ -38,23 +38,24 @@ Example Components are a tight integration of learning material directly into MC
3838
## Related Documentation
3939

4040
- [MCC Melody I<sup>2</sup>C Example Component (for the Curiosity Nano Explorer)](https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=I2C.HOST.EXAMPLE.COMPONENT&version=latest&redirect=true "MCC Melody I<sup>2</sup>C Example Component for the Curiosity Nano Explorer")
41-
- [MCC Melody Design Patterns for Control Flow](https://onlinedocs.microchip.com/v2/keyword-lookup?keyword=I2C.HOST.EXAMPLE.COMPONENT&version=latest&redirect=true "MCC Melody I<sup>2</sup>C Example Component for the Curiosity Nano Explorer")
41+
- [MCC Melody Design Patterns for Control Flow](https://onlinedocs.microchip.com/g/GUID-7CE1AEE9-2487-4E7B-B26B-93A577BA154E "MCC Melody Design Patterns for Control Flow")
4242

4343
- [Curiosity Nano Explorer User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/PIC18F57Q43-Curiosity-Nano-HW-UserGuide-DS40002186B.pdf "Curiosity Nano Explorer Users Guide")
4444

4545
- [PIC18F57Q43 Data Sheet](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/PIC18F27-47-57Q43-Data-Sheet-40002147F.pdf "PIC18F57Q43 Data Sheet")
4646

4747
## Software Used
48-
- MPLAB® X IDE 6.25.0 or newer [(MPLAB® X IDE 6.25.0)](https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-x-ide)
49-
- MPLAB® XC8 3.00.0 or newer [(MPLAB® XC8 3.00.0)](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers/xc8)
48+
- [MPLAB® X IDE](https://www.microchip.com/en-us/development-tools-tools-and-software/mplab-x-ide) 6.25.0 or newer
49+
- [MPLAB® XC8](https://www.microchip.com/en-us/tools-resources/develop/mplab-xc-compilers/xc8) 3.00.0 or newer
5050

51-
- MPLAB® Code Configurator (MCC) Plug-in Version 5.6 or newer (*Tools>Plugins>Installed*, search: "MCC")
52-
- MPLAB Data Visualizer Plug-in Version 1.4.1926 or newer (*Tools>Plugins>Installed*, search: "Data Visualizer")
51+
- [MPLAB® Code Configurator](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator) (MCC) Plug-in Version 5.6.2 or newer (*Tools>Plugins>Installed*, search: "MCC")
52+
- [MPLAB Data Visualizer](https://www.microchip.com/en-us/tools-resources/debug/mplab-data-visualizer) Plug-in Version 1.4.1926 or newer (*Tools>Plugins>Installed*, search: "Data Visualizer")
5353
- MCC Melody I2C_Host Example Component for the Curiosity Nano Explorer 1.0.0 or newer
54-
- MCC Core 5.8.0 or newer
55-
- MCC Melody Core 2.9.0 or newer
54+
- MCC Core 5.8.2 or newer
55+
- SPA Host 1.0.0 or newer
56+
- MCC Melody Core 2.9.1 or newer
5657

57-
Open the MCC Content Manager to verify the MCC Core and MCC Melody Core versions.
58+
Open the MCC Content Manager ![CM_icon](images/Icon-MPLAB-CM24.png) to verify the MCC Core and MCC Melody Core versions.
5859

5960
![alt text](images/MCC_Core_ContentLibrary_Versions_SPA.png)
6061

-163 Bytes
Loading

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
* Example: 4. I2C Proximity Sensor
3232
* Implementation: Interrupts with callbacks
3333
* Visualization: Data Streamer
34-
* MCU Device family: PIC18F/18F
34+
* MCU Device family: PIC18
3535
*/
36+
3637
#include "mcc_generated_files/system/system.h"
3738

39+
3840
// Note: VCNL4200 - High Sensitivity Long Distance Proximity and Ambient Light Sensor With I2C Interface
3941
// Reference to the VCNL4200 data sheet: https://www.vishay.com/docs/84430/vcnl4200.pdf
4042
// The VCNL4200 command codes are located in Table 1 (page 9) of the VCNL4200 data sheet
@@ -45,8 +47,10 @@ uint8_t VCNL4200_Initialize(void);
4547
uint8_t VCNL4200_ProximityRead(uint16_t* proximityValue);
4648
void Timer_Callback_100ms(void);
4749

48-
// TODO: Replace TimerX with name of const struct TIMER_INTERFACE, from MCC Generated Files > timer > {timer_header}X
49-
static const struct TIMER_INTERFACE *Timer = &Timer2; // TODO: Replace TimerX with the timer instance number
50+
// TODO: Replace TimerX with number of Timer chosen as dependency.
51+
// Matches name of const struct TIMER_INTERFACE, from MCC Generated Files > timer > tmrx.c
52+
static const struct TIMER_INTERFACE *Timer = &Timer2;
53+
5054
static volatile bool SEND_FRAME = false; // volatile because this variable is used inside & outside the ISR.
5155
static uint16_t proximityValue; // VCNL4200 sensor result
5256
static volatile uint8_t frameCount;
@@ -118,4 +122,4 @@ int main(void)
118122
SEND_FRAME = false;
119123
}
120124
}
121-
}
125+
}

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/mcc-manifest-autosave.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22

33
manifest_file_version: 1.0.0
44
project: pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer
5-
creation_date: 2025-05-05T10:06:38.527+02:00[Europe/Berlin]
5+
creation_date: 2025-06-17T12:11:15.249+02:00[Europe/Berlin]
66
operating_system: Windows 11
77
mcc_mode: IDE
88
mcc_mode_version: v6.25
99
device_name: PIC18F57Q43
1010
compiler: XC8 3.00
11-
mcc_version: 5.6.0-rc.f
12-
mcc_core_version: 5.8.0-rc.f
13-
content_manager_version: 6.0.0-rc.d
11+
mcc_version: 5.6.2
12+
mcc_core_version: 5.8.2
13+
content_manager_version: 6.0.1
1414
is_mcc_offline: false
15-
is_using_prerelease_versions: true
16-
mcc_content_registries: https://registry.npmjs.org/,https://artifacts.microchip.com/artifactory/api/npm/npm/
17-
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.0-rc.1}
15+
is_using_prerelease_versions: false
16+
mcc_content_registries: https://registry.npmjs.org/
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.1}
1818
packs: {name: N/A, version: N/A}
1919
modules:
20-
- {name: '@mchp-mcc/data-streamer-driver', type: MELODY, version: 2.0.2-dev.1}
20+
- {name: '@mchp-mcc/data-streamer-driver', type: MELODY, version: 2.0.1}
2121
- {name: '@mchp-mcc/example-i2c-host', type: MELODY, version: 1.0.0}
22-
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.1.0-dev.1}
22+
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.0.5}
2323
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
24-
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1-dev.6}
24+
- {name: '@mchp-mcc/melody', type: CLASSIC, version: 2.9.1}
25+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1}
2526
- {name: '@mchp-mcc/pic18-configuration-bits-v1', type: MELODY, version: 5.3.5}
2627
- {name: '@mchp-mcc/pic18-pin-manager', type: MELODY, version: 3.7.1}
27-
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.9.1-feat.6}
28+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.9.1}
2829
- {name: '@mchp-mcc/scf-pic8-i2c-v1', type: MELODY, version: 6.1.4}
2930
- {name: '@mchp-mcc/scf-pic8-interrupt-v1', type: MELODY, version: 5.2.11}
3031
- {name: '@mchp-mcc/scf-pic8-osc-v1', type: MELODY, version: 4.4.0}
31-
- {name: '@mchp-mcc/scf-pic8-tmr2-v1', type: MELODY, version: 5.1.1-dev.2}
32+
- {name: '@mchp-mcc/scf-pic8-tmr2-v1', type: MELODY, version: 5.1.1}
3233
- {name: '@mchp-mcc/scf-pic8-uart-v1', type: MELODY, version: 7.2.0}
3334
- {name: '@mchp-mcc/timer', type: MELODY, version: 1.2.3}
3435
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/mcc-manifest-generated-success.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22

33
manifest_file_version: 1.0.0
44
project: pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer
5-
creation_date: 2025-05-05T09:42:57.002+02:00[Europe/Berlin]
5+
creation_date: 2025-06-17T12:11:15.231+02:00[Europe/Berlin]
66
operating_system: Windows 11
77
mcc_mode: IDE
88
mcc_mode_version: v6.25
99
device_name: PIC18F57Q43
1010
compiler: XC8 3.00
11-
mcc_version: 5.6.0-rc.f
12-
mcc_core_version: 5.8.0-rc.f
13-
content_manager_version: 6.0.0-rc.d
11+
mcc_version: 5.6.2
12+
mcc_core_version: 5.8.2
13+
content_manager_version: 6.0.1
1414
is_mcc_offline: false
15-
is_using_prerelease_versions: true
16-
mcc_content_registries: https://registry.npmjs.org/,https://artifacts.microchip.com/artifactory/api/npm/npm/
17-
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.0-rc.1}
15+
is_using_prerelease_versions: false
16+
mcc_content_registries: https://registry.npmjs.org/
17+
device_library: {library_class: com.microchip.mcc.melody.Library, name: Melody, version: 2.9.1}
1818
packs: {name: N/A, version: N/A}
1919
modules:
20-
- {name: '@mchp-mcc/data-streamer-driver', type: MELODY, version: 2.0.2-dev.1}
20+
- {name: '@mchp-mcc/data-streamer-driver', type: MELODY, version: 2.0.1}
2121
- {name: '@mchp-mcc/example-i2c-host', type: MELODY, version: 1.0.0}
22-
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.1.0-dev.1}
22+
- {name: '@mchp-mcc/i2c-host-driver', type: MELODY, version: 1.0.5}
2323
- {name: '@mchp-mcc/main-manager', type: MELODY, version: 3.1.2}
24-
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1-dev.6}
24+
- {name: '@mchp-mcc/melody', type: CLASSIC, version: 2.9.1}
25+
- {name: '@mchp-mcc/pic-8bit', type: MELODY, version: 5.29.1}
2526
- {name: '@mchp-mcc/pic18-configuration-bits-v1', type: MELODY, version: 5.3.5}
2627
- {name: '@mchp-mcc/pic18-pin-manager', type: MELODY, version: 3.7.1}
27-
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.9.1-feat.6}
28+
- {name: '@mchp-mcc/pin-content-processor', type: MELODY, version: 3.9.1}
2829
- {name: '@mchp-mcc/scf-pic8-i2c-v1', type: MELODY, version: 6.1.4}
2930
- {name: '@mchp-mcc/scf-pic8-interrupt-v1', type: MELODY, version: 5.2.11}
3031
- {name: '@mchp-mcc/scf-pic8-osc-v1', type: MELODY, version: 4.4.0}
31-
- {name: '@mchp-mcc/scf-pic8-tmr2-v1', type: MELODY, version: 5.1.1-dev.2}
32+
- {name: '@mchp-mcc/scf-pic8-tmr2-v1', type: MELODY, version: 5.1.1}
3233
- {name: '@mchp-mcc/scf-pic8-uart-v1', type: MELODY, version: 7.2.0}
3334
- {name: '@mchp-mcc/timer', type: MELODY, version: 1.2.3}
3435
- {name: '@mchp-mcc/uart-driver', type: MELODY, version: 1.10.2}

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/mcc_generated_files/data_streamer/data_streamer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/**
23
* DATASTREAMER Generated Driver API Header File.
34
*
@@ -33,9 +34,8 @@
3334
#ifndef DATA_STREAMER_H
3435
#define DATA_STREAMER_H
3536

36-
#include <stddef.h>
37+
#include <stdio.h>
3738
#include <stdint.h>
38-
#include "data_streamer_comms.h"
3939

4040
/**
4141
* @def Data Streamer Start Byte Macro.
@@ -120,4 +120,4 @@ void DataStreamer_PackageSet(void * customStructHandler, size_t customlength);
120120
#endif /* DATA_STREAMER_H */
121121
/**
122122
End of File
123-
*/
123+
*/

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/mcc_generated_files/data_streamer/src/data_streamer.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
*/
3232

3333
#include "../data_streamer.h"
34+
#include "../../uart/uart1.h"
35+
36+
static const uart_drv_interface_t *DS_UART = &UART1;
37+
3438

3539
struct DATA_STREAMER_STRUCT DataStreamer;
3640
struct PACKAGE_STRUCT DATA_STREAMER_PACKAGE;
@@ -40,21 +44,22 @@ void DataStreamer_Initialize(void)
4044
DataStreamer_PackageSet(&DataStreamer, sizeof (DataStreamer));
4145
}
4246

47+
static void DataStreamer_VariableWrite(char var)
48+
{
49+
while (!(DS_UART->IsTxReady()));
50+
DS_UART->Write(var);
51+
};
52+
4353
void DataStreamer_FrameSend(void * package, size_t length)
4454
{
45-
/* cppcheck-suppress misra-c2012-11.5 */
4655
char * dp = package;
4756
DataStreamer_VariableWrite(DATA_STREAMER_START_BYTE);
48-
size_t counter = length;
49-
while (counter > 0U)
57+
while (length--)
5058
{
5159
DataStreamer_VariableWrite(*dp++);
52-
counter--;
5360
}
5461
DataStreamer_VariableWrite(DATA_STREAMER_END_BYTE);
55-
while (DataStreamer_IsTxDone() == false)
56-
{
57-
}
62+
while (!(DS_UART->IsTxDone()));
5863
};
5964

6065
void DataStreamer_PackageSet(void * customStructHandler, size_t customlength)

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/mcc_generated_files/examples/I2C-Host-Example/i2c_host_example.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
3838
#include "mcc_generated_files/system/system.h"
3939
40+
4041
// Note: VCNL4200 - High Sensitivity Long Distance Proximity and Ambient Light Sensor With I2C Interface
4142
// Reference to the VCNL4200 data sheet: https://www.vishay.com/docs/84430/vcnl4200.pdf
4243
// The VCNL4200 command codes are located in Table 1 (page 9) of the VCNL4200 data sheet
@@ -47,8 +48,10 @@ uint8_t VCNL4200_Initialize(void);
4748
uint8_t VCNL4200_ProximityRead(uint16_t* proximityValue);
4849
void Timer_Callback_100ms(void);
4950
50-
// TODO: Replace TimerX with name of const struct TIMER_INTERFACE, from MCC Generated Files > timer > {timer_header}X
51-
static const struct TIMER_INTERFACE *Timer = &TimerX; // TODO: Replace TimerX with the timer instance number
51+
// TODO: Replace TimerX with number of Timer chosen as dependency.
52+
// Matches name of const struct TIMER_INTERFACE, from MCC Generated Files > timer > tmrx.c
53+
static const struct TIMER_INTERFACE *Timer = &TimerX;
54+
5255
static volatile bool SEND_FRAME = false; // volatile because this variable is used inside & outside the ISR.
5356
static uint16_t proximityValue; // VCNL4200 sensor result
5457
static volatile uint8_t frameCount;

pic18f57q43-i2c-proximity-sensor-callbacks-data-streamer/nbproject/configurations.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<logicalFolder name="data_streamer"
1111
displayName="data_streamer"
1212
projectFiles="true">
13-
<itemPath>mcc_generated_files/data_streamer/data_streamer_comms.h</itemPath>
1413
<itemPath>mcc_generated_files/data_streamer/data_streamer.h</itemPath>
1514
</logicalFolder>
1615
<logicalFolder name="i2c_host" displayName="i2c_host" projectFiles="true">
@@ -58,7 +57,6 @@
5857
projectFiles="true">
5958
<logicalFolder name="src" displayName="src" projectFiles="true">
6059
<itemPath>mcc_generated_files/data_streamer/src/data_streamer.c</itemPath>
61-
<itemPath>mcc_generated_files/data_streamer/src/data_streamer_comms.c</itemPath>
6260
</logicalFolder>
6361
<itemPath>mcc_generated_files/data_streamer/data_streamer.ds</itemPath>
6462
</logicalFolder>

0 commit comments

Comments
 (0)