Skip to content

Commit bffc05b

Browse files
committed
Fix |>[drv] free a wrong instance of aw9527
1 parent 57c9fdd commit bffc05b

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

src/fw/board/boards/board_obelix_bb.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
#include "drivers/sf32lb/i2c_hal_definitions.h"
2323
#include "drivers/sf32lb/pwm_hal_definitions.h"
2424
#include "board/board_sf32lb.h"
25-
25+
#include "drivers/ioexp.h"
26+
#include "drivers/vibe.h"
2627

2728

2829
#define USING_UART1
@@ -377,6 +378,17 @@ void board_early_init(void) {
377378

378379
}
379380

381+
#include "bf0_hal.h"
380382
void board_init(void) {
381-
383+
i2c_init(&I2C1_BUS);
384+
i2c_init(&I2C2_BUS);
385+
i2c_init(&I2C3_BUS);
386+
i2c_init(&I2C_COMM_BUS);
387+
388+
PBL_LOG(LOG_LEVEL_DEBUG, "enr1:0x%08lx", *(uint32_t *)&hwp_hpsys_rcc->ENR1);
389+
PBL_LOG(LOG_LEVEL_DEBUG, "enr2:0x%08lx", *(uint32_t *)&hwp_hpsys_rcc->ENR2);
390+
//ioexp_init();
391+
//vibe_init();
392+
//PBL_LOG(LOG_LEVEL_DEBUG, "enr1:0x%08lx", *(uint32_t *)&hwp_hpsys_rcc->ENR1);
393+
//PBL_LOG(LOG_LEVEL_DEBUG, "enr2:0x%08lx", *(uint32_t *)&hwp_hpsys_rcc->ENR2);
382394
}

src/fw/drivers/ioexp_aw9527.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
static bool prv_read_register(uint8_t register_address, uint8_t *result) {
2727
i2c_use(I2C_AW9527);
2828
bool rv = i2c_read_register(I2C_AW9527, register_address, result);
29-
i2c_release(I2C_AW86225);
29+
i2c_release(I2C_AW9527);
3030
return rv;
3131
}
3232

@@ -65,5 +65,23 @@ void ioexp_led_ctrl(uint8_t percent) {
6565

6666
/*channel ctrl*/
6767
void ioexp_pin_set(IOEXP_CHANNEL_T channel, IOEXP_STATE_T state) {
68-
68+
if (channel >= IOEXP_CH10) {
69+
uint8_t p1_value;
70+
prv_read_register(0x03, &p1_value);
71+
if (state == IOEXP_HIGH) {
72+
p1_value |= (1<<channel);
73+
} else {
74+
p1_value &= ~(1<<channel);
75+
}
76+
prv_write_register(0x03, p1_value);
77+
} else {
78+
uint8_t p0_value;
79+
prv_read_register(0x02, &p0_value);
80+
if (state == IOEXP_HIGH) {
81+
p0_value |= (1<<channel);
82+
} else {
83+
p0_value &= ~(1<<channel);
84+
}
85+
prv_write_register(0x02, p0_value);
86+
}
6987
}

src/fw/drivers/wscript_build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ elif bld.is_obelix():
212212
'driver_flash',
213213
# 'driver_accessory',
214214
'driver_gpio_defaults',
215+
'driver_ioe',
216+
'driver_motor',
215217
],
216218
)
217219

@@ -1587,7 +1589,7 @@ if mcu_family == 'SF32LB':
15871589
#'display/sharp_ls013b7dh01/sharp_ls013b7dh01_nrf5.c',
15881590
'sf32lb/stubs/accel.c',
15891591
'sf32lb/stubs/ambient_light.c',
1590-
'sf32lb/stubs/vibe.c',
1592+
#'sf32lb/stubs/vibe.c',
15911593
'sf32lb/stubs/otp.c',
15921594
'sf32lb/stubs/mcu.c',
15931595
'sf32lb/stubs/backlight.c',

0 commit comments

Comments
 (0)