diff --git a/Makefile b/Makefile index aec3636..ad5d38a 100644 --- a/Makefile +++ b/Makefile @@ -65,13 +65,13 @@ endif # Stack size to be allocated to the Cortex-M process stack. This stack is # the stack used by the main() thread. ifeq ($(USE_PROCESS_STACKSIZE),) - USE_PROCESS_STACKSIZE = 0x240 + USE_PROCESS_STACKSIZE = 0x180 endif # Stack size to the allocated to the Cortex-M main/exceptions stack. This # stack is used for processing interrupts and exceptions. ifeq ($(USE_EXCEPTIONS_STACKSIZE),) - USE_EXCEPTIONS_STACKSIZE = 0x200 + USE_EXCEPTIONS_STACKSIZE = 0x100 endif # diff --git a/chconf.h b/chconf.h index 08860ae..deb0f9e 100644 --- a/chconf.h +++ b/chconf.h @@ -529,7 +529,7 @@ /** * ChibiOS/os/various/shell/shell_cmd.c */ -#define SHELL_CMD_EXIT_ENABLED TRUE +#define SHELL_CMD_EXIT_ENABLED FALSE #define SHELL_CMD_INFO_ENABLED FALSE #define SHELL_CMD_ECHO_ENABLED FALSE #define SHELL_CMD_SYSTIME_ENABLED FALSE diff --git a/halconf.h b/halconf.h index 0b48487..9a90280 100644 --- a/halconf.h +++ b/halconf.h @@ -317,7 +317,7 @@ * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 128 +#define SERIAL_USB_BUFFERS_SIZE 32 #endif /** diff --git a/main.c b/main.c index 2eeca06..82d04a6 100644 --- a/main.c +++ b/main.c @@ -124,7 +124,7 @@ extern int dirty; bool completed = false; -static THD_WORKING_AREA(waThread1, 900); +static THD_WORKING_AREA(waThread1, 768); static THD_FUNCTION(Thread1, arg) { (void)arg; @@ -2784,7 +2784,7 @@ void hard_fault_handler_c(uint32_t *sp) uint32_t psr = sp[7]; int y = 0; int x = 20; -static char buf[16]; + static char buf[16]; ili9341_set_background(0x0000); ili9341_set_foreground(0xFFFF); diff --git a/nanovna.h b/nanovna.h index e274472..295b00e 100644 --- a/nanovna.h +++ b/nanovna.h @@ -502,7 +502,7 @@ extern volatile uint8_t redraw_request; #define RGBHEX(hex) ( (((hex)&0x001c00)<<3) | (((hex)&0x0000f8)<<5) | (((hex)&0xf80000)>>16) | (((hex)&0x00e000)>>13) ) // Define size of screen buffer in pixels (one pixel 16bit size) -#define SPI_BUFFER_SIZE 1024 +#define SPI_BUFFER_SIZE (CELLWIDTH*CELLHEIGHT) #define LCD_WIDTH 320 #define LCD_HEIGHT 240 diff --git a/numfont20x22.c b/numfont20x22.c index 9affa97..0b495d3 100644 --- a/numfont20x22.c +++ b/numfont20x22.c @@ -515,12 +515,12 @@ const uint16_t numfont16x22[] = { 0b0000000000000000, 0b0000000000000000, 0b0000000000000000, - 0b1111001100110000, - 0b1111011111111100, - 0b1111111111111110, - 0b1111111111111110, - 0b1111111111011111, - 0b1111101111001111, + 0b1110111000011100, + 0b1111111100111110, + 0b1111111111111111, + 0b1111111111111111, + 0b1111001111001111, + 0b1111001111001111, 0b1111001111001111, 0b1111001111001111, 0b1111001111001111, @@ -536,22 +536,22 @@ const uint16_t numfont16x22[] = { 0b0000000000000000, 0b0000000000000000, 0b0000000000000000, - 0b0000000000000000, - 0b0000000000000000, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000001111, - 0b1111000000011111, - 0b1111100000111111, - 0b1111110001111111, - 0b0111111111111111, - 0b0011111111101111, - 0b0001111111001111, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111000000011110, + 0b1111100000111110, + 0b1111110001111110, + 0b1111111111111110, + 0b1111111111111111, + 0b1111011111001111, + 0b1111001110000111, + 0b1111000000000000, + 0b1111000000000000, 0b0000000000000000, // n 0b0000000000000000, diff --git a/sa_core.c b/sa_core.c index 7b00f35..f78b29b 100644 --- a/sa_core.c +++ b/sa_core.c @@ -34,7 +34,7 @@ uint32_t maxFreq = 520000000; uint32_t measured_sweep_time = 0; //int setting.refer = -1; // Off by default -int const reffer_freq[] = {30000000, 15000000, 10000000, 4000000, 3000000, 2000000, 1000000}; +static const int reffer_freq[] = {30000000, 15000000, 10000000, 4000000, 3000000, 2000000, 1000000}; int in_selftest = false; diff --git a/si4432.c b/si4432.c index b9989da..5bcc030 100644 --- a/si4432.c +++ b/si4432.c @@ -59,18 +59,6 @@ static void shiftOut(uint8_t val) { SI4432_log(SI4432_Sel); SI4432_log(val); -#if 0 - uint8_t i = 0; - do { - if (val & 0x80) - SPI2_SDI_HIGH; - else - SPI2_SDI_LOW; - val<<=1; - SPI2_CLK_HIGH; - SPI2_CLK_LOW; - }while((++i) & 0x07); -#else uint8_t i = 0; do { if (val & 0x80) @@ -79,7 +67,6 @@ static void shiftOut(uint8_t val) SPI2_RESET; val<<=1; }while((++i) & 0x07); -#endif } static uint8_t shiftIn(void) @@ -95,21 +82,32 @@ static uint8_t shiftIn(void) return value>>GPIO_SPI2_SDO; } -static void shiftInBuf(uint8_t *buf, uint16_t size, uint16_t delay) { +static inline void shiftInBuf(uint16_t sel, uint8_t addr, uint8_t *buf, uint16_t size, uint16_t delay) { uint8_t i = 0; do{ - uint8_t value = 0; + uint32_t value = addr; + palClearPad(GPIOC, sel); + do { + if (value & 0x80) + SPI2_SDI_HIGH; + SPI2_CLK_HIGH; + SPI2_RESET; + value<<=1; + }while((++i) & 0x07); + value = 0; do { SPI2_CLK_HIGH; - value = (value<<1)|SPI2_SDO; + value<<=1; + value|=SPI2_portSDO; SPI2_CLK_LOW; }while((++i) & 0x07); - *buf++=value; + palSetPad(GPIOC, sel); + *buf++=value>>GPIO_SPI2_SDO; if (delay) my_microsecond_delay(delay); }while(--size); } - +#if 0 static void shiftOutBuf(uint8_t *buf, uint16_t size) { uint8_t i = 0; do{ @@ -125,7 +123,7 @@ static void shiftOutBuf(uint8_t *buf, uint16_t size) { }while((++i) & 0x07); }while(--size); } - +#endif const int SI_nSEL[3] = { GPIO_RX_SEL, GPIO_LO_SEL, 0}; // #3 is dummy!!!!!! volatile int SI4432_Sel = 0; // currently selected SI4432 @@ -413,6 +411,7 @@ void SI4432_Fill(int s, int start) #endif uint32_t t = setting.additional_step_delay_us; START_PROFILE; +#if 1 SPI2_CLK_LOW; int i = start; do { @@ -424,6 +423,10 @@ void SI4432_Fill(int s, int start) if (t) my_microsecond_delay(t); } while(1); +#else + shiftInBuf(sel, SI4432_REG_RSSI, (uint8_t *)&age[start], sweep_points - start, t); +#endif +// STOP_PROFILE; setting.actual_sweep_time_us = DELTA_TIME*100; buf_index = start; // Is used to skip 1st entry during level triggering buf_read = true;