text stringlengths 0 234 |
|---|
function Keypad_Indev return Lv.Hal.Indev.Indev_T |
is (LV_Indev_Keypad); |
------------------ |
-- Read_Pointer -- |
------------------ |
function Read_Pointer (Data : access Indev_Data_T) return U_Bool is |
begin |
Pointer.State := Lv.Hal.Indev.State_Rel; |
for Elt of BB_Pico_Bsp.Touch.Get_All_Touch_Points loop |
if Elt.Weight /= 0 then |
Pointer.Union.Point.X := Integer_16 (Elt.X); |
Pointer.Union.Point.Y := Integer_16 (Elt.Y); |
Pointer.State := Lv.Hal.Indev.State_Pr; |
end if; |
end loop; |
Data.all := Pointer; |
return 0; |
end Read_Pointer; |
----------------- |
-- Read_Keypad -- |
----------------- |
function Read_Keypad (Data : access Indev_Data_T) return U_Bool is |
use BBQ10KBD; |
State : Key_State; |
begin |
loop |
State := BB_Pico_Bsp.Keyboard.Key_FIFO_Pop; |
case State.Kind is |
when Error => |
return 0; -- No more events |
when Held_Pressed => |
null; -- LVGL doesn't have a held pressed event |
when others => |
declare |
Pressed : constant Boolean := State.Kind = BBQ10KBD.Pressed; |
begin |
case State.Code is |
when Keyboard.KEY_JOY_UP => |
Data.Union.Key := Lv.LV_KEY_UP; |
when Keyboard.KEY_JOY_DOWN => |
Data.Union.Key := Lv.LV_KEY_DOWN; |
when Keyboard.KEY_JOY_LEFT => |
Data.Union.Key := Lv.LV_KEY_LEFT; |
when Keyboard.KEY_JOY_RIGHT => |
Data.Union.Key := Lv.LV_KEY_RIGHT; |
when Keyboard.KEY_JOY_CENTER => |
Data.Union.Key := Lv.LV_KEY_ENTER; |
when Keyboard.KEY_BTN_LEFT1 => |
Data.Union.Key := Lv.LV_KEY_PREV; |
when Keyboard.KEY_BTN_LEFT2 => |
Data.Union.Key := Lv.LV_KEY_HOME; |
when Keyboard.KEY_BTN_RIGHT1 => |
Data.Union.Key := Lv.LV_KEY_BACKSPACE; |
when Keyboard.KEY_BTN_RIGHT2 => |
Data.Union.Key := Lv.LV_KEY_NEXT; |
when others => |
Data.Union.Key := Unsigned_32 (State.Code); |
end case; |
Data.State := (if Pressed |
then Lv.Hal.Indev.State_Pr |
else Lv.Hal.Indev.State_Rel); |
return 1; |
Function Definition: function Read_Register (This : STMPE811_Device; |
Function Body: Reg_Addr : UInt8) |
return UInt8 |
is |
Data : TSC_Data (1 .. 1); |
Status : SPI_Status; |
begin |
This.Chip_Select.Clear; |
This.Port.Transmit (SPI_Data_8b'(16#80# or Reg_Addr, 0), Status); |
if Status /= Ok then |
raise Program_Error with "Timeout while reading TC data"; |
end if; |
This.Port.Receive (Data, Status); |
if Status /= Ok then |
raise Program_Error with "Timeout while reading TC data"; |
end if; |
This.Chip_Select.Set; |
return Data (Data'First); |
end Read_Register; |
-------------------- |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.