2020-2021 Sunseeker Telemetry and Lighting System
sfr.c
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // sfr.c - Driver for the sfr Module.
4 //
5 //*****************************************************************************
6 
7 //*****************************************************************************
8 //
11 //
12 //*****************************************************************************
13 
14 #include "inc/hw_memmap.h"
15 
16 #ifdef __MSP430_HAS_SFR__
17 #include "sfr.h"
18 
19 #include <assert.h>
20 
21 void SFR_enableInterrupt (uint8_t interruptMask)
22 {
23  HWREG8(SFR_BASE + OFS_SFRIE1_L) |= interruptMask;
24 }
25 
26 void SFR_disableInterrupt (uint8_t interruptMask)
27 {
28  HWREG8(SFR_BASE + OFS_SFRIE1_L) &= ~(interruptMask);
29 }
30 
31 uint8_t SFR_getInterruptStatus (uint8_t interruptFlagMask)
32 {
33  return ( HWREG8(SFR_BASE + OFS_SFRIFG1_L) & interruptFlagMask );
34 }
35 
36 void SFR_clearInterrupt (uint8_t interruptFlagMask)
37 {
38  HWREG8(SFR_BASE + OFS_SFRIFG1_L) &= ~(interruptFlagMask);
39 }
40 
41 void SFR_setResetPinPullResistor (uint16_t pullResistorSetup)
42 {
43  HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSRSTRE + SYSRSTUP);
44  HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= pullResistorSetup;
45 }
46 
47 void SFR_setNMIEdge (uint16_t edgeDirection)
48 {
49  HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSNMIIES);
50  HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= edgeDirection;
51 }
52 
53 void SFR_setResetNMIPinFunction (uint8_t resetPinFunction)
54 {
55  HWREG8(SFR_BASE + OFS_SFRRPCR_L) &= ~(SYSNMI);
56  HWREG8(SFR_BASE + OFS_SFRRPCR_L) |= resetPinFunction;
57 }
58 
59 #endif
60 //*****************************************************************************
61 //
64 //
65 //*****************************************************************************
#define HWREG8(x)
Definition: hw_memmap.h:41