Example #1
0
void sys_driver_init()
{
  //open screen
  gpio_setup(SCREES_DC, GPIO_OUTPUT);
  gpio_write(SCREES_DC, 0);
  //screen reset
  gpio_setup(SCREES_RES, GPIO_OUTPUT);
  gpio_write(SCREES_RES, 1);
  
  //rgb led
  uint8_t led_pin[] = {28, 29, 30};
  light_setup(led_pin, 0);
  

  //init screen
  SSD1306_Init_Struct init_struct;
  init_struct.SCL = 9;
  init_struct.SDA = 8;

  ssd1306_config(&init_struct);
  
  OLED_Init();    
  OLED_Clear();
  
  gfx_init_screen((uint8_t *)&screen, 128, 32, 1);
  gfx_clear();
  OLED_Refresh_all();
  
  //hall task
  gpio_change_point = NULL;
  gpio_watch(HALL, GPIO_FALLING);
  
  //button
  gpio_setup(BUTTON, GPIO_INPUT_PULLUP);
}
Example #2
0
void on_ready( )
{
  ble_device_set_name("RGB_Light"); 
	ble_device_set_advertising_interval(2000);
  ble_device_start_advertising();
	
  //uint8_t rgb_pin[4] = {7, 6, 5};
  //uint8_t rgb_pin[4] = {23, 21, 22};
  uint8_t rgb_pin[4] = {12, 11, 29};
  light_setup(rgb_pin, 1);
  
  light_off();
}
Example #3
0
/*
 * General main function. 
 */
int main(int argc, char **argv)
{

    // Initalizes the states for each of the lights
    // to be true so they all start on.
    state_1 = 1;
    state_2 = 1;
    state_3 = 1;
    state_4 = 1;
    state_5 = 1;

    glutInit(&argc, argv);
    
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    
        glutInitWindowSize(WINDOW_SIZE, WINDOW_SIZE);
        glutCreateWindow("Assignment #6 - Lighting with Wormy");
    
        //callBacks
        glutKeyboardFunc(myKeyboard);
        glutReshapeFunc(myReshape);
        glutDisplayFunc(display);
        glutIdleFunc(idle);
        glutKeyboardUpFunc(myKeyboardUp);

        glutIgnoreKeyRepeat(1);

    //Sets up light and locations
    light_setup();


    glEnable(GL_DEPTH_TEST);

    glutMainLoop();

    return 0;
}