HPM SDK
HPMicro Software Development Kit
hpm_mcl_drivers.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef HPM_MCL_DRIVERS_H
8 #define HPM_MCL_DRIVERS_H
9 #include "hpm_mcl_common.h"
10 
11 enum {
15 };
16 
21 typedef enum {
27 
32 typedef enum {
58 
60 
65 typedef struct {
66  void (*init)(void);
67  hpm_mcl_stat_t (*update_duty_cycle)(mcl_drivers_channel_t chn, float duty);
68  _FUNC_OPTIONAL_ hpm_mcl_stat_t (*update_frequency)(mcl_drivers_channel_t chn, uint32_t freqc);
69  _FUNC_OPTIONAL_ hpm_mcl_stat_t (*update_phase_offset)(mcl_drivers_channel_t chn, int32_t tick);
70  hpm_mcl_stat_t (*disable_all_drivers)(void);
71  hpm_mcl_stat_t (*enable_all_drivers)(void);
72  hpm_mcl_stat_t (*disable_drivers)(mcl_drivers_channel_t chn);
73  hpm_mcl_stat_t (*enable_drivers)(mcl_drivers_channel_t chn);
75 
80 typedef struct {
83 
88 typedef struct {
92 
93 #ifdef __cplusplus
94 extern "C" {
95 #endif
96 
105 
115 hpm_mcl_stat_t hpm_mcl_drivers_update_bldc_duty(mcl_drivers_t *drivers, float duty_a, float duty_b, float duty_c);
116 
127 hpm_mcl_stat_t hpm_mcl_drivers_update_step_duty(mcl_drivers_t *drivers, float duty_a0, float duty_a1, float duty_b0, float duty_b1);
128 
136 
144 
153 
162 
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif
static void init(hpm_panel_t *panel)
Definition: cc10128007.c:86
#define MAKE_STATUS(group, code)
Definition: hpm_common.h:135
@ mcl_group_drivers
Definition: hpm_mcl_common.h:22
uint32_t hpm_mcl_stat_t
Definition: hpm_mcl_common.h:15
mcl_drivers_channel_t
Channels for drive functions.
Definition: hpm_mcl_drivers.h:32
@ mcl_drivers_chn_a0
Four channels of the stepper motor.
Definition: hpm_mcl_drivers.h:44
@ mcl_drivers_chn_al
Definition: hpm_mcl_drivers.h:53
@ mcl_drivers_chn_bl
Definition: hpm_mcl_drivers.h:55
@ mcl_drivers_chn_bh
Definition: hpm_mcl_drivers.h:54
@ mcl_drivers_chn_ch
Definition: hpm_mcl_drivers.h:56
@ mcl_drivers_chn_a1
Definition: hpm_mcl_drivers.h:45
@ mcl_drivers_chn_cl
Definition: hpm_mcl_drivers.h:57
@ mcl_drivers_chn_ah
Drive channels for three-phase motors no pair.
Definition: hpm_mcl_drivers.h:52
@ mcl_drivers_chn_b0
Definition: hpm_mcl_drivers.h:46
@ mcl_drivers_chn_c
Definition: hpm_mcl_drivers.h:39
@ mcl_drivers_chn_a
Drive channels for three-phase motors in pair.
Definition: hpm_mcl_drivers.h:37
@ mcl_drivers_chn_b
Definition: hpm_mcl_drivers.h:38
@ mcl_drivers_chn_b1
Definition: hpm_mcl_drivers.h:47
hpm_mcl_stat_t hpm_mcl_drivers_block_update(mcl_drivers_t *drivers, mcl_motor_dir_t dir, uint8_t sector)
Block mode updates the outputs of the driver peripherals.
Definition: hpm_mcl_drivers.c:92
@ mcl_drivers_update_error
Definition: hpm_mcl_drivers.h:14
@ mcl_drivers_not_ready
Definition: hpm_mcl_drivers.h:13
@ mcl_drivers_init_error
Definition: hpm_mcl_drivers.h:12
mcl_drivers_status_t
Status of the drive function.
Definition: hpm_mcl_drivers.h:21
@ drivers_status_run
Definition: hpm_mcl_drivers.h:24
@ drivers_status_null
Definition: hpm_mcl_drivers.h:22
@ drivers_status_fail
Definition: hpm_mcl_drivers.h:25
@ drivers_status_init
Definition: hpm_mcl_drivers.h:23
hpm_mcl_stat_t hpm_mcl_disable_all_drivers(mcl_drivers_t *drivers)
Switch off all drive outputs.
Definition: hpm_mcl_drivers.c:56
hpm_mcl_stat_t hpm_mcl_enable_drivers(mcl_drivers_t *drivers, mcl_drivers_channel_t chn)
Starts the output of the specified channel of the driver.
Definition: hpm_mcl_drivers.c:83
hpm_mcl_stat_t hpm_mcl_drivers_init(mcl_drivers_t *drivers, mcl_drivers_cfg_t *cfg)
Initialising data for driver functions.
Definition: hpm_mcl_drivers.c:10
hpm_mcl_stat_t hpm_mcl_disable_drivers(mcl_drivers_t *drivers, mcl_drivers_channel_t chn)
Turns off the output of the specified channel of the driver.
Definition: hpm_mcl_drivers.c:74
hpm_mcl_stat_t hpm_mcl_drivers_update_step_duty(mcl_drivers_t *drivers, float duty_a0, float duty_a1, float duty_b0, float duty_b1)
Update the duty cycle of a step motor.
Definition: hpm_mcl_drivers.c:38
hpm_mcl_stat_t hpm_mcl_drivers_update_bldc_duty(mcl_drivers_t *drivers, float duty_a, float duty_b, float duty_c)
Update the duty cycle of a brushless motor.
Definition: hpm_mcl_drivers.c:23
hpm_mcl_stat_t hpm_mcl_enable_all_drivers(mcl_drivers_t *drivers)
Enable all drive outputs.
Definition: hpm_mcl_drivers.c:65
mcl_motor_dir_t
Definition: hpm_mcl_physical.h:23
Callbacks for Driver Functions.
Definition: hpm_mcl_drivers.h:65
Driver Function Configuration.
Definition: hpm_mcl_drivers.h:80
mcl_drivers_callback_t callback
Definition: hpm_mcl_drivers.h:81
Driver function running data.
Definition: hpm_mcl_drivers.h:88
mcl_drivers_cfg_t * cfg
Definition: hpm_mcl_drivers.h:89
mcl_drivers_status_t status
Definition: hpm_mcl_drivers.h:90