Skip to content

Commit

Permalink
Build changes
Browse files Browse the repository at this point in the history
  • Loading branch information
merrittlj committed Apr 26, 2024
1 parent ca3efda commit a8babdd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/act.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: act-build

jobs:
act-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: apt-get update
- run: apt install sudo
- run: sudo apt -y install gcc-arm-none-eabi make openocd git
- run: make
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: sudo apt-get update
- run: sudo apt -y install gcc-arm-none-eabi make openocd
- run: sudo apt -y install gcc-arm-none-eabi make openocd git
- run: make
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,7 @@ debug:
@openocd -f interface/stlink.cfg -f board/stm32f0discovery.cfg -c "init" &
@arm-none-eabi-gdb bin/firmware.elf -x gdbconf

.PHONY: all dep cmsis_core cmsis_f0 build clean dep_clean flash debug
test:
@act --job act-linux

.PHONY: all dep cmsis_core cmsis_f0 build clean dep_clean flash debug test
Binary file added src/hal/.hal.h.swp
Binary file not shown.
4 changes: 2 additions & 2 deletions src/hal/hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ uint8_t gpio_read(uint16_t pin)
void rcc_port_set(uint8_t bank, uint8_t mode)
{
int n = (17 + bank);
RCC->AHBENR = (RCC->AHBENR & ~BIT(n)) | (mode << n); /* Clear, then set bit. */
RCC->AHBENR = (RCC->AHBENR & ~BIT(n)) | (uint32_t)(mode << n); /* Clear, then set bit. */
}

int timer_expired(uint32_t *t, uint32_t prd, uint32_t now)
Expand Down Expand Up @@ -71,7 +71,7 @@ void exti_pin_init(uint16_t pin, uint8_t rising, uint8_t priority, func_ptr hand
volatile uint32_t *edge_selection = (&EXTI->FTSR - rising); /* Rising/falling edge. */
*edge_selection |= BIT(n);

SYSCFG->EXTICR[n / 4] |= PIN_BANK(pin) << ((n - (4 * (n / 4))) * 4); /* Set source input for respective EXTI line. */
SYSCFG->EXTICR[n / 4] |= (uint32_t)(PIN_BANK(pin) << ((n - (4 * (n / 4))) * 4)); /* Set source input for respective EXTI line. */

uint8_t irq_pos = n < 2 ? EXTI0_1_IRQn : n < 4 ? EXTI2_3_IRQn : EXTI4_15_IRQn;
NVIC_EnableIRQ(irq_pos);
Expand Down
4 changes: 2 additions & 2 deletions src/hal/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#define BIT_LAST(x, y) (x & ((1UL << y) - 1)) /* Last y bits. */

/* uint16_t(2 bytes): upper byte = bank #, lower byte = pin # */
#define PIN(bank, num) ((((bank) - 'A') << 8) | (num)) /* ex: PIN('C', 7) */
#define PIN_NUM(pin) ((uint8_t)BIT_LAST(pin, 8))
#define PIN(bank, num) ((uint16_t)((uint16_t)((uint8_t)(bank) - 'A') << (uint8_t)8) | (uint16_t)(num))
#define PIN_NUM(pin) ((uint8_t)(BIT_LAST(pin, 8)))
#define PIN_BANK(pin) ((uint8_t)((pin) >> 8))

/* GPIO input/output modes. */
Expand Down

0 comments on commit a8babdd

Please sign in to comment.