Вт янв 18, 2022 20:05:33
Вт янв 18, 2022 20:23:28
Вт янв 18, 2022 20:37:44
Вт янв 18, 2022 20:56:22
Вт янв 18, 2022 21:04:21
Вт янв 18, 2022 21:09:23
Вт янв 18, 2022 21:43:33
Вт янв 18, 2022 21:49:56
template<typename T, typename U>
auto min(T a, U b) { return a<b?a:b; }
Вт янв 18, 2022 23:20:17
Ср янв 19, 2022 05:01:38
Ср янв 19, 2022 06:51:22
Ср янв 19, 2022 09:10:19
typedef const struct Menu_Item {
const struct Menu_Item *Next; /**< Pointer to the next menu item of this menu item */
const struct Menu_Item *Previous; /**< Pointer to the previous menu item of this menu item */
const struct Menu_Item *Parent; /**< Pointer to the parent menu item of this menu item */
const 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;
Ср янв 19, 2022 19:22:28
parent = ((MenuItem*)pgm_read_ptr(&MenuItems[1]));
Ср янв 19, 2022 19:57:01
я здесь на форуме выкладывал свой проект с активным использованием __flash, и как раз для меню FlexMenuRoman Solovey писал(а):а для __flash не особо
// вот так строка помещается в память программ
const __flash char str[] = "string";
// вот так создается тип-структра, которую затем будем помещать в памяти программ
typedef const __flash struct{
int data;
const __flash char *fstr; // а это указатель на строку во flash
} flash_data;
// вот массив в памяти программ, наполненный теми структурами:
const __flash flash_data array[] = {
{.data=1, .fstr = str},
{/* и так далее*/}
};
// вот так выводится строка из памяти программ
printf("%S\n", str); // как видите, никаких pgm_read_xxxx
// вот собственная функция перебора символов подобной строки
int flash_strlen(const __flash char *s){
int result = 0;
while(*s++)
result++;
return result;
}
i = flash_strlen(str);
Ср янв 19, 2022 20:14:08
Ср янв 19, 2022 20:15:35
ну, успехов в раскопкахRoman Solovey писал(а):я такой человек который хочет докопаться до истины
Ср янв 19, 2022 20:42:34
Чт янв 20, 2022 00:14:21
Чт янв 20, 2022 08:14:03
typedef struct data_buffer {
int16_t setspeedLeft; // 2
int16_t setspeedRight; // 2
int16_t RealSpeedLeft; // 2
int16_t RealSpeedRight; // 2
int32_t StepsLeft; // 4
int32_t StepsRight; // 4
uint32_t Time; // 4
uint8_t vbat;
uint8_t sensors;
uint8_t whereami;
} __attribute__((packed)) data_buffer_t;
typedef struct slow_data {
int coordX;
int coordY;
uint segmentLength;
int nodeNum;
}
Чт янв 20, 2022 08:29:39
typedef struct data_buffer {
union{
struct {
int16_t setspeedLeft; // 2
int16_t setspeedRight; // 2
int16_t RealSpeedLeft; // 2
int16_t RealSpeedRight; // 2
};
struct{
int coordX; //2
int coordY; // 2
uint segmentLength; // 2
int nodeNum; // 2
};
};
int32_t StepsLeft; // 4
int32_t StepsRight; // 4
uint32_t Time; // 4
uint8_t vbat;
uint8_t sensors;
uint8_t whereami;
} __attribute__((packed)) data_buffer_t;