1.. zephyr:code-sample:: cfb-shell-sample 2 :name: Character Framebuffer shell module 3 :relevant-api: monochrome_character_framebuffer 4 5 Use the CFB shell module to interact with a monochrome display. 6 7Overview 8******** 9This is a simple shell module that exercises displays using the Character 10Framebuffer subsystem. 11 12Building and Running 13******************** 14 15Build the sample app by choosing the target board, for example: 16 17.. zephyr-app-commands:: 18 :zephyr-app: samples/subsys/display/cfb_shell 19 :board: reel_board 20 :goals: build 21 22 23Shell Module Command Help 24========================= 25 26.. code-block:: console 27 28 cfb - Character Framebuffer shell commands 29 Options: 30 -h, --help :Show command help. 31 Subcommands: 32 init :[none] 33 get_device :[none] 34 get_param :<all, height, width, ppt, rows, cols> 35 get_fonts :[none] 36 set_font :<idx> 37 invert :[none] 38 print :<col: pos> <row: pos> <text> 39 scroll :<dir: (vertical|horizontal)> <col: pos> <row: pos> 40 <text> 41 clear :[none] 42 43**init**: should be called first to initialize the display. 44 45Command example (reel_board): 46 47.. code-block:: console 48 49 uart:~$ cfb init 50 Framebuffer initialized: SSD16XX 51 Display Cleared 52 53**get_device**: prints the display device name. 54 55Command example (reel_board): 56 57.. code-block:: console 58 59 uart:~$ cfb get_device 60 Framebuffer Device: SSD16XX 61 62**get_param**: get the display parameters where height, width and ppt 63(pixel per tile) are in pixels and the number of rows and columns. The row 64position is incremented by a multiple of the ppt. 65 66Command example (reel_board): 67 68.. code-block:: console 69 70 uart:~$ cfb get_param all 71 param: height=120 72 param: width=250 73 param: ppt=8 74 param: rows=15 75 param: cols=250 76 77**get_fonts**: print the index, height and width in pixels of the static 78defined fonts presented in the system. 79 80Command example (reel_board): 81 82.. code-block:: console 83 84 uart:~$ cfb get_fonts 85 idx=0 height=32 width=20 86 idx=1 height=24 width=15 87 idx=2 height=16 width=10 88 89**set_font**: choose the font to be used by passing the font index. Only one 90font can be used at a time. 91 92Command example (reel_board): 93 94.. code-block:: console 95 96 uart:~$ cfb set_font 0 97 Font idx=0 height=32 width=20 set 98 99**invert**: invert the pixel color of the display. 100 101Command example (reel_board): 102 103.. code-block:: console 104 105 uart:~$ cfb invert 106 Framebuffer Inverted 107 108**print**: pass the initial column and row positions and the text in 109double quotation marks when it contains spaces. If text hits the edge 110of the display the remaining characters will be displayed on the next line. The 111previous printed text will be overwritten. 112 113Command example (reel_board): 114 115.. code-block:: console 116 117 uart:~$ cfb print 60 5 ZEPHYR 118 119**scroll**: pass the scroll direction, vertical or horizontal, the initial 120column and row positions, and the text to be displayed in double quotation 121marks when it contains spaces. If the text hits the edge of the display, the 122remaining characters will be displayed in the next line. The text will scroll 123until it hits the display boundary, last column for horizontal and last row 124for vertical direction. The text passed with the scroll command will be moved 125vertically or horizontally on the display. 126 127 128Command example (reel_board): 129 130.. code-block:: console 131 132 uart:~$ cfb scroll vertical 60 5 ZEPHYR 133 134**clear**: clear the display screen. 135 136Command example (reel_board): 137 138.. code-block:: console 139 140 uart:~$ cfb clear 141 Display Cleared 142