pwm 2.0.0.0
pwm.h File Reference

This file contains API for PWM Click driver. More...

#include "drv_digital_out.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  pwm_t
 Click ctx object definition. More...
 
struct  pwm_cfg_t
 Click configuration structure definition. More...
 

Macros

#define PWM_MAP_MIKROBUS(cfg, mikrobus)
 
#define PWM_MAX_RESOLUTION   4096
 
#define PWM_RETVAL   uint8_t
 
#define PWM_OK   0x00
 
#define PWM_INIT_ERROR   0xFF
 
#define PWM_DISABLE   0x00
 
#define PWM_ENABLE   0x01
 
#define PWM_RESTART   0x80
 
#define PWM_EXTCLK   0x40
 
#define PWM_AI   0x20
 
#define PWM_SLEEP   0x10
 
#define PWM_SUB_1   0x08
 
#define PWM_SUB_2   0x04
 
#define PWM_SUB_3   0x02
 
#define PWM_ALL_CALL   0x01
 
#define PWM_INVRT   0x10
 
#define PWM_OCH   0x08
 
#define PWM_OUTDRV   0x04
 
#define PWM_OUTNE1   0x02
 
#define PWM_OUTNE0   0x01
 
#define PWM_I2C_ADDRESS   0x40
 
#define PWM_MODE1_REG   0x00
 
#define PWM_MODE2_REG   0x01
 
#define PWM_PRE_SCALE   0xFE
 
#define PWM_TEST   0xFF
 
#define PWM_CH0_ON_L   0x06
 
#define PWM_CH0_ON_H   0x07
 
#define PWM_CH0_OFF_L   0x08
 
#define PWM_CH0_OFF_H   0x09
 
#define PWM_CH1_ON_L   0x0A
 
#define PWM_CH1_ON_H   0x0B
 
#define PWM_CH1_OFF_L   0x0C
 
#define PWM_CH1_OFF_H   0x0D
 
#define PWM_CH2_ON_L   0x0E
 
#define PWM_CH2_ON_H   0x0F
 
#define PWM_CH2_OFF_L   0x10
 
#define PWM_CH2_OFF_H   0x11
 
#define PWM_CH3_ON_L   0x12
 
#define PWM_CH3_ON_H   0x13
 
#define PWM_CH3_OFF_L   0x14
 
#define PWM_CH3_OFF_H   0x15
 
#define PWM_CH4_ON_L   0x16
 
#define PWM_CH4_ON_H   0x17
 
#define PWM_CH4_OFF_L   0x18
 
#define PWM_CH4_OFF_H   0x19
 
#define PWM_CH5_ON_L   0x1A
 
#define PWM_CH5_ON_H   0x1B
 
#define PWM_CH5_OFF_L   0x1C
 
#define PWM_CH5_OFF_H   0x1D
 
#define PWM_CH6_ON_L   0x1E
 
#define PWM_CH6_ON_H   0x1F
 
#define PWM_CH6_OFF_L   0x20
 
#define PWM_CH6_OFF_H   0x21
 
#define PWM_CH7_ON_L   0x22
 
#define PWM_CH7_ON_H   0x23
 
#define PWM_CH7_OFF_L   0x24
 
#define PWM_CH7_OFF_H   0x25
 
#define PWM_CH8_ON_L   0x26
 
#define PWM_CH8_ON_H   0x27
 
#define PWM_CH8_OFF_L   0x28
 
#define PWM_CH8_OFF_H   0x29
 
#define PWM_CH9_ON_L   0x2A
 
#define PWM_CH9_ON_H   0x2B
 
#define PWM_CH9_OFF_L   0x2C
 
#define PWM_CH9_OFF_H   0x2D
 
#define PWM_CH10_ON_L   0x2E
 
#define PWM_CH10_ON_H   0x2F
 
#define PWM_CH10_OFF_L   0x30
 
#define PWM_CH10_OFF_H   0x31
 
#define PWM_CH11_ON_L   0x32
 
#define PWM_CH11_ON_H   0x33
 
#define PWM_CH11_OFF_L   0x34
 
#define PWM_CH11_OFF_H   0x35
 
#define PWM_CH12_ON_L   0x36
 
#define PWM_CH12_ON_H   0x37
 
#define PWM_CH12_OFF_L   0x38
 
#define PWM_CH12_OFF_H   0x39
 
#define PWM_CH13_ON_L   0x3A
 
#define PWM_CH13_ON_H   0x3B
 
#define PWM_CH13_OFF_L   0x3C
 
#define PWM_CH13_OFF_H   0x3D
 
#define PWM_CH14_ON_L   0x3E
 
#define PWM_CH14_ON_H   0x3F
 
#define PWM_CH14_OFF_L   0x40
 
#define PWM_CH14_OFF_H   0x41
 
#define PWM_CH15_ON_L   0x42
 
#define PWM_CH15_ON_H   0x43
 
#define PWM_CH15_OFF_L   0x44
 
#define PWM_CH15_OFF_H   0x45
 
#define PWM_ALL_CH_ON_L   0xFA
 
#define PWM_ALL_CH_ON_H   0xFB
 
#define PWM_ALL_CH_OFF_L   0xFC
 
#define PWM_ALL_CH_OFF_H   0xFD
 

Functions

void pwm_cfg_setup (pwm_cfg_t *cfg)
 Config Object Initialization function.
 
PWM_RETVAL pwm_init (pwm_t *ctx, pwm_cfg_t *cfg)
 Initialization function.
 
void pwm_generic_write (pwm_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pwm_generic_read (pwm_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void pwm_set_output (pwm_t *ctx, uint8_t en_ou)
 Output state set function.
 
void pwm_dev_config (pwm_t *ctx, uint8_t *config)
 Device configuration function.
 
void pwm_output_config (pwm_t *ctx, uint8_t *config1)
 Output configuration function.
 
void pwm_channel_state (pwm_t *ctx, uint8_t chann_id, uint8_t state)
 Channel state function.
 
void pwm_set_channel_raw (pwm_t *ctx, uint8_t chann_id, uint16_t raw_off_set, uint16_t raw_dc)
 Set channel raw function.
 
void pwm_all_chann_state (pwm_t *ctx, uint8_t state)
 All channels state function.
 
void pwm_set_pre_scale (pwm_t *ctx, uint8_t pre_scale)
 Set pre scale function.
 
void pwm_set_all_raw (pwm_t *ctx, uint16_t raw_dc)
 Set all channels raw function.
 

Detailed Description

This file contains API for PWM Click driver.