static oswald_ui *ui_g;
-void hal_lcd_set_pixel(gint x, gint y, gboolean state)
+void hal_lcd_set_pixel(gint x, gint y, uint8_t state)
{
gint ix, iy;
ix = x*2;
iy = y*2;
+ // we double all pixel to get a bigger picture
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy);
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix+1, iy);
gdk_draw_point(GDK_DRAWABLE(ui_g->pixmap), state ? ui_g->darea->style->black_gc : ui_g->darea->style->white_gc, ix, iy+1);
return "BlueZ";
}
+void hal_accelerometer_enable(void)
+{
+ g_printerr("accel enable\n");
+ gtk_widget_set_sensitive(ui_g->x_sc, TRUE);
+ gtk_widget_set_sensitive(ui_g->y_sc, TRUE);
+ gtk_widget_set_sensitive(ui_g->z_sc, TRUE);
+}
+
+void hal_accelerometer_disable(void)
+{
+ g_printerr("accel disable\n");
+ gtk_widget_set_sensitive(ui_g->x_sc, FALSE);
+ gtk_widget_set_sensitive(ui_g->y_sc, FALSE);
+ gtk_widget_set_sensitive(ui_g->z_sc, FALSE);
+}
+
static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
sc = gtk_hscale_new_with_range (-128, 127, 1);
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5);
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelX_value_changed), ui);
+ ui->x_sc = sc;
+ gtk_widget_set_sensitive(ui->x_sc, FALSE);
l = gtk_label_new("Y:");
gtk_box_pack_start (GTK_BOX(hb), l, FALSE, FALSE, 5);
sc = gtk_hscale_new_with_range (-128, 127, 1);
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5);
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelY_value_changed), ui);
+ ui->y_sc = sc;
+ gtk_widget_set_sensitive(ui->y_sc, FALSE);
l = gtk_label_new("Z:");
gtk_box_pack_start (GTK_BOX(hb), l, FALSE, FALSE, 5);
sc = gtk_hscale_new_with_range (-128, 127, 1);
gtk_box_pack_start (GTK_BOX(hb), sc, TRUE, TRUE, 5);
g_signal_connect(G_OBJECT(sc), "value-changed", G_CALLBACK(accelZ_value_changed), ui);
+ ui->z_sc = sc;
+ gtk_widget_set_sensitive(ui->z_sc, FALSE);
gtk_widget_show_all(ui->mainwin);
}
rtc->minute = mtime.tm_min;
rtc->second = mtime.tm_sec;
rtc->day = mtime.tm_mday;
+ rtc->wday = mtime.tm_wday;
rtc->month = (mtime.tm_mon + 1);
rtc->year = (mtime.tm_year + 1900);
+
}
void hal_set_rtc(const clock_state *rtc, boolean set_set)
void hal_get_power_state(power_state *pwr)
{
+ pwr->source = POWER_SOURCE_EXTERNAL;
+ pwr->charge_state = POWER_CHARGER_CHARGING;
+ pwr->percent = 50;
+ pwr->level = 3242; // mV
}
static boolean BacklightState = FALSE;
return BacklightState;
}
+static boolean VibrationState = FALSE;
/* sets the vibration motor on/off, on=TRUE, off=FALSE */
void hal_vibration_set_state(boolean state)
{
+ g_print("turn vibration %s\n", state ? "on" : "off");
+ VibrationState = state;
}
boolean hal_vibration_get_state(void)
{
- return FALSE;
+ return VibrationState;
}
+uint16_t hal_amblight_get_val(void)
+{
+ return 42;
+}
+
int main(int argc , char ** argv)
{