no need for state in light sensor demo
This commit is contained in:
parent
d72daf72bc
commit
2f922f37b2
@ -34,16 +34,11 @@
|
|||||||
|
|
||||||
void light_sensor_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
void light_sensor_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||||
(void) watch_face_index;
|
(void) watch_face_index;
|
||||||
if (*context_ptr == NULL) {
|
(void) context_ptr;
|
||||||
*context_ptr = malloc(sizeof(light_sensor_state_t));
|
|
||||||
memset(*context_ptr, 0, sizeof(light_sensor_state_t));
|
|
||||||
// Do any one-time tasks in here; the inside of this conditional happens only at boot.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void light_sensor_face_activate(void *context) {
|
void light_sensor_face_activate(void *context) {
|
||||||
light_sensor_state_t *state = (light_sensor_state_t *)context;
|
(void) context;
|
||||||
(void) state;
|
|
||||||
HAL_GPIO_IR_ENABLE_out();
|
HAL_GPIO_IR_ENABLE_out();
|
||||||
HAL_GPIO_IR_ENABLE_clr();
|
HAL_GPIO_IR_ENABLE_clr();
|
||||||
HAL_GPIO_IRSENSE_pmuxen(HAL_GPIO_PMUX_ADC);
|
HAL_GPIO_IRSENSE_pmuxen(HAL_GPIO_PMUX_ADC);
|
||||||
@ -53,8 +48,7 @@ void light_sensor_face_activate(void *context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool light_sensor_face_loop(movement_event_t event, void *context) {
|
bool light_sensor_face_loop(movement_event_t event, void *context) {
|
||||||
light_sensor_state_t *state = (light_sensor_state_t *)context;
|
(void) context;
|
||||||
(void) state;
|
|
||||||
|
|
||||||
switch (event.event_type) {
|
switch (event.event_type) {
|
||||||
case EVENT_NONE:
|
case EVENT_NONE:
|
||||||
|
|||||||
@ -38,11 +38,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
// Anything you need to keep track of, put it here!
|
|
||||||
uint8_t unused;
|
|
||||||
} light_sensor_state_t;
|
|
||||||
|
|
||||||
void light_sensor_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
void light_sensor_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||||
void light_sensor_face_activate(void *context);
|
void light_sensor_face_activate(void *context);
|
||||||
bool light_sensor_face_loop(movement_event_t event, void *context);
|
bool light_sensor_face_loop(movement_event_t event, void *context);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user