Exemple #1
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_switchcpu(int timeout, int mode)
{
	if (!mode) {
		char buf[]={0xa5,0x0a,0x42,0x71,timeout};
		fp_write(buf,5);
	}
	else {
		char buf[]={0xa5,0x0a,0x42,0x7a,timeout};
		fp_write(buf,5);
	}
}
Exemple #2
0
status_t g1_write_str(g1_t g, uint8_t *data, int data_len)
{
	if(g == NULL) return ELEMENT_UNINITIALIZED;
	if(data_len < G1_LEN*2) return ELEMENT_INVALID_ARG_LEN;
	char *d = (char *) data;

	int len = FP_BYTES*2+1;

	fp_write(d, len, g->x, BASE);
	fp_write(&(d[len]), len, g->y, BASE);

	return ELEMENT_OK;
}
Exemple #3
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_display_data(char *data, int l)
{
	char buf[64]={0xa5,0x05,l+2,+1};
	memcpy(buf+4,data,l);
	fp_write(buf,l+4);
	u_sleep(3000);
}
Exemple #4
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_eeprom_flash(int a, int d)
{
        char buf[]={0xa5,0x14,0,0};
        buf[2]=a;
        buf[3]=d;
        fp_write(buf,4);
}
Exemple #5
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_led_brightness(int v)
{
	char buf[]={0xa5,0x10,0,0,0,0};
	buf[2]=v&255;
	buf[3]=(v>>8)&255;
	buf[4]=(v>>16)&255;
	buf[5]=(v>>24)&255;
	fp_write(buf,6);
}
Exemple #6
0
status_t g2_write_str(g2_t g, uint8_t *data, int data_len)
{
	if(g == NULL) return ELEMENT_UNINITIALIZED;
	int G2_STR = G2_LEN*4;
	if(data_len < G2_STR) return ELEMENT_INVALID_ARG_LEN;
	char *d = (char *) data;

	int len = FP_BYTES*2 + 1;
	fp_write(d, len, g->x[0], BASE);
	d += len;
	fp_write(d, len, g->x[1], BASE);
	d += len;
	fp_write(d, len, g->y[0], BASE);
	d += len;
	fp_write(d, len, g->y[1], BASE);

	return ELEMENT_OK;
}
Exemple #7
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_power_control(int v)
{
        char buf[]={0xa5,0x12,0,0,0,0};
        buf[2]=v&255;
        buf[3]=(v>>8)&255;
        buf[4]=(v>>16)&255;
        buf[5]=(v>>24)&255;
        fp_write(buf,6);
}
Exemple #8
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_clock(void)
{
	time_t t;
	struct tm tm;
	t=time(0);
	localtime_r(&t,&tm);
	{
		char buf[]={0xa5,0x7,tm.tm_hour,tm.tm_min,tm.tm_sec,
			    t>>24,t>>16,t>>8,t};
		fp_write(buf,9);
	}
}
Exemple #9
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_clear_display(void)
{
	char buf[]={0xa5,0x04};
	fp_write(buf,2);
}
Exemple #10
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_display_contrast(int n)
{
	char buf[]={0xa5,0x03,n,00};
	fp_write(buf,4);
}
Exemple #11
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_display_brightness(int n)
{
	char buf[]={0xa5,0x02,n,00};
	fp_write(buf,4);
}
Exemple #12
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_enable_messages(int n)
{
	char buf[]={0xa5,0x01,n};
	fp_write(buf,3);
}
Exemple #13
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_get_version(void)
{
	char buf[]={0xa5,0x00,0x00};
	fp_write(buf,3);
}
Exemple #14
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_noop(void)
{
	char buf[]={0xa6};
	
	fp_write(buf,1);
}
Exemple #15
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_wakeup(time_t t)
{
	char buf[]={0xa5,0x08,t>>24,t>>16,t>>8,t};
	fp_write(buf,6);
}
Exemple #16
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_clock_adjust(int v1, int v2)
{
	char buf[]={0xa5,0x0a,v1,v2};
	fp_write(buf,4);
}
Exemple #17
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_get_key(void)
{
	char buf[]={0xa5,0x0f};
	fp_write(buf,2);
}
Exemple #18
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_get_wakeup(void)
{
	char buf[]={0xa5,0x0e};
	fp_write(buf,2);
}
Exemple #19
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_get_clock(void)
{
	char buf[]={0xa5,0x0b};
	fp_write(buf,2);
}
Exemple #20
0
// Ignore, use display_cmd or display_data instead
void frontpanel_rs232::fp_write_display(unsigned char *data, int datalen)
{
	char buf[]={0xa5,0x05};
	fp_write(buf,2);
	fp_write((char*)data,datalen);
}
Exemple #21
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_leds(int blink, int state)
{
	char buf[]={0xa5,0x06,blink,state};
	fp_write(buf,4);
}
Exemple #22
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_get_flags(void)
{
	char buf[]={0xa5,0x11};
	fp_write(buf,2);
}
Exemple #23
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_set_displaymode(int m)
{
	char buf[]={0xa5,0x09,m};
	fp_write(buf,3);
}
Exemple #24
0
status_t gt_write_str(gt_t g, uint8_t *data, int data_len)
{
	if(g == NULL) return ELEMENT_UNINITIALIZED;
	if(data_len < GT_LEN*3) return ELEMENT_INVALID_ARG_LEN;

	int len = FP_BYTES*2 + 1;
	char *d1 = (char *) data;

	// write the x-coordinate
	fp_write(d1, len, g[0][0][0], BASE);
	d1 += len;
	fp_write(d1, len, g[0][0][1], BASE);
	d1 += len;
	fp_write(d1, len, g[0][1][0], BASE);
	d1 += len;
	fp_write(d1, len, g[0][1][1], BASE);
	d1 += len;
	fp_write(d1, len, g[0][2][0], BASE);
	d1 += len;
	fp_write(d1, len, g[0][2][1], BASE);
	d1 += len;
	fp_write(d1, len, g[1][0][0], BASE);
	d1 += len;
	fp_write(d1, len, g[1][0][1], BASE);
	d1 += len;
	fp_write(d1, len, g[1][1][0], BASE);
	d1 += len;
	fp_write(d1, len, g[1][1][1], BASE);
	d1 += len;
	fp_write(d1, len, g[1][2][0], BASE);
	d1 += len;
	fp_write(d1, len, g[1][2][1], BASE);

	return ELEMENT_OK;
}
Exemple #25
0
/*-------------------------------------------------------------------------*/
void frontpanel_rs232::fp_display_cmd(char cmd)
{
	char xbuf[]={0xa5, 0x05, 3, 0, cmd};
	fp_write(xbuf,5);
}