示例#1
0
static INLINE void Write(unsigned char reg, unsigned char value)
{
   	CSL();
  	SPI_BYTE(reg);
  	SPI_BYTE(value);
  	CSH();
}
示例#2
0
static AstroWindow *
get_window (AstroApplication *app)
{
  AstroExamplePrivate *priv;
  ClutterColor color = { 0xff, 0xff, 0x22, 0x22 };
  ClutterActor *window = NULL, *rect;

  g_return_val_if_fail (ASTRO_IS_EXAMPLE (app), NULL);
  priv = ASTRO_EXAMPLE (app)->priv;

  if (CLUTTER_IS_ACTOR (priv->window))
    window = priv->window;
  else
    {
      window = astro_window_new ();
      
      rect = clutter_rectangle_new_with_color (&color);
      clutter_container_add_actor (CLUTTER_CONTAINER (window), rect);
      clutter_actor_set_size (rect, CSW (), CSH()-ASTRO_PANEL_HEIGHT());
      clutter_actor_show (rect);
    }

  ASTRO_EXAMPLE (app)->priv->window = window;

  return ASTRO_WINDOW (window);
}
示例#3
0
/* Public Functions */
void
astro_appview_set_app_list (AstroAppview *view, 
                            GList        *apps)
{
  AstroAppviewPrivate *priv;
  GList *l;
  gint offset = 0;

  g_return_if_fail (ASTRO_IS_APPVIEW (view));
  priv = view->priv;

  priv->apps = apps;
  priv->active = 0;

  /* Add all the icons */
  for (l = apps; l; l = l->next)
    {
      AstroApplication *app = l->data;
      ClutterActor *icon = astro_appicon_new (app);

      clutter_container_add_actor (CLUTTER_CONTAINER (view), icon);
      clutter_actor_set_size (icon, ASTRO_APPICON_SIZE (),ASTRO_APPICON_SIZE());
      clutter_actor_set_anchor_point_from_gravity (icon,CLUTTER_GRAVITY_CENTER);

      clutter_actor_set_position (icon, offset, CSH ()/2);
      clutter_actor_show (icon);
      g_signal_connect (icon, "clicked",
                        G_CALLBACK (on_appicon_clicked), view);

      offset += ASTRO_APPICON_SPACING ();
    }
  astro_appview_advance (view, 0);
}
示例#4
0
static INLINE unsigned char Read(unsigned char reg)
{
	unsigned char value;
 	CSL();
  	SPI_BYTE(reg);
  	value = SPI_BYTE(0xFF);
  	CSH();
  	return value;
}
示例#5
0
void NRF24L01_Config(const unsigned char *buf)
{
	unsigned char len = *buf++;

	if(!buf)
		return;
	
	CSL();
	while(len--)
	{
		SPI_BYTE(*buf++);
		if(len == 0)
		{
			CSH();
			len = *buf++;
			CSL();
		}
	}
	CSH();
}
示例#6
0
static void ReadBuf(unsigned char reg, unsigned char *buf, unsigned char len)
{
	if(!buf || !len)
		return;
	
  	CSL();
  	SPI_BYTE(reg);
 	while(len--)
	{
		*buf++ = SPI_BYTE(0xFF);
	}
  	CSH();
}
示例#7
0
static void WriteBuf(unsigned char reg, unsigned char *buf, unsigned char len)
{
	if(!buf || !len)
		return;
	
 	CSL();
  	SPI_BYTE(reg);
 	while(len--)
	{
		SPI_BYTE(*buf++);
	}
  	CSH();
}
示例#8
0
文件: courasel.c 项目: UIKit0/toys
int
main (int argc, char *argv[])
{
  ClutterActor    *stage;
  ClutterColor     stage_color = { 0x34, 0x39, 0x39, 0xff };
  ClutterColor     white = { 0x72, 0x9f, 0xcf, 0xff };
  gint             i = 0;
  Item            *item;
  App             *app;
  gdouble          ang = 0.0;
  ClutterBehaviour *behave;

  clutter_init (&argc, &argv);

  stage = clutter_stage_get_default ();

  clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
  clutter_actor_set_size (stage, 800, 600);

  app = g_new0(App, 1);
  app->off = 0.0;
  app->timeline = clutter_timeline_new (300);
  app->alpha_sine_inc
    = clutter_alpha_new_full (app->timeline, CLUTTER_EASE_OUT_SINE);

  app->alpha_ramp
    = clutter_alpha_new_with_func (app->timeline, label_opacity_alpha_func,
                                   NULL, NULL);

  for (i=0; i<N_ITEMS; i++)
    {
      item = g_new0 (Item, 1);

      item->actor = clutter_texture_new_from_file (ItemDetails[i].img, NULL);
      if (!item->actor)
	g_error ("Unable to load '%s'", ItemDetails[i].img);

      clutter_group_add (CLUTTER_GROUP(stage), item->actor);

      item->ellipse_behave
	= clutter_behaviour_ellipse_new (app->alpha_sine_inc,
					 CSW()/4,   /* center x */
					 CSH() - (CSH()/3),   /* center y */
					 CSW()/2,   /* width */
					 CSH() - (CSH()/4),   /* height */
					 CLUTTER_ROTATE_CW,
					 ang,
					 ang + STEP);
      item->opacity_behave
	= clutter_behaviour_opacity_new (app->alpha_sine_inc, 0x66, 0x66);

      item->scale_behave
	= clutter_behaviour_scale_new (app->alpha_sine_inc,
				       0.6, 0.6, 0.6, 0.6);

      clutter_behaviour_apply (item->ellipse_behave, item->actor);
      clutter_behaviour_apply (item->opacity_behave, item->actor);
      clutter_behaviour_apply (item->scale_behave, item->actor);

      app->items = g_slist_append (app->items, item);

      ang += STEP;
    }

  app->label = clutter_text_new_full ("Bitstream Vera Sans 60px", "", &white);
  clutter_actor_set_position (app->label, CSW()/2 - 30, CSH()/3 - 40);
  clutter_group_add (CLUTTER_GROUP(stage), app->label);

  behave = clutter_behaviour_opacity_new (app->alpha_ramp, 0xff, 0);
  clutter_behaviour_apply (behave, app->label);

  g_signal_connect (app->timeline,
		    "new-frame",
		    G_CALLBACK(on_timeline_new_frame),
		    app);

  g_signal_connect (stage,
		    "event",
		    G_CALLBACK (on_input),
		    app);

  introduce_items (app);

  clutter_actor_show_all (stage);

  clutter_main();

  return 0;
}
示例#9
0
static INLINE void SendCMD(unsigned char cmd)
{
   	CSL();
  	SPI_BYTE(cmd);
  	CSH();
}
示例#10
0
void NRF24L01_Init(void)
{
	NRF24L01_HAL_Init();
	CEL();
	CSH();
}
示例#11
0
/* Private functions */
static void
ensure_layout (AstroAppview *view)
{
  AstroAppviewPrivate *priv;
  GList *l;
  gint groupx = 0;
  gint center = 0;
  gint i = 0;
  
  priv = view->priv;

  groupx = clutter_actor_get_x (CLUTTER_ACTOR (view));
  center = CSW()/2;

  l = clutter_container_get_children (CLUTTER_CONTAINER (view));
  for (l = l; l; l = l->next)
    {
      ClutterActor *icon = l->data;
      gint realx, diff, y_diff;;
      gfloat scale;

      realx = clutter_actor_get_x (icon) + groupx;
      
      if (realx > center && realx < CSW ())
        {
          diff = center - (realx - center);
        }
      else if (realx > 0 && realx <= center)
        {
          diff = realx;
        }
      else
        {
          diff = 0;
        }
  
      scale = (gfloat)diff/center;
      scale = 0.2 + (0.8 * scale);
      clutter_actor_set_scale (icon, scale, scale);

      if (realx < center)
        {
          gfloat angle, sine;

          angle = scale * (3.14*2);
          sine = sin (0.5 *angle);
          
          y_diff = (CSH()/2) + (VARIANCE * sine);
        }
      else
        {
          gfloat angle, sine;

          angle = scale * (3.14*2);
          sine = sin (0.5*angle);
          
          y_diff = (CSH()/2) - (VARIANCE * sine);

        }
      clutter_actor_set_y (icon, y_diff);
      
      astro_appicon_set_blur (ASTRO_APPICON (icon), (1.0 - scale) * MAX_BLUR);

      i++;
    }
}