1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-23 12:04:19 +00:00

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 uint8_t HAL_get_reset_source(void) { return MCUSR; }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// timers
#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
//
void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
#ifdef __cplusplus
extern "C" {
#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
}
#endif

View File

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

View File

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

View File

@ -111,7 +111,10 @@ extern "C" volatile uint32_t _millis;
//
// Utility functions
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
int freeMemory(void);
#pragma GCC diagnostic pop
//
// 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
void HAL_init(void);
/*#define HAL_IDLETASK 1
void HAL_idletask(void);*/
/*
#define HAL_IDLETASK 1
void HAL_idletask(void);
*/
//
// Utility functions
//
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);
#pragma GCC diagnostic pop

View File

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

View File

@ -158,7 +158,7 @@ typedef int8_t pin_t;
// Public Variables
// ------------------------
/** result of last ADC conversion */
// Result of last ADC conversion
extern uint16_t HAL_adc_result;
// ------------------------
@ -174,14 +174,17 @@ extern uint16_t HAL_adc_result;
// Memory related
#define __bss_end __bss_end__
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source(void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
void _delay_ms(const int delay);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
/*
extern "C" {
int freeMemory(void);
@ -189,6 +192,7 @@ extern "C" {
*/
extern "C" char* _sbrk(int incr);
/*
static int freeMemory() {
volatile int top;
@ -197,9 +201,6 @@ static int freeMemory() {
}
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static int freeMemory() {
volatile char top;
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)
//
/** Write single byte to specified SPI channel */
// Write single byte to specified SPI channel
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);
/** Read single byte from specified SPI channel */
// Read single byte from specified SPI channel
uint8_t spiRec(uint32_t chan);
//

View File

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

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); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// 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) { }
/** clear reset reason */
// Clear reset reason
void HAL_clear_reset_source(void);
/** reset reason */
// Reset reason
uint8_t HAL_get_reset_source(void);
FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
extern "C" {
int freeMemory(void);
}
#pragma GCC diagnostic pop
// 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);
/** Write buffer to specified SPI channel */
// Write buffer to specified SPI channel
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);
// ADC