File tree Expand file tree Collapse file tree 6 files changed +30
-27
lines changed
targets/TARGET_ONSEMI/TARGET_NCS36510 Expand file tree Collapse file tree 6 files changed +30
-27
lines changed Original file line number Diff line number Diff line change @@ -67,18 +67,19 @@ typedef struct {
67
67
__I uint32_t CBCo3 ; /**< Bits[127:96] of the 128-bit CBC result */
68
68
union {
69
69
struct {
70
- __O uint32_t START :1 ; /**< start the encryption : 0 = no-effect , 1 = enable */
71
- __O uint32_t ACC_CLR :1 ; /**< Clear the CBC accumulator : 0 = no-effect 1 = clears the CBC accumulator */
72
- __O uint32_t INT_CLEAR :1 ; /**< interrupt clear : 0 = no-effect 1 = clear the interrupt */
73
- __O uint32_t KEY_LENGTH :1 ; /**< Key Length: 0 = 128 Bit Encryption 1 = 256 Bit Encryption */
70
+ __IO uint32_t START :1 ; /**< start the encryption : 0 = no-effect , 1 = enable */
71
+ __IO uint32_t ACC_CLR :1 ; /**< Clear the CBC accumulator : 0 = no-effect 1 = clears the CBC accumulator */
72
+ __IO uint32_t INT_CLEAR :1 ; /**< interrupt clear : 0 = no-effect 1 = clear the interrupt */
74
73
} BITS ;
75
- __O uint32_t WORD ;
74
+ __IO uint32_t WORD ;
76
75
} CTL ;
77
76
union {
78
77
struct {
79
78
__IO uint32_t CBC_MODE :1 ; /**< counter mode : 0 = counter mode , 1 = CBC mode */
80
79
__IO uint32_t BYPASS :1 ; /**< encryption : 0 = Normal Mode , 1 = Bypasss any encryption */
81
80
__IO uint32_t INT_EN :1 ; /**< interrupt mask : 0 = disabled 1 = enabled */
81
+ __IO uint32_t KEY_LENGTH :1 ; /**< Key Length: 0 = 128 Bit Encryption 1 = 256 Bit Encryption */
82
+
82
83
} BITS ;
83
84
__IO uint32_t WORD ;
84
85
} MODE ;
Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ void analogin_init(analogin_t *obj, PinName pin)
64
64
obj -> adcReg = (AdcReg_pt )adc ;
65
65
obj -> pin = pin ;
66
66
obj -> pinFlag = 1 ;
67
-
67
+ obj -> ADC_Offset_Value = TRIMREG -> ADC_OFFSET_TRIM ;
68
+
68
69
switch (pin ) {
69
70
case A0 :
70
71
adc_pin = 0 ;
@@ -183,7 +184,14 @@ uint16_t analogin_read_u16(analogin_t *obj)
183
184
while ((uint32_t )(obj -> adcReg -> STATUS )!= (uint32_t )1 ) {
184
185
}
185
186
adcData = (uint16_t )(obj -> adcReg -> DATA );
186
- CLOCK_DISABLE (CLOCK_ADC );
187
+
188
+ /* Offset the ADC data with trim value */
189
+ if (obj -> ADC_Offset_Value != 0xFFFFFFFF ) {
190
+
191
+ if (adcData >= obj -> ADC_Offset_Value ) {
192
+ adcData -= obj -> ADC_Offset_Value ;
193
+ }
194
+ }
187
195
188
196
return (adcData );
189
197
}
Original file line number Diff line number Diff line change 37
37
#include "ncs36510Init.h"
38
38
39
39
void fPmuInit (void );
40
- uint32_t ADC_Trim_Offset ;
40
+
41
41
/**
42
42
* @brief
43
43
* Hardware trimming function
@@ -94,8 +94,6 @@ boolean fTrim()
94
94
RFANATRIMREG -> TX_VCO_TRIM_LUT1 = TRIMREG -> TX_VCO_LUT1 .WORD ;;
95
95
RFANATRIMREG -> TX_VCO_TRIM_LUT2 = TRIMREG -> TX_VCO_LUT2 .WORD ;;
96
96
97
- ADC_Trim_Offset = TRIMREG -> ADC_OFFSET_TRIM ;
98
-
99
97
status = True ;
100
98
101
99
} else {
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ struct analogin_s {
111
111
AdcReg_pt adcReg ;
112
112
PinName pin ;
113
113
uint8_t pinFlag ;
114
+ uint32_t ADC_Offset_Value ;
114
115
};
115
116
116
117
struct pwmout_s {
Original file line number Diff line number Diff line change 45
45
46
46
/** Power management Control HW Structure Overlay */
47
47
typedef struct {
48
- __IO uint32_t DUTYCYCLE ;
49
- union {
50
- struct {
51
- __O uint32_t ENABLE :8 ; /**< Write any value to enable PWM output */
52
- __I uint32_t PAD :1 ; /** < Pad */
53
- __I uint32_t ENABLE_STATE :1 ; /**< Current state of pwmEnable configuration bit. ‘1’ PWM output is enabled. ‘0’ PWN output is disabled. */
54
- __I uint32_t OUTPUT_STATE :1 ; /**< Current state of PWM output */
55
- } BITS ;
56
- __IO uint32_t WORD ;
57
- } PWM_ENABLE ;
48
+ __O uint32_t DUTYCYCLE ;
49
+ __O uint32_t PWM_ENABLE ;
58
50
__O uint32_t PWM_DISABLE ;
51
+ __O uint32_t PRESCALE_ENABLE ;
52
+ __O uint32_t PRESCALE_DISABLE ;
59
53
union {
60
54
struct {
61
- __O uint32_t ENABLE :8 ; /**< Write any value to select enable the 4-bit prescaler */
62
- __I uint32_t STATE :1 ; /**< Current state of the prescaler. ‘1’ the prescaler is enabled. ‘0’ the prescaler is disabled. */
55
+ __I uint32_t CUR_DUTY_CYCLE_VALUE : 8 ; /** Curent value of duty Cycle */
56
+ __I uint32_t CUR_PRE_SCALER_STATE : 1 ; /** Current state of the prescaler. ‘1’ the prescaler is enabled. ‘0’ the prescaler is disabled. */
57
+ __I uint32_t CUR_PWM_ENABLE_STATE : 1 ; /** Current state of the PWM. ‘1’ the PWM is enabled. ‘0’ the PWM is disabled. */
58
+ __I uint32_t CUR_PWM_OUTPUT_STATE : 1 ; /** Current state of PWM output */
63
59
} BITS ;
64
- __IO uint32_t WORD ;
65
- } PRESCALE_ENABLE ;
66
- __O uint32_t PRESCALE_DISABLE ;
60
+ __I uint32_t WORD ;
61
+ } READ_CONFIG_STATUS ;
67
62
} PwmReg_t , * PwmReg_pt ;
68
63
#endif /* PWM_MAP_H_ */
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ void pwmout_init(pwmout_t *obj, PinName pin)
61
61
obj -> pwmReg -> DUTYCYCLE = 0x80 ;
62
62
63
63
/* Write the PWM output enable register 0x4000B004, to 1 */
64
- obj -> pwmReg -> PWM_ENABLE . WORD = 0x1 ;
64
+ obj -> pwmReg -> PWM_ENABLE = 0x1 ;
65
65
66
66
obj -> pwmReg -> PRESCALE_DISABLE = 0x1 ;
67
67
@@ -190,7 +190,7 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
190
190
}
191
191
/* If pulsewidth is less than 128uSec, set the prescaler to 4096
192
192
* by enabling prescale register 0x4000B00C to 1 */
193
- obj -> pwmReg -> PRESCALE_ENABLE . WORD = 0x1 ;
193
+ obj -> pwmReg -> PRESCALE_ENABLE = 0x1 ;
194
194
195
195
/* Calculate the duty cycle based on the width of the pulse */
196
196
/* ((255 * us) / 128) + 1 = duty cycle */
You can’t perform that action at this time.
0 commit comments