API for configuring and manipulating Brushless 8 Click driver.
More...
|
void | brushless8_cfg_setup (brushless8_cfg_t *cfg) |
| Brushless 8 configuration object setup function.
|
|
BRUSHLESS8_RETVAL | brushless8_init (brushless8_t *ctx, brushless8_cfg_t *cfg) |
| Brushless 8 initialization function.
|
|
BRUSHLESS8_RETVAL | brushless8_default_cfg (brushless8_t *ctx) |
| Brushless 8 default configuration function.
|
|
void | brushless8_dac_write_data (brushless8_t *ctx, uint8_t reg, uint16_t write_data) |
| Brushless 8 I2C write function.
|
|
uint16_t | brushless8_dac_read_data (brushless8_t *ctx, uint8_t reg) |
| Brushless 8 I2C read function.
|
|
uint8_t | brushless8_get_fg (brushless8_t *ctx) |
| Brushless 8 fg state.
|
|
void | brushless8_set_direction (brushless8_t *ctx, uint8_t status) |
| Brushless 8 dir pin setting.
|
|
void | brushless8_set_reset (brushless8_t *ctx, uint8_t status) |
| Brushless 8 rst pin setting.
|
|
int8_t | brushless8_set_dac_vout (brushless8_t *ctx, uint8_t dac_chn, uint16_t vout) |
| Brushless 8 I2C function for setting vout.
|
|
void | brushless8_set_duty_cycle (brushless8_t *ctx, float duty_cycle) |
| Sets PWM duty cycle.
|
|
void | brushless8_pwm_stop (brushless8_t *ctx) |
| Stops PWM module.
|
|
void | brushless8_pwm_start (brushless8_t *ctx) |
| Starts PWM module.
|
|
BRUSHLESS8_RETVAL | brushless8_read_adc (brushless8_t *ctx, uint16_t *data_out) |
| ADC read function.
|
|
BRUSHLESS8_RETVAL | brushless8_read_an_voltage (brushless8_t *ctx, float *data_out) |
| AN voltage read function.
|
|
API for configuring and manipulating Brushless 8 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
◆ brushless8_cfg_setup()
Brushless 8 configuration object setup function.
This function initializes click configuration structure to initial values.
- Parameters
-
[out] | cfg | Click configuration structure. See brushless8_cfg_t object definition for detailed explanation. |
Default values:
Function | Default value |
SCL pin | HAL_PIN_NC (invalid pin) |
SDA pin | HAL_PIN_NC (invalid pin) |
DIR pin | HAL_PIN_NC (invalid pin) |
AN pin | HAL_PIN_NC (invalid pin) |
RST pin | HAL_PIN_NC (invalid pin) |
PWM pin | HAL_PIN_NC (invalid pin) |
FG pin | HAL_PIN_NC (invalid pin) |
I2C baud rate | 100000bps |
I2C slave address | 0x47 |
PWM frequency | 18kHz |
ADC resolution | 12-bit |
ADC vref | 2.5V |
Default mode | BRUSHLESS8_PWM |
- Returns
- Nothing.
- Note
- All used pins will be set to default state – NOT CONNECTED.
◆ brushless8_dac_read_data()
uint16_t brushless8_dac_read_data |
( |
brushless8_t * | ctx, |
|
|
uint8_t | reg ) |
Brushless 8 I2C read function.
This function reads 16 bits of data from the selected register by using I2C serial interface.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | reg | Start register address. |
- Returns
- Output read data.
See #err_t definition for detailed explanation.
- Note
- None.
◆ brushless8_dac_write_data()
void brushless8_dac_write_data |
( |
brushless8_t * | ctx, |
|
|
uint8_t | reg, |
|
|
uint16_t | write_data ) |
Brushless 8 I2C write function.
This function writes 16 bits of data from the selected register by using I2C serial interface.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | reg | Start register address. |
[in] | write_data | Data to be written. |
See #err_t definition for detailed explanation.
- Note
- None.
◆ brushless8_default_cfg()
Brushless 8 default configuration function.
This function executes a default configuration of Brushless 8 click board.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
- Returns
-
See #err_t definition for detailed explanation.
- Note
- This function can consist of any necessary configuration or setting to set device into operating mode.
◆ brushless8_get_fg()
Brushless 8 fg state.
This function reads fg pin input state.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
- Returns
0
- logical state low,
1
- logical state high.
- Note
- None.
◆ brushless8_init()
Brushless 8 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
- Parameters
-
[out] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | cfg | Click configuration structure. See brushless8_cfg_t object definition for detailed explanation. |
- Returns
-
See #err_t definition for detailed explanation.
- Note
- None.
◆ brushless8_pwm_start()
Starts PWM module.
- Parameters
-
ctx | Click object. @description This function starts the PWM module. |
◆ brushless8_pwm_stop()
Stops PWM module.
- Parameters
-
ctx | Click object. @description This function stops the PWM module. |
◆ brushless8_read_adc()
ADC read function.
- Parameters
-
[in] | ctx | Click object. |
[out] | data_out | Buffer where read data is to be placed. |
- Returns
0
- Ok,
-1
- Error. @description This function reads the ADC converted data.
◆ brushless8_read_an_voltage()
AN voltage read function.
- Parameters
-
ctx | Click object. |
data_out | Buffer where read data is to be placed. |
- Returns
0
- Ok,
-1
- Error. @description This function reads and calculates the voltage level of the AN pin.
◆ brushless8_set_dac_vout()
int8_t brushless8_set_dac_vout |
( |
brushless8_t * | ctx, |
|
|
uint8_t | dac_chn, |
|
|
uint16_t | vout ) |
Brushless 8 I2C function for setting vout.
This function writes adequate vout value to appropriate dac_chn channel.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | dac_chn | Adequate channel. |
[in] | vout | Output voltage. |
- Returns
- Function returns BRUSHLESS8_OK.
- Note
- None.
◆ brushless8_set_direction()
void brushless8_set_direction |
( |
brushless8_t * | ctx, |
|
|
uint8_t | status ) |
Brushless 8 dir pin setting.
This function sets dir pin output to status setting.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | status | Output value setting.
0 - digital out high,
1 - digital out low.
|
- Note
- None.
◆ brushless8_set_duty_cycle()
void brushless8_set_duty_cycle |
( |
brushless8_t * | ctx, |
|
|
float | duty_cycle ) |
Sets PWM duty cycle.
- Parameters
-
ctx | Click object. |
duty_cycle | PWM Duty cycle value. @description This function sets the PWM duty cycle value to duty_cycle. |
◆ brushless8_set_reset()
void brushless8_set_reset |
( |
brushless8_t * | ctx, |
|
|
uint8_t | status ) |
Brushless 8 rst pin setting.
This function sets rst pin output to status setting.
- Parameters
-
[in] | ctx | Click context object. See brushless8_t object definition for detailed explanation. |
[in] | status | Output value setting.
0 - digital out high,
1 - digital out low.
|
- Note
- None.