Compare commits
10 Commits
fbed8b272e
...
ff88b5a3fe
| Author | SHA1 | Date | |
|---|---|---|---|
| ff88b5a3fe | |||
| 170807fcc8 | |||
| 0a1608ccfa | |||
| 2b3e70f0e9 | |||
| 36ca756209 | |||
| c5edd57aa8 | |||
| a9b0fe1a18 | |||
| 02588f6411 | |||
| ca28f41448 | |||
| 75b9cc4a8f |
@@ -3,8 +3,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
|
|
||||||
#define BUZZER_QUEUE_LENGTH 40
|
#define BUZZER_TIME (100) // 蜂鸣器音节长度
|
||||||
|
#define BUZZER_QUEUE_LENGTH (40)
|
||||||
|
|
||||||
|
uint32_t time_out = 0;
|
||||||
uint16_t queue_long = 0;
|
uint16_t queue_long = 0;
|
||||||
uint32_t a[40] = {0};
|
uint32_t a[40] = {0};
|
||||||
|
|
||||||
@@ -23,7 +25,7 @@ void queue_add_element(int element)
|
|||||||
}
|
}
|
||||||
void queue_pop_element(void)
|
void queue_pop_element(void)
|
||||||
{
|
{
|
||||||
memmove(a, &a[1], (queue_long - 1) * sizeof(a[0]));
|
memmove(a, &a[1], (queue_long - 1) * sizeof(a[0])); // FIXME 强迫症震怒,仅移动,未清除原位置上的值
|
||||||
if (queue_long > 0) {
|
if (queue_long > 0) {
|
||||||
queue_long--;
|
queue_long--;
|
||||||
}
|
}
|
||||||
@@ -51,6 +53,7 @@ void by_buzzer_init(void)
|
|||||||
by_buzzer_add(1500);
|
by_buzzer_add(1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 异步写入问题,不可重入
|
||||||
void by_buzzer_add(uint16_t tone)
|
void by_buzzer_add(uint16_t tone)
|
||||||
{
|
{
|
||||||
queue_add_element(tone);
|
queue_add_element(tone);
|
||||||
@@ -58,10 +61,19 @@ void by_buzzer_add(uint16_t tone)
|
|||||||
|
|
||||||
void by_buzzer_run(void)
|
void by_buzzer_run(void)
|
||||||
{
|
{
|
||||||
if (queue_long != 0) {
|
if (queue_long > 0) {
|
||||||
|
|
||||||
|
if (0 == time_out) {
|
||||||
pwm_init(BUZZER_PIN, a[0], 5000);
|
pwm_init(BUZZER_PIN, a[0], 5000);
|
||||||
queue_pop_element();
|
queue_pop_element();
|
||||||
system_delay_ms(100);
|
time_out = BUZZER_TIME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (0 == time_out)
|
||||||
pwm_set_duty(BUZZER_PIN, 0);
|
pwm_set_duty(BUZZER_PIN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (time_out) {
|
||||||
|
time_out--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,25 +3,39 @@
|
|||||||
#include "zf_common_headfile.h"
|
#include "zf_common_headfile.h"
|
||||||
#include "jj_blueteeth.h"
|
#include "jj_blueteeth.h"
|
||||||
|
|
||||||
#define FAN_LL_PWM_PIN TIM8_PWM_MAP0_CH1_C6 // 左升力风扇
|
#define FAN_LL_PWM_PIN TIM8_PWM_MAP1_CH1_B6 // 左升力风扇
|
||||||
#define FAN_RL_PWM_PIN TIM8_PWM_MAP0_CH2_C7 // 右升力风扇
|
#define FAN_RL_PWM_PIN TIM8_PWM_MAP1_CH2_B7 // 右升力风扇
|
||||||
#define FAN_LS_PWM_PIN TIM4_PWM_MAP1_CH4_D15 // 左侧动力风扇
|
// M4
|
||||||
#define FAN_RS_PWM_PIN TIM4_PWM_MAP1_CH3_D14 // 右侧动力风扇
|
#define FAN_LS_PWM_A_PIN TIM10_PWM_MAP3_CH1_D1 // 左侧动力风扇
|
||||||
#define FAN_LB_PWM_PIN TIM4_PWM_MAP1_CH2_D13 // 左后动力风扇
|
#define FAN_LS_PWM_B_PIN TIM10_PWM_MAP3_CH2_D3 // 左侧动力风扇
|
||||||
#define FAN_RB_PWM_PIN TIM4_PWM_MAP1_CH1_D12 // 右后动力风扇
|
// M1
|
||||||
|
#define FAN_RS_PWM_A_PIN TIM4_PWM_MAP1_CH1_D12 // 右侧动力风扇
|
||||||
|
#define FAN_RS_PWM_B_PIN TIM4_PWM_MAP1_CH2_D13 // 右侧动力风扇
|
||||||
|
// M3
|
||||||
|
#define FAN_LB_PWM_A_PIN TIM10_PWM_MAP3_CH3_D5 // 左后动力风扇
|
||||||
|
#define FAN_LB_PWM_B_PIN TIM10_PWM_MAP3_CH4_D7 // 左后动力风扇
|
||||||
|
// M2
|
||||||
|
#define FAN_RB_PWM_A_PIN TIM4_PWM_MAP1_CH3_D14 // 右后动力风扇
|
||||||
|
#define FAN_RB_PWM_B_PIN TIM4_PWM_MAP1_CH4_D15 // 右后动力风扇
|
||||||
|
|
||||||
uint32_t pwm_duty_ls_g;
|
int32_t pwm_duty_ls_g;
|
||||||
uint32_t pwm_duty_rs_g;
|
int32_t pwm_duty_rs_g;
|
||||||
uint32_t pwm_duty_lb_g;
|
int32_t pwm_duty_lb_g;
|
||||||
uint32_t pwm_duty_rb_g;
|
int32_t pwm_duty_rb_g;
|
||||||
|
|
||||||
static uint32_t myclip(uint32_t x, uint32_t low, uint32_t up)
|
inline static uint32_t clip_u32(uint32_t x, uint32_t low, uint32_t up)
|
||||||
{
|
{
|
||||||
return (x > up ? up : x < low ? low
|
return (x > up ? up : x < low ? low
|
||||||
: x);
|
: x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float myclip_f(float x, float low, float up)
|
inline static int32_t clip_s32(int32_t x, int32_t low, int32_t up)
|
||||||
|
{
|
||||||
|
return (x > up ? up : x < low ? low
|
||||||
|
: x);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static float clip_f32(float x, float low, float up)
|
||||||
{
|
{
|
||||||
return (x > up ? up : x < low ? low
|
return (x > up ? up : x < low ? low
|
||||||
: x);
|
: x);
|
||||||
@@ -32,10 +46,43 @@ void by_pwm_init(void)
|
|||||||
pwm_init(FAN_LL_PWM_PIN, 50, 500);
|
pwm_init(FAN_LL_PWM_PIN, 50, 500);
|
||||||
pwm_init(FAN_RL_PWM_PIN, 50, 500);
|
pwm_init(FAN_RL_PWM_PIN, 50, 500);
|
||||||
|
|
||||||
pwm_init(FAN_LS_PWM_PIN, 4000, 0);
|
// 测试鸣叫
|
||||||
pwm_init(FAN_RS_PWM_PIN, 4000, 0);
|
pwm_init(FAN_LS_PWM_A_PIN, 1500, 100);
|
||||||
pwm_init(FAN_LB_PWM_PIN, 4000, 0);
|
pwm_init(FAN_LS_PWM_B_PIN, 4000, 0);
|
||||||
pwm_init(FAN_RB_PWM_PIN, 4000, 0);
|
pwm_init(FAN_RS_PWM_A_PIN, 1500, 100);
|
||||||
|
pwm_init(FAN_RS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LB_PWM_A_PIN, 1500, 100);
|
||||||
|
pwm_init(FAN_LB_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RB_PWM_A_PIN, 1500, 100);
|
||||||
|
pwm_init(FAN_RB_PWM_B_PIN, 4000, 0);
|
||||||
|
system_delay_ms(300);
|
||||||
|
pwm_init(FAN_LS_PWM_A_PIN, 2000, 100);
|
||||||
|
pwm_init(FAN_LS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RS_PWM_A_PIN, 2000, 100);
|
||||||
|
pwm_init(FAN_RS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LB_PWM_A_PIN, 2000, 100);
|
||||||
|
pwm_init(FAN_LB_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RB_PWM_A_PIN, 2000, 100);
|
||||||
|
pwm_init(FAN_RB_PWM_B_PIN, 4000, 0);
|
||||||
|
system_delay_ms(300);
|
||||||
|
pwm_init(FAN_LS_PWM_A_PIN, 2500, 100);
|
||||||
|
pwm_init(FAN_LS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RS_PWM_A_PIN, 2500, 100);
|
||||||
|
pwm_init(FAN_RS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LB_PWM_A_PIN, 2500, 100);
|
||||||
|
pwm_init(FAN_LB_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RB_PWM_A_PIN, 2500, 100);
|
||||||
|
pwm_init(FAN_RB_PWM_B_PIN, 4000, 0);
|
||||||
|
system_delay_ms(300);
|
||||||
|
|
||||||
|
pwm_init(FAN_LS_PWM_A_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RS_PWM_A_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RS_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LB_PWM_A_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_LB_PWM_B_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RB_PWM_A_PIN, 4000, 0);
|
||||||
|
pwm_init(FAN_RB_PWM_B_PIN, 4000, 0);
|
||||||
// system_delay_ms(3000);
|
// system_delay_ms(3000);
|
||||||
// // pwm_init(FAN_LS_PWM_PIN, 50, 1000); // 动力风扇左 1
|
// // pwm_init(FAN_LS_PWM_PIN, 50, 1000); // 动力风扇左 1
|
||||||
// // pwm_init(FAN_RS_PWM_PIN, 50, 1000); // 动力风扇右 1
|
// // pwm_init(FAN_RS_PWM_PIN, 50, 1000); // 动力风扇右 1
|
||||||
@@ -57,8 +104,8 @@ void by_pwm_init(void)
|
|||||||
*/
|
*/
|
||||||
void by_pwm_update_duty(uint32_t update_pwm_duty1, uint32_t update_pwm_duty2)
|
void by_pwm_update_duty(uint32_t update_pwm_duty1, uint32_t update_pwm_duty2)
|
||||||
{
|
{
|
||||||
update_pwm_duty1 = myclip(update_pwm_duty1, 500, 1000);
|
update_pwm_duty1 = clip_u32(update_pwm_duty1, 500, 1000);
|
||||||
update_pwm_duty2 = myclip(update_pwm_duty2, 500, 1000);
|
update_pwm_duty2 = clip_u32(update_pwm_duty2, 500, 1000);
|
||||||
pwm_set_duty(FAN_LL_PWM_PIN, update_pwm_duty1);
|
pwm_set_duty(FAN_LL_PWM_PIN, update_pwm_duty1);
|
||||||
pwm_set_duty(FAN_RL_PWM_PIN, update_pwm_duty2);
|
pwm_set_duty(FAN_RL_PWM_PIN, update_pwm_duty2);
|
||||||
}
|
}
|
||||||
@@ -71,19 +118,47 @@ void by_pwm_update_duty(uint32_t update_pwm_duty1, uint32_t update_pwm_duty2)
|
|||||||
* @param pwm_duty_lb
|
* @param pwm_duty_lb
|
||||||
* @param pwm_duty_rb
|
* @param pwm_duty_rb
|
||||||
*/
|
*/
|
||||||
void by_pwm_power_duty(uint32_t pwm_duty_ls, uint32_t pwm_duty_rs, uint32_t pwm_duty_lb, uint32_t pwm_duty_rb)
|
void by_pwm_power_duty(int32_t pwm_duty_ls, int32_t pwm_duty_rs, int32_t pwm_duty_lb, int32_t pwm_duty_rb)
|
||||||
{
|
{
|
||||||
pwm_duty_ls = myclip(pwm_duty_ls, 0, 8000);
|
pwm_duty_ls = clip_s32(pwm_duty_ls, 0, 8000);
|
||||||
pwm_duty_rs = myclip(pwm_duty_rs, 0, 8000);
|
pwm_duty_rs = clip_s32(pwm_duty_rs, 0, 8000);
|
||||||
pwm_duty_lb = myclip(pwm_duty_lb, 0, 8000);
|
pwm_duty_lb = clip_s32(pwm_duty_lb, 0, 8000);
|
||||||
pwm_duty_rb = myclip(pwm_duty_rb, 0, 8000);
|
pwm_duty_rb = clip_s32(pwm_duty_rb, 0, 8000);
|
||||||
|
|
||||||
pwm_duty_ls_g = pwm_duty_ls;
|
pwm_duty_ls_g = pwm_duty_ls;
|
||||||
pwm_duty_rs_g = pwm_duty_rs;
|
pwm_duty_rs_g = pwm_duty_rs;
|
||||||
pwm_duty_lb_g = pwm_duty_lb;
|
pwm_duty_lb_g = pwm_duty_lb;
|
||||||
pwm_duty_rb_g = pwm_duty_rb;
|
pwm_duty_rb_g = pwm_duty_rb;
|
||||||
pwm_set_duty(FAN_LS_PWM_PIN, pwm_duty_ls);
|
|
||||||
pwm_set_duty(FAN_RS_PWM_PIN, pwm_duty_rs);
|
if (pwm_duty_ls >= 0) {
|
||||||
pwm_set_duty(FAN_LB_PWM_PIN, pwm_duty_lb);
|
pwm_set_duty(FAN_LS_PWM_A_PIN, pwm_duty_ls);
|
||||||
pwm_set_duty(FAN_RB_PWM_PIN, pwm_duty_rb);
|
pwm_set_duty(FAN_LS_PWM_B_PIN, 0);
|
||||||
|
} else {
|
||||||
|
pwm_set_duty(FAN_LS_PWM_A_PIN, 0);
|
||||||
|
pwm_set_duty(FAN_LS_PWM_B_PIN, -1 * pwm_duty_ls);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pwm_duty_rs >= 0) {
|
||||||
|
pwm_set_duty(FAN_RS_PWM_A_PIN, pwm_duty_rs);
|
||||||
|
pwm_set_duty(FAN_RS_PWM_B_PIN, 0);
|
||||||
|
} else {
|
||||||
|
pwm_set_duty(FAN_RS_PWM_A_PIN, 0);
|
||||||
|
pwm_set_duty(FAN_RS_PWM_B_PIN, -1 * pwm_duty_rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pwm_duty_lb >= 0) {
|
||||||
|
pwm_set_duty(FAN_LB_PWM_A_PIN, pwm_duty_lb);
|
||||||
|
pwm_set_duty(FAN_LB_PWM_B_PIN, 0);
|
||||||
|
} else {
|
||||||
|
pwm_set_duty(FAN_LB_PWM_A_PIN, 0);
|
||||||
|
pwm_set_duty(FAN_LB_PWM_B_PIN, -1 * pwm_duty_lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pwm_duty_rb >= 0) {
|
||||||
|
pwm_set_duty(FAN_RB_PWM_A_PIN, pwm_duty_rb);
|
||||||
|
pwm_set_duty(FAN_RB_PWM_B_PIN, 0);
|
||||||
|
} else {
|
||||||
|
pwm_set_duty(FAN_RB_PWM_A_PIN, 0);
|
||||||
|
pwm_set_duty(FAN_RB_PWM_B_PIN, -1 * pwm_duty_rb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "ch32v30x.h"
|
#include "ch32v30x.h"
|
||||||
|
|
||||||
extern uint32_t pwm_duty_ls_g;
|
extern int32_t pwm_duty_ls_g;
|
||||||
extern uint32_t pwm_duty_rs_g;
|
extern int32_t pwm_duty_rs_g;
|
||||||
extern uint32_t pwm_duty_lb_g;
|
extern int32_t pwm_duty_lb_g;
|
||||||
extern uint32_t pwm_duty_rb_g;
|
extern int32_t pwm_duty_rb_g;
|
||||||
|
|
||||||
extern void by_pwm_init(void);
|
extern void by_pwm_init(void);
|
||||||
extern void by_pwm_update_duty(uint32_t update_pwm_duty1,uint32_t update_pwm_duty2);
|
extern void by_pwm_update_duty(uint32_t update_pwm_duty1, uint32_t update_pwm_duty2);
|
||||||
extern void by_pwm_power_duty(uint32_t power_pwm_duty_l1, uint32_t power_pwm_duty_r1,uint32_t power_pwm_duty_l2, uint32_t power_pwm_duty_r2);
|
extern void by_pwm_power_duty(int32_t pwm_duty_ls, int32_t pwm_duty_rs, int32_t pwm_duty_lb, int32_t pwm_duty_rb);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -17,10 +17,10 @@ uint8_t by_get_rb_status(void)
|
|||||||
|
|
||||||
void by_rb_init(void)
|
void by_rb_init(void)
|
||||||
{
|
{
|
||||||
gpio_init(E9, GPI, GPIO_HIGH, GPI_PULL_UP);
|
gpio_init(B9, GPI, GPIO_HIGH, GPI_PULL_UP);
|
||||||
gpio_init(E10, GPI, GPIO_HIGH, GPI_PULL_UP);
|
gpio_init(E0, GPI, GPIO_HIGH, GPI_PULL_UP);
|
||||||
gpio_init(E11, GPI, GPIO_HIGH, GPI_PULL_UP);
|
gpio_init(E1, GPI, GPIO_HIGH, GPI_PULL_UP);
|
||||||
|
|
||||||
exti_init(E9, EXTI_TRIGGER_FALLING);
|
exti_init(E0, EXTI_TRIGGER_FALLING);
|
||||||
exti_init(E11, EXTI_TRIGGER_BOTH);
|
exti_init(E1, EXTI_TRIGGER_BOTH);
|
||||||
}
|
}
|
||||||
|
|||||||
58
app/isr.c
58
app/isr.c
@@ -152,6 +152,15 @@ void DVP_IRQHandler(void)
|
|||||||
void EXTI0_IRQHandler(void)
|
void EXTI0_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if (SET == EXTI_GetITStatus(EXTI_Line0)) {
|
if (SET == EXTI_GetITStatus(EXTI_Line0)) {
|
||||||
|
if (rotate_button == rotate_button_none) {
|
||||||
|
if (SET == gpio_get_level(B9)) {
|
||||||
|
rotate_button = rotate_button_backward;
|
||||||
|
queue_add_element(BY_BACKWARD);
|
||||||
|
} else {
|
||||||
|
rotate_button = rotate_button_forward;
|
||||||
|
queue_add_element(BY_FORWARD);
|
||||||
|
}
|
||||||
|
}
|
||||||
EXTI_ClearITPendingBit(EXTI_Line0);
|
EXTI_ClearITPendingBit(EXTI_Line0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,6 +168,23 @@ void EXTI0_IRQHandler(void)
|
|||||||
void EXTI1_IRQHandler(void)
|
void EXTI1_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if (SET == EXTI_GetITStatus(EXTI_Line1)) {
|
if (SET == EXTI_GetITStatus(EXTI_Line1)) {
|
||||||
|
|
||||||
|
static uint64_t time_via = 0;
|
||||||
|
system_delay_ms(10);
|
||||||
|
if (RESET == gpio_get_level(E1)) {
|
||||||
|
time_via = system_get_tick();
|
||||||
|
} else if (SET == gpio_get_level(E1)) {
|
||||||
|
time_via = system_get_tick() - time_via;
|
||||||
|
if (time_via > LONG_PRESS_THRESHOLD_TICK) {
|
||||||
|
rotate_button = rotate_button_press_long;
|
||||||
|
queue_add_element(BY_PRESS_LONG);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
rotate_button = rotate_button_press_short;
|
||||||
|
queue_add_element(BY_PRESS_SHORT);
|
||||||
|
}
|
||||||
|
time_via = 0;
|
||||||
|
}
|
||||||
EXTI_ClearITPendingBit(EXTI_Line1);
|
EXTI_ClearITPendingBit(EXTI_Line1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -199,17 +225,6 @@ void EXTI9_5_IRQHandler(void)
|
|||||||
EXTI_ClearITPendingBit(EXTI_Line8);
|
EXTI_ClearITPendingBit(EXTI_Line8);
|
||||||
}
|
}
|
||||||
if (SET == EXTI_GetITStatus(EXTI_Line9)) {
|
if (SET == EXTI_GetITStatus(EXTI_Line9)) {
|
||||||
|
|
||||||
if (rotate_button == rotate_button_none) {
|
|
||||||
if (SET == gpio_get_level(E10)) {
|
|
||||||
rotate_button = rotate_button_backward;
|
|
||||||
queue_add_element(BY_BACKWARD);
|
|
||||||
} else {
|
|
||||||
rotate_button = rotate_button_forward;
|
|
||||||
queue_add_element(BY_FORWARD);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line9);
|
EXTI_ClearITPendingBit(EXTI_Line9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -225,22 +240,6 @@ void EXTI15_10_IRQHandler(void)
|
|||||||
EXTI_ClearITPendingBit(EXTI_Line10);
|
EXTI_ClearITPendingBit(EXTI_Line10);
|
||||||
}
|
}
|
||||||
if (SET == EXTI_GetITStatus(EXTI_Line11)) {
|
if (SET == EXTI_GetITStatus(EXTI_Line11)) {
|
||||||
static uint64_t time_via = 0;
|
|
||||||
system_delay_ms(10);
|
|
||||||
if (RESET == gpio_get_level(E11)) {
|
|
||||||
time_via = system_get_tick();
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line11);
|
|
||||||
} else if (SET == gpio_get_level(E11)) {
|
|
||||||
time_via = system_get_tick() - time_via;
|
|
||||||
if (time_via > LONG_PRESS_THRESHOLD_TICK) {
|
|
||||||
rotate_button = rotate_button_press_long;
|
|
||||||
queue_add_element(BY_PRESS_LONG);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
rotate_button = rotate_button_press_short;
|
|
||||||
queue_add_element(BY_PRESS_SHORT);
|
|
||||||
}
|
|
||||||
time_via = 0;
|
|
||||||
EXTI_ClearITPendingBit(EXTI_Line11);
|
EXTI_ClearITPendingBit(EXTI_Line11);
|
||||||
}
|
}
|
||||||
if (SET == EXTI_GetITStatus(EXTI_Line12)) {
|
if (SET == EXTI_GetITStatus(EXTI_Line12)) {
|
||||||
@@ -268,15 +267,14 @@ void EXTI15_10_IRQHandler(void)
|
|||||||
// -----------------* DM1XA <20><>/<2F><><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD> Ԥ<><D4A4><EFBFBD>жϴ<D0B6><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *-----------------
|
// -----------------* DM1XA <20><>/<2F><><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD> Ԥ<><D4A4><EFBFBD>жϴ<D0B6><CFB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *-----------------
|
||||||
EXTI_ClearITPendingBit(EXTI_Line15);
|
EXTI_ClearITPendingBit(EXTI_Line15);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIM1_UP_IRQHandler(void)
|
void TIM1_UP_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
|
if (TIM_GetITStatus(TIM1, TIM_IT_Update) != RESET) {
|
||||||
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
by_buzzer_run();
|
||||||
|
|
||||||
sport_motion();
|
sport_motion();
|
||||||
|
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,10 +75,9 @@ float sport_get_speed(void)
|
|||||||
static float speed_now = 0;
|
static float speed_now = 0;
|
||||||
static float speed_last = 0;
|
static float speed_last = 0;
|
||||||
|
|
||||||
speed_now = ALPHA * (float)encoder_get_count(TIM5_ENCOEDER) + (1.0f - ALPHA) * speed_last;
|
speed_now = ALPHA * (float)encoder_get_count(TIM3_ENCOEDER) + (1.0f - ALPHA) * speed_last;
|
||||||
speed_last = speed_now;
|
speed_last = speed_now;
|
||||||
|
encoder_clear_count(TIM3_ENCOEDER);
|
||||||
encoder_clear_count(TIM5_ENCOEDER);
|
|
||||||
|
|
||||||
return speed_now;
|
return speed_now;
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ void sport_motion(void)
|
|||||||
pwm_duty_lb = (uint32_t)myclip_f(1.f * out_speed + out_gyro, 0.0f, 8000.f);
|
pwm_duty_lb = (uint32_t)myclip_f(1.f * out_speed + out_gyro, 0.0f, 8000.f);
|
||||||
pwm_duty_rb = (uint32_t)myclip_f(1.f * out_speed - out_gyro, 0.0f, 8000.f);
|
pwm_duty_rb = (uint32_t)myclip_f(1.f * out_speed - out_gyro, 0.0f, 8000.f);
|
||||||
|
|
||||||
by_pwm_power_duty(pwm_duty_ls, pwm_duty_rs, pwm_duty_lb, pwm_duty_rb);
|
by_pwm_power_duty((int32_t)pwm_duty_ls, (int32_t)pwm_duty_rs, (int32_t)pwm_duty_lb, (int32_t)pwm_duty_rb);
|
||||||
} else {
|
} else {
|
||||||
by_pwm_power_duty(0, 0, 0, 0);
|
by_pwm_power_duty(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,18 +39,18 @@ uint8_t last_state;
|
|||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
TYPE_UNION test_data[BY_FRAME_DATA_NUM];
|
TYPE_UNION test_data[BY_FRAME_DATA_NUM];
|
||||||
clock_init(SYSTEM_CLOCK_120M);
|
clock_init(SYSTEM_CLOCK_144M);
|
||||||
system_delay_init();
|
system_delay_init();
|
||||||
debug_init();
|
debug_init();
|
||||||
|
|
||||||
encoder_quad_init(TIM5_ENCOEDER, TIM5_ENCOEDER_MAP0_CH1_A0, TIM5_ENCOEDER_MAP0_CH2_A1);
|
encoder_quad_init(TIM3_ENCOEDER, TIM3_ENCOEDER_MAP3_CH1_C6, TIM3_ENCOEDER_MAP3_CH2_C7);
|
||||||
ips200_init(IPS200_TYPE_SPI);
|
ips200_init(IPS200_TYPE_SPI);
|
||||||
while (imu660ra_init())
|
while (imu660ra_init())
|
||||||
;
|
;
|
||||||
jj_param_eeprom_init();
|
jj_param_eeprom_init();
|
||||||
jj_bt_init();
|
jj_bt_init();
|
||||||
by_rb_init();
|
by_rb_init();
|
||||||
by_pwm_init();
|
// by_pwm_init();
|
||||||
by_buzzer_init();
|
by_buzzer_init();
|
||||||
by_frame_init();
|
by_frame_init();
|
||||||
|
|
||||||
@@ -65,14 +65,13 @@ int main(void)
|
|||||||
// printf("pwm:%lu,%lu,%lu,%lu\r\n", pwm_duty_ls_g, pwm_duty_rs_g, pwm_duty_lb_g, pwm_duty_rb_g);
|
// printf("pwm:%lu,%lu,%lu,%lu\r\n", pwm_duty_ls_g, pwm_duty_rs_g, pwm_duty_lb_g, pwm_duty_rb_g);
|
||||||
Page_Run();
|
Page_Run();
|
||||||
by_frame_parse(&test_data[0].u32);
|
by_frame_parse(&test_data[0].u32);
|
||||||
by_buzzer_run();
|
|
||||||
jj_bt_run();
|
jj_bt_run();
|
||||||
in_pos = test_data[1].f32;
|
in_pos = test_data[1].f32;
|
||||||
in_angle = test_data[0].f32;
|
in_angle = test_data[0].f32;
|
||||||
in_state = test_data[2].u8[0];
|
in_state = test_data[2].u8[0];
|
||||||
in_stop = test_data[2].u8[1];
|
in_stop = test_data[2].u8[1];
|
||||||
if (last_state != in_state) {
|
if (last_state != in_state) {
|
||||||
bt_printf("changing to%u\r\n",in_state);
|
bt_printf("changing to%u\r\n", in_state);
|
||||||
}
|
}
|
||||||
last_state = in_state;
|
last_state = in_state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
#define __MPU_PRESENT 0 /* Other CH32 devices does not provide an MPU */
|
#define __MPU_PRESENT 0 /* Other CH32 devices does not provide an MPU */
|
||||||
#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */
|
#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */
|
||||||
|
|
||||||
#define HSE_VALUE ((uint32_t)8000000) /* Value of the External oscillator in Hz */
|
#define HSE_VALUE ((uint32_t)16000000) /* Value of the External oscillator in Hz */
|
||||||
|
|
||||||
/* In the following line adjust the External High Speed oscillator (HSE) Startup Timeout value */
|
/* In the following line adjust the External High Speed oscillator (HSE) Startup Timeout value */
|
||||||
#define HSE_STARTUP_TIMEOUT ((uint16_t)0x1000) /* Time out for HSE start up */
|
#define HSE_STARTUP_TIMEOUT ((uint16_t)0x1000) /* Time out for HSE start up */
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
* CH32V307VCT6 Opensourec Library <20><><EFBFBD><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD>⣩<EFBFBD><E2A3A9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڹٷ<DAB9> SDK <20>ӿڵĵ<DAB5><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
||||||
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
* Copyright (c) 2022 SEEKFREE <20><><EFBFBD>ɿƼ<C9BF>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
* <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD> CH32V307VCT6 <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
||||||
*
|
*
|
||||||
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* CH32V307VCT6 <20><>Դ<EFBFBD><D4B4> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNUͨ<55>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* <20><><EFBFBD><EFBFBD><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD> GPL<50><4C>GNU General Public License<73><65><EFBFBD><EFBFBD> GNU ͨ<EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
* <20><> GPL <20>ĵ<EFBFBD>3<EFBFBD>棨<EFBFBD><EFBFBD> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
* <20><> GPL <20>ĵ<EFBFBD> 3 <EFBFBD>棨<EFBFBD><EFBFBD> GPL3.0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>κκ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><DEB8><EFBFBD>
|
||||||
*
|
*
|
||||||
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
* <20><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κεı<CEB5>֤
|
||||||
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
* <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB>ʺ<EFBFBD><CABA>ض<EFBFBD><D8B6><EFBFBD>;<EFBFBD>ı<EFBFBD>֤
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* <20>ļ<DEB8>¼
|
* <20>ļ<DEB8>¼
|
||||||
* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ע
|
* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ע
|
||||||
* 2022-09-15 <20><>W first version
|
* 2022-09-15 <20><> W first version
|
||||||
********************************************************************************************************************/
|
********************************************************************************************************************/
|
||||||
|
|
||||||
#include "ch32v30x.h"
|
#include "ch32v30x.h"
|
||||||
@@ -48,7 +48,7 @@ uint32 system_clock = SYSTEM_CLOCK_144M; // ϵͳʱ
|
|||||||
//-------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
void clock_reset(void)
|
void clock_reset(void)
|
||||||
{
|
{
|
||||||
RCC->CTLR |= (uint32) 0x00000001; //ʹ<><CAB9>HSI<53><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
RCC->CTLR |= (uint32) 0x00000001; //ʹ<><CAB9> HSI <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
RCC->CFGR0 &= (uint32) 0xF8FF0000;
|
RCC->CFGR0 &= (uint32) 0xF8FF0000;
|
||||||
RCC->CTLR &= (uint32) 0xFEF6FFFF;
|
RCC->CTLR &= (uint32) 0xFEF6FFFF;
|
||||||
RCC->CTLR &= (uint32) 0xFFFBFFFF;
|
RCC->CTLR &= (uint32) 0xFFFBFFFF;
|
||||||
@@ -105,7 +105,7 @@ void clock_set_freq(uint32 clock)
|
|||||||
| RCC_PLLMULL));
|
| RCC_PLLMULL));
|
||||||
|
|
||||||
if (clock == SYSTEM_CLOCK_144M)
|
if (clock == SYSTEM_CLOCK_144M)
|
||||||
RCC->CFGR0 |= (uint32) (RCC_PLLSRC_HSE | RCC_PLLXTPRE_HSE
|
RCC->CFGR0 |= (uint32) (RCC_PLLSRC_HSE | RCC_PLLXTPRE_HSE_Div2
|
||||||
| RCC_PLLMULL18_EXTEN);
|
| RCC_PLLMULL18_EXTEN);
|
||||||
else if (clock == SYSTEM_CLOCK_120M)
|
else if (clock == SYSTEM_CLOCK_120M)
|
||||||
RCC->CFGR0 |= (uint32) (RCC_PLLSRC_HSE | RCC_PLLXTPRE_HSE
|
RCC->CFGR0 |= (uint32) (RCC_PLLSRC_HSE | RCC_PLLXTPRE_HSE
|
||||||
|
|||||||
@@ -223,6 +223,13 @@ void imu660ra_get_temperature(void)
|
|||||||
uint8 imu660ra_init(void)
|
uint8 imu660ra_init(void)
|
||||||
{
|
{
|
||||||
uint8 return_state = 0;
|
uint8 return_state = 0;
|
||||||
|
|
||||||
|
// 先给 IMU660RA 断电重启
|
||||||
|
gpio_init(IMU660RA_PE_PIN, GPO, 0, GPO_PUSH_PULL); // 配置 IMU660RA 的 PE 端口
|
||||||
|
gpio_low(IMU660RA_PE_PIN);
|
||||||
|
system_delay_ms(100);
|
||||||
|
gpio_high(IMU660RA_PE_PIN);
|
||||||
|
|
||||||
system_delay_ms(20); // 等待设备上电成功
|
system_delay_ms(20); // 等待设备上电成功
|
||||||
|
|
||||||
#if IMU660RA_USE_SOFT_IIC
|
#if IMU660RA_USE_SOFT_IIC
|
||||||
|
|||||||
@@ -62,8 +62,9 @@
|
|||||||
#if IMU660RA_USE_SOFT_IIC // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的
|
#if IMU660RA_USE_SOFT_IIC // 这两段 颜色正常的才是正确的 颜色灰的就是没有用的
|
||||||
//====================================================软件 IIC 驱动====================================================
|
//====================================================软件 IIC 驱动====================================================
|
||||||
#define IMU660RA_SOFT_IIC_DELAY (10) // 软件 IIC 的时钟延时周期 数值越小 IIC 通信速率越快
|
#define IMU660RA_SOFT_IIC_DELAY (10) // 软件 IIC 的时钟延时周期 数值越小 IIC 通信速率越快
|
||||||
#define IMU660RA_SCL_PIN (B3) // 软件 IIC SCL 引脚 连接 IMU660RA 的 SCL 引脚
|
#define IMU660RA_SCL_PIN (E5) // 软件 IIC SCL 引脚 连接 IMU660RA 的 SCL 引脚
|
||||||
#define IMU660RA_SDA_PIN (B5) // 软件 IIC SDA 引脚 连接 IMU660RA 的 SDA 引脚
|
#define IMU660RA_SDA_PIN (E4) // 软件 IIC SDA 引脚 连接 IMU660RA 的 SDA 引脚
|
||||||
|
#define IMU660RA_PE_PIN (E6) // 软件 IIC SDO 引脚 连接 IMU660RA 的 SDO 引脚
|
||||||
//====================================================软件 IIC 驱动====================================================
|
//====================================================软件 IIC 驱动====================================================
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ typedef enum {
|
|||||||
#define IMU660RA_TIMEOUT_COUNT (0x00FF) // IMU660RA 超时计数
|
#define IMU660RA_TIMEOUT_COUNT (0x00FF) // IMU660RA 超时计数
|
||||||
|
|
||||||
//================================================定义 IMU660RA 内部地址================================================
|
//================================================定义 IMU660RA 内部地址================================================
|
||||||
#define IMU660RA_DEV_ADDR (0x69) // SA0 接地:0x68 SA0 上拉:0x69 模块默认上拉
|
#define IMU660RA_DEV_ADDR (0x68) // SA0 接地:0x68 SA0 上拉:0x69 模块默认上拉
|
||||||
#define IMU660RA_SPI_W (0x00)
|
#define IMU660RA_SPI_W (0x00)
|
||||||
#define IMU660RA_SPI_R (0x80)
|
#define IMU660RA_SPI_R (0x80)
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
#define K24C02_SOFT_IIC_DELAY (500) // <20><><EFBFBD><EFBFBD> IIC <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> <20><>ֵԽС IIC ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>
|
#define K24C02_SOFT_IIC_DELAY (500) // <20><><EFBFBD><EFBFBD> IIC <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD> <20><>ֵԽС IIC ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD>
|
||||||
#define K24C02_SCL_PIN (E3) // <20><><EFBFBD><EFBFBD> IIC SCL <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SCL <20><><EFBFBD><EFBFBD>
|
#define K24C02_SCL_PIN (E3) // <20><><EFBFBD><EFBFBD> IIC SCL <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SCL <20><><EFBFBD><EFBFBD>
|
||||||
#define K24C02_SDA_PIN (E2 ) // <20><><EFBFBD><EFBFBD> IIC SDA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SDA <20><><EFBFBD><EFBFBD>
|
#define K24C02_SDA_PIN (E2) // <20><><EFBFBD><EFBFBD> IIC SDA <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> K24C02 <20><> SDA <20><><EFBFBD><EFBFBD>
|
||||||
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================<3D><><EFBFBD><EFBFBD> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
#else
|
#else
|
||||||
//====================================================Ӳ<><D3B2> IIC <20><><EFBFBD><EFBFBD>====================================================
|
//====================================================Ӳ<><D3B2> IIC <20><><EFBFBD><EFBFBD>====================================================
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
#define K24C02_TIMEOUT_COUNT (0x00FF) // K24C02 <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
#define K24C02_TIMEOUT_COUNT (0x00FF) // K24C02 <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||||
|
|
||||||
//================================================<3D><><EFBFBD><EFBFBD> K24C02 <20>ڲ<EFBFBD><DAB2><EFBFBD>ַ================================================
|
//================================================<3D><><EFBFBD><EFBFBD> K24C02 <20>ڲ<EFBFBD><DAB2><EFBFBD>ַ================================================
|
||||||
#define K24C02_DEV_ADDR (0xA0 >> 1) // IICд<43><D0B4>ʱ<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD> +1Ϊ<31><CEAA>ȡ
|
#define K24C02_DEV_ADDR (0xA0 >> 1) // IIC д<EFBFBD><EFBFBD>ʱ<EFBFBD>ĵ<EFBFBD>ַ<EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> +1 Ϊ<EFBFBD><EFBFBD>ȡ
|
||||||
//================================================<3D><><EFBFBD><EFBFBD> K24C02 <20>ڲ<EFBFBD><DAB2><EFBFBD>ַ================================================
|
//================================================<3D><><EFBFBD><EFBFBD> K24C02 <20>ڲ<EFBFBD><DAB2><EFBFBD>ַ================================================
|
||||||
|
|
||||||
#define K24C02_SIZE (256) // 256 byte
|
#define K24C02_SIZE (256) // 256 byte
|
||||||
|
|||||||
Reference in New Issue
Block a user