type
stringclasses
5 values
content
stringlengths
9
163k
includes
#include <fcntl.h>
includes
#include <sys/epoll.h>
includes
#include <compat/strl.h>
includes
#include <string/stdstring.h>
defines
#define NUM_BUTTONS 32
defines
#define NUM_AXES 32
structs
struct linuxraw_joypad { int fd; uint64_t buttons; int16_t axes[NUM_AXES]; char *ident; };
functions
void linuxraw_poll_pad(struct linuxraw_joypad *pad) { struct js_event event; while (read(pad->fd, &event, sizeof(event)) == (ssize_t)sizeof(event)) { unsigned type = event.type & ~JS_EVENT_INIT; switch (type) { case JS_EVENT_BUTTON: if (event.number < NUM_BUTTONS) ...
functions
bool linuxraw_joypad_init_pad(const char *path, struct linuxraw_joypad *pad) { if (pad->fd >= 0) return false; /* Device can have just been created, but not made accessible (yet). IN_ATTRIB will signal when permissions change. */ if (access(path, R_OK) < 0) return false; pad->fd = open(p...
functions
void handle_plugged_pad(void) { int i, rc; size_t event_size = sizeof(struct inotify_event) + NAME_MAX + 1; uint8_t *event_buf = (uint8_t*)calloc(1, event_size); if (!event_buf) return; while ((rc = read(linuxraw_inotify, event_buf, event_size)) >= 0) { struct inotify_event *event = (st...
functions
void linuxraw_joypad_poll(void) { int i, ret; struct epoll_event events[MAX_USERS + 1]; retry: ret = epoll_waiting(&linuxraw_epoll, events, MAX_USERS + 1, 0); if (ret < 0 && errno == EINTR) goto retry; for (i = 0; i < ret; i++) { struct linuxraw_joypad *ptr = (struct linuxraw_joypad*) ...
functions
bool linuxraw_joypad_init(void *data) { unsigned i; if (!epoll_new(&linuxraw_epoll)) return false; for (i = 0; i < MAX_USERS; i++) { char path[PATH_MAX_LENGTH]; struct linuxraw_joypad *pad = (struct linuxraw_joypad*)&linuxraw_pads[i]; settings_t *settings = config_get_ptr();...
functions
void linuxraw_joypad_destroy(void) { unsigned i; for (i = 0; i < MAX_USERS; i++) { if (linuxraw_pads[i].fd >= 0) close(linuxraw_pads[i].fd); }
functions
bool linuxraw_joypad_button(unsigned port, uint16_t joykey) { const struct linuxraw_joypad *pad = (const struct linuxraw_joypad*) &linuxraw_pads[port]; return joykey < NUM_BUTTONS && BIT64_GET(pad->buttons, joykey); }
functions
uint64_t linuxraw_joypad_get_buttons(unsigned port) { const struct linuxraw_joypad *pad = (const struct linuxraw_joypad*) &linuxraw_pads[port]; return pad->buttons; }
functions
int16_t linuxraw_joypad_axis(unsigned port, uint32_t joyaxis) { int16_t val = 0; const struct linuxraw_joypad *pad = NULL; if (joyaxis == AXIS_NONE) return 0; pad = (const struct linuxraw_joypad*)&linuxraw_pads[port]; if (AXIS_NEG_GET(joyaxis) < NUM_AXES) { val = pad->axes[AXIS_NEG_GET(...
functions
bool linuxraw_joypad_query_pad(unsigned pad) { return pad < MAX_USERS && linuxraw_pads[pad].fd >= 0; }
includes
#include <attributes.h>
includes
#include <irq/irq.h>
includes
#include <pit_8253/pit_8253.h>
includes
#include <cmos/cmos.h>
includes
#include <cmos/rtc.h>
includes
#include <time/time.h>
includes
#include <time/clock.h>
includes
#include <time/clock_tick.h>
defines
#define CLOCK_TICK_RTC_RATE 10
defines
#define CLOCK_TICK_PIT_INTERVAL (time_from_millis (1))
functions
void clock_tick_pit_8253_irq0_hook (irq_t irq) { clock_fast_add (pit_8253_current_interval); }
functions
void clock_tick_rtc_irq8_hook (irq_t irq) { clock_tick (); cmos_get (cmosr_rtc_status_c); }
functions
void clock_tick_start () { clock_real_interval_multiplier = rtc_interval_from_rate (CLOCK_TICK_RTC_RATE); // rtc_interval_from_rate is gurenteed to produce a multiplier that does not truncate // any bits. clock_real_interval_divisor = 1; pit_8253_set_interval (CLOCK_TICK_PIT_INTERVAL); rtc_set_rate (CLOCK_TICK_...
includes
#include <libgupnp/gupnp.h>
defines
#define GUPNP_GENERATED_CLIENT_BINDING_RC
defines
#define __GUPNPASYNCDATA_TYPE__
functions
void _free_cb_data (gpointer data, GClosure *closure) { GUPnPAsyncData *cbdata = (GUPnPAsyncData *) data; g_slice_free1 (sizeof (*cbdata), cbdata); }
functions
void rc_list_presets_action_get (GUPnPServiceAction *action, guint *in_instance_id) { gupnp_service_action_get (action, "InstanceID", G_TYPE_UINT, in_instance_id, NULL); }
functions
void rc_list_presets_action_set (GUPnPServiceAction *action, const gchar *out_current_preset_name_list) { gupnp_service_action_set (action, "CurrentPresetNameList", G_TYPE_STRING, out_current_preset_name_list, NULL); }
functions
gulong rc_list_presets_action_connect (GUPnPService *service, GCallback callback, gpointer userdata) { return g_signal_connect (service, "action-invoked::ListPresets", callback, ...
functions
void rc_select_preset_action_get (GUPnPServiceAction *action, guint *in_instance_id, gchar **in_preset_name) { gupnp_service_action_get (action, "InstanceID", G_TYPE_UINT, in_instance_id, "PresetName", G_...
functions
gulong rc_select_preset_action_connect (GUPnPService *service, GCallback callback, gpointer userdata) { return g_signal_connect (service, "action-invoked::SelectPreset", callback, ...
functions
void rc_get_volume_action_get (GUPnPServiceAction *action, guint *in_instance_id, gchar **in_channel) { gupnp_service_action_get (action, "InstanceID", G_TYPE_UINT, in_instance_id, "Channel", G_TYPE_STRING, in_...
functions
void rc_get_volume_action_set (GUPnPServiceAction *action, const guint out_current_volume) { gupnp_service_action_set (action, "CurrentVolume", G_TYPE_UINT, out_current_volume, NULL); }
functions
gulong rc_get_volume_action_connect (GUPnPService *service, GCallback callback, gpointer userdata) { return g_signal_connect (service, "action-invoked::GetVolume", callback, use...
functions
void rc_set_volume_action_get (GUPnPServiceAction *action, guint *in_instance_id, gchar **in_channel, guint *in_desired_volume) { gupnp_service_action_get (action, "InstanceID", G_TYPE_UINT, in_instance_id, ...
functions
gulong rc_set_volume_action_connect (GUPnPService *service, GCallback callback, gpointer userdata) { return g_signal_connect (service, "action-invoked::SetVolume", callback, use...
functions
void _rc_preset_name_list_query_cb (GUPnPService *service, gchar *variable, GValue *value, gpointer userdata) { GUPnPAsyncData *cbdata; gchar *preset_name_list; cbdata = (GUPnPAsyncData *) userdata; preset_name_list = ...
functions
gulong rc_preset_name_list_query_connect (GUPnPService *service, rc_preset_name_list_query_callback callback, gpointer userdata) { GUPnPAsyncData *cbdata; cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata)); cbdata->cb = G_CALLBACK (c...
functions
void _rc_last_change_query_cb (GUPnPService *service, gchar *variable, GValue *value, gpointer userdata) { GUPnPAsyncData *cbdata; gchar *last_change; cbdata = (GUPnPAsyncData *) userdata; last_change = ((rc_last_change_query_callbac...
functions
gulong rc_last_change_query_connect (GUPnPService *service, rc_last_change_query_callback callback, gpointer userdata) { GUPnPAsyncData *cbdata; cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata)); cbdata->cb = G_CALLBACK (callback); cbdata->...
functions
void rc_last_change_variable_notify (GUPnPService *service, const gchar *last_change) { gupnp_service_notify (service, "LastChange", G_TYPE_STRING, last_change, NULL); }
functions
void _rc_volume_query_cb (GUPnPService *service, gchar *variable, GValue *value, gpointer userdata) { GUPnPAsyncData *cbdata; guint volume; cbdata = (GUPnPAsyncData *) userdata; volume = ((rc_volume_query_callback)cbdata->cb) (service, ...
functions
gulong rc_volume_query_connect (GUPnPService *service, rc_volume_query_callback callback, gpointer userdata) { GUPnPAsyncData *cbdata; cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata)); cbdata->cb = G_CALLBACK (callback); cbdata->userdata = userdata;...
functions
void _rc_volume_db_query_cb (GUPnPService *service, gchar *variable, GValue *value, gpointer userdata) { GUPnPAsyncData *cbdata; gint volume_db; cbdata = (GUPnPAsyncData *) userdata; volume_db = ((rc_volume_db_query_callback)cbdata->cb) (s...
functions
gulong rc_volume_db_query_connect (GUPnPService *service, rc_volume_db_query_callback callback, gpointer userdata) { GUPnPAsyncData *cbdata; cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata)); cbdata->cb = G_CALLBACK (callback); cbdata->userdata...
includes
#include <stdint.h>
includes
#include <stdbool.h>
includes
#include <dmalloc/dmalloc.h>
defines
#define IF_TAG_TEXT "{if:"
defines
#define ELSE_TAG_TEXT "{else}"
defines
#define ENDIF_TAG_TEXT "{endif}"
defines
#define MAKE_TAG_INFO( a ) { a , a##_TEXT, sizeof(a##_TEXT ) -1 }
defines
#define LOOP_TAG_TEXT "{loop:"
defines
#define ENDLOOP_TAG_TEXT "{endloop}"
structs
struct template_tag { unsigned int id; const char* tag; unsigned int tag_size; };
functions
int getNextTag ( const char* pagedata,const int datalength, tag_groups search_tag_group,TAG_IDS *tag ) { int i,i2; int tags_in_group; int pos=0; const char *data = pagedata; struct template_tag *search_tags = 0; struct template_tag *tag_info =0; switch ( search_tag_group ) { case IF...
functions
int find_tag_end_pos ( const char *pagedata,int datalenght,const char *start_tag,const char *end_tag ) { int pos1=0,pos2=0,level=1,offset=0; /* char bb1[10000]; memcpy(bb1,pagedata,datalenght); bb1[datalenght]='\0'; bb1[datalenght]='\0'; */ do { pos1 = stringnfind ( ( char* ) pagedata+offset,end_t...
functions
void free_runscript(RUNSCRIPT *script) { Dmsg0(500, "runscript: freeing RUNSCRIPT object\n"); if (script->command) { free_pool_memory(script->command); }
functions
int run_scripts(JCR *jcr, alist *runscripts, const char *label) { Dmsg2(200, "runscript: running all RUNSCRIPT object (%s) JobStatus=%c\n", label, jcr->JobStatus); RUNSCRIPT *script; bool runit; int when; if (strstr(label, NT_("Before"))) { when = SCRIPT_Before; }
functions
void free_runscripts(alist *runscripts) { Dmsg0(500, "runscript: freeing all RUNSCRIPTS object\n"); RUNSCRIPT *elt; foreach_alist(elt, runscripts) { free_runscript(elt); }
defines
#define MASTER_BOARD
functions
void Error_Handler(void) { /* Turn LED5 on */ BSP_LED_On(LED5); while(1) { }
functions
void SystemClock_Config(void) { RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_OscInitTypeDef RCC_OscInitStruct; /* Enable Power Control clock */ __HAL_RCC_PWR_CLK_ENABLE(); /* The voltage scaling allows optimizing the power consumption when the device is clocked below the maximum system frequen...
functions
void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi) { /* Turn LED5 on: Transfer error in reception/transmission process */ BSP_LED_On(LED5); }
functions
void Timeout_Error_Handler(void) { /* Toggle LED5 on */ while(1) { BSP_LED_On(LED5); HAL_Delay(500); BSP_LED_Off(LED5); HAL_Delay(500); }
functions
uint16_t Buffercmp(uint8_t* pBuffer1, uint8_t* pBuffer2, uint16_t BufferLength) { while (BufferLength--) { if((*pBuffer1) != *pBuffer2) { return BufferLength; }
functions
void assert_failed(uint8_t* file, uint32_t line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { }
main
int main(void) { /* STM32F4xx HAL library initialization: - Configure the Flash prefetch, instruction and Data caches - Configure the Systick to generate an interrupt each 1 msec - Set NVIC Group Priority to 4 - Global MSP (MCU Support Package) initialization */ HAL_Init(); ...
functions
void create(varargs int clone) { adjectives = ({ }
functions
mapping get_properties() { mapping info; info = ([ "adjective": adjectives, "noun": nouns, "plural_adjective": plural_adjectives, "plural_noun": plural_nouns, "descriptions": descriptions, ]); return info; }
functions
mixed get_property(string *path) { switch(path[0]) { case "adjective": if(sizeof(path) > 1) return sizeof(({ path[1] }
functions
int set_property(string *path, mixed value) { if(!sizeof(path)) return FALSE; switch(path[0]) { case "noun": if(sizeof(path) == 2) { if(value) nouns = nouns | ({ path[1] }
functions
void limpamlc() { LCD_Cmd(_LCD_CLEAR); }
functions
void mostrapenter(char penter) { LCD_Out(2,1,penter); }
functions
void mostraplinha(char plinha) { LCD_Out(1,1,plinha); }
functions
void mostraslinha(char slinha) { LCD_Out(2,1,slinha); }
functions
void fraseum(char plinha, char penter) { limpamlc(); sprintf(plinha, "1: Suco s/acucar"); mostraplinha(plinha); mostrapenter(penter); }
functions
void frasedois(char plinha, char penter) { limpamlc(); sprintf(plinha, "2: Suco c/acucar"); mostraplinha(plinha); mostrapenter(penter); }
functions
void frasetres(char plinha, char penter) { limpamlc(); sprintf(plinha, "3: Cafe s/acucar"); mostraplinha(plinha); mostrapenter(penter); }
functions
void frasequatro(char plinha, char penter) { limpamlc(); sprintf(plinha, "4: Cafe Expresso"); mostraplinha(plinha); mostrapenter(penter); }
functions
void frasecinco(char plinha, char penter) { limpamlc(); sprintf(plinha, "5: Capuccino"); LCD_Out(1,3,plinha); mostrapenter(penter); }
functions
void fraseseis(char plinha, char penter) { limpamlc(); sprintf(plinha, "6: Soda"); LCD_Out(1,5,plinha); mostrapenter(penter); }
functions
void frasesete(char plinha, char penter) { limpamlc(); sprintf(plinha, "7: Refri de cola"); mostraplinha(plinha); mostrapenter(penter); }
functions
void fraseoito(char plinha, char penter) { limpamlc(); sprintf(plinha, "8: Guarana"); LCD_Out(1,4,plinha); mostrapenter(penter); }
functions
void frasenove(char plinha, char penter) { limpamlc(); sprintf(plinha, "9: Agua"); LCD_Out(1,5,plinha); mostrapenter(penter); }
functions
void frasezero(char plinha, char penter) { limpamlc(); sprintf(plinha, "0: Cha Gelado"); LCD_Out(1,2,plinha); mostrapenter(penter); }
functions
void erro(char plinha, char slinha) { limpamlc(); sprintf(plinha, "Favor pressionar"); mostraplinha(plinha); sprintf(slinha, "apenas numeros"); LCD_Out(2,2,slinha); }
functions
void tempob() { delay_ms(300); }
functions
void tempom() { delay_ms(2000); }
functions
void verificab() { if (vc_cent == 0) { tempob(); if (vc_cent == 1) { i = i + 0.25; }
functions
void main() { Lcd_Init(); ///limpamlc(); Lcd_Cmd(_LCD_CURSOR_OFF); //i = 0; ///Limite do unsigned int = 65535 ///sprintf(vezes, "%.2f",i); while(1){ //eap = 0; limpamlc(); while(1) { do { ...
functions
Keypad while(1) { kp = 0; // Reset key code variable // Wait for key to be pressed and released do { // kp = Keypad_Key_Press(); // Store key code in kp variable kp = Keypad_Key_Click(); // Store key code in kp variable if (p3_6...