- How do I utilize
mcu_card.h
header from Board Support Package?
/* Project name:
* How do I utilize `mcu_card.h` header from Board Support Package?
* Copyright:
* (c) MIKROE, 2024.
* Description:
* - Example is meant for demonstrating Board Support Package
* functionality using mikroSDK 2.0.
* Library dependencies?
* - Make sure `Driver.GPIO.Out` and `Board` libraries are enabled
* NECTO's Library Manager to ensure a successful build.
* How to test this code example?
* - Navigate to NECTO's [Planet Debug](https://www.mikroe.com/planet-debug)
* feature, connect to a development board, flash the code,
* and freely test all the other preprocessor directives from
* `mcu_card.h` header file.
*/
// ------------------------------------------------------------------ INCLUDES
#include "mcu_card.h"
#include "drv_digital_out.h"
#include "delays.h"
int main(void)
{
// Initialize the LED pin as a digital output
digital_out_t led;
// Utilize preprocessor directive from `mcu_card.h`
digital_out_init( &led, LEFT_CN_PIN_001 ); // Left connector pin number 1
// Main loop: toggle LED state
while (1)
{
// Turn the LED on
digital_out_high( &led );
Delay_ms(500); // Wait for 500 milliseconds
// Turn the LED off
digital_out_low( &led );
Delay_ms(500); // Wait for 500 milliseconds
}
return 0;
}
- How do I perform LED blink with MCU's pin name with the help of Board Support Package?
/* Project name:
* How do I perform LED blink with MCU's pin name?
* Copyright:
* (c) MIKROE, 2024.
* Description:
* - Example is meant for demonstrating Board Support Package
* functionality using mikroSDK 2.0.
* Library dependencies?
* - Make sure `Driver.GPIO.Out` and `Board` libraries are enabled
* NECTO's Library Manager to ensure a successful build.
* How to test this code example?
* - Navigate to NECTO's [Planet Debug](https://www.mikroe.com/planet-debug)
* feature, connect to a development board, flash the code,
* and freely test all the other preprocessor directives from
* `mcu_card.h` header file.
*/
// ------------------------------------------------------------------ INCLUDES
#include "mcu_card.h"
#include "drv_digital_out.h"
#include "delays.h"
int main(void)
{
// Initialize the LED pin as a digital output
digital_out_t led;
// Utilize preprocessor directive from `mcu_card.h`
digital_out_init( &led, PA0 ); // pin PA0 on a microcontroller
// Main loop: toggle LED state
while (1)
{
// Turn the LED on
digital_out_high( &led );
Delay_ms(500); // Wait for 500 milliseconds
// Turn the LED off
digital_out_low( &led );
Delay_ms(500); // Wait for 500 milliseconds
}
return 0;
}