Skip to content

Commit

Permalink
Update examples to use whatever priority group there exists
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Sep 15, 2024
1 parent 0a9b2c7 commit 4bcdc9e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
6 changes: 5 additions & 1 deletion examples/blinky-cpp-none-os/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ LEDBlinker blinker(BLINKY_GPIO_PORT, BLINKY_GPIO_PIN, BLINKY_CLOCK);

int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();

Expand Down
6 changes: 5 additions & 1 deletion examples/blinky-freertos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ void task2_task(void *pvParameters)

int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(115200);
Expand Down
4 changes: 4 additions & 0 deletions examples/blinky-none-os/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ void Delay_Ms(uint32_t n);

int main(void)
{
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();

Expand Down
6 changes: 5 additions & 1 deletion examples/hello-world-harmony-liteos/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ LITE_OS_SEC_TEXT_INIT int main(void)
{
unsigned int ret;

NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(115200);
Expand Down
4 changes: 4 additions & 0 deletions examples/sdi-printf-ch32v003/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ int main(void)
{
u8 i = 0;

#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
Delay_Init();
#if (SDI_PRINT == SDI_PR_OPEN)
SDI_Printf_Enable();
Expand Down
4 changes: 4 additions & 0 deletions examples/uart-printf-none-os/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@

int main(void)
{
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(115200);
Expand Down
6 changes: 5 additions & 1 deletion examples/usb-pd-none-os/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ void TIM1_Init(u16 arr, u16 psc)
*/
int main(void)
{
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#ifdef NVIC_PriorityGroup_2
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
#else
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
#endif
SystemCoreClockUpdate();
Delay_Init();
USART_Printf_Init(921600);
Expand Down

0 comments on commit 4bcdc9e

Please sign in to comment.