WonX.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "WonXP.h"
  2. #include "etc.h"
  3. #include "wonx_include/disp.h"
  4. #include "wonx_include/system.h"
  5. #include "wonx_include/comm.h"
  6. static WonX wonx = NULL;
  7. int WonX_IsCreated(void)
  8. {
  9. return (wonx != NULL);
  10. }
  11. void WonX_Create(void)
  12. {
  13. wonx = (WonX)malloc(sizeof(_WonX));
  14. if (wonx == NULL) WonX_Error("WonX_Create", "Cannot allocate memory.");
  15. wonx->wonx_display =
  16. WonXDisplay_Create(LCD_PIXEL_WIDTH * 2, LCD_PIXEL_HEIGHT * 2,
  17. LCD_PIXEL_WIDTH, LCD_PIXEL_HEIGHT,
  18. SCREEN_CHAR_WIDTH, SCREEN_CHAR_HEIGHT);
  19. wonx->wonx_system = WonXSystem_Create();
  20. wonx->wonx_serial_port = WonXSerialPort_Create();
  21. return;
  22. }
  23. WonXDisplay WonX_GetWonXDisplay(void)
  24. {
  25. return (wonx->wonx_display);
  26. }
  27. WonXSystem WonX_GetWonXSystem(void)
  28. {
  29. return (wonx->wonx_system);
  30. }
  31. WonXSerialPort WonX_GetWonXSerialPort(void)
  32. {
  33. return (wonx->wonx_serial_port);
  34. }
  35. /*===========================================================================*/
  36. /* ¥¨¥é¡¼½èÍý */
  37. /*===========================================================================*/
  38. int WonX_Error(char * funcname, char * message)
  39. {
  40. fprintf(stderr, "error : %s(): %s\n", funcname, message);
  41. exit (1);
  42. }
  43. int WonX_Warning(char * funcname, char * message)
  44. {
  45. fprintf(stderr, "warning : %s(): %s\n", funcname, message);
  46. return (0);
  47. }
  48. /*****************************************************************************/
  49. /* End of File. */
  50. /*****************************************************************************/