Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.44 KB | None | 0 0
  1. #include "common.h"
  2. #include "draw.h"
  3. #include "hid.h"
  4. #include "i2c.h"
  5.  
  6. //********************************************************************************
  7.  
  8. #define DISPLAY_TEXT1 "WARNING!!! NO SD CARD OR IMPROPER SD CARD"
  9. #define DISPLAY_TEXT2 "DETECTED. SYSTEM WILL NOT BOOT. PLEASE"
  10. #define DISPLAY_TEXT3 "INSERT A PROPERLY FORMATTED SD CARD."
  11. #define DISPLAY_TEXT4 "PLEASE POWER OFF THE SYSTEM NOW."
  12. #define DISPLAY_TEXT5 "PRESS ANY KEY TO REBOOT."
  13. #define START_X 0
  14. #define START_Y 0
  15.  
  16. //********************************************************************************
  17.  
  18. void Reboot()
  19. {
  20.     i2cWriteRegister(I2C_DEV_MCU, 0x20, 1 << 2);
  21.     while(true);
  22. }
  23.  
  24. //********************************************************************************
  25.  
  26. int main()
  27. {
  28.     bool use_top = true;
  29.     char clear_text[64] = { 0 };
  30.     u32 cur_x = START_X;
  31.     u32 cur_y = START_Y;
  32.    
  33.     ClearScreenFull(true, true);
  34.    
  35.     memset(clear_text, (int) ' ', strnlen(DISPLAY_TEXT1, 63));
  36.    
  37.     DrawStringF(cur_x, cur_y, use_top, DISPLAY_TEXT1);
  38.     cur_y += 10;
  39.     DrawStringF(cur_x, cur_y, use_top, DISPLAY_TEXT2);
  40.     cur_y += 10;
  41.     DrawStringF(cur_x, cur_y, use_top, DISPLAY_TEXT3);
  42.     cur_y += 10;
  43.     DrawStringF(cur_x, cur_y, use_top, DISPLAY_TEXT4);
  44.     cur_y += 10;
  45.     DrawStringF(cur_x, cur_y, use_top, DISPLAY_TEXT5);
  46.  
  47.     InputWait();
  48.     Reboot();
  49.    
  50.     return 0;
  51. }
  52.  
  53. //********************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement