Всем здравствуйте, объясните пожалуйста строку в коде
digitalWrite(row?PIN_LOAD2:PIN_LOAD, LOW); // что означает???
сам код
const unsigned char fnt5x7[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,//SPC
0x04,0x04,0x04,0x04,0x04,0x00,0x04,//!
0x0A,0x0A,0x00,0x00,0x00,0x00,0x00,//"
0x0A,0x0A,0x1F,0x0A,0x1F,0x0A,0x0A,//#
0x04,0x0F,0x14,0x0E,0x05,0x1E,0x04,//$
0x18,0x19,0x02,0x04,0x08,0x13,0x03,//%
0x08,0x14,0x14,0x08,0x15,0x12,0x0D,//&
0x0C,0x0C,0x04,0x08,0x00,0x00,0x00,//'
0x02,0x04,0x04,0x04,0x04,0x04,0x02,//(
0x08,0x04,0x04,0x04,0x04,0x04,0x08,//)
0x00,0x0A,0x04,0x1F,0x04,0x0A,0x00,//*
0x00,0x04,0x04,0x1F,0x04,0x04,0x00,//+
0x00,0x00,0x00,0x18,0x18,0x08,0x10,//,
0x00,0x00,0x00,0x1F,0x00,0x00,0x00,//-
0x00,0x00,0x00,0x00,0x00,0x0C,0x0C,//.
0x00,0x01,0x02,0x04,0x08,0x10,0x00,///
0x0E,0x11,0x13,0x15,0x19,0x11,0x0E,//0
//0x1E,0x05,0x1E,0x00,0x1F,0x14,0x1C,
0x04,0x0C,0x04,0x04,0x04,0x04,0x0E,//1
0x0E,0x11,0x01,0x06,0x08,0x10,0x1F,//2
0x0E,0x11,0x01,0x0E,0x01,0x11,0x0E,//3
0x02,0x06,0x0A,0x12,0x1F,0x02,0x02,//4
0x1F,0x10,0x1E,0x01,0x01,0x01,0x1E,//5
0x06,0x08,0x10,0x1E,0x11,0x11,0x0E,//6
0x1F,0x01,0x02,0x04,0x08,0x08,0x08,//7
0x0E,0x11,0x11,0x0E,0x11,0x11,0x0E,//8
0x0E,0x11,0x11,0x0F,0x01,0x02,0x0C,//9
0x00,0x0C,0x0C,0x00,0x0C,0x0C,0x00,//:
0x0C,0x0C,0x00,0x0C,0x0C,0x04,0x08,//;
0x01,0x02,0x04,0x08,0x04,0x02,0x01,//<
0x00,0x00,0x1F,0x00,0x1F,0x00,0x00,//=
0x10,0x08,0x04,0x02,0x04,0x08,0x10,//>
0x0E,0x11,0x01,0x02,0x04,0x00,0x04,//?
0x0E,0x11,0x17,0x15,0x17,0x10,0x0E,//@
0x0E,0x11,0x11,0x1F,0x11,0x11,0x11,//A
0x1E,0x11,0x11,0x1E,0x1E,0x11,0x1E,//B
0x0E,0x11,0x10,0x10,0x10,0x11,0x0E,//C
0x1E,0x11,0x11,0x11,0x11,0x11,0x1E,//D
0x1F,0x10,0x10,0x1E,0x10,0x10,0x1F,//E
0x1F,0x10,0x10,0x1E,0x10,0x10,0x10,//F
0x0E,0x11,0x10,0x10,0x13,0x11,0x0E,//G
0x11,0x11,0x11,0x1F,0x11,0x11,0x11,//H
0x1E,0x04,0x04,0x04,0x04,0x04,0x1E,//I
0x01,0x01,0x01,0x01,0x01,0x11,0x0E,//J
0x11,0x12,0x14,0x18,0x14,0x12,0x11,//K
0x10,0x10,0x10,0x10,0x10,0x10,0x1F,//L
0x11,0x1B,0x15,0x15,0x11,0x11,0x11,//M
0x11,0x11,0x19,0x15,0x13,0x11,0x11,//N
0x0E,0x11,0x11,0x11,0x11,0x11,0x0E,//O
0x1E,0x11,0x11,0x1E,0x10,0x10,0x10,//P
0x0E,0x11,0x11,0x11,0x15,0x12,0x0D,//Q
0x1E,0x11,0x11,0x1E,0x14,0x12,0x11,//R
0x0E,0x11,0x10,0x0E,0x01,0x11,0x0E,//S
0x1F,0x04,0x04,0x04,0x04,0x04,0x04,//T
0x11,0x11,0x11,0x11,0x11,0x11,0x0E,//U
0x11,0x11,0x11,0x0A,0x0A,0x04,0x04,//V
0x11,0x11,0x11,0x15,0x15,0x1B,0x11,//W
0x11,0x11,0x0A,0x04,0x0A,0x11,0x11,//X
0x11,0x11,0x0A,0x04,0x04,0x04,0x04,//Y
0x1F,0x01,0x02,0x04,0x08,0x10,0x1F,//Z
0x07,0x04,0x04,0x04,0x04,0x04,0x07,//[
0x00,0x10,0x08,0x04,0x02,0x01,0x00,// SLASH
0x1C,0x04,0x04,0x04,0x04,0x04,0x1C,//]
0x04,0x0E,0x15,0x04,0x04,0x04,0x04,//^
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,//_
0x0C,0x0C,0x08,0x04,0x00,0x00,0x00,//'
0x00,0x00,0x0E,0x12,0x12,0x12,0x0D,//a
0x10,0x10,0x10,0x16,0x19,0x11,0x1E,//b
0x00,0x00,0x0E,0x10,0x10,0x11,0x0E,//c
0x01,0x01,0x01,0x0D,0x13,0x11,0x0F,//d
0x00,0x00,0x0E,0x11,0x1E,0x10,0x0E,//e
0x04,0x0A,0x08,0x1C,0x08,0x08,0x08,//f
0x00,0x00,0x0F,0x11,0x0F,0x01,0x06,//g
0x10,0x10,0x16,0x19,0x11,0x11,0x11,//h
0x00,0x04,0x00,0x0C,0x04,0x04,0x0E,//i
0x02,0x00,0x06,0x02,0x02,0x12,0x0C,//j
0x10,0x10,0x12,0x14,0x18,0x14,0x12,//k
0x0C,0x04,0x04,0x04,0x04,0x04,0x0E,//l
0x00,0x00,0x0A,0x15,0x11,0x11,0x11,//m
0x00,0x00,0x16,0x19,0x11,0x11,0x11,//n
0x00,0x00,0x0E,0x11,0x11,0x11,0x0E,//o
0x00,0x00,0x0E,0x11,0x19,0x16,0x10,//p
0x00,0x00,0x0F,0x11,0x13,0x0D,0x01,//q
0x00,0x00,0x0B,0x0C,0x08,0x08,0x08,//r
0x00,0x00,0x0E,0x10,0x0E,0x01,0x1E,//s
0x08,0x08,0x1C,0x08,0x08,0x0A,0x04,//t
0x00,0x00,0x11,0x11,0x11,0x13,0x0D,//u
0x00,0x00,0x11,0x11,0x11,0x0A,0x04,//v
0x00,0x00,0x11,0x11,0x15,0x15,0x0A,//w
0x00,0x00,0x11,0x0A,0x04,0x0A,0x11,//x
0x00,0x00,0x11,0x0A,0x04,0x04,0x08,//y
0x00,0x00,0x1F,0x02,0x04,0x08,0x1F,//z
0x02,0x04,0x04,0x08,0x04,0x04,0x02,//{
0x04,0x04,0x04,0x00,0x04,0x04,0x04,//|
0x08,0x04,0x04,0x02,0x04,0x04,0x08,//}
0x00,0x00,0x08,0x15,0x02,0x00,0x00,//~
0x0A,0x15,0x0A,0x15,0x0A,0x15,0x0A //
};
//LED screen pins definitions
#define PIN_LOAD 6
#define PIN_DATA 7
#define PIN_CLK 5
#define PIN_RESET 2
#define PIN_INT_OC 3
#define PIN_LOAD2 4
//LED screen commands
#define CMD_CLEAR 0b11000000 //clear display
#define CMD_BR_BRIGHT 0b11101111 //100% brightness
#define CMD_BR_MED 0b11101001 //50% brightness
#define CMD_BR_DIM 0b11100001 //13% brightness
#define CMD_DIG_ADR 0b10100000 //digit adress mask
//
#define SCR_BUF_LEN 7
//Icons defines
#define ICN_R0_ENVELOPE 0x1
#define ICN_R0_GREEN 0x2
#define ICN_R0_RED 0x4
#define ICN_R0_YELLOW 0x8
#define ICN_RO_BAR_0 0x10
#define ICN_RO_BAR_1 0x20
#define ICN_RO_BAR_2 0x40
#define ICN_RO_BAR_3 0x80
#define ICN_RO_BAR_4 0x100
#define ICN_R1_BATTERY 0x8001
#define ICN_R1_SIG_0 0x8002
#define ICN_R1_SIG_1 0x8004
#define ICN_R1_SIG_2 0x8008
#define ICN_R1_BOOK 0x8010
#define ICN_R1_CLOCK 0x8020
#define ICN_R1_BELL 0x8040
#define ICN_R1_LOCK 0x8080
#define ICN_R1_PHONE 0x8100
const unsigned char str[]="TATUAJ - 120 ming, MANIKYUR - 80 ming, ";
unsigned char scr_buf[ SCR_BUF_LEN ] = {' ',' ',' ',' ',' ',' ',' '};
//-----------------------------------------------------------
// Send byte to LED screen
//-----------------------------------------------------------
void led_tx_byte( uint8_t data,uint8_t row )
{
uint8_t i;
//digitalWrite(PIN_LOAD2, LOW);
//PIN_LOAD = 0;
digitalWrite(row?PIN_LOAD2:PIN_LOAD, LOW);
for( i=0; i<8; i++ )
{
delayMicroseconds(1);
digitalWrite(PIN_CLK, LOW);
//PIN_CLK = 0;
if( data & (1<<i) )
digitalWrite(PIN_DATA, HIGH);
//PIN_DATA = 1;
else
digitalWrite(PIN_DATA, LOW);
//PIN_DATA = 0;
delayMicroseconds(1);
digitalWrite(PIN_CLK, HIGH);
//PIN_CLK = 1;
delayMicroseconds(1);
}
digitalWrite(row?PIN_LOAD2:PIN_LOAD, HIGH);
digitalWrite(PIN_CLK, LOW);
delayMicroseconds(1);
}
//-----------------------------------------------------------
// Print single char
// Arguments:
//char,
//symbol position(0-7)
//Row 0,1
//-----------------------------------------------------------
void led_putchar( uint8_t c, uint8_t adr ,uint8_t row)
{
uint8_t i;
const uint8_t *fnt_ptr;
led_tx_byte( adr | CMD_DIG_ADR,row);
c -= ' ';
fnt_ptr = &fnt5x7[ ((uint16_t)c)*7 ];
for( i=0; i<7; i++ )
{
led_tx_byte( *fnt_ptr++ & 0x1F,row);
};
}
void led_puticon_i(uint16_t c,uint8_t row)
{
led_tx_byte( 7 | CMD_DIG_ADR,row);
led_tx_byte( c & 0x1F,row);
led_tx_byte( 0,row);
led_tx_byte( (c>>4)&0x1F,row);
}
void led_puticon(uint16_t icon)
{
led_puticon_i(icon&0x7FFF,(icon&0x8000)!=0);
}
void led_putstring(const char *str,uint8_t row)
{
uint8_t i=0;
while(i<7 && str[i]!=NULL)
{
led_putchar( str[i], i,row);
i++;
}
}
//-----------------------------------------------------------
// Send scr_buf to LED screen
//-----------------------------------------------------------
void led_update()
{
uint8_t i;
for( i=0; i<SCR_BUF_LEN; i++ )
{
led_putchar( scr_buf[i], i,1);
};
led_putstring("=XUMOR=",0);
}
//-----------------------------------------------------------
// Shift string buffer left
//-----------------------------------------------------------
void buf_shift( void )
{
uint8_t i;
for( i=0; i<(SCR_BUF_LEN-1); i++ )
{
scr_buf[ i ] = scr_buf[ i+1 ];
};
scr_buf[ SCR_BUF_LEN-1 ] = ' ';
}
//-----------------------------------------------------------
// Scroll text buf string for 1 char
//-----------------------------------------------------------
void buf_scroll( void )
{
static unsigned char str_cnt = 0;
buf_shift();
if( str_cnt < (sizeof(str)-1) )
{
scr_buf[ SCR_BUF_LEN-1 ] = str[ str_cnt++ ];
}
else
{
str_cnt = 0;
};
}
void setup() {
pinMode(PIN_LOAD, OUTPUT);
pinMode(PIN_DATA, OUTPUT);
pinMode(PIN_CLK, OUTPUT);
pinMode(PIN_RESET, OUTPUT);
pinMode(PIN_INT_OC,OUTPUT);
pinMode(PIN_LOAD2,OUTPUT);
digitalWrite(PIN_RESET, HIGH);
digitalWrite(PIN_INT_OC, HIGH);
//LED screen init
led_tx_byte( CMD_CLEAR,0);
led_tx_byte( CMD_CLEAR,1);
led_tx_byte( CMD_BR_BRIGHT,0); //You can set brightness per row
led_tx_byte( CMD_BR_BRIGHT,1); //You can set brightness per row
//led_tx_byte( CMD_BR_DIM,1);
}
void loop() {
delay( 100 );
buf_scroll();
led_update();
//Each row has to be on a different call to led_puticon
//led_puticon(ICN_R0_RED|ICN_R0_YELLOW|ICN_R0_GREEN|ICN_RO_BAR_2);
//led_puticon(ICN_R1_SIG_0|ICN_R1_BATTERY|ICN_R1_SIG_1);
}