初始化仓库
This commit is contained in:
40
Header/PCA9685_driver.h
Normal file
40
Header/PCA9685_driver.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef __PCA9685_DRIVER_H__
|
||||
#define __PCA9685_DRIVER_H__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define PCA9685_I2C_ADDR 0x40 // PCA9685 I2C地址
|
||||
|
||||
#define PCA9685_USE_SOFT_IIC 1 // 使用软件IIC
|
||||
|
||||
#if PCA9685_USE_SOFT_IIC == 1
|
||||
|
||||
#define PCA9685_SOFT_IIC_SCL_PIN P1_5
|
||||
#define PCA9685_SOFT_IIC_SDA_PIN P1_4
|
||||
|
||||
#else
|
||||
|
||||
#define PCA9685_I2C_SCL_PIN IIC1_SCL_P15
|
||||
#define PCA9685_I2C_SDA_PIN IIC1_SDA_P14
|
||||
|
||||
#endif
|
||||
|
||||
#define PCA9685_MODE1 0x00
|
||||
#define PCA9685_PRESCALE 0xFE
|
||||
#define PCA9685_LED0_ON_L 0x06
|
||||
#define PCA9685_LED0_ON_H 0x07
|
||||
#define PCA9685_LED0_OFF_L 0x08
|
||||
#define PCA9685_LED0_OFF_H 0x09
|
||||
#define PCA9685_ALL_LED_ON_L 0xFA
|
||||
#define PCA9685_ALL_LED_ON_H 0xFB
|
||||
#define PCA9685_ALL_LED_OFF_L 0xFC
|
||||
#define PCA9685_ALL_LED_OFF_H 0xFD
|
||||
|
||||
#define PCA9685_DEF_FREQ 50 // 默认频率为50Hz
|
||||
|
||||
void pca9685_init();
|
||||
void pca9685_deinit();
|
||||
void pca9685_set_frequency(uint16 frequency);
|
||||
void pca9685_set_pwm(uint8 channel, uint16 on, uint16 off);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user