Skip to content

Commit

Permalink
modifications to mcumap
Browse files Browse the repository at this point in the history
  • Loading branch information
Paciente8159 committed Dec 5, 2024
1 parent 44bff83 commit f4a3b02
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions uCNC/src/hal/boards/renesas_ra/boardmap_uno_r4.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ extern "C"
// Setup com pins
#define RX_BIT 0
#define TX_BIT 1
#define RX_PORT D
#define TX_PORT D
#define RX_PORT 3
#define TX_PORT 3
#define RX_PULLUP
// only uncomment this if other port other then 0 is used
// #define UART_PORT 0
Expand Down
4 changes: 3 additions & 1 deletion uCNC/src/hal/boards/renesas_ra/renesas_ra.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ framework = arduino
; avr_compiler.py
; debug_tool = simavr
debug_build_flags = -Og -g3 -ggdb3 -gdwarf-2
build_flags = ${env.build_flags} -std=gnu99 -Wall -fdata-sections -ffunction-sections -fno-exceptions -Wl,--gc-sections -mcall-prologues -mrelax -flto -fno-fat-lto-objects -fno-tree-scev-cprop -Wl,--relax
build_flags = ${env.build_flags} -std=gnu99 -Wall -fdata-sections -ffunction-sections -fno-exceptions -Wl,--relax
lib_deps = ${env.lib_deps}
lib_ignore = WiFiS3
; lib_ignore = EEPROM, SPI, Wire

[env:RENESAS_RA-UNO-R4]
extends = common_renesas_ra
board = uno_r4_minima
build_flags = ${common_renesas_ra.build_flags} -D BOARD=\"src/hal/boards/renesas_ra/boardmap_uno_r4.h\"
18 changes: 10 additions & 8 deletions uCNC/src/hal/mcus/renesas_ra/mcumap_renesas_ra.h
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,9 @@ extern "C"
#define TOGGLEFLAG(x, y) ((x) ^= (y)) /* Toggle byte y in byte x*/
#endif

// #include <ra/fsp/src/bsp/mcu/all/bsp_io.h>
// #include <ra/fsp/src/bsp/mcu/all/bsp_io.h>

#define mcu_config_output(X) R_BSP_PinCfg(__indirect__(X, GPIO), BSP_IO_DIRECTION_OUTPUT)
#define mcu_config_output(X) ({ R_PFS->PORT[__indirect__(X, PORT)].PIN[__indirect__(X, BIT) & BSP_IO_PRV_8BIT_MASK].PmnPFS = BSP_IO_DIRECTION_OUTPUT; })
#define mcu_config_pwm(X, freq) \
{ \
pinMode(__indirect__(X, BIT), OUTPUT); \
Expand All @@ -1958,13 +1958,15 @@ extern "C"
#define mcu_config_input(X) R_BSP_PinCfg(__indirect__(X, GPIO), BSP_IO_DIRECTION_INPUT)
#define mcu_config_analog(X) mcu_config_input(X)
#define mcu_config_pullup(X) pinMode(__indirect__(X, BIT), INPUT_PULLUP)
#define mcu_config_input_isr(X) attachInterrupt(digitalPinToInterrupt(__indirect__(X, BIT)), mcu_din_isr, CHANGE)

#define mcu_get_input(X) CHECKBIT(sio_hw->gpio_in, __indirect__(X, BIT))
#define mcu_get_output(X) CHECKBIT(sio_hw->gpio_out, __indirect__(X, BIT))
#define mcu_set_output(X) ({ sio_hw->gpio_set = (1UL << __indirect__(X, BIT)); })
#define mcu_clear_output(X) ({ sio_hw->gpio_clr = (1UL << __indirect__(X, BIT)); })
#define mcu_toggle_output(X) ({ sio_hw->gpio_togl = (1UL << __indirect__(X, BIT)); })
extern void mcu_din_isr(void);
#define mcu_config_input_isr(X) attachInterrupt(digitalPinToInterrupt(__indirect__(X, GPIO)), mcu_din_isr, CHANGE)

#define mcu_get_input(X) digitalRead(__indirect__(X, GPIO))
#define mcu_get_output(X) digitalRead(__indirect__(X, GPIO))
#define mcu_set_output(X) ({ digitalWrite(__indirect__(X, GPIO), 1); })
#define mcu_clear_output(X) ({ digitalWrite(__indirect__(X, GPIO), 0); })
#define mcu_toggle_output(X) ({ digitalWrite(__indirect__(X, GPIO), !digitalRead(__indirect__(X, GPIO))); })

extern uint8_t rp2040_pwm[16];
#define mcu_set_pwm(X, Y) \
Expand Down

0 comments on commit f4a3b02

Please sign in to comment.