TimerProcess: make some variables uint8_t

save a couple of bytes
This commit is contained in:
Andrew Tridgell 2011-12-27 07:24:36 +11:00
parent d3679e5f92
commit dbaa6fb6d2
4 changed files with 10 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#include "AP_PeriodicProcessStub.h" #include "AP_PeriodicProcessStub.h"
AP_PeriodicProcessStub::AP_PeriodicProcessStub(int period) {} AP_PeriodicProcessStub::AP_PeriodicProcessStub(uint8_t period) {}
void AP_PeriodicProcessStub::init( Arduino_Mega_ISR_Registry * isr_reg ){} void AP_PeriodicProcessStub::init( Arduino_Mega_ISR_Registry * isr_reg ){}
void AP_PeriodicProcessStub::register_process(ap_procedure proc) {} void AP_PeriodicProcessStub::register_process(ap_procedure proc) {}
void AP_PeriodicProcessStub::set_failsafe(ap_procedure proc) {} void AP_PeriodicProcessStub::set_failsafe(ap_procedure proc) {}

View File

@ -9,13 +9,13 @@
class AP_PeriodicProcessStub : public AP_PeriodicProcess class AP_PeriodicProcessStub : public AP_PeriodicProcess
{ {
public: public:
AP_PeriodicProcessStub(int period = 0); AP_PeriodicProcessStub(uint8_t period = 0);
void init( Arduino_Mega_ISR_Registry * isr_reg ); void init( Arduino_Mega_ISR_Registry * isr_reg );
void register_process(ap_procedure proc); void register_process(ap_procedure proc);
void set_failsafe(ap_procedure proc); void set_failsafe(ap_procedure proc);
static void run(void); static void run(void);
protected: protected:
static int _period; static uint8_t _period;
static void (*_proc)(void); static void (*_proc)(void);
static void (*_failsafe)(void); static void (*_failsafe)(void);
}; };

View File

@ -1,3 +1,4 @@
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#include "AP_TimerProcess.h" #include "AP_TimerProcess.h"
@ -8,13 +9,13 @@ extern "C" {
#include <avr/interrupt.h> #include <avr/interrupt.h>
} }
int AP_TimerProcess::_period; uint8_t AP_TimerProcess::_period;
ap_procedure AP_TimerProcess::_proc[AP_TIMERPROCESS_MAX_PROCS]; ap_procedure AP_TimerProcess::_proc[AP_TIMERPROCESS_MAX_PROCS];
ap_procedure AP_TimerProcess::_failsafe; ap_procedure AP_TimerProcess::_failsafe;
bool AP_TimerProcess::_in_timer_call; bool AP_TimerProcess::_in_timer_call;
int AP_TimerProcess::_pidx = 0; uint8_t AP_TimerProcess::_pidx = 0;
AP_TimerProcess::AP_TimerProcess(int period) AP_TimerProcess::AP_TimerProcess(uint8_t period)
{ {
_period = period; _period = period;
} }

View File

@ -13,16 +13,16 @@
class AP_TimerProcess : public AP_PeriodicProcess class AP_TimerProcess : public AP_PeriodicProcess
{ {
public: public:
AP_TimerProcess(int period = TIMERPROCESS_PER_DEFAULT); AP_TimerProcess(uint8_t period = TIMERPROCESS_PER_DEFAULT);
void init( Arduino_Mega_ISR_Registry * isr_reg ); void init( Arduino_Mega_ISR_Registry * isr_reg );
void register_process(ap_procedure proc); void register_process(ap_procedure proc);
void set_failsafe(ap_procedure proc); void set_failsafe(ap_procedure proc);
static void run(void); static void run(void);
protected: protected:
static int _period; static uint8_t _period;
static ap_procedure _proc[AP_TIMERPROCESS_MAX_PROCS]; static ap_procedure _proc[AP_TIMERPROCESS_MAX_PROCS];
static ap_procedure _failsafe; static ap_procedure _failsafe;
static int _pidx; static uint8_t _pidx;
static bool _in_timer_call; static bool _in_timer_call;
}; };