Ср мар 18, 2015 12:40:20
#include <io.h>
#include <pgmspace.h>
#include <stdio.h>
#include "MicroMenu.h"
/*** DUMY CODE ***/
enum ButtonValues
{
BUTTON_NONE,
BUTTON_UP,
BUTTON_DOWN,
BUTTON_LEFT,
BUTTON_RIGHT,
BUTTON_ENTER,
};
enum ButtonValues GetButtonPress(void)
{
return BUTTON_NONE;
};
/*** END DUMY CODE ***/
/** Example menu item specific enter callback function, run when the associated menu item is entered. */
static void Level1Item1_Enter(void)
{
puts("ENTER");
}
/** Example menu item specific select callback function, run when the associated menu item is selected. */
static void Level1Item1_Select(void)
{
puts("SELECT");
}
/** Generic function to write the text of a menu.
*
* \param[in] Text Text of the selected menu to write, in \ref MENU_ITEM_STORAGE memory space
*/
static void Generic_Write(const char* Text)
{
if (Text)
puts_P(Text)
;
}
MENU_ITEM(Menu_1, Menu_2, Menu_3, NULL_MENU, Menu_1_1, NULL, NULL, "1");
MENU_ITEM(Menu_2, Menu_3, Menu_1, NULL_MENU, NULL_MENU, NULL, NULL, "2");
MENU_ITEM(Menu_3, Menu_1, Menu_2, NULL_MENU, NULL_MENU, NULL, NULL, "3");
MENU_ITEM(Menu_1_1, Menu_1_2, Menu_1_2, NULL_MENU, NULL_MENU, NULL, NULL, "1.1");
MENU_ITEM(Menu_1_2, Menu_1_1, Menu_1_1, NULL_MENU, NULL_MENU, NULL, NULL, "1.2");
void main(void)
{
/* Set up the default menu text write callback, and navigate to an absolute menu item entry. */
Menu_SetGenericWriteCallback(Generic_Write);
Menu_Navigate(&Menu_1);
while (1)
{
/* Example usage of Micromenu - here you can create your custom menu navigation system; you may wish to perform
* other tasks while detecting key presses, enter sleep mode while waiting for user input, etc.
*/
switch (GetButtonPress())
{
case BUTTON_UP:
Menu_Navigate(MENU_PREVIOUS);
break;
case BUTTON_DOWN:
Menu_Navigate(MENU_NEXT);
break;
case BUTTON_LEFT:
Menu_Navigate(MENU_PARENT);
break;
case BUTTON_RIGHT:
Menu_Navigate(MENU_CHILD);
break;
case BUTTON_ENTER:
Menu_EnterCurrentItem();
break;
default:
break;
}
}
}
Ср мар 18, 2015 17:35:18
Чт мар 19, 2015 12:39:43
Чт мар 19, 2015 14:43:22
Чт мар 19, 2015 15:56:14
Чт мар 19, 2015 17:14:23
Чт мар 19, 2015 18:53:07
typedef const struct Menu_Item {
flash struct Menu_Item *Next; /**< Pointer to the next menu item of this menu item */
flash struct Menu_Item *Previous; /**< Pointer to the previous menu item of this menu item */
flash struct Menu_Item *Parent; /**< Pointer to the parent menu item of this menu item */
flash struct Menu_Item *Child; /**< Pointer to the child menu item of this menu item */
void (*SelectCallback)(void); /**< Pointer to the optional menu-specific select callback of this menu item */
void (*EnterCallback)(void); /**< Pointer to the optional menu-specific enter callback of this menu item */
const char Text[]; /**< Menu item text to pass to the menu display callback function */
} Menu_Item_t;
Пт мар 20, 2015 09:38:07
Пт мар 20, 2015 10:53:45
Пт мар 20, 2015 11:11:59
Пт мар 20, 2015 11:19:32
eess9 писал(а):AVR Studio v6.2 релиз 1548. Кидайте свой проект гляну, т.к. с фото не очень то ясно, кода там почти не видно.
Пт мар 20, 2015 11:25:40
binarick писал(а):вот в полный размер
http://f-picture.net/lfp/s49.radikal.ru ... c7.png/htm
Сб мар 21, 2015 09:49:38
binarick писал(а):Да не это я имел ввиду. Как я по картинке могу определить ошибки, если я не вижу строк кода, в которых возникают ошибки? Вы же понимаете, что часто одну и туже ошибку можно вызвать большим количеством способов
Сб июн 27, 2015 19:48:17
Ср фев 28, 2018 08:56:32
Чт окт 25, 2018 13:54:31
Пт окт 26, 2018 08:18:56
Пт окт 26, 2018 08:50:11
Пт окт 26, 2018 13:24:47
//---Главное меню, рисует только пункты(без параметров)----------
void gl_item_print(uint8_t pos, uint8_t x, uint8_t y, const char *s, uint8_t Width, TSettingfontDot *sF){
uint16_t tcol[2];
tcol[0]=sF->Color; tcol[1]=sF->BgColor;
if (pos==menu_get_pos()){
sF->Color=tcol[1];
sF->BgColor=tcol[0];
}
str_dot_out_pgm(1,y,s,0,sF);
sF->Color=tcol[0];
sF->BgColor=tcol[1];
}
Пт окт 26, 2018 15:28:48