Commit b7962c7718e05545d26f836a5c595f5ef97cbae8
- Diff rendering mode:
- inline
- side by side
Wand/main/accel.h
(1 / 1)
|   | |||
| 11 | 11 | ||
| 12 | 12 | void initAccel(); //call with other inits | |
| 13 | 13 | void updateAccel(); //call with other updates | |
| 14 | void configAccel(fantasia_pkt_t *pkt); //give this all valid config packets, sets up triggers and timing, if it gets a mode==POLL then it sends a data packet to the xBee | ||
| 14 | void configAccel(accel_config_t *config); //give this all valid config packets, sets up triggers and timing, if it gets a mode==POLL then it sends a data packet to the xBee | ||
| 15 | 15 | //void pollAccel(); //depreciated, gave direct access to the data, instead it is just called internally and the packet is sent in accel.pde | |
| 16 | 16 | ||
| 17 | 17 | #endif |
Wand/main/accel.pde
(6 / 6)
|   | |||
| 113 | 113 | } | |
| 114 | 114 | ||
| 115 | 115 | //Accelerometer config | |
| 116 | //ARGS: just pass us the packet address: | ||
| 117 | void configAccel(fantasia_pkt_t *pkt){ | ||
| 116 | //ARGS: just pass us the accel_config packet data address: | ||
| 117 | void configAccel(accel_config_t *config){ | ||
| 118 | 118 | ||
| 119 | mode = pkt->accel_config.mode; | ||
| 119 | mode = config->mode; | ||
| 120 | 120 | ||
| 121 | switch( pkt->accel_config.mode){ | ||
| 121 | switch( config->mode){ | ||
| 122 | 122 | case TRIGGER: | |
| 123 | trigger = (pkt->accel_config.data)<<12; | ||
| 123 | trigger = (config->data)<<12; | ||
| 124 | 124 | break; | |
| 125 | 125 | case TIMER: | |
| 126 | timer_period = pkt->accel_config.data; | ||
| 126 | timer_period = config->data; | ||
| 127 | 127 | timer_target = millis() + timer_period; | |
| 128 | 128 | break; | |
| 129 | 129 | case POLL: |

