Reduce unused function warnings

This commit is contained in:
Scott Lahteine 2019-08-06 04:46:30 -05:00
parent 1fe195926f
commit fb579212ea
11 changed files with 71 additions and 34 deletions

View file

@ -114,9 +114,12 @@ void HAL_init(void);
inline void HAL_clear_reset_source(void) { MCUSR = 0; } inline void HAL_clear_reset_source(void) { MCUSR = 0; }
inline uint8_t HAL_get_reset_source(void) { return MCUSR; } inline uint8_t HAL_get_reset_source(void) { return MCUSR; }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
} }
#pragma GCC diagnostic pop
// timers // timers
#define HAL_TIMER_RATE ((F_CPU) / 8) // i.e., 2MHz or 2.5MHz #define HAL_TIMER_RATE ((F_CPU) / 8) // i.e., 2MHz or 2.5MHz

View file

@ -156,12 +156,16 @@ void HAL_init(void);
// Utility functions // Utility functions
// //
void _delay_ms(const int delay); void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void); int freeMemory(void);
#pragma GCC diagnostic pop
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
char *dtostrf (double __val, signed char __width, unsigned char __prec, char *__s); char *dtostrf(double __val, signed char __width, unsigned char __prec, char *__s);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -92,7 +92,10 @@ uint8_t HAL_get_reset_source(void);
void _delay_ms(int delay); void _delay_ms(int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void); int freeMemory(void);
#pragma GCC diagnostic pop
void analogWrite(pin_t pin, int value); void analogWrite(pin_t pin, int value);

View file

@ -81,7 +81,10 @@ extern HalSerial usb_serial;
inline void HAL_init(void) { } inline void HAL_init(void) { }
// Utility functions // Utility functions
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void); int freeMemory(void);
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
/** Write single byte to specified SPI channel */ /** Write single byte to specified SPI channel */

View file

@ -111,7 +111,10 @@ extern "C" volatile uint32_t _millis;
// //
// Utility functions // Utility functions
// //
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void); int freeMemory(void);
#pragma GCC diagnostic pop
// //
// SPI: Extended functions taking a channel number (Hardware SPI only) // SPI: Extended functions taking a channel number (Hardware SPI only)

View file

@ -132,11 +132,17 @@ void noTone(const pin_t _pin);
// Enable hooks into idle and setup for HAL // Enable hooks into idle and setup for HAL
void HAL_init(void); void HAL_init(void);
/*#define HAL_IDLETASK 1 /*
void HAL_idletask(void);*/ #define HAL_IDLETASK 1
void HAL_idletask(void);
*/
// //
// Utility functions // Utility functions
// //
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void); int freeMemory(void);
#pragma GCC diagnostic pop

View file

@ -136,7 +136,7 @@ typedef int16_t pin_t;
// Public Variables // Public Variables
// ------------------------ // ------------------------
/** result of last ADC conversion */ // result of last ADC conversion
extern uint16_t HAL_adc_result; extern uint16_t HAL_adc_result;
// ------------------------ // ------------------------
@ -149,30 +149,35 @@ extern uint16_t HAL_adc_result;
// Enable hooks into setup for HAL // Enable hooks into setup for HAL
void HAL_init(void); void HAL_init(void);
/** clear reset reason */ // Clear reset reason
void HAL_clear_reset_source (void); void HAL_clear_reset_source (void);
/** reset reason */ // Reset reason
uint8_t HAL_get_reset_source(void); uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay); void _delay_ms(const int delay);
extern "C" char* _sbrk(int incr); extern "C" char* _sbrk(int incr);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static inline int freeMemory() { static inline int freeMemory() {
volatile char top; volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
#pragma GCC diagnostic pop
// //
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
// //
/** Write single byte to specified SPI channel */ // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n); void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
// //
@ -182,8 +187,8 @@ uint8_t spiRec(uint32_t chan);
// Wire library should work for i2c EEPROMs // Wire library should work for i2c EEPROMs
void eeprom_write_byte(uint8_t *pos, unsigned char value); void eeprom_write_byte(uint8_t *pos, unsigned char value);
uint8_t eeprom_read_byte(uint8_t *pos); uint8_t eeprom_read_byte(uint8_t *pos);
void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_read_block(void *__dst, const void *__src, size_t __n);
void eeprom_update_block (const void *__src, void *__dst, size_t __n); void eeprom_update_block(const void *__src, void *__dst, size_t __n);
// //
// ADC // ADC

View file

@ -158,7 +158,7 @@ typedef int8_t pin_t;
// Public Variables // Public Variables
// ------------------------ // ------------------------
/** result of last ADC conversion */ // Result of last ADC conversion
extern uint16_t HAL_adc_result; extern uint16_t HAL_adc_result;
// ------------------------ // ------------------------
@ -174,14 +174,17 @@ extern uint16_t HAL_adc_result;
// Memory related // Memory related
#define __bss_end __bss_end__ #define __bss_end __bss_end__
/** clear reset reason */ // Clear reset reason
void HAL_clear_reset_source(void); void HAL_clear_reset_source(void);
/** reset reason */ // Reset reason
uint8_t HAL_get_reset_source(void); uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay); void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/* /*
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
@ -189,6 +192,7 @@ extern "C" {
*/ */
extern "C" char* _sbrk(int incr); extern "C" char* _sbrk(int incr);
/* /*
static int freeMemory() { static int freeMemory() {
volatile int top; volatile int top;
@ -197,9 +201,6 @@ static int freeMemory() {
} }
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int freeMemory() { static int freeMemory() {
volatile char top; volatile char top;
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
@ -211,11 +212,11 @@ static int freeMemory() {
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
// //
/** Write single byte to specified SPI channel */ // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n); void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
// //

View file

@ -37,7 +37,7 @@
#include <stdint.h> #include <stdint.h>
#ifdef defined(STM32F4) && USBCON #if defined(STM32F4) && USBCON
#include <USBSerial.h> #include <USBSerial.h>
#endif #endif
@ -100,8 +100,6 @@
#define NUM_SERIAL 1 #define NUM_SERIAL 1
#endif #endif
#define _BV(b) (1 << (b))
/** /**
* TODO: review this to return 1 for pins that are not analog input * TODO: review this to return 1 for pins that are not analog input
*/ */
@ -142,7 +140,7 @@ typedef int8_t pin_t;
// Public Variables // Public Variables
// ------------------------ // ------------------------
/** result of last ADC conversion */ // Result of last ADC conversion
extern uint16_t HAL_adc_result; extern uint16_t HAL_adc_result;
// ------------------------ // ------------------------
@ -154,14 +152,17 @@ extern uint16_t HAL_adc_result;
inline void HAL_init(void) { } inline void HAL_init(void) { }
/** clear reset reason */ // Clear reset reason
void HAL_clear_reset_source (void); void HAL_clear_reset_source (void);
/** reset reason */ // Reset reason
uint8_t HAL_get_reset_source(void); uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay); void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/* /*
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
@ -183,15 +184,17 @@ static int freeMemory() {
return &top - reinterpret_cast<char*>(_sbrk(0)); return &top - reinterpret_cast<char*>(_sbrk(0));
} }
#pragma GCC diagnostic pop
// //
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
// //
/** Write single byte to specified SPI channel */ // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n); void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
// //

View file

@ -97,9 +97,12 @@ uint8_t HAL_get_reset_source(void);
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
} }
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)

View file

@ -95,24 +95,27 @@ typedef int8_t pin_t;
inline void HAL_init(void) { } inline void HAL_init(void) { }
/** clear reset reason */ // Clear reset reason
void HAL_clear_reset_source(void); void HAL_clear_reset_source(void);
/** reset reason */ // Reset reason
uint8_t HAL_get_reset_source(void); uint8_t HAL_get_reset_source(void);
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" { extern "C" {
int freeMemory(void); int freeMemory(void);
} }
#pragma GCC diagnostic pop
// SPI: Extended functions which take a channel number (hardware SPI only) // SPI: Extended functions which take a channel number (hardware SPI only)
/** Write single byte to specified SPI channel */ // Write single byte to specified SPI channel
void spiSend(uint32_t chan, byte b); void spiSend(uint32_t chan, byte b);
/** Write buffer to specified SPI channel */ // Write buffer to specified SPI channel
void spiSend(uint32_t chan, const uint8_t* buf, size_t n); void spiSend(uint32_t chan, const uint8_t* buf, size_t n);
/** Read single byte from specified SPI channel */ // Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan); uint8_t spiRec(uint32_t chan);
// ADC // ADC