本文整理汇总了C++中write_command函数的典型用法代码示例。如果您正苦于以下问题:C++ write_command函数的具体用法?C++ write_command怎么用?C++ write_command使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了write_command函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _draw_char
inline static void _draw_char(int c, uint32_t x, uint32_t y, uint16_t fore, uint16_t back) {
uint32_t i, j;
uint8_t line;
unsigned char *p = (unsigned char *) cp437_font + (c * (int) FONT_CHAR_H);
uint16_t buffer[FONT_CHAR_H * FONT_CHAR_W];
uint16_t *q = buffer;
for (i = 0; i < FONT_CHAR_H; i++) {
line = (uint8_t) *p++;
for (j = 0; j < FONT_CHAR_W; j++) {
if ((line & 0x1) != 0) {
*q = __builtin_bswap16(fore);
} else {
*q = __builtin_bswap16(back);
}
line >>= 1;
q++;
}
}
write_command(0x2A);
write_data_word(x);
write_data_word(x + FONT_CHAR_H - 1);
write_command(0x2B);
write_data_word(y);
write_data_word(y + FONT_CHAR_W - 1);
write_command(0x2C);
bcm2835_spi_writenb((char *) buffer, 2 * FONT_CHAR_H * FONT_CHAR_W);
}
示例2: Display_Clear_Rect
void Display_Clear_Rect(unsigned int x, unsigned int y, unsigned int w, unsigned int h, unsigned int co)
{
int i, j;
write_command(0x2a);
write_data(x>>8&0xff);write_data(x&0xff);
x += w -1;
write_data(x>>8&0xff);write_data(x&0xff);
write_command(0x2b);
write_data((y)>>8&0xff);write_data((y)&0xff);
y += h - 1;
write_data((y)>>8&0xff);write_data((y)&0xff);
write_command(0x2C);
for (j=0; j<h; j++) {
for (i=0; i<w; i++) {
LCD_DataWrite(co>>8&0xff, co&0xff);
}
}
#if 0
write_command(0x2a);
write_data(0);write_data(0);
write_data(W>>8&0xff);write_data(W&0xff);
write_command(0x2b);
write_data(0);write_data(0);
write_data(H>>8&0XFF);write_data(H);
#endif
}
示例3: LCD_ExitSleep_ILI9340C
void LCD_ExitSleep_ILI9340C(void)
{
write_command(0x11);//Exit Sleep
delay(120);
write_command(0x29);//Display on
write_command(0x2C);
}
示例4: main
void main(){
init_lcd();
clear_screen();
choose_screen(1);
write_command(x|0);
write_command(y|0);
write_data(0x01<<0);
while(1);
}
示例5: addset
void addset(unsigned int x,unsigned int y)
{
write_command(ILI9341_CASET); // Column addr set
wr_com16(x>>8,x);
write_command(ILI9341_PASET); // Row addr set
wr_com16(y>>8,y);
write_command(ILI9341_RAMWR); // write to RAM
}
示例6: Address_set
void Address_set (unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2)
{
write_command (0x2a); // x -axis
write_data (x1);
write_data (x2);
write_command(0x2b); // y -axis
write_data (y1);
write_data (y2);
write_command(0x2c);
}
示例7: clear_screen
void clear_screen(){
unsigned char x,y;
choose_screen(0);
for(x=0xb8;x<0xc0;x++){
write_command(x);
write_command(0x40);
for(y=0;y<64;y++){
write_data(0);
}
}
}
示例8: ili9340_clear
void ili9340_clear(void) {
write_command(0x2A);
write_data_word(0);
write_data_word(239);
write_command(0x2B);
write_data_word(0);
write_data_word(319);
write_command(0x2C);
bcm2835_spi_writenb((char *) buffer, 2 * ILI9340_HEIGHT * ILI9340_WIDTH);
}
示例9: hokuyo_init
int hokuyo_init(HokuyoLaser* hokuyoLaser){
if (hokuyoLaser->fd<=0){
return -1;
}
#ifdef HOKUYO_ALWAYS_IN_SCIP20
fprintf(stderr, "\nAssuming laser is already in SCIP2.0 mode!\n");
fprintf(stderr, " (if the dirver hangs, either your Hokuyo has the old\n");
fprintf(stderr, " firmware or you have to disable -DHOKUYO_ALWAYS_IN_SCIP20\n");
fprintf(stderr, " in the Makefile of the laser driver)\n");
hokuyoLaser->isContinuous=0;
hokuyoLaser->isProtocol2=1;
#else
// stop the device anyhow
fprintf(stderr, "Stopping the device... ");
write_command(hokuyoLaser,HK_QUIT);
write_command(hokuyoLaser,HK_QUIT);
write_command(hokuyoLaser,HK_QUIT);
fprintf(stderr, "done\n");
hokuyoLaser->isContinuous=0;
// The UTM-30LX functions only in SCIP2.0 Mode, as do some URG's
fprintf(stderr, "Switching to enhanced mode (SCIP2.0)... ");
fprintf(stderr, " (if the dirver hangs you probably configured your Hokuyo\n");
fprintf(stderr, " so that SCIP is alwas on. IN this case, enable the Option\n");
fprintf(stderr, " CFLAGS += -DHOKUYO_ALWAYS_IN_SCIP20\n");
fprintf(stderr, " in the Makefile of the laser driver)\n");
int status=hokuyo_readStatus(hokuyoLaser, HK_SCIP,1);
if (status==0){
fprintf(stderr, "\nSwitching to SCIP 2.0 was successful!\n");
hokuyoLaser->isProtocol2=1;
} else {
fprintf(stderr, "Error. Unable to switch to SCIP2.0 Mode, please upgrade the firmware of your device.\n");
return -1;
}
#endif
fprintf(stderr, "Device initialized successfully\n");
hokuyoLaser->isInitialized=1;
hokuyo_readStatus(hokuyoLaser, "\nVV\n", 1);
hokuyo_readStatus(hokuyoLaser, "\nPP\n", 1);
hokuyo_readStatus(hokuyoLaser, "\nII\n", 1);
return 1;
}
示例10: Display_Clear
void Display_Clear(unsigned int co)
{
unsigned char i,j;
write_command(0x2a);
write_data(0x00);write_data(0x00);
write_command(0x2b);
write_data(0x00);write_data(0x00);
write_command(0x2C);
for (i=0;i<H;i++)
for (j=0;j<W;j++)
LCD_DataWrite(co>>8&0xff, co&0xff);
}
示例11: main
int main(int argc, char** argv) {
if (argc < 3) {
printf("Usage: jattach <pid> <cmd> <args> ...\n");
return 1;
}
int pid = atoi(argv[1]);
if (!check_socket(pid) && !start_attach_mechanism(pid)) {
printf("Could not start attach mechanism\n");
return 1;
}
int fd = connect_socket(pid);
if (fd == -1) {
printf("Could not connect to socket\n");
return 1;
}
printf("Connected to remote JVM\n");
write_command(fd, argc - 2, argv + 2);
printf("Response code = ");
read_response(fd);
printf("\n");
close(fd);
return 0;
}
示例12: main
int main(int argc,char *argv[])
{
if(argc < 3) return usage(argc, argv);
// set and check device name
char* tmp=argv[1];
if(strcmp(tmp,"1") && strcmp(tmp,"2")) return usage(argc, argv);
char devname[12];
sprintf(devname, "/dev/schar%s",tmp);
printf("devname %s\n",devname);
int commandnum = atoi( argv[2] );
printf("commandnum=%d\n",commandnum);
int adrnum = 0;
if (argc > 3){
adrnum = atoi( argv[3] );
printf("adrnum=%02x\n",adrnum);
}
// open device
eth_open(devname);
eth_register_mac();
int e=write_command(commandnum,adrnum);
// close device
eth_close();
return e;
}
示例13: ili9340_draw_pixel
void ili9340_draw_pixel(uint16_t x, uint16_t y, uint16_t color) {
if (x >= ILI9340_HEIGHT)
return;
if (y >= ILI9340_WIDTH)
return;
write_command(0x2A);
write_data_word(x);
write_data_word(x);
write_command(0x2B);
write_data_word(y);
write_data_word(y);
write_command(0x2C);
write_data_word(color);
}
示例14: process_command
void process_command(char *command)
{
char *token;
char *search = " ";
strtok(command, "\n");
token = strtok(command, search);
if (strcmp(token, "download") == 0) {
token = strtok(NULL, search);
int download_id = atoi(token);
if (in_download_range(download_id)) {
printf("Downloading %i", download_id);
write_command(download_id);
current_download = download_id;
global_state = GotIndex;
}
else {
printf("Log ID %i outside available range\n", download_id);
need_input = true;
}
}
else if (strcmp(token, "exit") == 0) {
keep_running = false;
}
else {
printf("Possible commands:\n"
" download <lognumber>\n"
" help\n"
" exit\n");
need_input = true;
}
}
示例15: adjust_time
int adjust_time()
{
long heure_serveur, heure_locale;
int res,code;
char *buf;
Date_offset=0;
write_command(CMD_DATE, 0, NULL);
res=read_server_with_reconnect(tcp_line_read, 3, MAX_READ_SIZE-1);
if (debug) fprintf(stderr,"Yo :%s\n",tcp_line_read);
if (res<0) return -1;
buf=strchr(tcp_line_read,' ');
code = time(NULL);
if (buf) {
code=strtol(buf+9,&buf,10);
heure_serveur=code %100 + 60*(((code/100)%100) + 60*(((code/10000)%100)));
} else
heure_serveur=code;
heure_locale=time(NULL);
/* heure_locale = mktime(gmtime(&heure_locale))%86400; */
Date_offset = ((heure_serveur - heure_locale)%86400);
if (Date_offset > 43200) Date_offset = Date_offset - 86400;
if (Date_offset < -43200) Date_offset = Date_offset + 86400;
if (debug)
fprintf(stderr,"Yu :%ld %ld %d\n",heure_serveur,
heure_locale,Date_offset);
return 0;
}