aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/includes/Audio/audio.h2
-rw-r--r--src/common/includes/Audio/cw.h2
-rw-r--r--src/common/includes/Core/common.h5
-rw-r--r--src/common/includes/Core/fsm.h10
-rw-r--r--src/common/includes/GPIO/i2c.h2
-rw-r--r--src/common/includes/GPIO/temperature.h6
-rw-r--r--src/common/includes/GPS/gps.h4
-rw-r--r--src/common/src/Audio/cw.c6
-rw-r--r--src/common/src/Core/common.c2
-rw-r--r--src/common/src/Core/fsm.c1
-rw-r--r--src/common/src/Core/main.c18
-rw-r--r--src/common/src/GPS/gps.c2
-rw-r--r--src/glutt-o-logique/Makefile44
-rw-r--r--src/glutt-o-logique/audio.c2
-rw-r--r--src/glutt-o-logique/common.c1
-rw-r--r--src/glutt-o-logique/cw.c1
-rw-r--r--src/glutt-o-logique/debug.c7
-rw-r--r--src/glutt-o-logique/debug.h4
-rw-r--r--src/glutt-o-logique/ds18b20/tm_stm32f4_onewire.h4
-rw-r--r--src/glutt-o-logique/main.c2
-rw-r--r--src/glutt-o-logique/pio.c2
-rw-r--r--src/glutt-o-logique/temperature.c7
-rw-r--r--src/glutt-o-logique/usart.c4
-rw-r--r--src/simulator/Makefile62
24 files changed, 129 insertions, 71 deletions
diff --git a/src/common/includes/Audio/audio.h b/src/common/includes/Audio/audio.h
index a4ac2da..573c157 100644
--- a/src/common/includes/Audio/audio.h
+++ b/src/common/includes/Audio/audio.h
@@ -59,4 +59,6 @@ void audio_stop(void);
void audio_provide_buffer(void *samples,int numsamples);
bool audio_provide_buffer_without_blocking(void *samples,int numsamples);
+void DMA1_Stream7_IRQHandler(void);
+
#endif
diff --git a/src/common/includes/Audio/cw.h b/src/common/includes/Audio/cw.h
index ccb13ab..39be9c5 100644
--- a/src/common/includes/Audio/cw.h
+++ b/src/common/includes/Audio/cw.h
@@ -47,5 +47,7 @@ int cw_psk31_busy(void);
void cw_message_sent(const char*);
+size_t cw_symbol(uint8_t, uint8_t *, size_t);
+
#endif // __CW_H_
diff --git a/src/common/includes/Core/common.h b/src/common/includes/Core/common.h
index 950085c..b0927c8 100644
--- a/src/common/includes/Core/common.h
+++ b/src/common/includes/Core/common.h
@@ -58,6 +58,11 @@ int random_bool(void);
#define FAULT_SOURCE_USART 4
void trigger_fault(int source);
+
+int find_last_sunday(const struct tm*);
+
#ifdef SIMULATOR
void __disable_irq(void);
+#else
+void hard_fault_handler_c(uint32_t *);
#endif
diff --git a/src/common/includes/Core/fsm.h b/src/common/includes/Core/fsm.h
index c061597..75f1f46 100644
--- a/src/common/includes/Core/fsm.h
+++ b/src/common/includes/Core/fsm.h
@@ -25,6 +25,8 @@
#ifndef _FSM_H_
#define _FSM_H_
+#include <stdint.h>
+
// List of all states the FSM of the relay can be in
enum fsm_state_e {
FSM_OISIF = 0, // Idle
@@ -88,10 +90,10 @@ struct fsm_output_signals_t {
};
// Initialise local structures
-void fsm_init();
+void fsm_init(void);
// Call the FSM once and update the internal state
-void fsm_update();
+void fsm_update(void);
// Setter for inputs
void fsm_update_inputs(struct fsm_input_signals_t* inputs);
@@ -102,5 +104,9 @@ void fsm_get_outputs(struct fsm_output_signals_t* out);
// Announce a state change
void fsm_state_switched(const char *new_state);
+uint64_t fsm_current_state_time_ms(void);
+uint64_t fsm_current_state_time_s(void);
+const char* fsm_select_letter(void);
+
#endif // _FSM_H_
diff --git a/src/common/includes/GPIO/i2c.h b/src/common/includes/GPIO/i2c.h
index 109213b..69a4ad2 100644
--- a/src/common/includes/GPIO/i2c.h
+++ b/src/common/includes/GPIO/i2c.h
@@ -28,7 +28,7 @@
#include <stdint.h>
/* Initialise I2C on the board for both the audio codec and the GPS receiver */
-void i2c_init();
+void i2c_init(void);
/* Do an I2C write, return 1 on success, 0 on failure */
int i2c_write(uint8_t device, const uint8_t *txbuf, int len);
diff --git a/src/common/includes/GPIO/temperature.h b/src/common/includes/GPIO/temperature.h
index a0e5b5d..f49cc26 100644
--- a/src/common/includes/GPIO/temperature.h
+++ b/src/common/includes/GPIO/temperature.h
@@ -29,12 +29,12 @@ extern float _temperature_last_value;
extern int _temperature_valid;
// Setup communication and temperature
-void temperature_init();
+void temperature_init(void);
// Return 1 if the temperature is valid
-int temperature_valid();
+int temperature_valid(void);
// Get current temperature
-float temperature_get();
+float temperature_get(void);
void temperature_task(void *);
diff --git a/src/common/includes/GPS/gps.h b/src/common/includes/GPS/gps.h
index 768ade1..ec5ec77 100644
--- a/src/common/includes/GPS/gps.h
+++ b/src/common/includes/GPS/gps.h
@@ -35,10 +35,10 @@
*/
// Setup communication and GPS receiver
-void gps_init();
+void gps_init(void);
// Return 1 of the GPS is receiving time
-int gps_locked();
+int gps_locked(void);
// Get current time from GPS
// Returns 1 if time is valid, 0 otherwise
diff --git a/src/common/src/Audio/cw.c b/src/common/src/Audio/cw.c
index e4a04f5..1922469 100644
--- a/src/common/src/Audio/cw.c
+++ b/src/common/src/Audio/cw.c
@@ -37,8 +37,10 @@
#include "Audio/cw.h"
#include "Core/common.h"
#include "Audio/audio.h"
+#include <string.h>
#ifdef SIMULATOR
+#include <math.h>
#define arm_cos_f32 cosf
#define arm_sin_f32 sinf
#else
@@ -461,7 +463,7 @@ static struct cw_message_s cw_fill_msg_current;
// Routine to generate CW audio
static float cw_generate_audio_ampl = 0.0f;
static float cw_generate_audio_nco = 0.0f;
-static int16_t cw_generate_audio(float omega, int i, int t)
+static int16_t cw_generate_audio(float omega, int i, int __attribute__ ((unused))t)
{
int16_t s = 0;
// Remove clicks from CW
@@ -516,7 +518,7 @@ static int16_t psk31_generate_audio(float omega, int i, int t, int samples_per_s
}
#endif
-static void cw_psk31_task(void *pvParameters)
+static void cw_psk31_task(void __attribute__ ((unused))*pvParameters)
{
int buf_pos = 0;
diff --git a/src/common/src/Core/common.c b/src/common/src/Core/common.c
index 77d3360..d231569 100644
--- a/src/common/src/Core/common.c
+++ b/src/common/src/Core/common.c
@@ -161,7 +161,7 @@ void common_init(void)
lfsr = lfsr_start_state;
}
-static void common_increase_timestamp(TimerHandle_t t)
+static void common_increase_timestamp(TimerHandle_t __attribute__ ((unused))t)
{
#ifdef SIMULATOR
diff --git a/src/common/src/Core/fsm.c b/src/common/src/Core/fsm.c
index d2c95f6..03180e0 100644
--- a/src/common/src/Core/fsm.c
+++ b/src/common/src/Core/fsm.c
@@ -23,6 +23,7 @@
*/
#include <string.h>
+#include <stdint.h>
#include "Core/common.h"
#include "Core/fsm.h"
#include "GPIO/usart.h"
diff --git a/src/common/src/Core/main.c b/src/common/src/Core/main.c
index 6a546a1..75a444a 100644
--- a/src/common/src/Core/main.c
+++ b/src/common/src/Core/main.c
@@ -64,9 +64,9 @@ static void launcher_task(void *pvParameters);
// Audio callback function
static void audio_callback(void* context, int select_buffer);
-void vApplicationStackOverflowHook( TaskHandle_t xTask,
- signed char *pcTaskName )
-{
+void vApplicationStackOverflowHook(TaskHandle_t, signed char *);
+
+void vApplicationStackOverflowHook(TaskHandle_t __attribute__ ((unused)) xTask, signed char *pcTaskName) {
usart_debug("TASK OVERFLOW %s\r\n", pcTaskName);
while (1) {};
}
@@ -107,7 +107,7 @@ int main(void) {
}
-static void test_task(void *pvParameters) {
+static void test_task(void __attribute__ ((unused))*pvParameters) {
int i = 0;
@@ -129,7 +129,7 @@ static void test_task(void *pvParameters) {
// Launcher task is here to make sure the scheduler is
// already running when calling the init functions.
-static void launcher_task(void *pvParameters)
+static void launcher_task(void __attribute__ ((unused))*pvParameters)
{
usart_debug_puts("CW init\r\n");
cw_psk31_init(16000);
@@ -227,7 +227,7 @@ static void launcher_task(void *pvParameters)
}
-static void detect_button_press(void *pvParameters)
+static void detect_button_press(void __attribute__ ((unused))*pvParameters)
{
int pin_high_count = 0;
int last_pin_high_count = 0;
@@ -270,7 +270,7 @@ static void detect_button_press(void *pvParameters)
}
}
-static void audio_callback(void* context, int select_buffer) {
+static void audio_callback(void __attribute__ ((unused))*context, int select_buffer) {
static int16_t audio_buffer0[AUDIO_BUF_LEN];
static int16_t audio_buffer1[AUDIO_BUF_LEN];
int16_t *samples;
@@ -300,7 +300,7 @@ static void audio_callback(void* context, int select_buffer) {
}
static struct tm gps_time;
-static void gps_monit_task(void *pvParameters) {
+static void gps_monit_task(void __attribute__ ((unused))*pvParameters) {
leds_turn_on(LED_BLUE);
@@ -355,7 +355,7 @@ static void gps_monit_task(void *pvParameters) {
}
static struct fsm_input_signals_t fsm_input;
-static void exercise_fsm(void *pvParameters)
+static void exercise_fsm(void __attribute__ ((unused))*pvParameters)
{
int cw_last_trigger = 0;
int last_tm_trigger = 0;
diff --git a/src/common/src/GPS/gps.c b/src/common/src/GPS/gps.c
index 568a181..a1fb043 100644
--- a/src/common/src/GPS/gps.c
+++ b/src/common/src/GPS/gps.c
@@ -65,7 +65,7 @@ int gps_utctime(struct tm *timeutc) {
#define RXBUF_LEN MAX_NMEA_SENTENCE_LEN
static char rxbuf[RXBUF_LEN];
-static void gps_task(void *pvParameters) {
+static void gps_task(void __attribute__ ((unused))*pvParameters) {
// Periodically reinit the GPS
while (1) {
taskYIELD();
diff --git a/src/glutt-o-logique/Makefile b/src/glutt-o-logique/Makefile
index 6762514..b7c2b9a 100644
--- a/src/glutt-o-logique/Makefile
+++ b/src/glutt-o-logique/Makefile
@@ -40,7 +40,24 @@ MCFLAGS=-mcpu=cortex-m4 -mthumb -mlittle-endian \
# COMPILE FLAGS
DEFS=-DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DARM_MATH_CM4 -D__FPU_PRESENT=1
-CFLAGS =-Wall -ggdb -std=c99 -c $(MCFLAGS) $(DEFS) $(INCLUDES)
+CWARNS += -Wextra
+CWARNS += -Wformat
+CWARNS += -Wmissing-braces
+CWARNS += -Wno-cast-align
+CWARNS += -Wparentheses
+CWARNS += -Wshadow
+CWARNS += -Wno-sign-compare
+CWARNS += -Wswitch
+CWARNS += -Wuninitialized
+CWARNS += -Wunknown-pragmas
+CWARNS += -Wunused-function
+CWARNS += -Wunused-label
+CWARNS += -Wunused-parameter
+CWARNS += -Wunused-value
+CWARNS += -Wunused-variable
+CWARNS += -Wmissing-prototypes
+
+CFLAGS =-Wall $(CWARNS) -ggdb -std=c99 -c $(MCFLAGS) $(DEFS) $(INCLUDES)
# LINKER FLAGS
LDSCRIPT= $(SRCDIR)/bsp/stm32_flash.ld
LDFLAGS =-T $(LDSCRIPT) --specs=nosys.specs $(MCFLAGS) -Wl,-Map=$(BINDIR)/outp.map
@@ -101,17 +118,20 @@ debug: LDFLAGS+=-g
debug: release
$(BINDIR)/$(BINHEX): $(BINDIR)/$(BINELF)
- $(CP) -O ihex $< $@
+ @$(CP) -O ihex $< $@
+ @echo "[CP] $@"
+ @echo "[:)] Happiness :)"
$(BINDIR)/$(BINELF): vc.h $(OBJECTS)
- $(CC) $(LDFLAGS) $(OBJECTS) -o $@
- $(SIZE) $(BINDIR)/$(BINELF)
+ @$(CC) $(LDFLAGS) $(OBJECTS) -o $@
+ @echo "[CC] $@"
+ @$(SIZE) $(BINDIR)/$(BINELF)
dir_guard=@mkdir -p $(@D)
obj/%.o: %.c $(HEADERS)
$(dir_guard)
- @echo [CC] $<
+ @echo "[CC] $<"
@$(CC) $(CFLAGS) $< -o $@
obj/%.o: %.s $(HEADERS)
@@ -120,14 +140,16 @@ obj/%.o: %.s $(HEADERS)
@$(CC) $(CFLAGS) $< -o $@
vc.h: ../../.git/logs/HEAD
- echo "// This file is generated by Makefile." > vc.h
- echo "// Do not edit this file!" >> vc.h
- git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h
- echo >> vc.h
- echo >> vc.h
+ @echo "// This file is generated by Makefile." > vc.h
+ @echo "// Do not edit this file!" >> vc.h
+ @git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h
+ @echo >> vc.h
+ @echo >> vc.h
+ @echo [EC] vc.h
clean:
- rm -f $(OBJECTS) $(BINDIR)/$(BINELF) $(BINDIR)/$(BINHEX)
+ @rm -f $(OBJECTS) $(BINDIR)/$(BINELF) $(BINDIR)/$(BINHEX)
+ @echo "[RM] Cleanuped °o°"
# Connect to openocd's gdb server on port 3333
deploy: $(BINDIR)/$(BINELF)
diff --git a/src/glutt-o-logique/audio.c b/src/glutt-o-logique/audio.c
index bf41169..0576d30 100644
--- a/src/glutt-o-logique/audio.c
+++ b/src/glutt-o-logique/audio.c
@@ -29,7 +29,7 @@
static void audio_write_register(uint8_t address, uint8_t value);
-void audio_initialize_platform(int plln, int pllr, int i2sdiv, int i2sodd, int rate) {
+void audio_initialize_platform(int plln, int pllr, int i2sdiv, int i2sodd, int __attribute__ ((unused)) rate) {
GPIO_InitTypeDef GPIO_InitStructure;
diff --git a/src/glutt-o-logique/common.c b/src/glutt-o-logique/common.c
index d089091..ed3a3a8 100644
--- a/src/glutt-o-logique/common.c
+++ b/src/glutt-o-logique/common.c
@@ -24,6 +24,7 @@
#include <stm32f4xx.h>
#include "GPIO/usart.h"
+#include "Core/common.h"
void hard_fault_handler_c(uint32_t *hardfault_args)
{
diff --git a/src/glutt-o-logique/cw.c b/src/glutt-o-logique/cw.c
index c362f6a..417359f 100644
--- a/src/glutt-o-logique/cw.c
+++ b/src/glutt-o-logique/cw.c
@@ -23,6 +23,7 @@
*/
#include "GPIO/usart.h"
+#include "Audio/cw.h"
// Function to display message in GUI, unused on STM32 firmware
void cw_message_sent(const char* str) {
diff --git a/src/glutt-o-logique/debug.c b/src/glutt-o-logique/debug.c
index 2e33a32..0c12c8b 100644
--- a/src/glutt-o-logique/debug.c
+++ b/src/glutt-o-logique/debug.c
@@ -69,9 +69,10 @@ void debug_print(const char* str)
}
#else
-void debug_send_command(int command, void *message) { }
-void put_char(char c) { }
-void debug_print(const char* str) { }
+void USART3_IRQHandler(void);
+void debug_send_command(int __attribute__ ((unused))command, void __attribute__ ((unused))*message) { }
+void put_char(char __attribute__ ((unused))c) { }
+void debug_print(const char __attribute__ ((unused))*str) { }
#endif
diff --git a/src/glutt-o-logique/debug.h b/src/glutt-o-logique/debug.h
index 6215e5f..59d0a84 100644
--- a/src/glutt-o-logique/debug.h
+++ b/src/glutt-o-logique/debug.h
@@ -43,5 +43,9 @@ send_command(0x05, m);
/* Print a string to the OpenOCD console */
void debug_print(const char* str);
+
+void debug_send_command(int, void*);
+void put_char(char);
+
#endif // __DEBUG_H_
diff --git a/src/glutt-o-logique/ds18b20/tm_stm32f4_onewire.h b/src/glutt-o-logique/ds18b20/tm_stm32f4_onewire.h
index 9b14109..f906566 100644
--- a/src/glutt-o-logique/ds18b20/tm_stm32f4_onewire.h
+++ b/src/glutt-o-logique/ds18b20/tm_stm32f4_onewire.h
@@ -290,6 +290,10 @@ uint8_t TM_OneWire_CRC8(uint8_t* addr, uint8_t len);
/**
* @}
*/
+
+int TM_OneWire_Verify(TM_OneWire_t*);
+void TM_OneWire_TargetSetup(TM_OneWire_t*, uint8_t);
+void TM_OneWire_FamilySkipSetup(TM_OneWire_t*);
/* C++ detection */
#ifdef __cplusplus
diff --git a/src/glutt-o-logique/main.c b/src/glutt-o-logique/main.c
index 6d4597e..8152926 100644
--- a/src/glutt-o-logique/main.c
+++ b/src/glutt-o-logique/main.c
@@ -26,6 +26,8 @@
#include "leds.h"
+void init(void);
+
void init() {
/* Initialise the onboard peripherals
* Four LEDs and one push-button
diff --git a/src/glutt-o-logique/pio.c b/src/glutt-o-logique/pio.c
index c003881..b389a0b 100644
--- a/src/glutt-o-logique/pio.c
+++ b/src/glutt-o-logique/pio.c
@@ -125,7 +125,7 @@ void pio_set_fsm_signals(struct fsm_input_signals_t* sig)
*sig = pio_signals;
}
-void read_fsm_input_task(void *pvParameters)
+void read_fsm_input_task(void __attribute__ ((unused))*pvParameters)
{
while (1) {
pio_signals.qrp =
diff --git a/src/glutt-o-logique/temperature.c b/src/glutt-o-logique/temperature.c
index b9f7d87..2ca5f5c 100644
--- a/src/glutt-o-logique/temperature.c
+++ b/src/glutt-o-logique/temperature.c
@@ -42,6 +42,11 @@ const TickType_t _temperature_delay = 60000 / portTICK_PERIOD_MS; // 60s
static TM_OneWire_t tm_onewire;
+void ds18b20_init(void);
+int ds18b20_gettemp(float*);
+int ds18b20_gettemp_one(float*);
+
+
void ds18b20_init() {
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
@@ -97,7 +102,7 @@ int ds18b20_gettemp(float *temperature) {
return status;
}
-void temperature_task(void *pvParameters) {
+void temperature_task(void __attribute__ ((unused))*pvParameters) {
while (1) {
diff --git a/src/glutt-o-logique/usart.c b/src/glutt-o-logique/usart.c
index 4bef27a..0b02ec5 100644
--- a/src/glutt-o-logique/usart.c
+++ b/src/glutt-o-logique/usart.c
@@ -39,6 +39,10 @@ const uint16_t GPIOA_PIN_USART2_TX = GPIO_Pin_2;
#include "../common/includes/GPIO/usart.h"
+void USART2_IRQHandler(void);
+void USART3_IRQHandler(void);
+
+
void usart_init() {
// ============== PC DEBUG USART ===========
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
diff --git a/src/simulator/Makefile b/src/simulator/Makefile
index 6593f73..ba2cc92 100644
--- a/src/simulator/Makefile
+++ b/src/simulator/Makefile
@@ -55,23 +55,23 @@ OBJS = $(patsubst %.c,%.o,$(C_FILES))
CWARNS += -W
CWARNS += -Wall
# CWARNS += -Werror
-# CWARNS += -Wextra
-# CWARNS += -Wformat
-# CWARNS += -Wmissing-braces
-# CWARNS += -Wno-cast-align
-# CWARNS += -Wparentheses
-# CWARNS += -Wshadow
-# CWARNS += -Wno-sign-compare
-# CWARNS += -Wswitch
-# CWARNS += -Wuninitialized
-# CWARNS += -Wunknown-pragmas
-# CWARNS += -Wunused-function
-# CWARNS += -Wunused-label
-# CWARNS += -Wunused-parameter
-# CWARNS += -Wunused-value
-# CWARNS += -Wunused-variable
-# CWARNS += -Wmissing-prototypes
-#
+CWARNS += -Wextra
+CWARNS += -Wformat
+CWARNS += -Wmissing-braces
+CWARNS += -Wno-cast-align
+CWARNS += -Wparentheses
+CWARNS += -Wshadow
+CWARNS += -Wno-sign-compare
+CWARNS += -Wswitch
+CWARNS += -Wuninitialized
+CWARNS += -Wunknown-pragmas
+CWARNS += -Wunused-function
+CWARNS += -Wunused-label
+CWARNS += -Wunused-parameter
+CWARNS += -Wunused-value
+CWARNS += -Wunused-variable
+CWARNS += -Wmissing-prototypes
+
CFLAGS += -m32
CFLAGS += -DDEBUG=1
CFLAGS += -g -DUSE_STDIO=1 -D__GCC_POSIX__=1 -lX11 -lm -lGL -lm -lGLU -lpulse-simple -lpulse
@@ -105,36 +105,32 @@ $(ODIR)/%.o: %.c
$(dir_guard)
# If verbose, print gcc execution, else hide
ifeq ($(verbose),1)
- @echo ">> Compiling $<"
+ @echo "[CC] $<"
$(CC) $(CFLAGS) -c -o $@ $<
else
- @echo ">> Compiling $(notdir $<)"
+ @echo "[CC] $(notdir $<)"
@$(CC) $(CFLAGS) -c -o $@ $<
endif
vc.h: ../../.git/logs/HEAD
- echo "// This file is generated by Makefile." > vc.h
- echo "// Do not edit this file!" >> vc.h
- git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h
- echo >> vc.h
- echo >> vc.h
+ @echo "// This file is generated by Makefile." > vc.h
+ @echo "// Do not edit this file!" >> vc.h
+ @git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h
+ @echo >> vc.h
+ @echo >> vc.h
+ @echo [EC] vc.h
FreeRTOS-Sim: $(_OBJS)
- @echo ">> Linking $@..."
+ @echo "[LK] $@"
ifeq ($(verbose),1)
$(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@
else
@$(CC) $(CFLAGS) $^ $(LINKFLAGS) $(LIBS) -o $@
endif
-
- @echo "-------------------------"
- @echo "BUILD COMPLETE: $@"
- @echo "-------------------------"
+ @echo "[:)] Happiness :)"
.PHONY : clean
clean:
- @-rm -rf $(ODIR) FreeRTOS-Sim
- @echo "--------------"
- @echo "CLEAN COMPLETE"
- @echo "--------------"
+ @-rm -rf $(ODIR) FreeRTOS-Sim common/
+ @echo "[RM] Cleanuped °o°"