openchronos-ng
opensource firmware for the ez430 chronos
openchronos.h
Go to the documentation of this file.
00001 
00029 #ifndef __EZCHRONOS_H__
00030 #define __EZCHRONOS_H__
00031 
00032 #include <msp430.h>
00033 
00034 #include <stdlib.h>
00035 
00036 #include "config.h"
00037 
00044 void menu_add_entry(
00045         char const * name,          
00046         void (*up_btn_fn)(void),    
00047         void (*down_btn_fn)(void),  
00048         void (*num_btn_fn)(void),   
00049         void (*lstar_btn_fn)(void), 
00050         void (*lnum_btn_fn)(void),  
00051         void (*updown_btn_fn)(void),
00052         void (*activate_fn)(void),  
00053         void (*deactivate_fn)(void) 
00054 );
00055 
00059 struct menu_editmode_item {
00060         void (* select)(void);     
00061         void (* deselect)(void);   
00062         void (* set)(int8_t step); 
00063 };
00064 
00070 void menu_editmode_start(
00072         void (* complete_fn)(void),
00074         struct menu_editmode_item *items
00075 );
00076 
00077 /* Include function defined in even_in_range.s TODO: do we even need this?? */
00078 unsigned short __even_in_range(unsigned short __value, unsigned short __bound);
00079 
00083 typedef void(* helpers_loop_fn_t)(uint8_t *, uint8_t, uint8_t, int8_t);
00084 
00091 void helpers_loop(
00092         uint8_t *value, 
00093         uint8_t lower,  
00094         uint8_t upper,  
00095         int8_t step     
00096 );
00097 
00098 
00103 /* WARNING: the enum values are optimized to work with some drivers.
00104         If you need to add a new entry, append it to the end! */
00105 enum sys_message {
00106         /* drivers/rtca */
00107         SYS_MSG_RTC_ALARM               = BIT0, 
00108         SYS_MSG_RTC_MINUTE      = BIT1, 
00109         SYS_MSG_RTC_HOUR                = BIT2, 
00110         SYS_MSG_RTC_DAY         = BIT3, 
00111         SYS_MSG_RTC_MONTH               = BIT4, 
00112         SYS_MSG_RTC_YEAR                = BIT5, 
00113         /* drivers/timer */
00114         SYS_MSG_TIMER_1HZ               = BIT6, 
00115         SYS_MSG_TIMER_20HZ      = BIT7, 
00116         SYS_MSG_TIMER_PROG      = BIT8, 
00117         /* sensor/interrups */
00118         SYS_MSG_AS_INT =        BIT9,
00119         SYS_MSG_PS_INT =        BITA,
00120         SYS_MSG_TEMP =          BITB,
00121 };
00122 
00126 struct sys_messagebus {
00128         void (*fn)(enum sys_message);
00130         enum sys_message listens;
00132         struct sys_messagebus *next;
00133 };
00134 
00140 void sys_messagebus_register(
00142         void (*callback)(enum sys_message),
00144         enum sys_message listens
00145 );
00146 
00151 void sys_messagebus_unregister(
00153         void (*callback)(enum sys_message)
00154 );
00155 
00156 #endif /* __EZCHRONOS_H__ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines