3 #include "contiki-conf.h"
5 #include "reset-sensor.h"
17 _Static_assert(
sizeof(*reset_counter) < RESET_SENSOR_SIZE,
"Reset sensor size mismatch");
19 const struct sensors_sensor reset_sensor;
21 static int reset_counter_get(
int type) {
22 return *reset_counter;
25 static int reset_counter_update(
int type,
int c) {
26 uint32_t
count = *reset_counter + 1;
29 reset_counter_reset();
30 rom_util_program_flash(&count, (uintptr_t) reset_counter,
sizeof(*reset_counter));
32 return reset_counter_get(0);
35 void reset_counter_reset(
void) {
36 rom_util_page_erase((uintptr_t) reset_counter,
sizeof(*reset_counter));
39 static int reset_counter_status(
int type) {
43 SENSORS_SENSOR(reset_sensor,
"Resets", reset_counter_get, reset_counter_update, reset_counter_status);
Header file for the cc2538 devices definitions.
Header file for the cc2538 ROM utility function library driver.
static volatile clock_time_t count
These routines define the AVR-specific calls declared in /core/sys/clock.h CLOCK_SECOND is the number...
#define CC2538_DEV_FLASH_ADDR
Flash address.