]> git.earman.xyz Git - sensor-watch.git/commitdiff
no need for state in light sensor demo
authorJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 13:04:25 +0000 (09:04 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 13:04:25 +0000 (09:04 -0400)
watch-faces/demo/light_sensor_face.c
watch-faces/demo/light_sensor_face.h

index 8357b3793b73b18cf5f3eac7fda0ea5a5d3f873c..e7e1e0df45cafeb23cb618ddecbe93e15539640d 100644 (file)
 
 void light_sensor_face_setup(uint8_t watch_face_index, void ** context_ptr) {
     (void) watch_face_index;
-    if (*context_ptr == NULL) {
-        *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) context_ptr;
 }
 
 void light_sensor_face_activate(void *context) {
-    light_sensor_state_t *state = (light_sensor_state_t *)context;
-    (void) state;
+    (void) context;
     HAL_GPIO_IR_ENABLE_out();
     HAL_GPIO_IR_ENABLE_clr();
     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) {
-    light_sensor_state_t *state = (light_sensor_state_t *)context;
-    (void) state;
+    (void) context;
 
     switch (event.event_type) {
         case EVENT_NONE:
index 5032bdd932e1b267e7d71f311840622e579fcfdc..d077c87ad22302d7461942307c468879108ee1f6 100644 (file)
  *
  */
 
-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_activate(void *context);
 bool light_sensor_face_loop(movement_event_t event, void *context);