Skip to content

Commit

Permalink
Various cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chintal committed Jan 11, 2025
1 parent 312bab4 commit b5ee7f1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 56 deletions.
45 changes: 29 additions & 16 deletions include/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,9 @@
#define APP_ENABLE_UART1 0 // A
#define APP_ENABLE_UART2 0 // B
#define APP_ENABLE_UART3 1 // Backchannel
#define APP_ENABLE_UART4 0
#define APP_ENABLE_UART5 0
#define APP_ENABLE_UART7 0
#define APP_ENABLE_UART8 0
#define APP_ENABLE_UART6 0 // lp

#define APP_ENABLE_UART (APP_ENABLE_UART1 + APP_ENABLE_UART2 + APP_ENABLE_UART3 + APP_ENABLE_UART4 + APP_ENABLE_UART5 + APP_ENABLE_UART7 + APP_ENABLE_UART8 + APP_ENABLE_UART6)

#define APP_ENABLE_UART3_PT 0
#define uC_UART3_PT_INFNUM 0
#define uC_UART3_INTFNUM 0
#define uC_UART3_BAUD 1000000
#define uC_UART3_TXBUF_LEN 255
#define uC_UART3_RXBUF_LEN 255
#define uC_UART3_BAUD 1000000
/**@}*/

/**
Expand Down Expand Up @@ -309,6 +298,15 @@
#define APP_PRIF_INTFNUM 0
/**@}*/

/**
* @name Application Bulk Interface Configuration
*/
/**@{*/
#define APP_ENABLE_BULKIF 0
#define APP_BULKIF_TYPE EBS_INTF_UART
#define APP_BULKIF_INTFNUM 0
/**@}*/

/**
* @name Application Backchannel Interface Configuration
*/
Expand All @@ -318,7 +316,7 @@
#define APP_BCIF_INTFNUM 0
/**@}*/

/**
/**
* @name Application DMA Configuration
*/
/**@{*/
Expand Down Expand Up @@ -353,7 +351,7 @@
#define APP_ENABLE_DMA2_CH9 0
#define APP_ENABLE_DMA2_CH10 0
#define APP_ENABLE_DMA2_CH11 0
#define APP_ENABLE_DMA2_CH12 1
#define APP_ENABLE_DMA2_CH12 1
#define APP_ENABLE_DMA2_CH13 0
#define APP_ENABLE_DMA2_CH14 0
#define APP_ENABLE_DMA2_CH15 0
Expand All @@ -375,15 +373,30 @@
#define ERROR_POLARITY 1

// button appears to be broken. unclear if it is a
// hardware or software issue.
// hardware or software issue.
#define APP_ENABLE_BUTTON 0
/**@}*/

/**
* @name Application Debug Configuration
*/
/**@{*/
#define APP_ENABLE_DEBUG 1

#if APP_ENABLE_BCIF
#define DEBUG_TRANSPORT_INTFNUM APP_BCIF_INTFNUM
#define DEBUG_TRANSPORT_TYPE APP_BCIF_TYPE
#elif APP_ENABLE_PRIF
#define DEBUG_TRANSPORT_INTFNUM APP_PRIF_INTFNUM
#define DEBUG_TRANSPORT_TYPE APP_PRIF_TYPE
#endif
/**@}*/

/**
* @name Application Modbus Configuration
*/
/**@{*/
#define APP_ENABLE_MODBUS 1
#define APP_ENABLE_MODBUS 0

#if APP_ENABLE_PRIF
#define MODBUS_TRANSPORT_INTFNUM APP_PRIF_INTFNUM
Expand Down
4 changes: 3 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ build_flags =
-I lib/tinyusb/src
-I lib/hal/src
-fdata-sections -ffunction-sections
-fno-builtin-printf -fno-builtin-sprintf
-fstack-usage -mthumb -Wl,--gc-sections
-mfpu=fpv5-d16
-std=gnu++11 -Wall -O1
-std=gnu++11 -Wall -O1
build_unflags =
-Os
board_build.ldscript = src/cubemx/STM32H7S3L8HX_FLASH.ld
Expand All @@ -37,6 +38,7 @@ lib_deps =
ebs-modbus
https://github.com/ebs-universe/piolib-task-blink.git
https://github.com/ebs-universe/tinyusb.git
monitor_speed = 1000000

[env:dev]
board = nucleo_h7s3l8
Expand Down
2 changes: 1 addition & 1 deletion src/demos/itcm_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma GCC push_options
#pragma GCC optimize("O0")
__attribute__((section(".itcm")))
void itcm_test(void) {
void itcm_demo(void) {
gpio_set_output_high(GPIO_LED_GREEN);
}
#pragma GCC pop_options
2 changes: 1 addition & 1 deletion src/demos/itcm_demo.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


void itcm_test(void);
void itcm_demo(void);
31 changes: 31 additions & 0 deletions src/demos/uart_demo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@


#include <time/cron.h>
#include <hal/uc.h>


cron_job_t uart_bare_job;
tm_system_t uart_bare_start;
tm_sdelta_t uart_bare_period = 100;


void uart_bare_send(void) {
if (*(HAL_SFR_t *)(uart_if[DEBUG_TRANSPORT_INTFNUM]->hwif->base + OFS_UART_ISR) & USART_ISR_TXE_TXFNF) {
uart_putc_bare(DEBUG_TRANSPORT_INTFNUM, 'a');
}
}

void uart_buffered_send(void) {
if (uart_reqlock(DEBUG_TRANSPORT_INTFNUM, 1, 0x00)){
uart_putc(DEBUG_TRANSPORT_INTFNUM, 'a', 0x00, 0x00);
} else {
uart_send_trigger(DEBUG_TRANSPORT_INTFNUM);
}
}


void start_uart_demo(void) {
uart_vprintf(DEBUG_TRANSPORT_INTFNUM, "UART example %d\n", 12);
tm_current_time(&uart_bare_start);
tm_cron_create_job_abs(&uart_bare_job, &uart_buffered_send, &uart_bare_start, &uart_bare_period);
}
2 changes: 1 addition & 1 deletion src/tasks/uart_bare.h → src/demos/uart_demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#include <time/cron.h>
#include <iomap.h>

void start_uart_bare_task(void);
void start_uart_demo(void);
9 changes: 4 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
#include <modbus/modbus.h>

#include <blink.h>
#include <tasks/uart_bare.h>
#include <tasks/usb_task.h>

#include <demos/itcm_demo.h>
#include <demos/adc_demo.h>
#include <demos/dma_demo.h>
#include <demos/uart_demo.h>

ucdm_addr_t next_address;

Expand Down Expand Up @@ -129,14 +129,13 @@ int main(void) {
ucdm_addr_t ucdm_address = 1;
ucdm_address = setup_system(ucdm_address);
ucdm_address = setup_application(ucdm_address);
// start_uart_bare_task();

// itcm_test();

// itcm_demo();
start_uart_demo();
// setup_dma_demo();
setup_adc_demo();
timer_set_mode(uC_TIM15_INTFNUM, TIMER_MODE_PERIODIC);

while (1)
{
#if APP_ENABLE_TIME_CRON
Expand Down
31 changes: 0 additions & 31 deletions src/tasks/uart_bare.c

This file was deleted.

0 comments on commit b5ee7f1

Please sign in to comment.