示例#1
0
文件: main.c 项目: Abdellbar/nrf51
/**
 * main function
 * @return int return type required by ANSI/ISO standard.
 */
int main(void)
{
  gpio_config();

  //Initialize the LCD display
  if (!nrf6350_lcd_init())
  {
    show_error();
  }

  // Clear the display and print a welcome message
  if (!nrf6350_lcd_write_string("    RF TEST     ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0))
  {
    show_error();
  }
  
  if (!nrf6350_lcd_write_string("   SCROLL DOWN  ", MAX_CHARACTERS_PER_LINE, LCD_LOWER_LINE, 0))
  {
    show_error();
  }

  // Init peripherals needed by radio
  radio_init();

  wait_for_joystick_movement();     // so that the test title is visible on display until joystick status is changed

  menu_help_testrun_when_idle();  // This function will never return
}
示例#2
0
文件: main.c 项目: Abdellbar/nrf51
/*
 * Display text of the correct section with correct offset on the display
 */
static void display_text(void)
{
  if(!nrf6350_lcd_clear())
  {
    show_error();
  }

  if(in_menu)
  {
    if(!nrf6350_lcd_write_string(&help_menu[current_menu_pos][current_scroll_pos], MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0))
    {
      show_error();
    }
  }
  else
  {
    if(p_variables[current_menu_pos] != 0)
    {
      char buffer[3];
      sprintf(buffer, "%lu", (int32_t)(*(uint8_t *)p_variables[current_menu_pos]));

      if(!nrf6350_lcd_write_string(buffer, 3, LCD_UPPER_LINE, 7))
      {
        show_error();
      }
    }
  }
}
示例#3
0
/**@brief  Application main function.
 */
int main(void)
{
    // Initialize
    leds_init();
    timers_init();
    buttons_init();
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();
    sec_params_init();
	  nrf6350_lcd_init(); 
	 
	    nrf6350_lcd_write_string("Ok a ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0);
    
    advertising_start();
     nrf6350_lcd_write_string("Ok b ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0);
    // Enter main loop
    while(true)
    {
        power_manage();
    }
		

}
示例#4
0
/**@brief Display iOS notification message contents
 *
 */
static void display_ios_message(void)
{
    bool success;

    success = nrf6350_lcd_write_string(display_title, strlen(display_title), LCD_UPPER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);
    success = nrf6350_lcd_write_string(display_message, strlen(display_message), LCD_LOWER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);

    display_offset = 0;
}
示例#5
0
/**@brief Function for application main entry.
 */
int main(void)
{
    gpio_config();

    bool success = nrf6350_lcd_init();
    APP_ERROR_CHECK_BOOL(success);
    success = nrf6350_lcd_write_string("    BLE ANCS    ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);

    // Initialize.
    leds_init();
    timers_init();
    gpiote_init();
    buttons_init();
    ble_stack_init();    
    bond_manager_init();
    gap_params_init();
    service_add();    
    advertising_init();
    conn_params_init();
    sec_params_init();
    radio_notification_init();
    
    // Start execution.
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        power_manage();
    }

}
示例#6
0
/**@brief Display an iOS notification
 *
 */
void evt_ios_notification(ble_ancs_c_evt_ios_notification_t *p_notice)
{
    bool success;
    char buffer[DISPLAY_BUFFER_SIZE];
    
    success = nrf6350_lcd_write_string(lit_catid[p_notice->category_id], 
        strlen(lit_catid[p_notice->category_id]), LCD_UPPER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);
    
    sprintf(buffer, "%s %02x%02x%02x%02x",
        lit_eventid[p_notice->event_id], 
        p_notice->notification_uid[0], p_notice->notification_uid[1], 
        p_notice->notification_uid[2], p_notice->notification_uid[3]);

    success = nrf6350_lcd_write_string(buffer, strlen(buffer), LCD_LOWER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);
}
示例#7
0
/**@brief Scroll message contents
 *
 */
 static void scroll_one(void)
{
    bool success;

    display_offset++;

    success = nrf6350_lcd_write_string(display_message + display_offset,
                             strlen(display_message) - display_offset, LCD_LOWER_LINE, 0);
    APP_ERROR_CHECK_BOOL(success);
}
示例#8
0
/**@snippet [Handling the data received over BLE] */
void nus_data_handler(ble_nus_t * p_nus, uint8_t * p_data, uint16_t length)
{
	
    for (int i = 0; i < length; i++)
    {
      //  simple_uart_put(p_data[i]);
    }
	
		//char str[MAX_CHARACTERS_PER_LINE];
   //snprintf(str, sizeof str, "%lu", (unsigned long)p_data[length-1]);
		 nrf6350_lcd_write_string(" test01 ", MAX_CHARACTERS_PER_LINE, LCD_UPPER_LINE, 0);
   
}