- Wed Jul 01, 2015 5:16 am
#183047
Hi
Last 8 months I developed an AVR framework for the Atmega 328p (for your Arduino uno board).
(my framework is easily adaptable for other uC too...)
This is work in progress project, I want to finish Gyro, Gps, and pwm input class for Drone application, but actually the framework is 100% ok for multiple electronics projects.
It contain this class:
Timer.h:
AVR : 158 bytes / (691 ms -> 1000000 pin toggling)
If you are interested, contact me for download
Or develop your own framework
Last 8 months I developed an AVR framework for the Atmega 328p (for your Arduino uno board).
(my framework is easily adaptable for other uC too...)
This is work in progress project, I want to finish Gyro, Gps, and pwm input class for Drone application, but actually the framework is 100% ok for multiple electronics projects.
It contain this class:
Code: Select all
Class contain this fonction:#include "../framework/Timer.h"
#include "../framework/Button.h"
#include "../framework/Led.h"
#include "../framework/LedDigit.h"
#include "../framework/LedMatrix8x8.h"
#include "../framework/LedMatrix64x64.h"
#include "../framework/Iteration.h"
#include "../framework/Random.h"
#include "../framework/Interrupt.h"
#include "../framework/Potentiometer.h"
#include "../framework/Math.h"
#include "../framework/Buzzer.h"
#include "../framework/Memory.h"
#include "../framework/Servo.h"
Timer.h:
Code: Select all
Button.h:
Timer (const uint32_t DURATION);
static void start();
static void pause (const uint32_t DURATION);
void state();
void set (const uint32_t DURATION);
void reset();
static void stop();
Code: Select all
Led.h:
Button (uint8_t PIN, bool PULL_UP_INTERNAL);
void state();
Code: Select all
LedDigit.h:
Led (const uint8_t PIN);
void toggle();
void on();
void off();
Code: Select all
LedMatrix8x8.h:
LedDigit (const uint8_t PIN_SS, const uint8_t PIN_MOSI, const uint8_t PIN_SCK, const uint8_t DEVICE);
void scanLimit (const uint8_t LIMIT);
void brightness (const uint8_t BRIGHTNESS);
void digit (const uint8_t DIGIT, const bool COMMA, const uint8_t POSITION);
void number (const int32_t NUMBER, const uint8_t POSITION_MIN, const uint8_t POSITION_MAX, const uint8_t DIGIT_AFTER_COMMA, const bool SIDE);
void character (const char *CHARACTER, const uint8_t ADDRESS);
void word (const char *CHARACTER1, const char *CHARACTER2, const char *CHARACTER3, const char *CHARACTER4, const char *CHARACTER5, const char *CHARACTER6, const char *CHARACTER7, const char *CHARACTER8);
void draw (const uint8_t DRAW, const uint8_t POSITION);
void clearDigit (const uint8_t POSITION);
void clearDevice();
Code: Select all
LedMatrix64x64.h:
LedMatrix8x8 (const uint8_t PIN_SS, const uint8_t PIN_MOSI, const uint8_t PIN_SCK, const uint8_t DEVICE);
void scanLimit (const uint8_t LIMIT);
void brightness (const uint8_t BRIGHTNESS);
void dot (const uint8_t X, const uint8_t Y);
void draw (const uint8_t DRAW, const uint8_t Y);
void clearY (const uint8_t Y);
void clearDevice();
Code: Select all
Iteration.h:
LedMatrix64x64 (const uint8_t PIN_SS, const uint8_t PIN_MOSI1, const uint8_t PIN_MOSI2, const uint8_t PIN_MOSI3, const uint8_t PIN_MOSI4, const uint8_t PIN_MOSI5, const uint8_t PIN_MOSI6, const uint8_t PIN_MOSI7, const uint8_t PIN_MOSI8, const uint8_t PIN_SCK);
void scanLimit (const uint8_t LIMIT);
void brightness (const uint8_t BRIGHTNESS);
void dot (const uint8_t X, const uint8_t Y);
void draw (const uint64_t DRAW, const uint8_t Y);
void clearY (const uint8_t Y);
void clearDevice();
Code: Select all
Random.h:
Iteration (const int32_t START, const int32_t MIN, const int32_t MAX, const bool LOOP);
void increment (const int32_t INCREMENT);
void decrement (const int32_t DECREMENT);
void set (const int32_t VALUE);
void reset();
void min (const int32_t MIN);
void max (const int32_t MAX);
void loop (const bool LOOP);
Code: Select all
Interrupt.h:
static void seed (const uint8_t PIN);
static bool boolean();
static int32_t integer (const int32_t MIN, const int32_t MAX);
Code: Select all
Potentiometer.h:
Interrupt (const uint8_t PIN);
void start (void functionCall(), const bool FALLING);
void stop();
Code: Select all
Math.h:
Potentiometer (const uint8_t PIN);
void state();
int32_t curve (const uint16_t POTENTIOMETER_START, const uint16_t POTENTIOMETER_END, const int32_t INTERPOLATION_START, const int32_t INTERPOLATION_END, const int8_t CURVE);
int32_t smooth (const uint16_t POTENTIOMETER_START, const uint16_t POTENTIOMETER_END, const int32_t INTERPOLATION_START, const int32_t INTERPOLATION_END, const int8_t CURVE);
Code: Select all
Buzzer.h:
static int32_t curve (const int32_t POSITION_START, const int32_t POSITION_CURRENT, const int32_t POSITION_END, const int32_t INTERPOLATION_START, const int32_t INTERPOLATION_END, const uint8_t CURVE);
static int32_t smooth (const int32_t POSITION_START, const int32_t POSITION_CURRENT, const int32_t POSITION_END, const int32_t INTERPOLATION_START, const int32_t INTERPOLATION_END, const uint8_t CURVE);
Code: Select all
Memory.h:
static void start (const uint8_t PIN);
static void play (const uint16_t FREQUENCY, const uint32_t DURATION);
static void playInfinite (const uint16_t FREQUENCY);
static void modulate (const uint16_t FREQUENCY);
static void key (const uint16_t FREQUENCY, const uint32_t DURATION);
static void playMelody();
static void stop();
Code: Select all
Servo.h:
static void write8Bit (const uint16_t ADDRESS, const uint8_t DATA);
static void write16Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2, const uint16_t DATA);
static void write32Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2, const uint16_t ADDRESS3, const uint16_t ADDRESS4, uint32_t DATA);
static uint8_t read8Bit (const uint16_t ADDRESS);
static uint16_t read16Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2);
static uint32_t read32Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2, const uint16_t ADDRESS3, const uint16_t ADDRESS4);
static void erase8Bit (const uint16_t ADDRESS);
static void erase16Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2);
static void erase32Bit (const uint16_t ADDRESS1, const uint16_t ADDRESS2, const uint16_t ADDRESS3, const uint16_t ADDRESS4);
static void eraseAll();
Code: Select all
BLINK (.INO) BENCHMARK Servo (const uint8_t PIN, const uint16_t PULSE_MIN, const uint16_t PULSE_MAX);
static void start (const uint16_t FREQUENCY);
void min (const uint16_t PULSE_MIN);
void center (const uint16_t PULSE_CENTER);
void max (const uint16_t PULSE_MAX);
void pulse (const uint16_t PULSE);
void move10Bit (const uint16_t BIT);
void movePercentage (const uint8_t PERCENTAGE);
void moveMin();
void moveCenter();
void moveMax();
AVR : 158 bytes / (691 ms -> 1000000 pin toggling)
Code: Select all
My AVR framework : 378 bytes / (753 ms -> 1000000 pin toggling)
#include "avr/io.h"
#include "util/delay.h"
using namespace std;
int main()
{
DDRD |= 0b00000001;
while (true)
{
PIND = 0b00000001;
_delay_ms (1000);
}
return 0;
}
Code: Select all
Arduino framework : 1076 bytes / (4550 ms -> 1000000 pin toggling)
#include "../framework/Led.h"
#include "../framework/Timer.h"
using namespace std;
int main()
{
Led led = Led (1);
while (true)
{
led.toggle();
Timer::pause (1000);
}
return 0;
}
Code: Select all
Benchmarking blink is really basic, but my all framework as verified like this, optimised and tested line per line, logical bloc per logical bloc, fonction per fonction.void setup()
{
pinMode (0, OUTPUT);
}
void loop()
{
digitalWrite (0, HIGH);
delay (1000);
digitalWrite (0, LOW);
delay (1000);
}
If you are interested, contact me for download
Or develop your own framework