دوستان این کد رو کسی میتونه بفمه به من توضیح بده
تورو خدا کمکم کنید
[code=c]#include "wav/DPCMAllDigits.h"
#include "wav/volts.h"
#include "wav/point.h"
#include "wav/ready.h"
#include "wav/beeplow.h"
#include "wav/beephigh.h"
#include "wav/samples.h"
#include "wav/over.h"
#include "wav/low.h"
#include "wav/mean.h"
#include "wav/high.h"
#include "wav/breakfast.h"
#include "wav/hz.h"
#include "wav/nosignal.h"
enum Table_enum {
Volts_e = 100, Point_e, AllDigits_e, Ready_e, Beeplow_e, Beephigh_e, High_e, Low_e, Mean_e, Over_e, Samples_e, Breakfast_e, Hz_e, Nosignal_e
};
#define QUEUESIZE 32
//queue at bottom
//Says the enum passed
void say_index(unsigned char i)
{
// turn off PWM
TCCR0B = 0;
//init the output indexes
outI = 0;
tableI = 0;
switch(i)
{
case Volts_e:
TableSize = VOLTS_SIZE;
CurrentTable = Volts_e;
break;
case Point_e:
TableSize = POINT_SIZE;
CurrentTable = Point_e;
break;
case AllDigits_e:
TableSize = ALLDIGITS_SIZE;
CurrentTable = AllDigits_e;
break;
case Ready_e:
TableSize = READY_SIZE;
CurrentTable = Ready_e;
break;
case Beeplow_e:
TableSize = BEEPLOW_SIZE;
CurrentTable = Beeplow_e;
break;
case Beephigh_e:
TableSize = BEEPHIGH_SIZE;
CurrentTable = Beephigh_e;
break;
case High_e:
TableSize = HIGH_SIZE;
CurrentTable = High_e;
break;
case Low_e:
TableSize = LOW_SIZE;
CurrentTable = Low_e;
break;
case Mean_e:
TableSize = MEAN_SIZE;
CurrentTable = Mean_e;
break;
case Samples_e:
TableSize = SAMPLES_SIZE;
CurrentTable = Samples_e;
break;
case Over_e:
TableSize = OVER_SIZE;
CurrentTable = Over_e;
break;
case Breakfast_e:
TableSize = BREAKFAST_SIZE;
CurrentTable = Breakfast_e;
break;
case Hz_e:
TableSize = HZ_SIZE;
CurrentTable = Hz_e;
break;
case Nosignal_e:
TableSize = NOSIGNAL_SIZE;
CurrentTable = Nosignal_e;
break;
default:
TableSize = 0;
break;
}
//init the ouptut value
lastout = 0;
// turn on PWM
TCCR0B = 1;
}
//Says a specific number
void say_num(unsigned char n)
{
// turn off PWM
TCCR0B = 0;
//init the output indexes
outI = 0;
switch(n)
{
case 0:
tableI = START_0;
TableSize = START_1;
break;
case 1:
tableI = START_1;
TableSize = START_2;
break;
case 2:
tableI = START_2;
TableSize = START_3;
break;
case 3:
tableI = START_3;
TableSize = START_4;
break;
case 4:
tableI = START_4;
TableSize = START_5;
break;
case 5:
tableI = START_5;
TableSize = START_6;
break;
case 6:
tableI = START_6;
TableSize = START_7;
break;
case 7:
tableI = START_7;
TableSize = START_8;
break;
case 8:
tableI = START_8;
TableSize = START_9;
break;
case 9:
tableI = START_9;
TableSize = ALLDIGITS_SIZE;
break;
default:
return;
break;
}
//init the ouptut value
lastout = 0;
//set table to volts
CurrentTable = AllDigits_e;
// turn on PWM
TCCR0B = 1;
}
//say a value
void say(unsigned char i)
{
if(i < 10)
say_num(i);
else
say_index(i);
}
unsigned char queue[QUEUESIZE];
unsigned char head = 0, tail = 0;
//head = next to say; tail = next pos to place object
//if head == tail, queue is empty.
void clear_say()
{
tail = head;
TCCR0B = 0;
}
//add index to queue
void add_say(unsigned char i)
{
queue[tail] = i;
tail = (tail+1)%QUEUESIZE;
TCCR0B = 1;
}
//starts the next voice in the queue
void say_next()
{
if(head != tail)
{
say(queue[head]);
head = (head+1)%QUEUESIZE;
}
}
void add_num(unsigned char *str)
{
for (int i = 0; str[i] != 0; i++)
{
if(str[i] == 0x2E)
add_say(Point_e);
else
add_say(str[i]-0x30);
}
}
[/code]
تورو خدا کمکم کنید
[code=c]#include "wav/DPCMAllDigits.h"
#include "wav/volts.h"
#include "wav/point.h"
#include "wav/ready.h"
#include "wav/beeplow.h"
#include "wav/beephigh.h"
#include "wav/samples.h"
#include "wav/over.h"
#include "wav/low.h"
#include "wav/mean.h"
#include "wav/high.h"
#include "wav/breakfast.h"
#include "wav/hz.h"
#include "wav/nosignal.h"
enum Table_enum {
Volts_e = 100, Point_e, AllDigits_e, Ready_e, Beeplow_e, Beephigh_e, High_e, Low_e, Mean_e, Over_e, Samples_e, Breakfast_e, Hz_e, Nosignal_e
};
#define QUEUESIZE 32
//queue at bottom
//Says the enum passed
void say_index(unsigned char i)
{
// turn off PWM
TCCR0B = 0;
//init the output indexes
outI = 0;
tableI = 0;
switch(i)
{
case Volts_e:
TableSize = VOLTS_SIZE;
CurrentTable = Volts_e;
break;
case Point_e:
TableSize = POINT_SIZE;
CurrentTable = Point_e;
break;
case AllDigits_e:
TableSize = ALLDIGITS_SIZE;
CurrentTable = AllDigits_e;
break;
case Ready_e:
TableSize = READY_SIZE;
CurrentTable = Ready_e;
break;
case Beeplow_e:
TableSize = BEEPLOW_SIZE;
CurrentTable = Beeplow_e;
break;
case Beephigh_e:
TableSize = BEEPHIGH_SIZE;
CurrentTable = Beephigh_e;
break;
case High_e:
TableSize = HIGH_SIZE;
CurrentTable = High_e;
break;
case Low_e:
TableSize = LOW_SIZE;
CurrentTable = Low_e;
break;
case Mean_e:
TableSize = MEAN_SIZE;
CurrentTable = Mean_e;
break;
case Samples_e:
TableSize = SAMPLES_SIZE;
CurrentTable = Samples_e;
break;
case Over_e:
TableSize = OVER_SIZE;
CurrentTable = Over_e;
break;
case Breakfast_e:
TableSize = BREAKFAST_SIZE;
CurrentTable = Breakfast_e;
break;
case Hz_e:
TableSize = HZ_SIZE;
CurrentTable = Hz_e;
break;
case Nosignal_e:
TableSize = NOSIGNAL_SIZE;
CurrentTable = Nosignal_e;
break;
default:
TableSize = 0;
break;
}
//init the ouptut value
lastout = 0;
// turn on PWM
TCCR0B = 1;
}
//Says a specific number
void say_num(unsigned char n)
{
// turn off PWM
TCCR0B = 0;
//init the output indexes
outI = 0;
switch(n)
{
case 0:
tableI = START_0;
TableSize = START_1;
break;
case 1:
tableI = START_1;
TableSize = START_2;
break;
case 2:
tableI = START_2;
TableSize = START_3;
break;
case 3:
tableI = START_3;
TableSize = START_4;
break;
case 4:
tableI = START_4;
TableSize = START_5;
break;
case 5:
tableI = START_5;
TableSize = START_6;
break;
case 6:
tableI = START_6;
TableSize = START_7;
break;
case 7:
tableI = START_7;
TableSize = START_8;
break;
case 8:
tableI = START_8;
TableSize = START_9;
break;
case 9:
tableI = START_9;
TableSize = ALLDIGITS_SIZE;
break;
default:
return;
break;
}
//init the ouptut value
lastout = 0;
//set table to volts
CurrentTable = AllDigits_e;
// turn on PWM
TCCR0B = 1;
}
//say a value
void say(unsigned char i)
{
if(i < 10)
say_num(i);
else
say_index(i);
}
unsigned char queue[QUEUESIZE];
unsigned char head = 0, tail = 0;
//head = next to say; tail = next pos to place object
//if head == tail, queue is empty.
void clear_say()
{
tail = head;
TCCR0B = 0;
}
//add index to queue
void add_say(unsigned char i)
{
queue[tail] = i;
tail = (tail+1)%QUEUESIZE;
TCCR0B = 1;
}
//starts the next voice in the queue
void say_next()
{
if(head != tail)
{
say(queue[head]);
head = (head+1)%QUEUESIZE;
}
}
void add_num(unsigned char *str)
{
for (int i = 0; str[i] != 0; i++)
{
if(str[i] == 0x2E)
add_say(Point_e);
else
add_say(str[i]-0x30);
}
}
[/code]
دیدگاه