├── .gitignore ├── data ├── bg.bin ├── intro.gif ├── test.bin ├── Emojis │ ├── 1.bin │ ├── 2.bin │ ├── 3.bin │ ├── 4.bin │ ├── 5.bin │ ├── 6.bin │ ├── 7.bin │ ├── 8.bin │ ├── 9.bin │ ├── 10.bin │ ├── 11.bin │ ├── 12.bin │ ├── 13.bin │ ├── 14.bin │ ├── 15.bin │ ├── 16.bin │ ├── 17.bin │ ├── 18.bin │ ├── 19.bin │ ├── 20.bin │ ├── 21.bin │ ├── 22.bin │ ├── 23.bin │ └── 24.bin ├── Pics │ ├── 0.bin │ ├── 1.bin │ ├── 2.bin │ ├── 3.bin │ ├── 4.bin │ ├── 5.bin │ ├── 6.bin │ └── 7.bin ├── Unread.bin ├── UserHW.bin ├── arrowUp.bin ├── chatter.bin ├── pairing.gif ├── splash.bin ├── splash.raw ├── startup.gif ├── Battery │ ├── 0.bin │ ├── 1.bin │ ├── 2.bin │ ├── 3.bin │ ├── 4.bin │ └── 5.bin ├── Lock │ ├── Icon.bin │ ├── Locked.bin │ └── Unlocked.bin ├── arrowDown.bin ├── Menu │ ├── ArrowUp.bin │ ├── ArrowDown.bin │ ├── Big │ │ ├── Games.gif │ │ ├── Inbox.gif │ │ ├── Friends.gif │ │ ├── Profile.gif │ │ └── Settings.gif │ ├── Label │ │ ├── Friends.bin │ │ ├── Games.bin │ │ ├── Inbox.bin │ │ ├── Profile.bin │ │ └── Settings.bin │ └── Small │ │ ├── Friends.bin │ │ ├── Games.bin │ │ ├── Inbox.bin │ │ ├── Profile.bin │ │ └── Settings.bin ├── colorPicker.bin ├── Avatars │ ├── large │ │ ├── 1.bin │ │ ├── 2.bin │ │ ├── 3.bin │ │ ├── 4.bin │ │ ├── 5.bin │ │ ├── 6.bin │ │ ├── 7.bin │ │ ├── 8.bin │ │ ├── 9.bin │ │ ├── 10.bin │ │ ├── 11.bin │ │ ├── 12.bin │ │ ├── 13.bin │ │ ├── 14.bin │ │ └── 15.bin │ └── small │ │ ├── 1.bin │ │ ├── 2.bin │ │ ├── 3.bin │ │ ├── 4.bin │ │ ├── 5.bin │ │ ├── 6.bin │ │ ├── 7.bin │ │ ├── 8.bin │ │ ├── 9.bin │ │ ├── 10.bin │ │ ├── 11.bin │ │ ├── 12.bin │ │ ├── 13.bin │ │ ├── 14.bin │ │ └── 15.bin └── Games │ ├── Space │ ├── bg.raw │ ├── player.gif │ ├── splash.raw │ ├── asteroidL.raw │ ├── asteroidM.raw │ └── asteroidS.raw │ ├── Common │ ├── heart.raw │ └── goblet.raw │ └── Icons │ ├── Pong.bin │ ├── Snake.bin │ ├── Space.bin │ └── Invaders.bin ├── src ├── Games │ ├── Pong │ │ ├── State.cpp │ │ ├── PauseState.h │ │ ├── State.hpp │ │ ├── TitleState.h │ │ ├── Bonk.h │ │ ├── GameState.h │ │ ├── bonk_title.hpp │ │ ├── PauseState.cpp │ │ ├── Bonk.cpp │ │ └── TitleState.cpp │ ├── GameEngine │ │ ├── PixelDim.hpp │ │ ├── Collision │ │ │ ├── RectCC.cpp │ │ │ ├── RectCC.h │ │ │ ├── CircleCC.cpp │ │ │ ├── CircleCC.h │ │ │ ├── CollisionComponent.h │ │ │ ├── CollisionComponent.cpp │ │ │ ├── PolygonCC.h │ │ │ ├── PolygonCC.cpp │ │ │ └── CollisionSystem.h │ │ ├── GameSystem.cpp │ │ ├── Rendering │ │ │ ├── RenderComponent.cpp │ │ │ ├── RenderSystem.h │ │ │ ├── SpriteRC.h │ │ │ ├── SpriteRC.cpp │ │ │ ├── StaticRC.h │ │ │ ├── RenderComponent.h │ │ │ ├── StaticRC.cpp │ │ │ ├── RenderSystem.cpp │ │ │ ├── AnimRC.cpp │ │ │ └── AnimRC.h │ │ ├── GameSystem.h │ │ ├── Highscore.h │ │ ├── GameObject.cpp │ │ ├── GameObject.h │ │ ├── ResourceManager.h │ │ ├── TextInput.h │ │ ├── Game.h │ │ ├── ResourceManager.cpp │ │ ├── TextInput.cpp │ │ ├── Highscore.cpp │ │ └── Game.cpp │ ├── Common │ │ ├── Score.h │ │ ├── Hearts.h │ │ ├── Hearts.cpp │ │ └── Score.cpp │ ├── Space │ │ ├── Player.cpp │ │ └── Player.h │ ├── Invaders │ │ ├── Star.h │ │ └── Star.cpp │ └── Snake │ │ └── Snake.h ├── Services │ ├── Pair │ │ ├── State.cpp │ │ ├── State.h │ │ ├── BroadcastState.h │ │ ├── RequestState.h │ │ ├── AcknowledgeState.h │ │ ├── RequestState.cpp │ │ ├── BroadcastState.cpp │ │ ├── AcknowledgeState.cpp │ │ └── PairService.h │ ├── ShutdownService.h │ ├── SleepService.h │ ├── BuzzerService.h │ ├── ShutdownService.cpp │ ├── ProfileService.h │ ├── MessageService.h │ ├── BuzzerService.cpp │ ├── LoRaService.h │ └── LoRaPacket.h ├── Types.hpp ├── Model │ ├── Entity.hpp │ ├── Profile.hpp │ ├── Friend.hpp │ ├── Convo.hpp │ ├── Message.h │ └── Message.cpp ├── Fonts │ └── font.h ├── Storage │ ├── Storage.cpp │ ├── ConvoRepo.h │ ├── Storage.h │ ├── MessageRepo.h │ ├── Repo.h │ ├── ConvoRepo.cpp │ └── MessageRepo.cpp ├── ChatterTheme.h ├── Interface │ ├── Pics.h │ ├── LVObject.h │ ├── LVObject.cpp │ ├── LVSelectable.h │ ├── LVModal.h │ ├── Pics.cpp │ ├── LVSelectable.cpp │ ├── LVScreen.h │ ├── ConvoView.h │ ├── LVModal.cpp │ ├── ConvoView.cpp │ └── LVScreen.cpp ├── Elements │ ├── Avatar.h │ ├── IntroScreen.h │ ├── ListItem.h │ ├── BatteryElement.h │ ├── GameItem.h │ ├── EmojiMenu.h │ ├── EditableAvatar.h │ ├── PicMenu.h │ ├── BatteryElement.cpp │ ├── NotificationElement.h │ ├── User.h │ ├── ConvoMessage.h │ ├── UserWithMessage.h │ ├── ColorBox.h │ ├── IntroScreen.cpp │ ├── UnlockSlide.h │ ├── Avatar.cpp │ ├── NotificationElement.cpp │ ├── ConvoBox.h │ ├── GameItem.cpp │ ├── TextEntry.h │ ├── ListItem.cpp │ ├── User.cpp │ ├── EmojiMenu.cpp │ ├── UnlockSlide.cpp │ └── UserWithMessage.cpp ├── AutoPop.cpp ├── Modals │ ├── BatteryNotification.h │ ├── Prompt.h │ ├── ContextMenu.h │ ├── ContextMenu.cpp │ └── BatteryNotification.cpp ├── InputLVGL.h ├── AutoPop.h ├── Screens │ ├── FriendsScreen.h │ ├── InboxScreen.h │ ├── GamesScreen.h │ ├── LockScreen.h │ ├── SettingsScreen.h │ ├── UserHWTest.h │ ├── ProfileScreen.h │ ├── ConvoScreen.h │ ├── PairScreen.h │ ├── MainMenu.h │ ├── FriendsScreen.cpp │ ├── GamesScreen.cpp │ ├── InboxScreen.cpp │ └── LockScreen.cpp ├── InputChatter.h ├── InputLVGL.cpp ├── InputChatter.cpp ├── JigHWTest │ └── JigHWTest.h └── FSLVGL.h └── DefaultThemeBackup └── ChatterThemeBackup.h /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | cmake-build-debug 3 | build 4 | .vscode 5 | spiffs.bin -------------------------------------------------------------------------------- /data/bg.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/bg.bin -------------------------------------------------------------------------------- /src/Games/Pong/State.cpp: -------------------------------------------------------------------------------- 1 | #include "State.hpp" 2 | Bonk::State::~State(){stop();} 3 | -------------------------------------------------------------------------------- /data/intro.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/intro.gif -------------------------------------------------------------------------------- /data/test.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/test.bin -------------------------------------------------------------------------------- /data/Emojis/1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/1.bin -------------------------------------------------------------------------------- /data/Emojis/2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/2.bin -------------------------------------------------------------------------------- /data/Emojis/3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/3.bin -------------------------------------------------------------------------------- /data/Emojis/4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/4.bin -------------------------------------------------------------------------------- /data/Emojis/5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/5.bin -------------------------------------------------------------------------------- /data/Emojis/6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/6.bin -------------------------------------------------------------------------------- /data/Emojis/7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/7.bin -------------------------------------------------------------------------------- /data/Emojis/8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/8.bin -------------------------------------------------------------------------------- /data/Emojis/9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/9.bin -------------------------------------------------------------------------------- /data/Pics/0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/0.bin -------------------------------------------------------------------------------- /data/Pics/1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/1.bin -------------------------------------------------------------------------------- /data/Pics/2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/2.bin -------------------------------------------------------------------------------- /data/Pics/3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/3.bin -------------------------------------------------------------------------------- /data/Pics/4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/4.bin -------------------------------------------------------------------------------- /data/Pics/5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/5.bin -------------------------------------------------------------------------------- /data/Pics/6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/6.bin -------------------------------------------------------------------------------- /data/Pics/7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Pics/7.bin -------------------------------------------------------------------------------- /data/Unread.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Unread.bin -------------------------------------------------------------------------------- /data/UserHW.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/UserHW.bin -------------------------------------------------------------------------------- /data/arrowUp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/arrowUp.bin -------------------------------------------------------------------------------- /data/chatter.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/chatter.bin -------------------------------------------------------------------------------- /data/pairing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/pairing.gif -------------------------------------------------------------------------------- /data/splash.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/splash.bin -------------------------------------------------------------------------------- /data/splash.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/splash.raw -------------------------------------------------------------------------------- /data/startup.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/startup.gif -------------------------------------------------------------------------------- /data/Battery/0.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/0.bin -------------------------------------------------------------------------------- /data/Battery/1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/1.bin -------------------------------------------------------------------------------- /data/Battery/2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/2.bin -------------------------------------------------------------------------------- /data/Battery/3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/3.bin -------------------------------------------------------------------------------- /data/Battery/4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/4.bin -------------------------------------------------------------------------------- /data/Battery/5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Battery/5.bin -------------------------------------------------------------------------------- /data/Emojis/10.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/10.bin -------------------------------------------------------------------------------- /data/Emojis/11.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/11.bin -------------------------------------------------------------------------------- /data/Emojis/12.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/12.bin -------------------------------------------------------------------------------- /data/Emojis/13.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/13.bin -------------------------------------------------------------------------------- /data/Emojis/14.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/14.bin -------------------------------------------------------------------------------- /data/Emojis/15.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/15.bin -------------------------------------------------------------------------------- /data/Emojis/16.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/16.bin -------------------------------------------------------------------------------- /data/Emojis/17.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/17.bin -------------------------------------------------------------------------------- /data/Emojis/18.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/18.bin -------------------------------------------------------------------------------- /data/Emojis/19.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/19.bin -------------------------------------------------------------------------------- /data/Emojis/20.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/20.bin -------------------------------------------------------------------------------- /data/Emojis/21.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/21.bin -------------------------------------------------------------------------------- /data/Emojis/22.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/22.bin -------------------------------------------------------------------------------- /data/Emojis/23.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/23.bin -------------------------------------------------------------------------------- /data/Emojis/24.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Emojis/24.bin -------------------------------------------------------------------------------- /data/Lock/Icon.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Lock/Icon.bin -------------------------------------------------------------------------------- /data/arrowDown.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/arrowDown.bin -------------------------------------------------------------------------------- /data/Lock/Locked.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Lock/Locked.bin -------------------------------------------------------------------------------- /data/Lock/Unlocked.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Lock/Unlocked.bin -------------------------------------------------------------------------------- /data/Menu/ArrowUp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/ArrowUp.bin -------------------------------------------------------------------------------- /data/colorPicker.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/colorPicker.bin -------------------------------------------------------------------------------- /data/Avatars/large/1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/1.bin -------------------------------------------------------------------------------- /data/Avatars/large/2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/2.bin -------------------------------------------------------------------------------- /data/Avatars/large/3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/3.bin -------------------------------------------------------------------------------- /data/Avatars/large/4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/4.bin -------------------------------------------------------------------------------- /data/Avatars/large/5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/5.bin -------------------------------------------------------------------------------- /data/Avatars/large/6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/6.bin -------------------------------------------------------------------------------- /data/Avatars/large/7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/7.bin -------------------------------------------------------------------------------- /data/Avatars/large/8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/8.bin -------------------------------------------------------------------------------- /data/Avatars/large/9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/9.bin -------------------------------------------------------------------------------- /data/Avatars/small/1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/1.bin -------------------------------------------------------------------------------- /data/Avatars/small/2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/2.bin -------------------------------------------------------------------------------- /data/Avatars/small/3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/3.bin -------------------------------------------------------------------------------- /data/Avatars/small/4.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/4.bin -------------------------------------------------------------------------------- /data/Avatars/small/5.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/5.bin -------------------------------------------------------------------------------- /data/Avatars/small/6.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/6.bin -------------------------------------------------------------------------------- /data/Avatars/small/7.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/7.bin -------------------------------------------------------------------------------- /data/Avatars/small/8.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/8.bin -------------------------------------------------------------------------------- /data/Avatars/small/9.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/9.bin -------------------------------------------------------------------------------- /data/Games/Space/bg.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/bg.raw -------------------------------------------------------------------------------- /data/Menu/ArrowDown.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/ArrowDown.bin -------------------------------------------------------------------------------- /data/Menu/Big/Games.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Big/Games.gif -------------------------------------------------------------------------------- /data/Menu/Big/Inbox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Big/Inbox.gif -------------------------------------------------------------------------------- /data/Avatars/large/10.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/10.bin -------------------------------------------------------------------------------- /data/Avatars/large/11.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/11.bin -------------------------------------------------------------------------------- /data/Avatars/large/12.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/12.bin -------------------------------------------------------------------------------- /data/Avatars/large/13.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/13.bin -------------------------------------------------------------------------------- /data/Avatars/large/14.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/14.bin -------------------------------------------------------------------------------- /data/Avatars/large/15.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/large/15.bin -------------------------------------------------------------------------------- /data/Avatars/small/10.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/10.bin -------------------------------------------------------------------------------- /data/Avatars/small/11.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/11.bin -------------------------------------------------------------------------------- /data/Avatars/small/12.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/12.bin -------------------------------------------------------------------------------- /data/Avatars/small/13.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/13.bin -------------------------------------------------------------------------------- /data/Avatars/small/14.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/14.bin -------------------------------------------------------------------------------- /data/Avatars/small/15.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Avatars/small/15.bin -------------------------------------------------------------------------------- /data/Games/Common/heart.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Common/heart.raw -------------------------------------------------------------------------------- /data/Games/Icons/Pong.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Icons/Pong.bin -------------------------------------------------------------------------------- /data/Games/Icons/Snake.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Icons/Snake.bin -------------------------------------------------------------------------------- /data/Games/Icons/Space.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Icons/Space.bin -------------------------------------------------------------------------------- /data/Games/Space/player.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/player.gif -------------------------------------------------------------------------------- /data/Games/Space/splash.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/splash.raw -------------------------------------------------------------------------------- /data/Menu/Big/Friends.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Big/Friends.gif -------------------------------------------------------------------------------- /data/Menu/Big/Profile.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Big/Profile.gif -------------------------------------------------------------------------------- /data/Menu/Big/Settings.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Big/Settings.gif -------------------------------------------------------------------------------- /data/Menu/Label/Friends.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Label/Friends.bin -------------------------------------------------------------------------------- /data/Menu/Label/Games.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Label/Games.bin -------------------------------------------------------------------------------- /data/Menu/Label/Inbox.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Label/Inbox.bin -------------------------------------------------------------------------------- /data/Menu/Label/Profile.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Label/Profile.bin -------------------------------------------------------------------------------- /data/Menu/Small/Friends.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Small/Friends.bin -------------------------------------------------------------------------------- /data/Menu/Small/Games.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Small/Games.bin -------------------------------------------------------------------------------- /data/Menu/Small/Inbox.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Small/Inbox.bin -------------------------------------------------------------------------------- /data/Menu/Small/Profile.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Small/Profile.bin -------------------------------------------------------------------------------- /data/Games/Common/goblet.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Common/goblet.raw -------------------------------------------------------------------------------- /data/Games/Icons/Invaders.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Icons/Invaders.bin -------------------------------------------------------------------------------- /data/Menu/Label/Settings.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Label/Settings.bin -------------------------------------------------------------------------------- /data/Menu/Small/Settings.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Menu/Small/Settings.bin -------------------------------------------------------------------------------- /data/Games/Space/asteroidL.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/asteroidL.raw -------------------------------------------------------------------------------- /data/Games/Space/asteroidM.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/asteroidM.raw -------------------------------------------------------------------------------- /data/Games/Space/asteroidS.raw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/Chatter-Firmware/HEAD/data/Games/Space/asteroidS.raw -------------------------------------------------------------------------------- /src/Services/Pair/State.cpp: -------------------------------------------------------------------------------- 1 | #include "State.h" 2 | 3 | Pairing::State::~State(){ 4 | } 5 | 6 | Pairing::State::State(PairService* pairService) : Pair(pairService){ 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/Games/GameEngine/PixelDim.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_PIXELDIM_HPP 2 | #define CIRCUITPET_FIRMWARE_PIXELDIM_HPP 3 | #include 4 | 5 | typedef glm::i16vec2 PixelDim; 6 | 7 | #endif //CIRCUITPET_FIRMWARE_PIXELDIM_HPP 8 | -------------------------------------------------------------------------------- /src/Types.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_TYPES_HPP 2 | #define CHATTER_FIRMWARE_TYPES_HPP 3 | 4 | #include 5 | 6 | typedef uint64_t UID_t; 7 | typedef uint32_t hash_t; 8 | 9 | #endif //CHATTER_FIRMWARE_TYPES_HPP 10 | -------------------------------------------------------------------------------- /src/Model/Entity.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_ENTITY_HPP 2 | #define CHATTER_FIRMWARE_ENTITY_HPP 3 | 4 | #include "../Types.hpp" 5 | 6 | struct Entity { 7 | UID_t uid = 0; 8 | }; 9 | 10 | #endif //CHATTER_FIRMWARE_ENTITY_HPP 11 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/RectCC.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "RectCC.h" 3 | 4 | RectCC::RectCC(glm::vec2 dim) : dim(dim), CollisionComponent(CollisionType::Rect){ 5 | 6 | } 7 | 8 | glm::vec2 RectCC::getDim() const{ 9 | return dim; 10 | } 11 | -------------------------------------------------------------------------------- /src/Games/GameEngine/GameSystem.cpp: -------------------------------------------------------------------------------- 1 | #include "GameSystem.h" 2 | #include "Game.h" 3 | 4 | GameSystem::GameSystem(const Game* game) : game(game){ } 5 | 6 | std::set> GameSystem::getObjects(){ 7 | return game->objects; 8 | } -------------------------------------------------------------------------------- /src/Fonts/font.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_FONT_H 2 | #define CHATTER_FIRMWARE_FONT_H 3 | 4 | #include 5 | #include 6 | 7 | extern const lv_font_t pixelbasic16; 8 | extern const lv_font_t pixelbasic7; 9 | 10 | #endif // CHATTER_FIRMWARE_FONT_H -------------------------------------------------------------------------------- /src/Model/Profile.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_PROFILE_HPP 2 | #define CHATTER_FIRMWARE_PROFILE_HPP 3 | 4 | #include 5 | 6 | struct Profile { 7 | char nickname[21]; 8 | uint8_t avatar; //avatar image ID (0-14) 9 | uint16_t hue; //hue value (0-360) 10 | }; 11 | #endif //CHATTER_FIRMWARE_PROFILE_HPP -------------------------------------------------------------------------------- /src/Storage/Storage.cpp: -------------------------------------------------------------------------------- 1 | #include "Storage.h" 2 | 3 | Repositories Storage = { 4 | MessageRepo("/Repo/Msg"), 5 | ConvoRepo("/Repo/Convo", 12), 6 | Repo("/Repo/Friends", 12) 7 | }; 8 | 9 | void Repositories::begin(){ 10 | Messages.begin(); 11 | Convos.begin(true); 12 | Friends.begin(true); 13 | } 14 | -------------------------------------------------------------------------------- /src/Model/Friend.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_FRIEND_HPP 2 | #define CHATTER_FIRMWARE_FRIEND_HPP 3 | 4 | #include 5 | #include "Profile.hpp" 6 | #include "Entity.hpp" 7 | #include "../Types.hpp" 8 | 9 | struct Friend : Entity { 10 | Profile profile; 11 | uint8_t encKey[32]; 12 | }; 13 | 14 | #endif //CHATTER_FIRMWARE_FRIEND_HPP 15 | -------------------------------------------------------------------------------- /src/Model/Convo.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CONVO_HPP 2 | #define CHATTER_FIRMWARE_CONVO_HPP 3 | 4 | #include 5 | #include "Entity.hpp" 6 | #include 7 | 8 | /// UID is same as friend UID 9 | struct Convo : Entity { 10 | std::vector messages; 11 | bool unread = false; 12 | }; 13 | 14 | #endif //CHATTER_FIRMWARE_CONVO_HPP 15 | -------------------------------------------------------------------------------- /src/ChatterTheme.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CHATTERTHEME_H 2 | #define CHATTER_FIRMWARE_CHATTERTHEME_H 3 | 4 | #include 5 | #include "core/lv_obj.h" 6 | 7 | void chatterThemeInit(lv_disp_t* disp); 8 | 9 | lv_theme_t* chatterThemeGet(void); 10 | 11 | bool chatterThemeInited(void); 12 | 13 | #endif //CHATTER_FIRMWARE_CHATTERTHEME_H 14 | 15 | -------------------------------------------------------------------------------- /DefaultThemeBackup/ChatterThemeBackup.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CHATTERTHEME_H 2 | #define CHATTER_FIRMWARE_CHATTERTHEME_H 3 | 4 | #include 5 | #include "core/lv_obj.h" 6 | 7 | lv_theme_t* chatterThemeInit(lv_disp_t* disp); 8 | 9 | lv_theme_t* chatterThemeGet(void); 10 | 11 | bool chatterThemeInited(void); 12 | 13 | #endif //CHATTER_FIRMWARE_CHATTERTHEME_H 14 | 15 | -------------------------------------------------------------------------------- /src/Interface/Pics.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_PICS_H 2 | #define CHATTER_FIRMWARE_PICS_H 3 | 4 | #include 5 | #include 6 | 7 | #define NUM_PICS 8 8 | 9 | struct Pic { 10 | const char* name; 11 | 12 | bool gif() const; 13 | lv_obj_t* create(lv_obj_t* parent) const; 14 | }; 15 | 16 | extern const Pic Pics[NUM_PICS]; 17 | 18 | 19 | #endif //CHATTER_FIRMWARE_PICS_H 20 | -------------------------------------------------------------------------------- /src/Elements/Avatar.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_AVATAR_H 2 | #define CHATTER_FIRMWARE_AVATAR_H 3 | 4 | #include "../Interface/LVObject.h" 5 | 6 | class Avatar : public LVObject{ 7 | public: 8 | Avatar(lv_obj_t* parent, uint8_t index, bool large = false); 9 | void changeImage(uint8_t index); 10 | protected: 11 | bool large = false; 12 | lv_obj_t* img; 13 | }; 14 | 15 | 16 | #endif //CHATTER_FIRMWARE_AVATAR_H 17 | -------------------------------------------------------------------------------- /src/Services/Pair/State.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_STATE_H 2 | #define CHATTER_FIRMWARE_STATE_H 3 | #include 4 | class PairService; 5 | 6 | namespace Pairing { 7 | 8 | class State { 9 | public: 10 | State(PairService* pairService); 11 | virtual ~State(); 12 | virtual void loop(uint micros) = 0; 13 | protected: 14 | PairService* Pair; 15 | }; 16 | 17 | } 18 | 19 | #endif //CHATTER_FIRMWARE_STATE_H 20 | -------------------------------------------------------------------------------- /src/Interface/LVObject.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_LVOBJECT_H 2 | #define CHATTER_FIRMWARE_LVOBJECT_H 3 | 4 | #include 5 | 6 | class LVObject { 7 | public: 8 | LVObject(lv_obj_t* parent); 9 | virtual ~LVObject(); 10 | 11 | lv_obj_t* getLvObj(); 12 | 13 | protected: 14 | lv_obj_t* obj = nullptr; 15 | 16 | private: 17 | bool deleting = false; 18 | }; 19 | 20 | 21 | #endif //CHATTER_FIRMWARE_LVOBJECT_H 22 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/RenderComponent.cpp: -------------------------------------------------------------------------------- 1 | #include "RenderComponent.h" 2 | 3 | int8_t RenderComponent::getLayer() const{ 4 | return layer; 5 | } 6 | 7 | void RenderComponent::setLayer(int8_t layer){ 8 | RenderComponent::layer = layer; 9 | } 10 | 11 | bool RenderComponent::isVisible() const{ 12 | return visible; 13 | } 14 | 15 | void RenderComponent::setVisible(bool visible){ 16 | RenderComponent::visible = visible; 17 | } 18 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/RectCC.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CIRCUITPET_FIRMWARE_RECTCC_H 3 | #define CIRCUITPET_FIRMWARE_RECTCC_H 4 | #include "CollisionComponent.h" 5 | #include "../PixelDim.hpp" 6 | 7 | class RectCC : public CollisionComponent{ 8 | public: 9 | RectCC(glm::vec2 dim); 10 | ~RectCC() override = default; 11 | 12 | glm::vec2 getDim() const; 13 | 14 | private: 15 | glm::vec2 dim; 16 | }; 17 | 18 | 19 | #endif //CIRCUITPET_FIRMWARE_RECTCC_H 20 | -------------------------------------------------------------------------------- /src/Games/Pong/PauseState.h: -------------------------------------------------------------------------------- 1 | #ifndef BONK_PAUSESTATE_H 2 | #define BONK_PAUSESTATE_H 3 | 4 | #include "State.hpp" 5 | 6 | namespace Bonk { 7 | class PauseState : public State { 8 | public: 9 | PauseState(Sprite* sprite); 10 | void update(uint _time, Bonk& game) override; 11 | void draw() override; 12 | void start(Bonk& game) override; 13 | void stop() override; 14 | 15 | private: 16 | static PauseState* instance; 17 | }; 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/CircleCC.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CircleCC.h" 3 | 4 | CircleCC::CircleCC(float radius, glm::vec2 offset): radius(radius), offset(offset), CollisionComponent(CollisionType::Circle){ 5 | 6 | } 7 | 8 | float CircleCC::getRadius() const{ 9 | return radius; 10 | } 11 | 12 | glm::vec2 CircleCC::getOffset() const{ 13 | return offset; 14 | } 15 | 16 | void CircleCC::setOffset(const glm::vec2& offset){ 17 | CircleCC::offset = offset; 18 | } 19 | -------------------------------------------------------------------------------- /src/Storage/ConvoRepo.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CONVOREPO_H 2 | #define CHATTER_FIRMWARE_CONVOREPO_H 3 | 4 | #include 5 | #include "Repo.h" 6 | #include "../Model/Convo.hpp" 7 | 8 | class ConvoRepo : public Repo { 9 | public: 10 | using Repo::Repo; 11 | 12 | protected: 13 | bool write(File& file, const Convo& object) override; 14 | bool read(File& file, Convo& object) override; 15 | }; 16 | 17 | 18 | #endif //CHATTER_FIRMWARE_CONVOREPO_H 19 | -------------------------------------------------------------------------------- /src/Storage/Storage.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_STORAGE_H 2 | #define CHATTER_FIRMWARE_STORAGE_H 3 | 4 | #include 5 | #include "Repo.h" 6 | #include "MessageRepo.h" 7 | #include "ConvoRepo.h" 8 | #include "../Model/Friend.hpp" 9 | 10 | struct Repositories { 11 | MessageRepo Messages; 12 | ConvoRepo Convos; 13 | Repo Friends; 14 | 15 | void begin(); 16 | }; 17 | 18 | extern Repositories Storage; 19 | 20 | 21 | #endif //CHATTER_FIRMWARE_STORAGE_H 22 | -------------------------------------------------------------------------------- /src/AutoPop.cpp: -------------------------------------------------------------------------------- 1 | #include "AutoPop.h" 2 | #include 3 | #include 4 | 5 | AutoPop::AutoPop(LVScreen* screen) : screen(screen){} 6 | 7 | AutoPop::~AutoPop(){ 8 | stop(); 9 | } 10 | 11 | void AutoPop::start(){ 12 | Input::getInstance()->addListener(this); 13 | } 14 | 15 | void AutoPop::stop(){ 16 | Input::getInstance()->removeListener(this); 17 | } 18 | 19 | void AutoPop::buttonPressed(uint i){ 20 | if(i != BTN_BACK) return; 21 | screen->pop(); 22 | } 23 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/RenderSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_RENDERSYSTEM_H 2 | #define CIRCUITPET_FIRMWARE_RENDERSYSTEM_H 3 | 4 | #include 5 | #include "../GameSystem.h" 6 | 7 | class RenderSystem : public GameSystem { 8 | public: 9 | RenderSystem(const Game* game, Sprite* canvas); 10 | 11 | void update(uint32_t deltaMicros) override; 12 | 13 | private: 14 | Sprite* canvas; 15 | }; 16 | 17 | 18 | #endif //CIRCUITPET_FIRMWARE_RENDERSYSTEM_H 19 | -------------------------------------------------------------------------------- /src/Elements/IntroScreen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_INTROSCREEN_H 2 | #define CHATTER_FIRMWARE_INTROSCREEN_H 3 | 4 | #include 5 | #include "../Interface/LVScreen.h" 6 | 7 | class IntroScreen : public LVScreen { 8 | public: 9 | IntroScreen(void (* callback)()); 10 | 11 | void onStart() override; 12 | void onStop() override; 13 | 14 | private: 15 | lv_obj_t* gif; 16 | void (*callback)() = nullptr; 17 | 18 | }; 19 | 20 | 21 | #endif //CHATTER_FIRMWARE_INTROSCREEN_H 22 | -------------------------------------------------------------------------------- /src/Modals/BatteryNotification.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_BATTERYNOTIFICATION_H 2 | #define CHATTER_FIRMWARE_BATTERYNOTIFICATION_H 3 | 4 | #include "../Interface/LVModal.h" 5 | 6 | 7 | class BatteryNotification : public LVModal { 8 | public: 9 | enum Type { 10 | WARNING, SHUTDOWN 11 | }; 12 | BatteryNotification(LVScreen* parent, Type type); 13 | protected: 14 | void onStart() override; 15 | void onStop() override; 16 | }; 17 | 18 | 19 | #endif //CHATTER_FIRMWARE_BATTERYNOTIFICATION_H 20 | -------------------------------------------------------------------------------- /src/InputLVGL.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_INPUTLVGL_H 2 | #define CHATTER_FIRMWARE_INPUTLVGL_H 3 | 4 | #include 5 | class InputLVGL{ 6 | public: 7 | InputLVGL(lv_indev_type_t type = LV_INDEV_TYPE_KEYPAD); 8 | static InputLVGL* getInstance(); 9 | 10 | virtual void read(lv_indev_drv_t* drv, lv_indev_data_t* data) = 0; 11 | lv_indev_t* getIndev(); 12 | 13 | private: 14 | static InputLVGL* instance; 15 | lv_indev_t* inputDevice; 16 | }; 17 | 18 | 19 | #endif //CHATTER_FIRMWARE_INPUTLVGL_H 20 | -------------------------------------------------------------------------------- /src/Services/Pair/BroadcastState.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_BROADCASTSTATE_H 2 | #define CHATTER_FIRMWARE_BROADCASTSTATE_H 3 | #include "State.h" 4 | 5 | using namespace Pairing; 6 | 7 | class BroadcastState : public State { 8 | public: 9 | BroadcastState(PairService* pService); 10 | void loop(uint micros) override; 11 | private: 12 | const uint32_t bufferClearTime = 1000000; 13 | uint32_t buffTime = 0; 14 | bool buffCleared = false; 15 | }; 16 | 17 | 18 | #endif //CHATTER_FIRMWARE_BROADCASTSTATE_H 19 | -------------------------------------------------------------------------------- /src/Storage/MessageRepo.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_MESSAGEREPO_H 2 | #define CHATTER_FIRMWARE_MESSAGEREPO_H 3 | 4 | #include 5 | #include 6 | #include "Repo.h" 7 | #include "../Model/Message.h" 8 | 9 | class MessageRepo : public Repo { 10 | public: 11 | using Repo::Repo; 12 | 13 | protected: 14 | bool write(fs::File& file, const Message& object) override; 15 | bool read(fs::File& file, Message& object) override; 16 | 17 | }; 18 | 19 | #endif //CHATTER_FIRMWARE_MESSAGEREPO_H 20 | -------------------------------------------------------------------------------- /src/AutoPop.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_AUTOPOP_H 2 | #define CHATTER_FIRMWARE_AUTOPOP_H 3 | 4 | #include 5 | #include 6 | #include "Interface/LVScreen.h" 7 | 8 | class AutoPop : private InputListener { 9 | public: 10 | AutoPop(LVScreen* screen); 11 | virtual ~AutoPop(); 12 | 13 | void start(); 14 | void stop(); 15 | 16 | private: 17 | LVScreen* screen; 18 | 19 | void buttonPressed(uint i) override; 20 | 21 | }; 22 | 23 | 24 | #endif //CHATTER_FIRMWARE_AUTOPOP_H 25 | -------------------------------------------------------------------------------- /src/Games/Pong/State.hpp: -------------------------------------------------------------------------------- 1 | #ifndef BONK_STATE_H 2 | #define BONK_STATE_H 3 | 4 | #include 5 | 6 | namespace Bonk { 7 | class Bonk; 8 | 9 | class State { 10 | public: 11 | State(Sprite* sprite) : display(sprite){ } 12 | virtual ~State(); 13 | 14 | virtual void start(Bonk& game) = 0; 15 | virtual void update(uint _time, Bonk& game) = 0; 16 | virtual void draw() = 0; 17 | virtual void stop(){ } 18 | 19 | protected: 20 | Sprite* display; 21 | Bonk* game; 22 | }; 23 | }; 24 | 25 | #endif -------------------------------------------------------------------------------- /src/Elements/ListItem.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_LISTITEM_H 2 | #define CHATTER_FIRMWARE_LISTITEM_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include 8 | 9 | class ListItem : public LVObject { 10 | public: 11 | ListItem(lv_obj_t* parent, const std::string& text, uint8_t icon=0); 12 | virtual ~ListItem(); 13 | 14 | protected: 15 | lv_style_t styleFocus; 16 | lv_style_t styleDef; 17 | lv_obj_t* name; 18 | }; 19 | 20 | 21 | #endif //CHATTER_FIRMWARE_LISTITEM_H 22 | -------------------------------------------------------------------------------- /src/Elements/BatteryElement.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_BATTERYELEMENT_H 2 | #define CHATTER_FIRMWARE_BATTERYELEMENT_H 3 | 4 | #include 5 | #include "../Interface/LVObject.h" 6 | #include 7 | 8 | class BatteryElement : public LVObject, public LoopListener { 9 | public: 10 | BatteryElement(lv_obj_t* parent); 11 | 12 | virtual ~BatteryElement(); 13 | 14 | void loop(uint micros) override; 15 | 16 | private: 17 | lv_obj_t* img; 18 | uint8_t level; 19 | }; 20 | 21 | 22 | #endif //CHATTER_FIRMWARE_BATTERYELEMENT_H 23 | -------------------------------------------------------------------------------- /src/Games/GameEngine/GameSystem.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_GAMESYSTEM_H 2 | #define CIRCUITPET_FIRMWARE_GAMESYSTEM_H 3 | 4 | #include "GameObject.h" 5 | #include 6 | #include 7 | 8 | class Game; 9 | 10 | class GameSystem { 11 | public: 12 | virtual void update(uint32_t deltaMicros) = 0; 13 | 14 | protected: 15 | GameSystem(const Game* game); 16 | 17 | std::set> getObjects(); 18 | 19 | private: 20 | const Game* game; 21 | 22 | }; 23 | 24 | 25 | #endif //CIRCUITPET_FIRMWARE_GAMESYSTEM_H 26 | -------------------------------------------------------------------------------- /src/Elements/GameItem.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_GAMEITEM_H 2 | #define CHATTER_FIRMWARE_GAMEITEM_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include 8 | 9 | class GameItem : public LVObject { 10 | public: 11 | GameItem(lv_obj_t* parent, const std::string& text, const std::string& icon); 12 | virtual ~GameItem(); 13 | 14 | protected: 15 | lv_style_t styleFocus; 16 | lv_style_t styleDef; 17 | lv_obj_t* name; 18 | lv_obj_t* image; 19 | }; 20 | 21 | 22 | #endif //CHATTER_FIRMWARE_GAMEITEM_H 23 | -------------------------------------------------------------------------------- /src/Games/Common/Score.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_SCORE_H 2 | #define CIRCUITPET_FIRMWARE_SCORE_H 3 | 4 | 5 | #include "../GameEngine/GameObject.h" 6 | #include "../GameEngine/Rendering/SpriteRC.h" 7 | 8 | class Score { 9 | public: 10 | Score(File icon); 11 | 12 | std::shared_ptr getGO() const; 13 | void setScore(uint16_t score); 14 | 15 | private: 16 | File icon; 17 | 18 | std::shared_ptr go; 19 | std::shared_ptr rc; 20 | std::shared_ptr sprite; 21 | 22 | }; 23 | 24 | 25 | #endif //CIRCUITPET_FIRMWARE_SCORE_H 26 | -------------------------------------------------------------------------------- /src/Screens/FriendsScreen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_FRIENDSSCREEN_H 2 | #define CHATTER_FIRMWARE_FRIENDSSCREEN_H 3 | 4 | #include 5 | #include "../Interface/LVScreen.h" 6 | #include "../AutoPop.h" 7 | #include "../Elements/User.h" 8 | 9 | class FriendsScreen : public LVScreen{ 10 | public: 11 | FriendsScreen(); 12 | 13 | void onStart() override; 14 | void onStop() override; 15 | void onStarting() override; 16 | 17 | private: 18 | AutoPop apop; 19 | 20 | std::vector elements; 21 | 22 | }; 23 | 24 | 25 | #endif //CHATTER_FIRMWARE_FRIENDSSCREEN_H 26 | -------------------------------------------------------------------------------- /src/Elements/EmojiMenu.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_EMOJIMENU_H 2 | #define CHATTER_FIRMWARE_EMOJIMENU_H 3 | 4 | #include "../Interface/LVObject.h" 5 | 6 | class EmojiMenu : public LVObject { 7 | public: 8 | EmojiMenu(lv_obj_t* parent, void(*callback)(uint8_t emojiID, void* userData), void* userData); 9 | void exit(uint8_t emojiID); 10 | void enter(lv_group_t* oldGroup); 11 | private: 12 | void(*returnCallback)(uint8_t emojiID, void* userData); 13 | lv_group_t* group; 14 | lv_group_t* oldGroup; 15 | void* userData; 16 | }; 17 | 18 | 19 | #endif //CHATTER_FIRMWARE_EMOJIMENU_H 20 | -------------------------------------------------------------------------------- /src/Modals/Prompt.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_PROMPT_H 2 | #define CHATTER_FIRMWARE_PROMPT_H 3 | 4 | #include "../Interface/LVModal.h" 5 | 6 | #define EV_PROMPT_YES ((lv_event_code_t) (_LV_EVENT_LAST + 1)) 7 | #define EV_PROMPT_NO ((lv_event_code_t) (_LV_EVENT_LAST + 2)) 8 | 9 | class Prompt : public LVModal{ 10 | public: 11 | Prompt(LVScreen* parent, const char* text); 12 | virtual ~Prompt(); 13 | 14 | private: 15 | lv_style_t btnDefault; 16 | lv_style_t btnFocused; 17 | 18 | lv_obj_t* noBtn; 19 | lv_obj_t* yesBtn; 20 | }; 21 | 22 | 23 | #endif //CHATTER_FIRMWARE_PROMPT_H 24 | -------------------------------------------------------------------------------- /src/Games/Space/Player.cpp: -------------------------------------------------------------------------------- 1 | #include "Player.h" 2 | 3 | void Player::leftTurn(float delta){ 4 | angle -= delta * rotSpeed; 5 | angle = fmod(angle, 360.0f); 6 | 7 | obj->setRot(angle); 8 | } 9 | 10 | void Player::rightTurn(float delta){ 11 | angle += delta * rotSpeed; 12 | angle = fmod(angle, 360.0f); 13 | 14 | obj->setRot(angle); 15 | } 16 | 17 | float Player::getAngle() const{ 18 | return angle; 19 | } 20 | 21 | void Player::setObj(Player::ObjPtr obj){ 22 | Player::obj = obj; 23 | 24 | } 25 | 26 | const Player::ObjPtr& Player::getObj() const{ 27 | return obj; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/Games/Common/Hearts.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_HEARTS_H 2 | #define CIRCUITPET_FIRMWARE_HEARTS_H 3 | 4 | 5 | #include 6 | #include "../GameEngine/GameObject.h" 7 | #include "../GameEngine/Rendering/SpriteRC.h" 8 | 9 | class Hearts { 10 | public: 11 | Hearts(File heart); 12 | 13 | std::shared_ptr getGO() const; 14 | void setLives(uint8_t lives); 15 | 16 | private: 17 | File heart; 18 | 19 | std::shared_ptr go; 20 | std::shared_ptr rc; 21 | std::shared_ptr sprite; 22 | 23 | }; 24 | 25 | 26 | #endif //CIRCUITPET_FIRMWARE_HEARTS_H 27 | -------------------------------------------------------------------------------- /src/Games/Space/Player.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_PLAYER_H 2 | #define CIRCUITPET_FIRMWARE_PLAYER_H 3 | 4 | #include "../GameEngine/GameObject.h" 5 | 6 | class Player{ 7 | typedef std::shared_ptr ObjPtr; 8 | 9 | public: 10 | void setObj(ObjPtr obj); 11 | const ObjPtr& getObj() const; 12 | 13 | void leftTurn(float delta); 14 | void rightTurn(float delta); 15 | 16 | float getAngle() const; 17 | private: 18 | float angle = 0.f; //0 - 360 19 | 20 | constexpr static float rotSpeed = 140.f; 21 | 22 | ObjPtr obj; 23 | }; 24 | 25 | 26 | #endif //CIRCUITPET_FIRMWARE_PLAYER_H 27 | -------------------------------------------------------------------------------- /src/Games/Pong/TitleState.h: -------------------------------------------------------------------------------- 1 | #ifndef BONK_TITLESTATE_H 2 | #define BONK_TITLESTATE_H 3 | 4 | #include "State.hpp" 5 | 6 | namespace Bonk { 7 | class TitleState : public State { 8 | public: 9 | TitleState(Sprite* sprite); 10 | virtual ~TitleState(); 11 | void update(uint _time, Bonk& game) override; 12 | void draw() override; 13 | void start(Bonk& game) override; 14 | void stop() override; 15 | private: 16 | static const char* titleMenu[3] PROGMEM; 17 | uint8_t titleCursor; 18 | bool blinkState; 19 | uint blinkMicros; 20 | static TitleState* instance; 21 | }; 22 | }; 23 | 24 | #endif -------------------------------------------------------------------------------- /src/Services/ShutdownService.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_SHUTDOWNSERVICE_H 2 | #define CHATTER_FIRMWARE_SHUTDOWNSERVICE_H 3 | 4 | #include 5 | 6 | class ShutdownService : public LoopListener{ 7 | public: 8 | void begin(); 9 | void loop(uint micros) override; 10 | 11 | private: 12 | bool warningShown = false; 13 | bool shutdownStarted = false; 14 | const uint32_t checkInterval = 10000000; //10 sec 15 | uint32_t checkTimer = 0; 16 | 17 | void showWarning(); 18 | void showShutdown(); 19 | }; 20 | 21 | extern ShutdownService Shutdown; 22 | 23 | #endif //CHATTER_FIRMWARE_SHUTDOWNSERVICE_H 24 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/CircleCC.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CIRCUITPET_FIRMWARE_CIRCLECC_H 3 | #define CIRCUITPET_FIRMWARE_CIRCLECC_H 4 | 5 | #include 6 | #include "CollisionComponent.h" 7 | #include "../PixelDim.hpp" 8 | 9 | class CircleCC : public CollisionComponent{ 10 | public: 11 | CircleCC(float radius, glm::vec2 offset = {0, 0}); 12 | ~CircleCC() override = default; 13 | 14 | float getRadius() const; 15 | glm::vec2 getOffset() const; 16 | void setOffset(const glm::vec2& offset); 17 | 18 | private: 19 | float radius; 20 | glm::vec2 offset; 21 | }; 22 | 23 | 24 | #endif //CIRCUITPET_FIRMWARE_CIRCLECC_H 25 | -------------------------------------------------------------------------------- /src/Interface/LVObject.cpp: -------------------------------------------------------------------------------- 1 | #include "LVObject.h" 2 | 3 | LVObject::LVObject(lv_obj_t* parent){ 4 | obj = lv_obj_create(parent); 5 | 6 | lv_obj_clear_flag(obj, LV_OBJ_FLAG_SCROLLABLE); 7 | 8 | lv_obj_add_event_cb(obj, [](lv_event_t* event){ 9 | auto obj = static_cast(event->user_data); 10 | if(!obj->deleting){ 11 | obj->deleting = true; 12 | delete obj; 13 | } 14 | }, LV_EVENT_DELETE, this); 15 | } 16 | 17 | LVObject::~LVObject(){ 18 | if(!deleting){ 19 | deleting = true; 20 | lv_obj_del((lv_obj_t*) obj); 21 | } 22 | } 23 | 24 | lv_obj_t* LVObject::getLvObj(){ 25 | return obj; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/Services/Pair/RequestState.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_REQUESTSTATE_H 2 | #define CHATTER_FIRMWARE_REQUESTSTATE_H 3 | 4 | #include "State.h" 5 | #include "../../Types.hpp" 6 | 7 | using namespace Pairing; 8 | 9 | class RequestState : public State { 10 | public: 11 | RequestState(UID_t uid, PairService* pairService); 12 | void loop(uint micros) override; 13 | private: 14 | UID_t uid; 15 | uint8_t key[32]; 16 | 17 | uint32_t broadcastTime = broadcastInterval; 18 | uint32_t broadcastRand = 0; 19 | const uint32_t broadcastInterval = 1000000; //1s interval 20 | }; 21 | 22 | 23 | #endif //CHATTER_FIRMWARE_REQUESTSTATE_H 24 | -------------------------------------------------------------------------------- /src/Elements/EditableAvatar.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_EDITABLEAVATAR_H 2 | #define CHATTER_FIRMWARE_EDITABLEAVATAR_H 3 | 4 | #include "Avatar.h" 5 | 6 | class EditableAvatar : public LVObject{ 7 | public: 8 | EditableAvatar(lv_obj_t* parent, uint8_t index = 1, bool large = false); 9 | void toggleState(); 10 | void scrollUp(); 11 | void scrollDown(); 12 | uint8_t getIndex() const; 13 | private: 14 | Avatar* avatar; 15 | lv_obj_t* arrowLeft; 16 | lv_obj_t* arrowRight; 17 | uint8_t index = 1; 18 | bool arrowsState = false; 19 | lv_anim_t anim; 20 | 21 | void exit(); 22 | }; 23 | 24 | 25 | #endif //CHATTER_FIRMWARE_EDITABLEAVATAR_H 26 | -------------------------------------------------------------------------------- /src/Interface/LVSelectable.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_LVSELECTABLE_H 2 | #define CHATTER_FIRMWARE_LVSELECTABLE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "LVObject.h" 8 | 9 | class LVSelectable : virtual public LVObject { 10 | public: 11 | LVSelectable(lv_obj_t* parent); 12 | virtual ~LVSelectable(); 13 | 14 | bool isActive() const; 15 | void select(); 16 | void deselect(); 17 | 18 | protected: 19 | lv_group_t* inputGroup; 20 | 21 | private: 22 | lv_group_t* parentGroup = nullptr; 23 | bool active = false; 24 | }; 25 | 26 | 27 | #endif //CHATTER_FIRMWARE_LVSELECTABLE_H 28 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/SpriteRC.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CIRCUITPET_FIRMWARE_SPRITERC_H 3 | #define CIRCUITPET_FIRMWARE_SPRITERC_H 4 | 5 | 6 | #include 7 | #include 8 | #include "../PixelDim.hpp" 9 | #include "RenderComponent.h" 10 | 11 | class SpriteRC : public RenderComponent { 12 | public: 13 | SpriteRC(PixelDim dim); 14 | virtual ~SpriteRC() = default; 15 | std::shared_ptr getSprite() const; 16 | 17 | protected: 18 | void push(Sprite* parent, PixelDim pos, float rot) const override; 19 | 20 | private: 21 | std::shared_ptr sprite; 22 | }; 23 | 24 | 25 | #endif //CIRCUITPET_FIRMWARE_SPRITERC_H 26 | -------------------------------------------------------------------------------- /src/Games/Common/Hearts.cpp: -------------------------------------------------------------------------------- 1 | #include "Hearts.h" 2 | 3 | Hearts::Hearts(File heart) : heart(heart){ 4 | go = std::make_shared( 5 | std::make_unique(PixelDim{ 25, 6 }), 6 | nullptr 7 | ); 8 | 9 | rc = std::static_pointer_cast(go->getRenderComponent()); 10 | rc->setLayer(10); 11 | sprite = rc->getSprite(); 12 | 13 | setLives(3); 14 | } 15 | 16 | void Hearts::setLives(uint8_t lives){ 17 | sprite->clear(TFT_TRANSPARENT); 18 | 19 | for(int i = 0; i < lives; i++){ 20 | sprite->drawIcon(heart, i*9, 0, 7, 6, 1, TFT_TRANSPARENT); 21 | } 22 | } 23 | 24 | std::shared_ptr Hearts::getGO() const{ 25 | return go; 26 | } 27 | -------------------------------------------------------------------------------- /src/Elements/PicMenu.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_PICMENU_H 2 | #define CHATTER_FIRMWARE_PICMENU_H 3 | 4 | 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include "../Interface/LVModal.h" 8 | 9 | class PicMenu : public LVModal { 10 | public: 11 | PicMenu(LVScreen* parent); 12 | 13 | uint8_t getSelected(); 14 | 15 | protected: 16 | void onStart() override; 17 | void onStop() override; 18 | 19 | private: 20 | lv_obj_t* picLayout; 21 | std::vector pics; 22 | 23 | lv_obj_t* arrowLeft; 24 | lv_obj_t* arrowRight; 25 | lv_anim_t anim; 26 | 27 | uint8_t index = 0; 28 | 29 | void refreshArrows(); 30 | 31 | }; 32 | 33 | 34 | #endif //CHATTER_FIRMWARE_PICMENU_H 35 | -------------------------------------------------------------------------------- /src/Elements/BatteryElement.cpp: -------------------------------------------------------------------------------- 1 | #include "BatteryElement.h" 2 | 3 | BatteryElement::BatteryElement(lv_obj_t* parent) : LVObject(parent){ 4 | lv_obj_set_size(obj, 19, 12); 5 | img = lv_img_create(obj); 6 | 7 | level = Battery.getLevel(); 8 | lv_img_set_src(img, (String("S:/Battery/") + level + ".bin").c_str()); 9 | 10 | LoopManager::addListener(this); 11 | } 12 | 13 | void BatteryElement::loop(uint micros){ 14 | uint8_t newLevel = Battery.getLevel(); 15 | if(newLevel != level){ 16 | level = newLevel; 17 | lv_img_set_src(img, (String("S:/Battery/") + level + ".bin").c_str()); 18 | } 19 | 20 | } 21 | 22 | BatteryElement::~BatteryElement(){ 23 | LoopManager::removeListener(this); 24 | } 25 | -------------------------------------------------------------------------------- /src/Elements/NotificationElement.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_NOTIFICATIONELEMENT_H 2 | #define CHATTER_FIRMWARE_NOTIFICATIONELEMENT_H 3 | 4 | #include 5 | #include "../Interface/LVObject.h" 6 | #include "../Services/MessageService.h" 7 | 8 | class NotificationElement : public LVObject, private UnreadListener { 9 | public: 10 | NotificationElement(lv_obj_t* parent); 11 | virtual ~NotificationElement(); 12 | 13 | void start(); 14 | void stop(); 15 | 16 | private: 17 | lv_obj_t* img; 18 | lv_anim_t anim; 19 | 20 | static void notifFloat(void* var, int32_t value); 21 | 22 | void onUnread(bool unread) override; 23 | }; 24 | 25 | 26 | #endif //CHATTER_FIRMWARE_NOTIFICATIONELEMENT_H 27 | -------------------------------------------------------------------------------- /src/Interface/LVModal.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_LVMODAL_H 2 | #define CHATTER_FIRMWARE_LVMODAL_H 3 | 4 | 5 | #include "LVObject.h" 6 | #include "LVScreen.h" 7 | 8 | class LVModal : public LVObject { 9 | public: 10 | LVModal(LVScreen* parent); 11 | virtual ~LVModal(); 12 | 13 | void start(); 14 | void stop(); 15 | 16 | bool isActive() const; 17 | 18 | static LVModal* getCurrent(); 19 | protected: 20 | LVScreen* parentScreen; 21 | lv_group_t* inputGroup; 22 | 23 | lv_obj_t* container; 24 | 25 | bool active = false; 26 | 27 | virtual void onStart(); 28 | virtual void onStop(); 29 | 30 | private: 31 | static LVModal* current; 32 | 33 | }; 34 | 35 | 36 | #endif //CHATTER_FIRMWARE_LVMODAL_H 37 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/SpriteRC.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "SpriteRC.h" 3 | 4 | SpriteRC::SpriteRC(PixelDim dim) : sprite(std::make_shared((Sprite*) nullptr, dim.x, dim.y)){ 5 | static_cast(sprite.get())->setSwapBytes(false); //has to be called since it's not inherited from baseSprite or any other sprite 6 | } 7 | 8 | std::shared_ptr SpriteRC::getSprite() const{ 9 | return sprite; 10 | } 11 | 12 | void SpriteRC::push(Sprite* parent, PixelDim pos, float rot) const{ 13 | if(rot == 0){ 14 | sprite->push(parent, pos.x, pos.y); 15 | }else{ 16 | sprite->pushRotateZoomWithAA(parent, pos.x + sprite->width() / 2, pos.y + sprite->height() / 2, rot, 1, 1, TFT_TRANSPARENT); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Elements/User.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_USER_H 2 | #define CHATTER_FIRMWARE_USER_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include "../Model/Profile.hpp" 8 | #include "../Services/ProfileService.h" 9 | 10 | class Avatar; 11 | 12 | class User : public LVObject, private ProfileListener { 13 | public: 14 | User(lv_obj_t* parent, const Friend &fren); 15 | virtual ~User(); 16 | UID_t getUID(); 17 | protected: 18 | lv_style_t styleFocus; 19 | lv_style_t styleDef; 20 | lv_obj_t* name; 21 | 22 | UID_t frenUID; 23 | Avatar* avatar; 24 | 25 | private: 26 | void profileChanged(const Friend &fren) override; 27 | }; 28 | 29 | 30 | #endif //CHATTER_FIRMWARE_USER_H 31 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/StaticRC.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_STATICRC_H 2 | #define CIRCUITPET_FIRMWARE_STATICRC_H 3 | 4 | #include "RenderComponent.h" 5 | 6 | class StaticRC : public RenderComponent{ 7 | public: 8 | /** 9 | * @param file Raw RGB565 image file. 10 | * @param dim Width, height. 11 | */ 12 | StaticRC(File file, PixelDim dim); 13 | ~StaticRC() override = default; 14 | 15 | void setFile(File file); //no change in dim 16 | void setFile(File file, PixelDim dim); //change in dim 17 | 18 | protected: 19 | void push(Sprite* parent, PixelDim pos, float rot) const override; 20 | 21 | private: 22 | File file; 23 | PixelDim dim; 24 | }; 25 | 26 | 27 | #endif //CIRCUITPET_FIRMWARE_STATICRC_H 28 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/RenderComponent.h: -------------------------------------------------------------------------------- 1 | #ifndef CIRCUITPET_FIRMWARE_RENDERCOMPONENT_H 2 | #define CIRCUITPET_FIRMWARE_RENDERCOMPONENT_H 3 | 4 | #include 5 | #include "../PixelDim.hpp" 6 | 7 | class RenderSystem; 8 | 9 | class RenderComponent { 10 | friend RenderSystem; 11 | 12 | public: 13 | virtual ~RenderComponent() = default; 14 | int8_t getLayer() const; 15 | void setLayer(int8_t layer); 16 | 17 | bool isVisible() const; 18 | void setVisible(bool visible); 19 | 20 | protected: 21 | virtual void push(Sprite* parent, PixelDim pos, float rot) const = 0; 22 | 23 | private: 24 | bool visible = true; 25 | int8_t layer = 0; 26 | }; 27 | 28 | 29 | #endif //CIRCUITPET_FIRMWARE_RENDERCOMPONENT_H 30 | -------------------------------------------------------------------------------- /src/Elements/ConvoMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CONVOMESSAGE_H 2 | #define CHATTER_FIRMWARE_CONVOMESSAGE_H 3 | 4 | #include 5 | #include "../Interface/LVObject.h" 6 | #include "../Model/Message.h" 7 | 8 | class ConvoMessage : public LVObject{ 9 | public: 10 | ConvoMessage(lv_obj_t* parent, const Message& msg, uint16_t bgColor); 11 | virtual ~ConvoMessage(); 12 | void setDelivered(bool delivered); 13 | void setHue(uint16_t hue); 14 | 15 | const Message& getMsg() const; 16 | void clearFocus(); 17 | 18 | private: 19 | lv_style_t defaultStyle; 20 | lv_style_t focusedStyle; 21 | lv_obj_t* deliveredIndicator; 22 | lv_obj_t* label; 23 | 24 | Message msg; 25 | }; 26 | 27 | 28 | #endif //CHATTER_FIRMWARE_CONVOMESSAGE_H 29 | -------------------------------------------------------------------------------- /src/InputChatter.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_INPUTCHATTER_H 2 | #define CHATTER_FIRMWARE_INPUTCHATTER_H 3 | 4 | #include "InputLVGL.h" 5 | #include 6 | #include 7 | #include 8 | 9 | class InputChatter : public InputLVGL , public InputListener{ 10 | public: 11 | InputChatter(); 12 | void read(lv_indev_drv_t* drv, lv_indev_data_t* data) override; 13 | 14 | void buttonPressed(uint i) override; 15 | void buttonReleased(uint i) override; 16 | 17 | static InputChatter* getInputInstance(); 18 | 19 | private: 20 | uint32_t lastKey = -1; 21 | bool pressed = false; 22 | static std::map keyMap; 23 | 24 | static InputChatter* instance; 25 | 26 | }; 27 | 28 | 29 | #endif //CHATTER_FIRMWARE_INPUTCHATTER_H 30 | -------------------------------------------------------------------------------- /src/Interface/Pics.cpp: -------------------------------------------------------------------------------- 1 | #include "Pics.h" 2 | 3 | const Pic Pics[NUM_PICS] = { 4 | { "0.bin" }, 5 | { "1.bin" }, 6 | { "2.bin" }, 7 | { "3.bin" }, 8 | { "4.bin" }, 9 | { "5.bin" }, 10 | { "6.bin" }, 11 | { "7.bin" }, 12 | }; 13 | 14 | bool Pic::gif() const{ 15 | String str = String(name); 16 | str.toLowerCase(); 17 | return str.endsWith(".gif"); 18 | } 19 | 20 | lv_obj_t* Pic::create(lv_obj_t* parent) const{ 21 | String path = String("S:/Pics/") + name; 22 | 23 | lv_obj_t* pic; 24 | if(gif()){ 25 | pic = lv_gif_create(parent); 26 | lv_gif_set_src(pic, path.c_str()); 27 | }else{ 28 | pic = lv_img_create(parent); 29 | lv_img_set_src(pic, path.c_str()); 30 | } 31 | 32 | lv_obj_set_size(pic, 64, 64); 33 | 34 | return pic; 35 | } 36 | -------------------------------------------------------------------------------- /src/Screens/InboxScreen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_INBOXSCREEN_H 2 | #define CHATTER_FIRMWARE_INBOXSCREEN_H 3 | #include "../Interface/LVScreen.h" 4 | #include "vector" 5 | #include "../AutoPop.h" 6 | #include "../Types.hpp" 7 | 8 | class UserWithMessage; 9 | 10 | class InboxScreen : public LVScreen{ 11 | public: 12 | InboxScreen(); 13 | 14 | void onStart() override; 15 | void onStop() override; 16 | void onStarting() override; 17 | 18 | protected: 19 | AutoPop apop; 20 | 21 | struct LaunchParams { 22 | UID_t uid; 23 | InboxScreen* ctx; 24 | }; 25 | 26 | std::vector params; 27 | 28 | std::vector userElements; 29 | 30 | void openConvo(UID_t uid); 31 | }; 32 | 33 | 34 | #endif //CHATTER_FIRMWARE_INBOXSCREEN_H 35 | -------------------------------------------------------------------------------- /src/Services/Pair/AcknowledgeState.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_ACKNOWLEDGESTATE_H 2 | #define CHATTER_FIRMWARE_ACKNOWLEDGESTATE_H 3 | 4 | #include "State.h" 5 | #include "../../Types.hpp" 6 | 7 | using namespace Pairing; 8 | 9 | class AcknowledgeState : public State { 10 | public: 11 | AcknowledgeState(UID_t uid, uint8_t* key, PairService* pairService); 12 | void loop(uint micros) override; 13 | private: 14 | UID_t uid; 15 | uint8_t key[32]; 16 | 17 | uint32_t broadcastTime = broadcastInterval; 18 | uint32_t broadcastRand = 0; 19 | const uint32_t broadcastInterval = 1000000; //1s interval 20 | bool whichPack = false; 21 | 22 | uint8_t ackSent = 0; 23 | uint8_t ackSuccessful = 0; 24 | }; 25 | 26 | 27 | #endif //CHATTER_FIRMWARE_ACKNOWLEDGESTATE_H 28 | -------------------------------------------------------------------------------- /src/Elements/UserWithMessage.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_USERWITHMESSAGE_H 2 | #define CHATTER_FIRMWARE_USERWITHMESSAGE_H 3 | 4 | #include "User.h" 5 | #include 6 | #include "../Services/MessageService.h" 7 | 8 | class UserWithMessage : public User, private MsgReceivedListener, private UnreadListener { 9 | public: 10 | UserWithMessage(lv_obj_t* parent, const Friend &fren, const std::string& text = ""); 11 | virtual ~UserWithMessage(); 12 | 13 | void setText(const std::string& text); 14 | void updateText(); 15 | 16 | private: 17 | lv_obj_t* message; 18 | lv_obj_t* notif; 19 | 20 | void msgReceived(const Message &message) override; 21 | void onUnread(bool unread) override; 22 | 23 | }; 24 | 25 | 26 | #endif //CHATTER_FIRMWARE_USERWITHMESSAGE_H 27 | -------------------------------------------------------------------------------- /src/InputLVGL.cpp: -------------------------------------------------------------------------------- 1 | #include "InputLVGL.h" 2 | #include 3 | //#include 4 | 5 | InputLVGL* InputLVGL::instance = nullptr; 6 | 7 | InputLVGL::InputLVGL(lv_indev_type_t type){ 8 | instance = this; 9 | 10 | static lv_indev_drv_t inputDriver; 11 | lv_indev_drv_init(&inputDriver); 12 | inputDriver.type = type; 13 | inputDriver.long_press_repeat_time = UINT16_MAX; 14 | inputDriver.long_press_time = UINT16_MAX; 15 | inputDriver.read_cb = [](lv_indev_drv_t* drv, lv_indev_data_t* data){InputLVGL::getInstance()->read(drv, data);}; 16 | inputDevice = lv_indev_drv_register(&inputDriver); 17 | } 18 | 19 | InputLVGL* InputLVGL::getInstance(){ 20 | return instance; 21 | } 22 | 23 | lv_indev_t* InputLVGL::getIndev(){ 24 | return inputDevice; 25 | } 26 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/CollisionComponent.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CIRCUITPET_FIRMWARE_COLLISIONCOMPONENT_H 3 | #define CIRCUITPET_FIRMWARE_COLLISIONCOMPONENT_H 4 | 5 | #include 6 | #include 7 | 8 | class RectCC; 9 | 10 | class CircleCC; 11 | 12 | class PolygonCC; 13 | 14 | enum class CollisionType { 15 | Circle, Rect, Polygon 16 | }; 17 | 18 | class CollisionComponent { 19 | protected: 20 | CollisionType type; 21 | CollisionComponent(CollisionType type); 22 | 23 | public: 24 | virtual ~CollisionComponent() = default; 25 | CollisionType getType() const; 26 | const CircleCC* getCircle() const; 27 | const RectCC* getRect() const; 28 | const PolygonCC* getPolygon() const; 29 | }; 30 | 31 | 32 | #endif //CIRCUITPET_FIRMWARE_COLLISIONCOMPONENT_H 33 | -------------------------------------------------------------------------------- /src/Games/Common/Score.cpp: -------------------------------------------------------------------------------- 1 | #include "Score.h" 2 | 3 | Score::Score(File icon) : icon(icon){ 4 | go = std::make_shared( 5 | std::make_unique(PixelDim{ 28, 8 }), 6 | nullptr 7 | ); 8 | 9 | rc = std::static_pointer_cast(go->getRenderComponent()); 10 | rc->setLayer(10); 11 | sprite = rc->getSprite(); 12 | 13 | sprite->setTextFont(0); 14 | sprite->setTextSize(0); 15 | sprite->setTextColor(TFT_WHITE); 16 | 17 | setScore(0); 18 | } 19 | 20 | void Score::setScore(uint16_t score){ 21 | sprite->clear(TFT_TRANSPARENT); 22 | 23 | sprite->drawIcon(icon, 28 - 7, 0, 7, 7, 1, TFT_TRANSPARENT); 24 | sprite->setCursor(0, 0); 25 | sprite->printf("%3d", score); 26 | } 27 | 28 | std::shared_ptr Score::getGO() const{ 29 | return go; 30 | } 31 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Highscore.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_HIGHSCORE_H 2 | #define CHATTER_HIGHSCORE_H 3 | 4 | #include 5 | #include 6 | 7 | #define HS_NAME_LIMIT 3 // player name character limit 8 | #define HS_MAX_SCORES 5 // # of players in HS 9 | 10 | class Highscore { 11 | public: 12 | virtual ~Highscore(); 13 | 14 | struct Score { 15 | char name[HS_NAME_LIMIT + 1]; 16 | uint score; 17 | }; 18 | 19 | void begin(const char* name); 20 | void add(const Score& score); 21 | const Score& get(uint8_t i); 22 | void clear(); 23 | uint8_t count(); 24 | 25 | private: 26 | struct Data { 27 | uint8_t count; 28 | Score scores[HS_MAX_SCORES]; 29 | } data; 30 | 31 | void save(); 32 | void load(); 33 | 34 | nvs_handle nvs = 0; 35 | }; 36 | 37 | 38 | #endif // CHATTER_HIGHSCORE_H -------------------------------------------------------------------------------- /src/Screens/GamesScreen.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_GAMESSCREEN_H 2 | #define CHATTER_FIRMWARE_GAMESSCREEN_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVScreen.h" 7 | #include "../AutoPop.h" 8 | #include "../Elements/User.h" 9 | #include "../Games/GameEngine/Game.h" 10 | 11 | class GamesScreen : public LVScreen{ 12 | public: 13 | GamesScreen(); 14 | 15 | void onStart() override; 16 | void onStop() override; 17 | 18 | private: 19 | AutoPop apop; 20 | 21 | std::vector elements; 22 | 23 | struct GameInfo { 24 | const char* name; 25 | const char* icon; 26 | std::function launch; 27 | const char* splash = nullptr; 28 | }; 29 | 30 | static const GameInfo Games[]; 31 | 32 | }; 33 | 34 | 35 | #endif //CHATTER_FIRMWARE_GAMESSCREEN_H 36 | -------------------------------------------------------------------------------- /src/Games/GameEngine/GameObject.cpp: -------------------------------------------------------------------------------- 1 | #include "GameObject.h" 2 | 3 | GameObject::GameObject(std::unique_ptr rc, std::unique_ptr cc) : renderComponent(std::move(rc)), 4 | collisionComponent(std::move(cc)){ 5 | } 6 | 7 | glm::vec2 GameObject::getPos() const{ 8 | return pos; 9 | } 10 | 11 | void GameObject::setPos(glm::vec2 pos){ 12 | GameObject::pos = pos; 13 | } 14 | 15 | std::shared_ptr GameObject::getRenderComponent() const{ 16 | return renderComponent; 17 | } 18 | 19 | std::shared_ptr GameObject::getCollisionComponent() const{ 20 | return collisionComponent; 21 | } 22 | 23 | float GameObject::getRot() const{ 24 | return rot; 25 | } 26 | 27 | void GameObject::setRot(float rot){ 28 | GameObject::rot = rot; 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Collision/CollisionComponent.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "CollisionComponent.h" 3 | #include "CircleCC.h" 4 | #include "RectCC.h" 5 | 6 | CollisionComponent::CollisionComponent(CollisionType type) : type(type){ 7 | 8 | } 9 | 10 | CollisionType CollisionComponent::getType() const{ 11 | return type; 12 | } 13 | 14 | const CircleCC* CollisionComponent::getCircle() const{ 15 | if(this->type != CollisionType::Circle) return nullptr; 16 | return reinterpret_cast(this); 17 | } 18 | 19 | const RectCC* CollisionComponent::getRect() const{ 20 | if(this->type != CollisionType::Rect) return nullptr; 21 | return reinterpret_cast(this); 22 | } 23 | 24 | const PolygonCC* CollisionComponent::getPolygon() const{ 25 | if(this->type != CollisionType::Polygon) return nullptr; 26 | return reinterpret_cast(this); 27 | } 28 | -------------------------------------------------------------------------------- /src/Games/Pong/Bonk.h: -------------------------------------------------------------------------------- 1 | #ifndef BONK_H 2 | #define BONK_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include "../GameEngine/Game.h" 12 | 13 | namespace Bonk { 14 | class State; 15 | 16 | class Bonk : public Game { 17 | public: 18 | Bonk(GamesScreen* gamesScreen); 19 | virtual ~Bonk(); 20 | void onStart() override; 21 | void onLoop(float dt) override; 22 | void onStop() override; 23 | 24 | void newGame(); 25 | void pauseGame(); 26 | void resumeGame(); 27 | void quitGame(); 28 | 29 | void play(std::initializer_list sound); 30 | void play(const Sound& sound); 31 | 32 | private: 33 | void draw(); 34 | 35 | State* state; 36 | State* pausedGameState = nullptr; 37 | Sprite* canvas; 38 | }; 39 | }; 40 | #endif -------------------------------------------------------------------------------- /src/Elements/ColorBox.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_COLORBOX_H 2 | #define CHATTER_FIRMWARE_COLORBOX_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include 8 | 9 | class ColorBox : public InputListener{ 10 | public: 11 | ColorBox(lv_obj_t *parent,uint16_t hue); 12 | virtual ~ColorBox(); 13 | lv_obj_t* getLvObj(); 14 | void setColor(uint16_t hue); 15 | uint16_t getHue() const; 16 | protected: 17 | uint16_t hue; 18 | lv_obj_t* slider; 19 | 20 | private: 21 | lv_style_t style_colorPicker; 22 | lv_style_t style_knob; 23 | lv_style_t style_def; 24 | lv_style_t style_focused; 25 | 26 | bool heldThresh = false; 27 | void buttonHeldRepeat(uint i, uint repeatCount) override; 28 | void buttonHeld(uint i) override; 29 | void buttonReleased(uint i) override; 30 | }; 31 | 32 | #endif //CHATTER_FIRMWARE_COLORBOX_H 33 | -------------------------------------------------------------------------------- /src/Elements/IntroScreen.cpp: -------------------------------------------------------------------------------- 1 | #include "IntroScreen.h" 2 | #include "../Screens/MainMenu.h" 3 | 4 | IntroScreen::IntroScreen(void (* callback)()) : callback(callback){ 5 | gif = lv_gif_create(obj); 6 | lv_gif_set_src(gif, "S:/intro.gif"); 7 | lv_gif_set_loop(gif, LV_GIF_LOOP_SINGLE); 8 | lv_gif_stop(gif); 9 | lv_gif_restart(gif); 10 | 11 | lv_obj_add_event_cb(gif, [](lv_event_t * e){ 12 | IntroScreen* intro = static_cast(e->user_data); 13 | intro->stop(); 14 | volatile auto temp = intro->callback; 15 | lv_obj_del(intro->getLvObj()); 16 | 17 | MainMenu* menu = new MainMenu(); 18 | menu->start(); 19 | if(temp != nullptr) temp(); 20 | }, LV_EVENT_READY, this); 21 | } 22 | 23 | void IntroScreen::onStart(){ 24 | lv_gif_restart(gif); 25 | lv_gif_start(gif); 26 | } 27 | 28 | void IntroScreen::onStop(){ 29 | lv_gif_stop(gif); 30 | lv_obj_del(gif); 31 | } 32 | -------------------------------------------------------------------------------- /src/Model/Message.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_MESSAGE_H 2 | #define CHATTER_FIRMWARE_MESSAGE_H 3 | 4 | #include 5 | #include "Entity.hpp" 6 | #include 7 | 8 | class Message : Entity { 9 | public: 10 | enum Type : uint8_t { 11 | TEXT, PIC, NONE 12 | }; 13 | 14 | Message(); 15 | Message(const std::string& text); 16 | Message(uint8_t picIndex); 17 | Message(const Message& other); 18 | Message& operator=(const Message &other); 19 | virtual ~Message(); 20 | 21 | UID_t uid = 0; 22 | UID_t convo = 0; 23 | bool outgoing = false; 24 | bool received = false; 25 | 26 | Type getType() const; 27 | std::string getText() const; 28 | uint8_t getPic() const; 29 | void setText(const std::string& text); 30 | void setPic(uint8_t index); 31 | 32 | private: 33 | Type type = NONE; 34 | void* content = nullptr; 35 | 36 | void clear(); 37 | }; 38 | 39 | 40 | #endif //CHATTER_FIRMWARE_MESSAGE_H 41 | -------------------------------------------------------------------------------- /src/Services/SleepService.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_SLEEPSERVICE_H 2 | #define CHATTER_FIRMWARE_SLEEPSERVICE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "MessageService.h" 8 | 9 | class SleepService : public LoopListener, private InputListener, private MsgReceivedListener { 10 | public: 11 | SleepService(); 12 | void begin(); 13 | 14 | void loop(uint micros) override; 15 | 16 | void enterSleep(); 17 | void turnOff(); 18 | 19 | void resetActivity(); 20 | void updateTimes(); 21 | 22 | virtual void msgReceived(const Message& message); 23 | 24 | private: 25 | uint32_t sleepTime; // [s] 26 | uint32_t shutdownTime; // [s] 27 | 28 | uint32_t activityTime; 29 | 30 | void anyKeyPressed() override; 31 | 32 | bool gotMessage = false; 33 | 34 | }; 35 | 36 | extern SleepService Sleep; 37 | 38 | #endif //CHATTER_FIRMWARE_SLEEPSERVICE_H 39 | -------------------------------------------------------------------------------- /src/Games/GameEngine/Rendering/StaticRC.cpp: -------------------------------------------------------------------------------- 1 | #include "StaticRC.h" 2 | 3 | #include 4 | 5 | StaticRC::StaticRC(File file, PixelDim dim) : file(std::move(file)), dim(dim){} 6 | 7 | void StaticRC::push(Sprite* parent, PixelDim pos, float rot) const{ 8 | if(!file){ 9 | ESP_LOGE("Render", "StaticRC: Pushing closed file"); 10 | return; 11 | } 12 | 13 | if(rot == 0){ 14 | parent->drawIcon(file, pos.x, pos.y, dim.x, dim.y); 15 | }else{ 16 | Sprite rotated = Sprite(parent, dim.x, dim.y); 17 | rotated.clear(TFT_TRANSPARENT); 18 | rotated.drawIcon(file, 0, 0, dim.x, dim.y, 1, TFT_TRANSPARENT); 19 | rotated.pushRotateZoomWithAA(pos.x + dim.x/2, pos.y + dim.y/2, rot, 1, 1, TFT_TRANSPARENT); 20 | } 21 | } 22 | 23 | void StaticRC::setFile(File file){ 24 | StaticRC::file = file; 25 | } 26 | 27 | void StaticRC::setFile(File file, PixelDim dim){ 28 | StaticRC::file = file; 29 | StaticRC::dim = dim; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/Modals/ContextMenu.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATTER_FIRMWARE_CONTEXTMENU_H 2 | #define CHATTER_FIRMWARE_CONTEXTMENU_H 3 | 4 | #include 5 | #include 6 | #include "../Interface/LVObject.h" 7 | #include "../Interface/LVModal.h" 8 | #include 9 | #include 10 | #include 11 | 12 | class ContextMenu : public LVModal { 13 | public: 14 | struct Option { 15 | std::string text; 16 | int16_t value; 17 | }; 18 | 19 | ContextMenu(LVScreen* parent, const std::vector