Andrew Boyson / lpc1768

Dependents:   test-lpc1768 oldheating gps motorhome ... more

Committer:
andrewboyson
Date:
Wed May 08 12:13:37 2019 +0000
Revision:
49:d056e2c5c4ee
Sorted out reset module to properly read the RSID register

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 49:d056e2c5c4ee 1 #include <stdbool.h>
andrewboyson 49:d056e2c5c4ee 2
andrewboyson 49:d056e2c5c4ee 3 #define RSID (*((volatile unsigned *) 0x400FC180))
andrewboyson 49:d056e2c5c4ee 4
andrewboyson 49:d056e2c5c4ee 5 bool RsidPor = false;
andrewboyson 49:d056e2c5c4ee 6 bool RsidExtr = false;
andrewboyson 49:d056e2c5c4ee 7 bool RsidWdtr = false;
andrewboyson 49:d056e2c5c4ee 8 bool RsidBodr = false;
andrewboyson 49:d056e2c5c4ee 9
andrewboyson 49:d056e2c5c4ee 10 void RsidInit()
andrewboyson 49:d056e2c5c4ee 11 {
andrewboyson 49:d056e2c5c4ee 12 RsidPor = RSID & 1; //RSID is defined in 3.4.1 Reset Source Identification Register
andrewboyson 49:d056e2c5c4ee 13 RsidExtr = RSID & 2;
andrewboyson 49:d056e2c5c4ee 14 RsidWdtr = RSID & 4;
andrewboyson 49:d056e2c5c4ee 15 RsidBodr = RSID & 8;
andrewboyson 49:d056e2c5c4ee 16 RSID = 0xF; //Clear any values
andrewboyson 49:d056e2c5c4ee 17 }