nRF51 SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

Simple Motor Control Example Application main file. More...

Macros

#define PWM_OUTPUT_PIN_NUMBER   (LED0)
 
#define TIMER_PRESCALER   (4)
 
#define LED_INTENSITY_HIGH   (224U)
 
#define LED_INTENSITY_LOW   (32U)
 
#define LED_OFF   (1U)
 
#define LED_INTENSITY_HALF   (128U)
 

Functions

static void pwm_set (uint8_t new_setting)
 Function for setting the PWM duty cycle. More...
 
static void timer2_init (void)
 Function for initializing the Timer 2 peripheral.
 
static void gpiote_init (void)
 Function for initializing the GPIO peripheral.
 
static void ppi_init (void)
 Function for initializing the PPI peripheral.
 
void TIMER2_IRQHandler (void)
 Function for handling the Timer 2 interrupt.
 
int main (void)
 Function for main application entry.
 

Detailed Description

This file contains the source code for a sample application using PWM that could control a motor.

example_board_setup_a.jpg
Use board setup A for this example.

Macro Definition Documentation

#define PWM_OUTPUT_PIN_NUMBER   (LED0)

Pin number for PWM output.

#define TIMER_PRESCALER   (4)

Prescaler setting for timers.

#define LED_INTENSITY_HIGH   (224U)

High intensity.

#define LED_INTENSITY_LOW   (32U)

Low intensity.

#define LED_OFF   (1U)

Led off.

#define LED_INTENSITY_HALF   (128U)

Half intensity. Used to calculate timer parameters.

Function Documentation

static void pwm_set ( uint8_t  new_setting)
static
Parameters
[in]new_settingNew duty cycle, where 128 results in 50% duty cycle.