Skip to content

Commit

Permalink
pin and sci drvier, make all projects' board/Kconfig file the same
Browse files Browse the repository at this point in the history
  • Loading branch information
newflydd committed Jan 9, 2025
1 parent c6622a8 commit 6dc5ba0
Show file tree
Hide file tree
Showing 21 changed files with 3,503 additions and 37 deletions.
34 changes: 11 additions & 23 deletions libraries/HAL_Drivers/drv_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,31 +361,19 @@ static rt_err_t ra_pin_dettach_irq(struct rt_device *device, rt_base_t pin)
#endif
}

static rt_base_t ra_pin_get(const char *name)
// USE "PXX_X" or "pXX_X" format, the character 'P'/'p' and '_' are required.
static rt_base_t ra_pin_get(const char *name)
{
int pin_number = -1, port = -1, pin = -1;
if (rt_strlen(name) != 4)
return -1;
if ((name[0] == 'P') || (name[0] == 'p'))
{
if ('0' <= (int)name[1] && (int)name[1] <= '9')
{
port = ((int)name[1] - 48) * 16 * 16;
if ('0' <= (int)name[2] && (int)name[2] <= '9')
{
if ('0' <= (int)name[3] && (int)name[3] <= '9')
{
pin = ((int)name[2] - 48) * 10;
pin += (int)name[3] - 48;
pin_number = port + pin;
}
else return -1;
}
else return -1;
}
else return -1;
if ((rt_strlen(name) == 5) &&
((name[0] == 'P') || (name[0] == 'p')) &&
(name[3] == '_') &&
('0' <= (int) name[1] && (int) name[1] <= '1') &&
('0' <= (int) name[2] && (int) name[2] <= '9') &&
('0' <= (int) name[4] && (int) name[4] <= '7')) {
return (((int) name[1] - '0') * 10 + ((int) name[2] - '0')) * 0x100 + ((int) name[4] - '0');
}
return pin_number;
LOG_W("Invalid pin expression, use `PXX_X` format");
return -1;
}

const static struct rt_pin_ops _ra_pin_ops =
Expand Down
5 changes: 4 additions & 1 deletion libraries/HAL_Drivers/drv_sci.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,11 @@ static int ra_uart_putc(struct rt_serial_device *serial, char c)
sci_uart_instance_ctrl_t *p_ctrl = (sci_uart_instance_ctrl_t *)param->sci_ctrl;

p_ctrl->p_reg->TDR = c;
#ifdef SOC_SERIES_R9A07G0
while ((p_ctrl->p_reg->CSR_b.TEND) == 0);
#else
while ((p_ctrl->p_reg->SSR_b.TEND) == 0);

#endif
return RT_EOK;
}

Expand Down
10 changes: 10 additions & 0 deletions projects/etherkit_basic_key_irq/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ menu "Hardware Drivers Config"
default n
endif

menuconfig BSP_USING_PWM
bool "Enable PWM"
default n
select RT_USING_PWM
if BSP_USING_PWM
config BSP_USING_PWM5
bool "Enable GPT5 (32-Bits) output PWM"
default n
endif

config BSP_USING_ETH
bool "Enable Ethernet"
select RT_USING_SAL
Expand Down
10 changes: 10 additions & 0 deletions projects/etherkit_basic_rtc/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ menu "Hardware Drivers Config"
default n
endif

menuconfig BSP_USING_PWM
bool "Enable PWM"
default n
select RT_USING_PWM
if BSP_USING_PWM
config BSP_USING_PWM5
bool "Enable GPT5 (32-Bits) output PWM"
default n
endif

config BSP_USING_ETH
bool "Enable Ethernet"
select RT_USING_SAL
Expand Down
10 changes: 10 additions & 0 deletions projects/etherkit_blink_led/board/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ menu "Hardware Drivers Config"
default n
endif

menuconfig BSP_USING_PWM
bool "Enable PWM"
default n
select RT_USING_PWM
if BSP_USING_PWM
config BSP_USING_PWM5
bool "Enable GPT5 (32-Bits) output PWM"
default n
endif

config BSP_USING_ETH
bool "Enable Ethernet"
select RT_USING_SAL
Expand Down
Loading

0 comments on commit 6dc5ba0

Please sign in to comment.