H BRIDGE 2 Click
H-Bridge 2 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : MikroE Team
- Date : Dec 2019.
- Type : GPIO type
Software Support
Example Description
This application controls the speed and direction of motor.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.HBridge2
Example Key Functions
- hbridge2_cfg_setup Config Object Initialization function.
void hbridge2_cfg_setup(hbridge2_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition hbridge2.h:125
- hbridge2_init Initialization function.
HBRIDGE2_RETVAL hbridge2_init(hbridge2_t *ctx, hbridge2_cfg_t *cfg)
Initialization function.
Click ctx object definition.
Definition hbridge2.h:109
- hbridge2_set_output Output Set function.
uint8_t hbridge2_set_output(hbridge2_t *ctx, uint8_t out_state)
Output Set function.
- hbridge2_enable Enable function.
void hbridge2_enable(hbridge2_t *ctx, uint8_t state)
Enable function.
- hbridge2_set_gout GOUT Set function.
void hbridge2_set_gout(hbridge2_t *ctx, uint8_t state)
GOUT Set function.
Application Init
Initializes GPIO driver and puts the device to enable state, and the GPIO pin to logic high state.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info(&logger, "---- Application Init ----");
log_printf( &logger, "H-Bridge 2 is intialized\r\n" );
Delay_ms ( 200 );
}
#define HBRIDGE2_MAP_MIKROBUS(cfg, mikrobus)
Definition hbridge2.h:65
#define HBRIDGE2_ENABLE
Definition hbridge2.h:92
#define HBRIDGE2_GOUT_HIGH
Definition hbridge2.h:94
void application_init(void)
Definition main.c:32
Application Task
Demonstrates the control of output pins by put output pins to different states. The outputs be changed after every 3 seconds.
{
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
#define HBRIDGE2_OUT1_L_OUT2_H
Definition hbridge2.h:88
#define HBRIDGE2_OUT1_Z_OUT2_Z
Definition hbridge2.h:89
#define HBRIDGE2_OUT1_H_OUT2_L
Definition hbridge2.h:87
void application_task(void)
Definition main.c:62
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.