change rel control

This commit is contained in:
wmano
2025-10-16 00:07:30 +08:00
parent 1cdc01f7cf
commit c8032dd1c6
14 changed files with 332 additions and 996 deletions
@@ -15,8 +15,40 @@ struct chrg_north_t chrgnorth = {
.tid = RT_NULL,
.tty = RT_NULL,
.rx_len = 0,
.sw[IDX_CH_0] = {
.id = ID_SINK,
},
.sw[IDX_CH_1] = {
.id = ID_SINK,
},
.sw[IDX_CH_2] = {
.id = ID_SINK,
},
.sw[IDX_CH_3] = {
.id = ID_SINK,
},
};
const rt_base_t sw_uart[TOTAL_CHS] = {
PIN_NORTH_UART_SW1,
PIN_NORTH_UART_SW2,
PIN_NORTH_UART_SW3,
PIN_NORTH_UART_SW4
};
void chrg_north_sw_uart (eIDX_CH ch, eIDX_ID id)
{
if (ch >= TOTAL_CHS) {
return ;
}
if (ID_SOURCE == id) {
rt_pin_write(sw_uart[ch], PIN_HIGH);
} else {
rt_pin_write(sw_uart[ch], PIN_LOW);
}
}
int chrg_north_send (rt_uint8_t *data, rt_size_t length)
{
@@ -71,6 +103,12 @@ static int chrg_north_init (void)
rt_err_t ret;
struct chrg_north_t *pNOR = &chrgnorth;
int i = 0;
for (i = 0; i < TOTAL_CHS; i++) {
rt_pin_mode(sw_uart[i], PIN_MODE_OUTPUT);
chrg_north_sw_uart((eIDX_CH)i, ID_SINK);
}
pNOR->tty = chrg_tty_create(pNOR->devname, 2000000, 0, -1, 1);
if (RT_NULL == pNOR->tty) {
LOG_E("tty can't create.");